diff --git a/algo/src/main/java/org/neo4j/gds/kspanningtree/KSpanningTreeAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/kspanningtree/KSpanningTreeAlgorithmFactory.java
deleted file mode 100644
index 5b203c6f44..0000000000
--- a/algo/src/main/java/org/neo4j/gds/kspanningtree/KSpanningTreeAlgorithmFactory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.kspanningtree;
-
-import org.neo4j.gds.GraphAlgorithmFactory;
-import org.neo4j.gds.api.Graph;
-import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
-import org.neo4j.gds.core.utils.progress.tasks.Task;
-import org.neo4j.gds.core.utils.progress.tasks.Tasks;
-import org.neo4j.gds.termination.TerminationFlag;
-
-public class KSpanningTreeAlgorithmFactory extends GraphAlgorithmFactory {
-
- public KSpanningTree build(Graph graph, KSpanningTreeParameters parameters, ProgressTracker progressTracker) {
- if (!graph.schema().isUndirected()) {
- throw new IllegalArgumentException(
- "The K-Spanning Tree algorithm works only with undirected graphs. Please orient the edges properly");
- }
- return new KSpanningTree(
- graph,
- parameters.objective(),
- graph.toMappedNodeId(parameters.sourceNode()),
- parameters.k(),
- progressTracker,
- TerminationFlag.RUNNING_TRUE
- );
- }
-
- @Override
- public KSpanningTree build(Graph graph, KSpanningTreeBaseConfig configuration, ProgressTracker progressTracker) {
- return build(graph, configuration.toKSpanningTreeParameters(), progressTracker);
- }
-
- @Override
- public Task progressTask(
- Graph graph, KSpanningTreeBaseConfig config
- ) {
- return Tasks.task(
- taskName(),
- Tasks.leaf("SpanningTree", graph.relationshipCount()),
- Tasks.leaf("Remove relationships")
- );
- }
-
-
-
- @Override
- public String taskName() {
- return "KSpanningTree";
- }
-}
diff --git a/algo/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeAlgorithmFactory.java
deleted file mode 100644
index 3fde84455a..0000000000
--- a/algo/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeAlgorithmFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.spanningtree;
-
-import org.neo4j.gds.GraphAlgorithmFactory;
-import org.neo4j.gds.api.Graph;
-import org.neo4j.gds.mem.MemoryEstimation;
-import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
-import org.neo4j.gds.core.utils.progress.tasks.Task;
-import org.neo4j.gds.core.utils.progress.tasks.Tasks;
-import org.neo4j.gds.termination.TerminationFlag;
-
-public class SpanningTreeAlgorithmFactory extends GraphAlgorithmFactory {
-
- public Prim build(Graph graph, SpanningTreeParameters parameters, ProgressTracker progressTracker) {
- if (!graph.schema().isUndirected()) {
- throw new IllegalArgumentException(
- "The Spanning Tree algorithm works only with undirected graphs. Please orient the edges properly");
- }
- return new Prim(
- graph,
- parameters.objective(),
- graph.toMappedNodeId(parameters.sourceNode()),
- progressTracker,
- TerminationFlag.RUNNING_TRUE
- );
- }
-
- @Override
- public Prim build(Graph graph, CONFIG configuration, ProgressTracker progressTracker) {
- return build(graph, configuration.toParameters(), progressTracker);
- }
-
- @Override
- public String taskName() {
- return "SpanningTree";
- }
-
- @Override
- public MemoryEstimation memoryEstimation(CONFIG config) {
- return new SpanningTreeMemoryEstimateDefinition().memoryEstimation();
- }
-
- public Task progressTask(Graph graph) {
- return Tasks.leaf(taskName(), graph.relationshipCount());
- }
-
- @Override
- public Task progressTask(Graph graph, CONFIG config) {
- return progressTask(graph);
- }
-}
diff --git a/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeAlgorithmFactory.java
deleted file mode 100644
index 1c73837bdf..0000000000
--- a/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeAlgorithmFactory.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.steiner;
-
-import org.neo4j.gds.GraphAlgorithmFactory;
-import org.neo4j.gds.api.Graph;
-import org.neo4j.gds.core.concurrency.DefaultPool;
-import org.neo4j.gds.mem.MemoryEstimation;
-import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
-import org.neo4j.gds.core.utils.progress.tasks.Task;
-import org.neo4j.gds.core.utils.progress.tasks.Tasks;
-import org.neo4j.gds.termination.TerminationFlag;
-
-import java.util.ArrayList;
-import java.util.stream.Collectors;
-
-public class SteinerTreeAlgorithmFactory extends GraphAlgorithmFactory {
-
- public ShortestPathsSteinerAlgorithm build(
- Graph graph,
- SteinerTreeParameters parameters,
- ProgressTracker progressTracker
- ) {
- var mappedTargetNodes = parameters.targetNodes().stream()
- .map(graph::safeToMappedNodeId)
- .collect(Collectors.toList());
- return new ShortestPathsSteinerAlgorithm(
- graph,
- graph.toMappedNodeId(parameters.sourceNode()),
- mappedTargetNodes,
- parameters.delta(),
- parameters.concurrency(),
- parameters.applyRerouting(),
- DefaultPool.INSTANCE,
- progressTracker,
- TerminationFlag.RUNNING_TRUE
- );
- }
-
- @Override
- public ShortestPathsSteinerAlgorithm build(Graph graph, CONFIG configuration, ProgressTracker progressTracker) {
- return build(graph, configuration.toParameters(), progressTracker);
- }
-
- @Override
- public String taskName() {
- return "SteinerTree";
- }
-
- public Task progressTask(Graph graph, int targetNodesSize, boolean applyRerouting) {
- var subtasks = new ArrayList();
- subtasks.add(Tasks.leaf("Traverse", targetNodesSize));
- if (applyRerouting) {
- long nodeCount = graph.nodeCount();
- subtasks.add(Tasks.leaf("Reroute", nodeCount));
- }
- return Tasks.task(taskName(), subtasks);
- }
-
- @Override
- public Task progressTask(Graph graph, CONFIG config) {
- return progressTask(graph, config.targetNodes().size(), config.applyRerouting());
- }
-
- @Override
- public MemoryEstimation memoryEstimation(CONFIG config) {
- return new SteinerTreeMemoryEstimateDefinition(config.applyRerouting()).memoryEstimation();
- }
-}
diff --git a/algo/src/test/java/org/neo4j/gds/kspanningtree/KSpanningTreeTest.java b/algo/src/test/java/org/neo4j/gds/kspanningtree/KSpanningTreeTest.java
index 8c4cce3725..b2e13fe6d3 100644
--- a/algo/src/test/java/org/neo4j/gds/kspanningtree/KSpanningTreeTest.java
+++ b/algo/src/test/java/org/neo4j/gds/kspanningtree/KSpanningTreeTest.java
@@ -25,12 +25,14 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.neo4j.gds.Orientation;
-import org.neo4j.gds.TestProgressTracker;
import org.neo4j.gds.api.Graph;
+import org.neo4j.gds.applications.algorithms.machinery.ProgressTrackerCreator;
+import org.neo4j.gds.applications.algorithms.machinery.RequestScopedDependencies;
+import org.neo4j.gds.applications.algorithms.pathfinding.PathFindingAlgorithms;
import org.neo4j.gds.compat.TestLog;
-import org.neo4j.gds.core.concurrency.Concurrency;
import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
+import org.neo4j.gds.core.utils.warnings.EmptyUserLogRegistryFactory;
import org.neo4j.gds.extension.GdlExtension;
import org.neo4j.gds.extension.GdlGraph;
import org.neo4j.gds.extension.IdFunction;
@@ -268,34 +270,36 @@ void shouldWorkForComponentSmallerThanK() {
@Test
void shouldLogProgress() {
- var config = KSpanningTreeBaseConfigImpl.builder().sourceNode(idFunction.of("a")).k(2).build();
- var factory = new KSpanningTreeAlgorithmFactory<>();
var log = new GdsTestLog();
- var progressTracker = new TestProgressTracker(
- factory.progressTask(graph, config),
- log,
- new Concurrency(1),
- EmptyTaskRegistryFactory.INSTANCE
- );
- factory.build(graph, config, progressTracker).compute();
+ var requestScopedDependencies = RequestScopedDependencies.builder()
+ .with(EmptyTaskRegistryFactory.INSTANCE)
+ .with(TerminationFlag.RUNNING_TRUE)
+ .with(EmptyUserLogRegistryFactory.INSTANCE)
+ .build();
+ var progressTrackerCreator = new ProgressTrackerCreator(log, requestScopedDependencies);
+ var pathFindingAlgorithms = new PathFindingAlgorithms(requestScopedDependencies, progressTrackerCreator);
+
+ var config = KSpanningTreeBaseConfigImpl.builder().sourceNode(idFunction.of("a")).k(2).build();
+ pathFindingAlgorithms.kSpanningTree(graph, config);
+
assertThat(log.getMessages(TestLog.INFO))
.extracting(removingThreadId())
.extracting(replaceTimings())
.containsExactly(
- "KSpanningTree :: Start",
- "KSpanningTree :: SpanningTree :: Start",
- "KSpanningTree :: SpanningTree 30%",
- "KSpanningTree :: SpanningTree 50%",
- "KSpanningTree :: SpanningTree 80%",
- "KSpanningTree :: SpanningTree 100%",
- "KSpanningTree :: SpanningTree :: Finished",
- "KSpanningTree :: Remove relationships :: Start",
- "KSpanningTree :: Remove relationships 20%",
- "KSpanningTree :: Remove relationships 40%",
- "KSpanningTree :: Remove relationships 60%",
- "KSpanningTree :: Remove relationships 100%",
- "KSpanningTree :: Remove relationships :: Finished",
- "KSpanningTree :: Finished"
+ "K Spanning Tree :: Start",
+ "K Spanning Tree :: SpanningTree :: Start",
+ "K Spanning Tree :: SpanningTree 30%",
+ "K Spanning Tree :: SpanningTree 50%",
+ "K Spanning Tree :: SpanningTree 80%",
+ "K Spanning Tree :: SpanningTree 100%",
+ "K Spanning Tree :: SpanningTree :: Finished",
+ "K Spanning Tree :: Remove relationships :: Start",
+ "K Spanning Tree :: Remove relationships 20%",
+ "K Spanning Tree :: Remove relationships 40%",
+ "K Spanning Tree :: Remove relationships 60%",
+ "K Spanning Tree :: Remove relationships 100%",
+ "K Spanning Tree :: Remove relationships :: Finished",
+ "K Spanning Tree :: Finished"
);
}
diff --git a/algo/src/test/java/org/neo4j/gds/spanningtree/PrimTest.java b/algo/src/test/java/org/neo4j/gds/spanningtree/PrimTest.java
index 1ace3d40e5..70553b04a2 100644
--- a/algo/src/test/java/org/neo4j/gds/spanningtree/PrimTest.java
+++ b/algo/src/test/java/org/neo4j/gds/spanningtree/PrimTest.java
@@ -26,11 +26,13 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.Orientation;
-import org.neo4j.gds.TestProgressTracker;
+import org.neo4j.gds.applications.algorithms.machinery.ProgressTrackerCreator;
+import org.neo4j.gds.applications.algorithms.machinery.RequestScopedDependencies;
+import org.neo4j.gds.applications.algorithms.pathfinding.PathFindingAlgorithms;
import org.neo4j.gds.compat.TestLog;
-import org.neo4j.gds.core.concurrency.Concurrency;
import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
+import org.neo4j.gds.core.utils.warnings.EmptyUserLogRegistryFactory;
import org.neo4j.gds.extension.GdlExtension;
import org.neo4j.gds.extension.GdlGraph;
import org.neo4j.gds.extension.IdFunction;
@@ -150,16 +152,18 @@ void testMinimum(String nodeId, String parentA, String parentB, String parentC,
@Test
void shouldLogProgress() {
- var parameters = new SpanningTreeParameters(PrimOperators.MIN_OPERATOR, graph.toOriginalNodeId("a"));
- var factory = new SpanningTreeAlgorithmFactory<>();
var log = new GdsTestLog();
- var progressTracker = new TestProgressTracker(
- factory.progressTask(graph),
- log,
- new Concurrency(1),
- EmptyTaskRegistryFactory.INSTANCE
- );
- factory.build(graph, parameters, progressTracker).compute();
+ var requestScopedDependencies = RequestScopedDependencies.builder()
+ .with(EmptyTaskRegistryFactory.INSTANCE)
+ .with(TerminationFlag.RUNNING_TRUE)
+ .with(EmptyUserLogRegistryFactory.INSTANCE)
+ .build();
+ var progressTrackerCreator = new ProgressTrackerCreator(log, requestScopedDependencies);
+ var pathFindingAlgorithms = new PathFindingAlgorithms(requestScopedDependencies, progressTrackerCreator);
+
+ var config = SpanningTreeBaseConfigImpl.builder().sourceNode(graph.toOriginalNodeId("a")).build();
+ pathFindingAlgorithms.spanningTree(graph, config);
+
assertThat(log.getMessages(TestLog.INFO))
.extracting(removingThreadId())
.extracting(replaceTimings())
diff --git a/algo/src/test/java/org/neo4j/gds/spanningtree/SpanningTreeAlgorithmFactoryTest.java b/algo/src/test/java/org/neo4j/gds/spanningtree/SpanningTreeAlgorithmFactoryTest.java
index d95af7d202..d01c1db59d 100644
--- a/algo/src/test/java/org/neo4j/gds/spanningtree/SpanningTreeAlgorithmFactoryTest.java
+++ b/algo/src/test/java/org/neo4j/gds/spanningtree/SpanningTreeAlgorithmFactoryTest.java
@@ -20,7 +20,7 @@
package org.neo4j.gds.spanningtree;
import org.junit.jupiter.api.Test;
-import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
+import org.neo4j.gds.applications.algorithms.pathfinding.PathFindingAlgorithms;
import org.neo4j.gds.gdl.GdlFactory;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -29,9 +29,9 @@ class SpanningTreeAlgorithmFactoryTest {
@Test
void shouldThrowIfNotUndirected() {
var graph = GdlFactory.of("(a)-[:foo{cost:1.0}]->(b)").build().getUnion();
- var parameters = new SpanningTreeParameters(PrimOperators.MIN_OPERATOR, 0);
- var spanningTreeAlgorithmFactory = new SpanningTreeAlgorithmFactory<>();
- assertThatThrownBy(() -> spanningTreeAlgorithmFactory.build(graph, parameters, ProgressTracker.NULL_TRACKER))
+ var pathFindingAlgorithms = new PathFindingAlgorithms(null, null);
+
+ assertThatThrownBy(() -> pathFindingAlgorithms.spanningTree(graph, null))
.hasMessageContaining("undirected");
}
}
diff --git a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java
index 85578db20a..3ea50d6ff1 100644
--- a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java
+++ b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java
@@ -22,13 +22,15 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.neo4j.gds.Orientation;
-import org.neo4j.gds.TestProgressTracker;
+import org.neo4j.gds.applications.algorithms.machinery.ProgressTrackerCreator;
+import org.neo4j.gds.applications.algorithms.machinery.RequestScopedDependencies;
+import org.neo4j.gds.applications.algorithms.pathfinding.PathFindingAlgorithms;
import org.neo4j.gds.compat.TestLog;
import org.neo4j.gds.core.concurrency.Concurrency;
import org.neo4j.gds.core.concurrency.DefaultPool;
import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory;
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
-import org.neo4j.gds.core.utils.progress.tasks.Task;
+import org.neo4j.gds.core.utils.warnings.EmptyUserLogRegistryFactory;
import org.neo4j.gds.extension.GdlExtension;
import org.neo4j.gds.extension.GdlGraph;
import org.neo4j.gds.extension.IdFunction;
@@ -38,7 +40,6 @@
import org.neo4j.gds.termination.TerminationFlag;
import java.util.List;
-import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static org.neo4j.gds.assertj.Extractors.removingThreadId;
@@ -336,33 +337,20 @@ void shouldWorkIfNoReachableTerminals() {
@Test
void shouldLogProgress() {
- var sourceId = graph.toOriginalNodeId("a0");
- var target1 = graph.toOriginalNodeId("a3");
- var target2 = graph.toOriginalNodeId("a4");
- var targetNodes = List.of(target1, target2);
-
- var steinerTreeAlgorithmFactory = new SteinerTreeAlgorithmFactory<>();
var log = new GdsTestLog();
- var baseTask = steinerTreeAlgorithmFactory.progressTask(graph, targetNodes.size(), false);
- var concurrency = new Concurrency(4);
- var progressTracker = new TestProgressTracker(
- baseTask,
- log,
- concurrency,
- EmptyTaskRegistryFactory.INSTANCE
- );
-
- new ShortestPathsSteinerAlgorithm(
- graph,
- graph.toMappedNodeId(sourceId),
- targetNodes.stream().map(graph::safeToMappedNodeId).collect(Collectors.toList()),
- 2.0,
- concurrency,
- false,
- DefaultPool.INSTANCE,
- progressTracker,
- TerminationFlag.RUNNING_TRUE
- ).compute();
+ var requestScopedDependencies = RequestScopedDependencies.builder()
+ .with(EmptyTaskRegistryFactory.INSTANCE)
+ .with(TerminationFlag.RUNNING_TRUE)
+ .with(EmptyUserLogRegistryFactory.INSTANCE)
+ .build();
+ var progressTrackerCreator = new ProgressTrackerCreator(log, requestScopedDependencies);
+ var pathFindingAlgorithms = new PathFindingAlgorithms(requestScopedDependencies, progressTrackerCreator);
+
+ var config = SteinerTreeBaseConfigImpl.builder()
+ .sourceNode(graph.toOriginalNodeId("a0"))
+ .targetNodes(List.of(graph.toOriginalNodeId("a3"), graph.toOriginalNodeId("a4")))
+ .build();
+ pathFindingAlgorithms.steinerTree(graph, config);
assertThat(log.getMessages(TestLog.INFO))
.extracting(removingThreadId())
@@ -377,38 +365,23 @@ void shouldLogProgress() {
);
}
-
@Test
void shouldLogProgressWithRerouting() {
-
- var sourceId = graph.toOriginalNodeId("a0");
- var target1 = graph.toOriginalNodeId("a3");
- var target2 = graph.toOriginalNodeId("a4");
- var targetNodes = List.of(target1, target2);
- var applyRerouting = true;
-
- var steinerTreeAlgorithmFactory = new SteinerTreeAlgorithmFactory<>();
var log = new GdsTestLog();
- Task baseTask = steinerTreeAlgorithmFactory.progressTask(graph, targetNodes.size(), applyRerouting);
- var concurrency = new Concurrency(4);
- var progressTracker = new TestProgressTracker(
- baseTask,
- log,
- concurrency,
- EmptyTaskRegistryFactory.INSTANCE
- );
-
- new ShortestPathsSteinerAlgorithm(
- graph,
- graph.toMappedNodeId(sourceId),
- targetNodes.stream().map(graph::safeToMappedNodeId).collect(Collectors.toList()),
- 2.0,
- concurrency,
- applyRerouting,
- DefaultPool.INSTANCE,
- progressTracker,
- TerminationFlag.RUNNING_TRUE
- ).compute();
+ var requestScopedDependencies = RequestScopedDependencies.builder()
+ .with(EmptyTaskRegistryFactory.INSTANCE)
+ .with(TerminationFlag.RUNNING_TRUE)
+ .with(EmptyUserLogRegistryFactory.INSTANCE)
+ .build();
+ var progressTrackerCreator = new ProgressTrackerCreator(log, requestScopedDependencies);
+ var pathFindingAlgorithms = new PathFindingAlgorithms(requestScopedDependencies, progressTrackerCreator);
+
+ var config = SteinerTreeBaseConfigImpl.builder()
+ .applyRerouting(true)
+ .sourceNode(graph.toOriginalNodeId("a0"))
+ .targetNodes(List.of(graph.toOriginalNodeId("a3"), graph.toOriginalNodeId("a4")))
+ .build();
+ pathFindingAlgorithms.steinerTree(graph, config);
assertThat(log.getMessages(TestLog.INFO))
.extracting(removingThreadId())
@@ -433,34 +406,21 @@ void shouldLogProgressWithRerouting() {
@Test
void shouldLogProgressWithInverseRerouting() {
- var sourceId = invGraph.toOriginalNodeId("a0");
- var target1 = invGraph.toOriginalNodeId("a3");
- var target2 = invGraph.toOriginalNodeId("a4");
- var targetNodes = List.of(target1, target2);
- var applyRerouting = true;
-
- var steinerTreeAlgorithmFactory = new SteinerTreeAlgorithmFactory<>();
var log = new GdsTestLog();
- var concurrency = new Concurrency(4);
- Task baseTask = steinerTreeAlgorithmFactory.progressTask(invGraph, targetNodes.size(), applyRerouting);
- var progressTracker = new TestProgressTracker(
- baseTask,
- log,
- concurrency,
- EmptyTaskRegistryFactory.INSTANCE
- );
-
- new ShortestPathsSteinerAlgorithm(
- invGraph,
- invGraph.toMappedNodeId(sourceId),
- targetNodes.stream().map(invGraph::safeToMappedNodeId).collect(Collectors.toList()),
- 2.0,
- concurrency,
- applyRerouting,
- DefaultPool.INSTANCE,
- progressTracker,
- TerminationFlag.RUNNING_TRUE
- ).compute();
+ var requestScopedDependencies = RequestScopedDependencies.builder()
+ .with(EmptyTaskRegistryFactory.INSTANCE)
+ .with(TerminationFlag.RUNNING_TRUE)
+ .with(EmptyUserLogRegistryFactory.INSTANCE)
+ .build();
+ var progressTrackerCreator = new ProgressTrackerCreator(log, requestScopedDependencies);
+ var pathFindingAlgorithms = new PathFindingAlgorithms(requestScopedDependencies, progressTrackerCreator);
+
+ var config = SteinerTreeBaseConfigImpl.builder()
+ .applyRerouting(true)
+ .sourceNode(invGraph.toOriginalNodeId("a0"))
+ .targetNodes(List.of(invGraph.toOriginalNodeId("a3"), invGraph.toOriginalNodeId("a4")))
+ .build();
+ pathFindingAlgorithms.steinerTree(invGraph, config);
assertThat(log.getMessages(TestLog.INFO))
.extracting(removingThreadId())
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/kspanningtree/Constants.java b/algorithm-specifications/src/main/java/org/neo4j/gds/kspanningtree/Constants.java
deleted file mode 100644
index a08e030be1..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/kspanningtree/Constants.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.kspanningtree;
-
-class Constants {
- static final String K_SPANNING_TREE_DESCRIPTION =
- "The K-spanning tree algorithm starts from a root node and returns a spanning tree with exactly k nodes";
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/kspanningtree/KSpanningTreeWriteSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/kspanningtree/KSpanningTreeWriteSpec.java
deleted file mode 100644
index c45bade0e5..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/kspanningtree/KSpanningTreeWriteSpec.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.kspanningtree;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.KSpanningTreeWriteResult;
-import org.neo4j.gds.spanningtree.SpanningTree;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.WRITE_RELATIONSHIP;
-
-@GdsCallable(
- name = "gds.kSpanningTree.write",
- aliases = "gds.alpha.kSpanningTree.write",
- description = Constants.K_SPANNING_TREE_DESCRIPTION,
- executionMode = WRITE_RELATIONSHIP)
-public class KSpanningTreeWriteSpec implements
- AlgorithmSpec, KSpanningTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "KSpanningTreeWrite";
- }
-
- @Override
- public KSpanningTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new KSpanningTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> KSpanningTreeWriteConfig.of(config);
- }
-
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/Constants.java b/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/Constants.java
deleted file mode 100644
index de6016aa28..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/Constants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.spanningtree;
-
-class Constants {
- static final String SPANNING_TREE_DESCRIPTION =
- "The spanning tree algorithm visits all nodes that are in the same connected component as the starting node, " +
- "and returns a spanning tree of all nodes in the component where the total weight of the relationships is either minimized or maximized.";
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeMutateSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeMutateSpec.java
deleted file mode 100644
index 97d6e30e6f..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeMutateSpec.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.spanningtree;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SpanningTreeMutateResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.MUTATE_RELATIONSHIP;
-
-@GdsCallable(
- name = "gds.spanningTree.mutate",
- aliases = {"gds.beta.spanningTree.mutate"},
- description = Constants.SPANNING_TREE_DESCRIPTION,
- executionMode = MUTATE_RELATIONSHIP
-)
-public class SpanningTreeMutateSpec implements AlgorithmSpec, SpanningTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SpanningTreeMutate";
- }
-
- @Override
- public SpanningTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SpanningTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SpanningTreeMutateConfig.of(config);
-
- }
-
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeStatsSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeStatsSpec.java
deleted file mode 100644
index 845c021945..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeStatsSpec.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.spanningtree;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SpanningTreeStatsResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.STATS;
-
-@GdsCallable(
- name = "gds.spanningTree.stats",
- aliases = {"gds.beta.spanningTree.stats"},
- description = Constants.SPANNING_TREE_DESCRIPTION,
- executionMode = STATS
-)
-public class SpanningTreeStatsSpec implements AlgorithmSpec, SpanningTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SpanningTreeStats";
- }
-
- @Override
- public SpanningTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SpanningTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SpanningTreeStatsConfig.of(config);
-
- }
-
- @Override
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeStreamSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeStreamSpec.java
deleted file mode 100644
index d313d47685..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeStreamSpec.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.spanningtree;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SpanningTreeStreamResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.STREAM;
-
-@GdsCallable(
- name = "gds.spanningTree.stream",
- aliases = {"gds.beta.spanningTree.stream"},
- description = Constants.SPANNING_TREE_DESCRIPTION,
- executionMode = STREAM
-)
-public class SpanningTreeStreamSpec implements AlgorithmSpec, SpanningTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SpanningTreeStream";
- }
-
- @Override
- public SpanningTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SpanningTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SpanningTreeStreamConfig.of(config);
-
- }
-
- @Override
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeWriteSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeWriteSpec.java
deleted file mode 100644
index b1080f0465..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeWriteSpec.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.spanningtree;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SpanningTreeWriteResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.MUTATE_RELATIONSHIP;
-
-@GdsCallable(
- name = "gds.spanningTree.write",
- aliases = {"gds.beta.spanningTree.write"},
- description = Constants.SPANNING_TREE_DESCRIPTION,
- executionMode = MUTATE_RELATIONSHIP)
-public class SpanningTreeWriteSpec implements
- AlgorithmSpec, SpanningTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SpanningTreeWrite";
- }
-
- @Override
- public SpanningTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SpanningTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SpanningTreeWriteConfig.of(config);
- }
-
- @Override
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/Constants.java b/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/Constants.java
deleted file mode 100644
index 943d160bdd..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/Constants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.steiner;
-
-final class Constants {
- static final String STEINER_DESCRIPTION =
- "The steiner tree algorithm accepts a source node, as well as a list of target nodes. " +
- "It then attempts to find a spanning tree where there is a path from the source node to each target node, " +
- "such that the total weight of the relationships is as low as possible.";
-
- private Constants() {}
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeMutateSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeMutateSpec.java
deleted file mode 100644
index bea4782a2e..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeMutateSpec.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.steiner;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SteinerMutateResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.STREAM;
-
-@GdsCallable(
- name = "gds.steinerTree.mutate",
- aliases = {"gds.beta.steinerTree.mutate"},
- description = Constants.STEINER_DESCRIPTION,
- executionMode = STREAM
-)
-public class SteinerTreeMutateSpec implements AlgorithmSpec, SteinerTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SteinerTreeMutate";
- }
-
- @Override
- public SteinerTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SteinerTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SteinerTreeMutateConfig.of(config);
-
- }
-
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeStatsSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeStatsSpec.java
deleted file mode 100644
index d7149c64d7..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeStatsSpec.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.steiner;
-
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SteinerStatsResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.STATS;
-
-@GdsCallable(
- name = "gds.steinerTree.stats",
- aliases = {"gds.beta.steinerTree.stats"},
- description = Constants.STEINER_DESCRIPTION,
- executionMode = STATS
-)
-public class SteinerTreeStatsSpec implements AlgorithmSpec, SteinerTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SteinerTreeStats";
- }
-
- @Override
- public SteinerTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SteinerTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SteinerTreeStatsConfig.of(config);
- }
-
- @Override
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeStreamSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeStreamSpec.java
deleted file mode 100644
index f7ba28de6d..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeStreamSpec.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.steiner;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SteinerTreeStreamResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.STREAM;
-
-@GdsCallable(
- name = "gds.steinerTree.stream",
- aliases = {"gds.beta.steinerTree.stream"},
- description = Constants.STEINER_DESCRIPTION,
- executionMode = STREAM
-)
-public class SteinerTreeStreamSpec implements AlgorithmSpec, SteinerTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SteinerTreeStream";
- }
-
- @Override
- public SteinerTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SteinerTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SteinerTreeStreamConfig.of(config);
- }
-
- @Override
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeWriteSpec.java b/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeWriteSpec.java
deleted file mode 100644
index 0ad33676d9..0000000000
--- a/algorithm-specifications/src/main/java/org/neo4j/gds/steiner/SteinerTreeWriteSpec.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) "Neo4j"
- * Neo4j Sweden AB [http://neo4j.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.neo4j.gds.steiner;
-
-import org.neo4j.gds.NullComputationResultConsumer;
-import org.neo4j.gds.executor.AlgorithmSpec;
-import org.neo4j.gds.executor.ComputationResultConsumer;
-import org.neo4j.gds.executor.ExecutionContext;
-import org.neo4j.gds.executor.GdsCallable;
-import org.neo4j.gds.procedures.algorithms.configuration.NewConfigFunction;
-import org.neo4j.gds.procedures.algorithms.pathfinding.SteinerWriteResult;
-
-import java.util.stream.Stream;
-
-import static org.neo4j.gds.executor.ExecutionMode.WRITE_RELATIONSHIP;
-
-@GdsCallable(
- name = "gds.steinerTree.write",
- aliases = {"gds.beta.steinerTree.write"},
- description = Constants.STEINER_DESCRIPTION,
- executionMode = WRITE_RELATIONSHIP)
-public class SteinerTreeWriteSpec implements
- AlgorithmSpec, SteinerTreeAlgorithmFactory> {
-
- @Override
- public String name() {
- return "SteinerTreeWrite";
- }
-
- @Override
- public SteinerTreeAlgorithmFactory algorithmFactory(ExecutionContext executionContext) {
- return new SteinerTreeAlgorithmFactory<>();
- }
-
- @Override
- public NewConfigFunction newConfigFunction() {
- return (__, config) -> SteinerTreeWriteConfig.of(config);
- }
-
- @Override
- public ComputationResultConsumer> computationResultConsumer() {
- return new NullComputationResultConsumer<>();
- }
-}
diff --git a/applications/algorithms/path-finding/src/main/java/org/neo4j/gds/applications/algorithms/pathfinding/PathFindingAlgorithms.java b/applications/algorithms/path-finding/src/main/java/org/neo4j/gds/applications/algorithms/pathfinding/PathFindingAlgorithms.java
index 716babf1ab..725ae69fbe 100644
--- a/applications/algorithms/path-finding/src/main/java/org/neo4j/gds/applications/algorithms/pathfinding/PathFindingAlgorithms.java
+++ b/applications/algorithms/path-finding/src/main/java/org/neo4j/gds/applications/algorithms/pathfinding/PathFindingAlgorithms.java
@@ -182,7 +182,7 @@ HugeLongArray depthFirstSearch(Graph graph, DfsBaseConfig configuration) {
);
}
- SpanningTree kSpanningTree(Graph graph, KSpanningTreeBaseConfig configuration) {
+ public SpanningTree kSpanningTree(Graph graph, KSpanningTreeBaseConfig configuration) {
if (!graph.schema().isUndirected()) {
throw new IllegalArgumentException(
"The K-Spanning Tree algorithm works only with undirected graphs. Please orient the edges properly");
@@ -377,7 +377,7 @@ PathFindingResult singleSourceShortestPathDijkstra(Graph graph, DijkstraBaseConf
return algorithmMachinery.runAlgorithmsAndManageProgressTracker(algorithm, progressTracker, false);
}
- SpanningTree spanningTree(Graph graph, SpanningTreeBaseConfig configuration) {
+ public SpanningTree spanningTree(Graph graph, SpanningTreeBaseConfig configuration) {
if (!graph.schema().isUndirected()) {
throw new IllegalArgumentException(
"The Spanning Tree algorithm works only with undirected graphs. Please orient the edges properly");
@@ -386,7 +386,7 @@ SpanningTree spanningTree(Graph graph, SpanningTreeBaseConfig configuration) {
var parameters = configuration.toParameters();
var progressTracker = createProgressTracker(
configuration,
- Tasks.leaf(AlgorithmLabel.SpanningTree.asString())
+ Tasks.leaf(AlgorithmLabel.SpanningTree.asString(), graph.relationshipCount())
);
var algorithm = new Prim(
@@ -400,7 +400,7 @@ SpanningTree spanningTree(Graph graph, SpanningTreeBaseConfig configuration) {
return algorithmMachinery.runAlgorithmsAndManageProgressTracker(algorithm, progressTracker, true);
}
- SteinerTreeResult steinerTree(Graph graph, SteinerTreeBaseConfig configuration) {
+ public SteinerTreeResult steinerTree(Graph graph, SteinerTreeBaseConfig configuration) {
var parameters = configuration.toParameters();
var mappedSourceNodeId = graph.toMappedNodeId(parameters.sourceNode());
var mappedTargetNodeIds = parameters.targetNodes().stream()
diff --git a/procedures/facade-api/configs/path-finding-configs/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeBaseConfig.java b/procedures/facade-api/configs/path-finding-configs/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeBaseConfig.java
index 2658bcfcb7..472e591c2a 100644
--- a/procedures/facade-api/configs/path-finding-configs/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeBaseConfig.java
+++ b/procedures/facade-api/configs/path-finding-configs/src/main/java/org/neo4j/gds/spanningtree/SpanningTreeBaseConfig.java
@@ -26,6 +26,7 @@
import java.util.function.DoubleUnaryOperator;
+@Configuration
public interface SpanningTreeBaseConfig extends
AlgoBaseConfig,
RelationshipWeightConfig,