@@ -229,5 +229,66 @@ void shouldExecuteGrowthPhaseCorrectlyWithUniqueWeights() {
229
229
}
230
230
}
231
231
232
+ @ Nested
233
+ @ GdlExtension
234
+ class DisconnectedAndParallelEdgesGraph {
235
+
236
+ @ GdlGraph (orientation = Orientation .UNDIRECTED )
237
+ private static final String DB_CYPHER =
238
+ "CREATE " +
239
+ "(a0:Node{prize: 4.0})," +
240
+ "(a1:Node{prize: 9.0})," +
241
+ "(a2:Node{prize: 8.0})," +
242
+ "(a3:Node{prize: 0.0})," +
243
+ "(a4:Node{prize: 7.0})," +
244
+ "(a0)-[:R{w:7.0}]->(a3)," +
245
+ "(a1)-[:R{w:3.0}]->(a3)," +
246
+ "(a1)-[:R{w:2.0}]->(a3)," +
247
+ "(a2)-[:R{w:4.0}]->(a4)," +
248
+ "(a2)-[:R{w:4.0}]->(a4)" ;
249
+
250
+ @ Inject
251
+ private TestGraph graph ;
252
+
253
+ @ Test
254
+ void shouldFindCorrectAnswer () {
255
+
256
+ var prizes = graph .nodeProperties ("prize" );
257
+
258
+ var growthPhase = new GrowthPhase (graph , prizes ::doubleValue ,ProgressTracker .NULL_TRACKER ,TerminationFlag .RUNNING_TRUE );
259
+ growthPhase .grow ();
260
+
261
+ var clusterStructure = growthPhase .clusterStructure ();
262
+
263
+ var a0 = graph .toMappedNodeId ("a0" );
264
+ var a1 = graph .toMappedNodeId ("a1" );
265
+ var a2 = graph .toMappedNodeId ("a2" );
266
+ var a3 = graph .toMappedNodeId ("a3" );
267
+ var a4 = graph .toMappedNodeId ("a4" );
268
+
269
+ assertThat (clusterStructure .inactiveSince (a3 )).isEqualTo (0 );
270
+
271
+ assertThat (clusterStructure .inactiveSince (a1 )).isEqualTo (2 );
272
+
273
+ assertThat (clusterStructure .inactiveSince (a2 )).isEqualTo (2 );
274
+ assertThat (clusterStructure .inactiveSince (a4 )).isEqualTo (2 );
275
+
276
+ assertThat (clusterStructure .inactiveSince (a0 )).isEqualTo (4 );
277
+
278
+ assertThat (clusterStructure .inactiveSince (7 )).isEqualTo (9 );
279
+
280
+ var lastCluster = clusterStructure .singleActiveCluster ();
281
+
282
+ var otherCluster = 5 ; //trick to find correct placement
283
+ if (lastCluster ==5 ){
284
+ otherCluster = 6 ;
285
+ }
286
+ assertThat (clusterStructure .inactiveSince (otherCluster )).isEqualTo (5 );
287
+
288
+
289
+ }
290
+
291
+ }
292
+
232
293
233
294
}
0 commit comments