Skip to content

Commit 8b65cab

Browse files
IoannisPanagiotasvnickolov
authored andcommitted
Path finding spec moving
1 parent 4363df3 commit 8b65cab

File tree

55 files changed

+457
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+457
-161
lines changed

algorithm-specifications/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ dependencies {
99

1010
implementation project(':algo')
1111
implementation project(':algo-common')
12+
implementation project(':algorithms-facade-common')
13+
1214
implementation project(':algorithms-machinery')
1315

1416
// `CypherMapWrapper`
@@ -24,6 +26,8 @@ dependencies {
2426
implementation project(':node-embeddings-facade-api')
2527

2628
implementation project(':path-finding-configs')
29+
implementation project(':path-finding-facade-api')
30+
2731

2832
// `BaseConfig`
2933
implementation project(':config-api')
@@ -46,6 +50,8 @@ dependencies {
4650

4751
implementation project(':progress-tracking')
4852

53+
implementation project(':termination')
54+
4955
integrationTestImplementation project(':proc-catalog')
5056
integrationTestImplementation project(':proc-test')
5157
integrationTestImplementation project(':test-utils')

proc/path-finding/src/main/java/org/neo4j/gds/paths/all/AllShortestPathsStreamSpec.java renamed to algorithm-specifications/src/main/java/org/neo4j/gds/allshortest/AllShortestPathsStreamSpec.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
package org.neo4j.gds.paths.all;
20+
package org.neo4j.gds.allshortest;
2121

2222
import org.neo4j.gds.AlgorithmFactory;
2323
import org.neo4j.gds.GraphAlgorithmFactory;
@@ -40,12 +40,11 @@
4040
import java.util.stream.Stream;
4141

4242
import static org.neo4j.gds.executor.ExecutionMode.STREAM;
43-
import static org.neo4j.gds.paths.all.Constants.ALL_PAIRS_SHORTEST_PATH_DESCRIPTION;
4443

4544
@GdsCallable(
4645
name = "gds.allShortestPaths.stream",
4746
aliases = "gds.alpha.allShortestPaths.stream",
48-
description = ALL_PAIRS_SHORTEST_PATH_DESCRIPTION,
47+
description = Constants.ALL_PAIRS_SHORTEST_PATH_DESCRIPTION,
4948
executionMode = STREAM
5049
)
5150
public class AllShortestPathsStreamSpec implements AlgorithmSpec<MSBFSASPAlgorithm, Stream<AllShortestPathsStreamResult>, AllShortestPathsConfig, Stream<AllShortestPathsStreamResult>, AlgorithmFactory<Graph, MSBFSASPAlgorithm, AllShortestPathsConfig>> {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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.allshortest;
21+
22+
final class Constants {
23+
static final String ALL_PAIRS_SHORTEST_PATH_DESCRIPTION = "The All Pairs Shortest Path (APSP) calculates the shortest (weighted) path between all pairs of nodes.";
24+
25+
private Constants() {}
26+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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.astar;
21+
22+
class Constants {
23+
static final String ASTAR_DESCRIPTION =
24+
"The A* shortest path algorithm computes the shortest path between a pair of nodes. " +
25+
"It uses the relationship weight property to compare path lengths. " +
26+
"In addition, this implementation uses the haversine distance as a heuristic to converge faster.";
27+
28+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
package org.neo4j.gds.paths.sourcetarget;
20+
package org.neo4j.gds.astar;
2121

2222
import org.neo4j.gds.NullComputationResultConsumer;
2323
import org.neo4j.gds.executor.AlgorithmSpec;
@@ -34,9 +34,8 @@
3434
import java.util.stream.Stream;
3535

3636
import static org.neo4j.gds.executor.ExecutionMode.MUTATE_RELATIONSHIP;
37-
import static org.neo4j.gds.paths.sourcetarget.SinglePairShortestPathConstants.ASTAR_DESCRIPTION;
3837

39-
@GdsCallable(name = "gds.shortestPath.astar.mutate", description = ASTAR_DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
38+
@GdsCallable(name = "gds.shortestPath.astar.mutate", description = Constants.ASTAR_DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
4039
public class ShortestPathAStarMutateSpec implements AlgorithmSpec<AStar, PathFindingResult, ShortestPathAStarMutateConfig, Stream<PathFindingMutateResult>, AStarFactory<ShortestPathAStarMutateConfig>> {
4140

4241
@Override
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
package org.neo4j.gds.paths.sourcetarget;
20+
package org.neo4j.gds.astar;
2121

2222
import org.neo4j.gds.NullComputationResultConsumer;
2323
import org.neo4j.gds.executor.AlgorithmSpec;
@@ -34,9 +34,8 @@
3434
import java.util.stream.Stream;
3535

3636
import static org.neo4j.gds.executor.ExecutionMode.STREAM;
37-
import static org.neo4j.gds.paths.sourcetarget.SinglePairShortestPathConstants.ASTAR_DESCRIPTION;
3837

39-
@GdsCallable(name = "gds.shortestPath.astar.stream", description = ASTAR_DESCRIPTION, executionMode = STREAM)
38+
@GdsCallable(name = "gds.shortestPath.astar.stream", description = Constants.ASTAR_DESCRIPTION, executionMode = STREAM)
4039
public class ShortestPathAStarStreamSpec implements AlgorithmSpec<AStar, PathFindingResult, ShortestPathAStarStreamConfig, Stream<PathFindingStreamResult>, AStarFactory<ShortestPathAStarStreamConfig>> {
4140

4241
@Override
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
package org.neo4j.gds.paths.sourcetarget;
20+
package org.neo4j.gds.astar;
2121

2222
import org.neo4j.gds.NullComputationResultConsumer;
2323
import org.neo4j.gds.executor.AlgorithmSpec;
@@ -34,9 +34,8 @@
3434
import java.util.stream.Stream;
3535

3636
import static org.neo4j.gds.executor.ExecutionMode.WRITE_RELATIONSHIP;
37-
import static org.neo4j.gds.paths.sourcetarget.SinglePairShortestPathConstants.ASTAR_DESCRIPTION;
3837

39-
@GdsCallable(name = "gds.shortestPath.astar.write", description = ASTAR_DESCRIPTION, executionMode = WRITE_RELATIONSHIP)
38+
@GdsCallable(name = "gds.shortestPath.astar.write", description = Constants.ASTAR_DESCRIPTION, executionMode = WRITE_RELATIONSHIP)
4039
public class ShortestPathAStarWriteSpec implements AlgorithmSpec<AStar, PathFindingResult, ShortestPathAStarWriteConfig, Stream<StandardWriteRelationshipsResult>, AStarFactory<ShortestPathAStarWriteConfig>> {
4140

4241
@Override
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
package org.neo4j.gds.paths.singlesource.bellmanford;
20+
package org.neo4j.gds.bellmanFord;
2121

2222
import org.neo4j.gds.NullComputationResultConsumer;
2323
import org.neo4j.gds.executor.AlgorithmSpec;
@@ -34,9 +34,8 @@
3434
import java.util.stream.Stream;
3535

3636
import static org.neo4j.gds.executor.ExecutionMode.MUTATE_RELATIONSHIP;
37-
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;
3837

39-
@GdsCallable(name = "gds.bellmanFord.mutate", description = BELLMAN_FORD_DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
38+
@GdsCallable(name = "gds.bellmanFord.mutate", description = Constants.BELLMAN_FORD_DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
4039
public class BellmanFordMutateSpec implements AlgorithmSpec<BellmanFord, BellmanFordResult, AllShortestPathsBellmanFordMutateConfig, Stream<BellmanFordMutateResult>, BellmanFordAlgorithmFactory<AllShortestPathsBellmanFordMutateConfig>> {
4140

4241
@Override
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
package org.neo4j.gds.paths.singlesource.bellmanford;
20+
package org.neo4j.gds.bellmanFord;
2121

2222
import org.neo4j.gds.NullComputationResultConsumer;
2323
import org.neo4j.gds.executor.AlgorithmSpec;
@@ -34,9 +34,8 @@
3434
import java.util.stream.Stream;
3535

3636
import static org.neo4j.gds.executor.ExecutionMode.STATS;
37-
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;
3837

39-
@GdsCallable(name = "gds.bellmanFord.stats", description = BELLMAN_FORD_DESCRIPTION, executionMode = STATS)
38+
@GdsCallable(name = "gds.bellmanFord.stats", description = Constants.BELLMAN_FORD_DESCRIPTION, executionMode = STATS)
4039
public class BellmanFordStatsSpec implements AlgorithmSpec<BellmanFord, BellmanFordResult, AllShortestPathsBellmanFordStatsConfig, Stream<BellmanFordStatsResult>, BellmanFordAlgorithmFactory<AllShortestPathsBellmanFordStatsConfig>> {
4140
@Override
4241
public String name() {
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
package org.neo4j.gds.paths.singlesource.bellmanford;
20+
package org.neo4j.gds.bellmanFord;
2121

2222
import org.neo4j.gds.NullComputationResultConsumer;
2323
import org.neo4j.gds.executor.AlgorithmSpec;
@@ -34,9 +34,8 @@
3434
import java.util.stream.Stream;
3535

3636
import static org.neo4j.gds.executor.ExecutionMode.STREAM;
37-
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;
3837

39-
@GdsCallable(name = "gds.bellmanFord.stream", description = BELLMAN_FORD_DESCRIPTION, executionMode = STREAM)
38+
@GdsCallable(name = "gds.bellmanFord.stream", description = Constants.BELLMAN_FORD_DESCRIPTION, executionMode = STREAM)
4039
public class BellmanFordStreamSpec implements
4140
AlgorithmSpec<BellmanFord, BellmanFordResult, AllShortestPathsBellmanFordStreamConfig, Stream<BellmanFordStreamResult>, BellmanFordAlgorithmFactory<AllShortestPathsBellmanFordStreamConfig>> {
4241

0 commit comments

Comments
 (0)