Skip to content

Commit

Permalink
cleaning up procedure descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
lassewesth committed Jan 2, 2024
1 parent e8af456 commit 47f3afe
Show file tree
Hide file tree
Showing 46 changed files with 102 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
import static org.neo4j.gds.paths.delta.TentativeDistances.NO_PREDECESSOR;

public class BellmanFord extends Algorithm<BellmanFordResult> {
public static final String DESCRIPTION =
"The Bellman-Ford shortest path algorithm computes the shortest (weighted) path between one node and any other node in the graph without negative cycles.";

private final long sourceNode;
private final Graph graph;
private final boolean trackNegativeCycles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
import static org.neo4j.gds.paths.delta.TentativeDistances.NO_PREDECESSOR;

public final class DeltaStepping extends Algorithm<PathFindingResult> {
public static final String DESCRIPTION = "The Delta Stepping shortest path algorithm computes the shortest (weighted) path between one node and any other node in the graph. " +
"The computation is run multi-threaded";

private static final int NO_BIN = Integer.MAX_VALUE;
private static final int BIN_SIZE_THRESHOLD = 1000;
private static final int BATCH_SIZE = 64;
Expand Down
2 changes: 0 additions & 2 deletions algo/src/main/java/org/neo4j/gds/paths/dijkstra/Dijkstra.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
import static org.neo4j.gds.paths.dijkstra.Dijkstra.TraversalState.EMIT_AND_STOP;

public final class Dijkstra extends Algorithm<PathFindingResult> {
public static final String DESCRIPTION_SOURCE_TARGET = "The Dijkstra shortest path algorithm computes the shortest (weighted) path between one node and any other node in the graph.";

private static final long NO_RELATIONSHIP = -1;

private final Graph graph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.paths.sourcetarget;
package org.neo4j.gds.paths.singlesource;

final class ShortestPathDijkstraProc {
static final String DIJKSTRA_DESCRIPTION = "The Dijkstra shortest path algorithm computes the shortest (weighted) path between a pair of nodes.";
public interface SingleSourceShortestPathConstants {
String BELLMAN_FORD_DESCRIPTION =
"The Bellman-Ford shortest path algorithm computes the shortest (weighted) path between one node and any other node in the graph without negative cycles.";

private ShortestPathDijkstraProc() {}
String DELTA_STEPPING_DESCRIPTION = "The Delta Stepping shortest path algorithm computes the shortest (weighted) path between one node and any other node in the graph. " +
"The computation is run multi-threaded";

String DIJKSTRA_DESCRIPTION = "The Dijkstra shortest path algorithm computes the shortest (weighted) path between one node and any other node in the graph.";
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.neo4j.gds.BaseProc;
import org.neo4j.gds.executor.MemoryEstimationExecutor;
import org.neo4j.gds.executor.ProcedureExecutor;
import org.neo4j.gds.paths.bellmanford.BellmanFord;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.MemoryEstimateResult;
import org.neo4j.procedure.Description;
import org.neo4j.procedure.Name;
Expand All @@ -31,12 +31,13 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class BellmanFordMutateProc extends BaseProc {

@Procedure(name = "gds.bellmanFord.mutate", mode = READ)
@Description(BellmanFord.DESCRIPTION)
@Description(BELLMAN_FORD_DESCRIPTION)
public Stream<BellmanFordMutateResult> mutate(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
import org.neo4j.gds.paths.bellmanford.BellmanFordAlgorithmFactory;
import org.neo4j.gds.paths.bellmanford.BellmanFordMutateConfig;
import org.neo4j.gds.paths.bellmanford.BellmanFordResult;
import org.neo4j.gds.paths.delta.DeltaStepping;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;

import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.MUTATE_RELATIONSHIP;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;

@GdsCallable(name = "gds.bellmanFord.mutate", description = DeltaStepping.DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
@GdsCallable(name = "gds.bellmanFord.mutate", description = BELLMAN_FORD_DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
public class BellmanFordMutateSpec implements AlgorithmSpec<BellmanFord, BellmanFordResult, BellmanFordMutateConfig, Stream<BellmanFordMutateResult>, BellmanFordAlgorithmFactory<BellmanFordMutateConfig>> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.neo4j.gds.BaseProc;
import org.neo4j.gds.executor.MemoryEstimationExecutor;
import org.neo4j.gds.executor.ProcedureExecutor;
import org.neo4j.gds.paths.bellmanford.BellmanFord;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.MemoryEstimateResult;
import org.neo4j.procedure.Description;
import org.neo4j.procedure.Name;
Expand All @@ -31,13 +31,14 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class BellmanFordStatsProc extends BaseProc {


@Procedure(name = "gds.bellmanFord.stats", mode = READ)
@Description(BellmanFord.DESCRIPTION)
@Description(BELLMAN_FORD_DESCRIPTION)
public Stream<BellmanFordStatsResult> stats(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import org.neo4j.gds.paths.bellmanford.BellmanFordAlgorithmFactory;
import org.neo4j.gds.paths.bellmanford.BellmanFordResult;
import org.neo4j.gds.paths.bellmanford.BellmanFordStatsConfig;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;

import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.STATS;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;

@GdsCallable(name = "gds.bellmanFord.stats", description = BellmanFord.DESCRIPTION, executionMode = STATS)
@GdsCallable(name = "gds.bellmanFord.stats", description = BELLMAN_FORD_DESCRIPTION, executionMode = STATS)
public class BellmanFordStatsSpec implements AlgorithmSpec<BellmanFord, BellmanFordResult, BellmanFordStatsConfig, Stream<BellmanFordStatsResult>, BellmanFordAlgorithmFactory<BellmanFordStatsConfig>> {
@Override
public String name() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.neo4j.gds.BaseProc;
import org.neo4j.gds.executor.MemoryEstimationExecutor;
import org.neo4j.gds.executor.ProcedureExecutor;
import org.neo4j.gds.paths.bellmanford.BellmanFord;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.MemoryEstimateResult;
import org.neo4j.procedure.Description;
import org.neo4j.procedure.Name;
Expand All @@ -31,12 +31,13 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class BellmanFordStreamProc extends BaseProc {

@Procedure(name = "gds.bellmanFord.stream", mode = READ)
@Description(BellmanFord.DESCRIPTION)
@Description(BELLMAN_FORD_DESCRIPTION)
public Stream<StreamResult> stream(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
import org.neo4j.gds.paths.bellmanford.BellmanFordResult;
import org.neo4j.gds.paths.bellmanford.BellmanFordStreamConfig;
import org.neo4j.gds.paths.dijkstra.PathFindingResult;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;

import java.util.stream.Stream;

import static org.neo4j.gds.LoggingUtil.runWithExceptionLogging;
import static org.neo4j.gds.executor.ExecutionMode.STREAM;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;

@GdsCallable(name = "gds.bellmanFord.stream", description = BellmanFord.DESCRIPTION, executionMode = STREAM)
@GdsCallable(name = "gds.bellmanFord.stream", description = BELLMAN_FORD_DESCRIPTION, executionMode = STREAM)
public class BellmanFordStreamSpec implements
AlgorithmSpec<BellmanFord, BellmanFordResult, BellmanFordStreamConfig, Stream<StreamResult>, BellmanFordAlgorithmFactory<BellmanFordStreamConfig>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.neo4j.gds.executor.ExecutionContext;
import org.neo4j.gds.executor.MemoryEstimationExecutor;
import org.neo4j.gds.executor.ProcedureExecutor;
import org.neo4j.gds.paths.bellmanford.BellmanFord;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.MemoryEstimateResult;
import org.neo4j.procedure.Context;
import org.neo4j.procedure.Description;
Expand All @@ -34,6 +34,7 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;
import static org.neo4j.procedure.Mode.WRITE;

Expand All @@ -42,7 +43,7 @@ public class BellmanFordWriteProc extends BaseProc {
public RelationshipStreamExporterBuilder relationshipStreamExporterBuilder;

@Procedure(name = "gds.bellmanFord.write", mode = WRITE)
@Description(BellmanFord.DESCRIPTION)
@Description(BELLMAN_FORD_DESCRIPTION)
public Stream<BellmanFordWriteResult> write(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import org.neo4j.gds.paths.bellmanford.BellmanFordAlgorithmFactory;
import org.neo4j.gds.paths.bellmanford.BellmanFordResult;
import org.neo4j.gds.paths.bellmanford.BellmanFordWriteConfig;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;

import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.WRITE_RELATIONSHIP;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.BELLMAN_FORD_DESCRIPTION;

@GdsCallable(name = "gds.bellmanFord.write", description = BellmanFord.DESCRIPTION, executionMode = WRITE_RELATIONSHIP)
@GdsCallable(name = "gds.bellmanFord.write", description = BELLMAN_FORD_DESCRIPTION, executionMode = WRITE_RELATIONSHIP)
public class BellmanFordWriteSpec implements AlgorithmSpec<BellmanFord, BellmanFordResult, BellmanFordWriteConfig, Stream<BellmanFordWriteResult>, BellmanFordAlgorithmFactory<BellmanFordWriteConfig>> {
@Override
public String name() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.neo4j.gds.executor.MemoryEstimationExecutor;
import org.neo4j.gds.executor.ProcedureExecutor;
import org.neo4j.gds.executor.ProcedureExecutorSpec;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.procedures.pathfinding.PathFindingMutateResult;
import org.neo4j.gds.paths.delta.DeltaStepping;
import org.neo4j.gds.paths.delta.config.AllShortestPathsDeltaMutateConfig;
Expand All @@ -35,12 +36,13 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class AllShortestPathsDeltaMutateProc extends BaseProc {

@Procedure(name = "gds.allShortestPaths.delta.mutate", mode = READ)
@Description(DeltaStepping.DESCRIPTION)
@Description(DELTA_STEPPING_DESCRIPTION)
public Stream<PathFindingMutateResult> stream(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.neo4j.gds.executor.ExecutionContext;
import org.neo4j.gds.executor.GdsCallable;
import org.neo4j.gds.executor.NewConfigFunction;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.procedures.pathfinding.PathFindingMutateResult;
import org.neo4j.gds.paths.ShortestPathMutateResultConsumer;
import org.neo4j.gds.paths.delta.DeltaStepping;
Expand All @@ -34,8 +35,9 @@
import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.MUTATE_RELATIONSHIP;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;

@GdsCallable(name = "gds.allShortestPaths.delta.mutate", description = DeltaStepping.DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
@GdsCallable(name = "gds.allShortestPaths.delta.mutate", description = DELTA_STEPPING_DESCRIPTION, executionMode = MUTATE_RELATIONSHIP)
public class AllShortestPathsDeltaMutateSpec implements AlgorithmSpec<DeltaStepping, PathFindingResult, AllShortestPathsDeltaMutateConfig, Stream<PathFindingMutateResult>, DeltaSteppingFactory<AllShortestPathsDeltaMutateConfig>> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.neo4j.gds.BaseProc;
import org.neo4j.gds.executor.MemoryEstimationExecutor;
import org.neo4j.gds.executor.ProcedureExecutor;
import org.neo4j.gds.paths.delta.DeltaStepping;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.MemoryEstimateResult;
import org.neo4j.gds.results.StandardStatsResult;
import org.neo4j.procedure.Description;
Expand All @@ -32,12 +32,13 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class AllShortestPathsDeltaStatsProc extends BaseProc {

@Procedure(name = "gds.allShortestPaths.delta.stats", mode = READ)
@Description(DeltaStepping.DESCRIPTION)
@Description(DELTA_STEPPING_DESCRIPTION)
public Stream<StandardStatsResult> stats(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
import org.neo4j.gds.paths.delta.DeltaSteppingFactory;
import org.neo4j.gds.paths.delta.config.AllShortestPathsDeltaStatsConfig;
import org.neo4j.gds.paths.dijkstra.PathFindingResult;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.StandardStatsResult;

import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.STATS;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;

@GdsCallable(name = "gds.allShortestPaths.delta.stats", description = DeltaStepping.DESCRIPTION, executionMode = STATS)
@GdsCallable(name = "gds.allShortestPaths.delta.stats", description = DELTA_STEPPING_DESCRIPTION, executionMode = STATS)
public class AllShortestPathsDeltaStatsSpec implements AlgorithmSpec<DeltaStepping, PathFindingResult, AllShortestPathsDeltaStatsConfig, Stream<StandardStatsResult>, DeltaSteppingFactory<AllShortestPathsDeltaStatsConfig>> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.neo4j.gds.executor.MemoryEstimationExecutor;
import org.neo4j.gds.executor.ProcedureExecutor;
import org.neo4j.gds.executor.ProcedureExecutorSpec;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.procedures.pathfinding.PathFindingStreamResult;
import org.neo4j.gds.paths.delta.DeltaStepping;
import org.neo4j.gds.paths.delta.config.AllShortestPathsDeltaStreamConfig;
Expand All @@ -35,12 +36,13 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;

public class AllShortestPathsDeltaStreamProc extends BaseProc {

@Procedure(name = "gds.allShortestPaths.delta.stream", mode = READ)
@Description(DeltaStepping.DESCRIPTION)
@Description(DELTA_STEPPING_DESCRIPTION)
public Stream<PathFindingStreamResult> stream(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.neo4j.gds.executor.GdsCallable;
import org.neo4j.gds.executor.NewConfigFunction;
import org.neo4j.gds.paths.ShortestPathStreamResultConsumer;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.procedures.pathfinding.PathFindingStreamResult;
import org.neo4j.gds.paths.delta.DeltaStepping;
import org.neo4j.gds.paths.delta.DeltaSteppingFactory;
Expand All @@ -34,8 +35,9 @@
import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.STREAM;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;

@GdsCallable(name = "gds.allShortestPaths.delta.stream", description = DeltaStepping.DESCRIPTION, executionMode = STREAM)
@GdsCallable(name = "gds.allShortestPaths.delta.stream", description = DELTA_STEPPING_DESCRIPTION, executionMode = STREAM)
public class AllShortestPathsDeltaStreamSpec implements AlgorithmSpec<DeltaStepping, PathFindingResult, AllShortestPathsDeltaStreamConfig, Stream<PathFindingStreamResult>, DeltaSteppingFactory<AllShortestPathsDeltaStreamConfig>> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.neo4j.gds.paths.delta.DeltaStepping;
import org.neo4j.gds.paths.delta.config.AllShortestPathsDeltaWriteConfig;
import org.neo4j.gds.paths.dijkstra.PathFindingResult;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.MemoryEstimateResult;
import org.neo4j.gds.results.StandardWriteRelationshipsResult;
import org.neo4j.procedure.Context;
Expand All @@ -38,6 +39,7 @@
import java.util.Map;
import java.util.stream.Stream;

import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;
import static org.neo4j.procedure.Mode.READ;
import static org.neo4j.procedure.Mode.WRITE;

Expand All @@ -47,7 +49,7 @@ public class AllShortestPathsDeltaWriteProc extends BaseProc {
public RelationshipStreamExporterBuilder relationshipStreamExporterBuilder;

@Procedure(name = "gds.allShortestPaths.delta.write", mode = WRITE)
@Description(DeltaStepping.DESCRIPTION)
@Description(DELTA_STEPPING_DESCRIPTION)
public Stream<StandardWriteRelationshipsResult> stream(
@Name(value = "graphName") String graphName,
@Name(value = "configuration", defaultValue = "{}") Map<String, Object> configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
import org.neo4j.gds.paths.delta.DeltaSteppingFactory;
import org.neo4j.gds.paths.delta.config.AllShortestPathsDeltaWriteConfig;
import org.neo4j.gds.paths.dijkstra.PathFindingResult;
import org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants;
import org.neo4j.gds.results.StandardWriteRelationshipsResult;

import java.util.stream.Stream;

import static org.neo4j.gds.executor.ExecutionMode.WRITE_RELATIONSHIP;
import static org.neo4j.gds.paths.singlesource.SingleSourceShortestPathConstants.DELTA_STEPPING_DESCRIPTION;

@GdsCallable(name = "gds.allShortestPaths.delta.write", description = DeltaStepping.DESCRIPTION, executionMode = WRITE_RELATIONSHIP)
@GdsCallable(name = "gds.allShortestPaths.delta.write", description = DELTA_STEPPING_DESCRIPTION, executionMode = WRITE_RELATIONSHIP)
public class AllShortestPathsDeltaWriteSpec implements AlgorithmSpec<DeltaStepping, PathFindingResult, AllShortestPathsDeltaWriteConfig, Stream<StandardWriteRelationshipsResult>, DeltaSteppingFactory<AllShortestPathsDeltaWriteConfig>> {
@Override
public String name() {
Expand Down
Loading

0 comments on commit 47f3afe

Please sign in to comment.