File tree Expand file tree Collapse file tree 4 files changed +17
-9
lines changed
algorithms-compute-facade/src
main/java/org/neo4j/gds/pathfinding
test/java/org/neo4j/gds/pathfinding
algo/src/main/java/org/neo4j/gds/paths/bellmanford
procedures/pushback-procedures-facade/src/test/java/org/neo4j/gds/procedures/algorithms/pathfinding Expand file tree Collapse file tree 4 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,12 @@ public record BellmanFordResult(
2626 PathFindingResult negativeCycles ,
2727 boolean containsNegativeCycle
2828) {
29- public static final BellmanFordResult EMPTY = new BellmanFordResult (
30- PathFindingResult .empty (),
31- PathFindingResult .empty (),
32- false
33- );
29+ public static BellmanFordResult empty () {
30+ return new BellmanFordResult (
31+ PathFindingResult .empty (),
32+ PathFindingResult .empty (),
33+ false
34+ );
35+ }
3436
3537}
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ public CompletableFuture<BellmanFordResult> bellmanFord(
149149 ) {
150150 // If the input graph is empty return a completed future with empty result
151151 if (graph .isEmpty ()) {
152- return CompletableFuture .completedFuture (BellmanFordResult .EMPTY );
152+ return CompletableFuture .completedFuture (BellmanFordResult .empty () );
153153 }
154154
155155 // Create ProgressTracker
Original file line number Diff line number Diff line change 3636import org .neo4j .gds .kspanningtree .KSpanningTreeParameters ;
3737import org .neo4j .gds .paths .astar .AStarParameters ;
3838import org .neo4j .gds .paths .bellmanford .BellmanFordParameters ;
39- import org .neo4j .gds .paths .bellmanford .BellmanFordResult ;
4039import org .neo4j .gds .paths .delta .DeltaSteppingParameters ;
4140import org .neo4j .gds .paths .dijkstra .DijkstraSingleSourceParameters ;
4241import org .neo4j .gds .paths .dijkstra .DijkstraSourceTargetParameters ;
@@ -110,7 +109,14 @@ void bellmanFord() {
110109 var result = future .join ();
111110
112111 assertThat (result ).isNotNull ();
113- assertThat (result ).isEqualTo (BellmanFordResult .EMPTY );
112+ assertThat (result .shortestPaths ())
113+ .extracting (PathFindingResult ::pathSet )
114+ .asInstanceOf (SET )
115+ .isEmpty ();
116+ assertThat (result .negativeCycles ())
117+ .extracting (PathFindingResult ::pathSet )
118+ .asInstanceOf (SET )
119+ .isEmpty ();
114120
115121 verifyNoInteractions (progressTrackerFactoryMock );
116122 verifyNoInteractions (algorithmCallerMock );
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ void shouldReturnEmptyStreamOnEmptyResult() {
5151 pathFactoryFacadeMock
5252 );
5353
54- var streamResult = transformer .apply (BellmanFordResult .EMPTY );
54+ var streamResult = transformer .apply (BellmanFordResult .empty () );
5555 assertThat (streamResult ).isEmpty ();
5656
5757 verifyNoInteractions (graphMock );
You can’t perform that action at this time.
0 commit comments