|
| 1 | +/* |
| 2 | + * Copyright (c) "Neo4j" |
| 3 | + * Neo4j Sweden AB [http://neo4j.com] |
| 4 | + * |
| 5 | + * This file is part of Neo4j. |
| 6 | + * |
| 7 | + * Neo4j is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU General Public License as published by |
| 9 | + * the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | +package org.neo4j.gds.triangle; |
| 21 | + |
| 22 | +import org.junit.jupiter.api.Test; |
| 23 | +import org.neo4j.gds.Orientation; |
| 24 | +import org.neo4j.gds.api.Graph; |
| 25 | +import org.neo4j.gds.core.concurrency.Pools; |
| 26 | +import org.neo4j.gds.extension.GdlExtension; |
| 27 | +import org.neo4j.gds.extension.GdlGraph; |
| 28 | +import org.neo4j.gds.extension.Inject; |
| 29 | + |
| 30 | +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; |
| 31 | + |
| 32 | +@GdlExtension |
| 33 | +class UnionGraphTriangleCountingTest { |
| 34 | + @GdlGraph(orientation = Orientation.UNDIRECTED) |
| 35 | + static String DB_CYPHER="CREATE "+ |
| 36 | + "(a0:L4)," + |
| 37 | + "(a1:L1)," + |
| 38 | + "(a2:L3)," + |
| 39 | + "(a3:L1)," + |
| 40 | + "(a5:L3)," + |
| 41 | + "(a6:L1)," + |
| 42 | + "(a7:L4)," + |
| 43 | + "(a8:L3)," + |
| 44 | + "(a9:L4)," + |
| 45 | + "(a10:L1)," + |
| 46 | + "(a11:L1)," + |
| 47 | + "(a12:L4)," + |
| 48 | + "(a13:L4)," + |
| 49 | + "(a14:L3)," + |
| 50 | + "(a15:L3)," + |
| 51 | + "(a17:L4)," + |
| 52 | + "(a18:L0)," + |
| 53 | + "(a19:L3)," + |
| 54 | + "(a20:L1)," + |
| 55 | + "(a21:L1)," + |
| 56 | + "(a22:L1)," + |
| 57 | + "(a23:L2)," + |
| 58 | + "(a24:L4)," + |
| 59 | + "(a25:L3)," + |
| 60 | + "(a26:L0)," + |
| 61 | + "(a28:L4)," + |
| 62 | + "(a29:L4)," + |
| 63 | + "(a11)-[:T1]->(a15), "+ |
| 64 | + "(a0)-[:T1]->(a21), "+ |
| 65 | + "(a8)-[:T2]->(a28), "+ |
| 66 | + "(a12)-[:T3]->(a12), "+ |
| 67 | + "(a9)-[:T4]->(a10), "+ |
| 68 | + "(a3)-[:T2]->(a26), "+ |
| 69 | + "(a7)-[:T0]->(a21), "+ |
| 70 | + "(a11)-[:T3]->(a29), "+ |
| 71 | + "(a1)-[:T3]->(a14), "+ |
| 72 | + "(a14)-[:T0]->(a22), "+ |
| 73 | + "(a10)-[:T1]->(a13), "+ |
| 74 | + "(a3)-[:T0]->(a21), "+ |
| 75 | + "(a5)-[:T3]->(a28), "+ |
| 76 | + "(a10)-[:T3]->(a25), "+ |
| 77 | + "(a8)-[:T1]->(a14), "+ |
| 78 | + "(a11)-[:T3]->(a15), "+ |
| 79 | + "(a13)-[:T2]->(a18), "+ |
| 80 | + "(a13)-[:T4]->(a20), "+ |
| 81 | + "(a6)-[:T1]->(a29), "+ |
| 82 | + "(a12)-[:T3]->(a14), "+ |
| 83 | + "(a3)-[:T2]->(a21), "+ |
| 84 | + "(a2)-[:T1]->(a21), "+ |
| 85 | + "(a0)-[:T0]->(a20), "+ |
| 86 | + "(a24)-[:T0]->(a29), "+ |
| 87 | + "(a10)-[:T4]->(a19), "+ |
| 88 | + "(a0)-[:T1]->(a28), "+ |
| 89 | + "(a9)-[:T4]->(a17), "+ |
| 90 | + "(a15)-[:T4]->(a21), "+ |
| 91 | + "(a21)-[:T1]->(a24) "; |
| 92 | + |
| 93 | + @Inject |
| 94 | + Graph graph; |
| 95 | + |
| 96 | + @Test |
| 97 | + void shouldWorkWithUnionGraphs() { |
| 98 | + var config=TriangleCountStreamConfigImpl.builder().concurrency(1).build(); |
| 99 | + var a=IntersectingTriangleCount.create(graph,config, Pools.DEFAULT); |
| 100 | + var result=a.compute(); |
| 101 | + assertThat(result.globalTriangles()).isEqualTo(0); |
| 102 | + } |
| 103 | +} |
0 commit comments