|
41 | 41 | import org.neo4j.gds.dag.longestPath.DagLongestPath;
|
42 | 42 | import org.neo4j.gds.dag.longestPath.DagLongestPathParameters;
|
43 | 43 | import org.neo4j.gds.dag.longestPath.LongestPathTask;
|
| 44 | +import org.neo4j.gds.dag.topologicalsort.TopSortTask; |
| 45 | +import org.neo4j.gds.dag.topologicalsort.TopologicalSort; |
| 46 | +import org.neo4j.gds.dag.topologicalsort.TopologicalSortParameters; |
44 | 47 | import org.neo4j.gds.dag.topologicalsort.TopologicalSortResult;
|
45 | 48 | import org.neo4j.gds.kspanningtree.KSpanningTree;
|
46 | 49 | import org.neo4j.gds.kspanningtree.KSpanningTreeParameters;
|
@@ -837,13 +840,47 @@ CompletableFuture<SteinerTreeResult> steinerTree(
|
837 | 840 | );
|
838 | 841 | }
|
839 | 842 |
|
840 |
| - CompletableFuture<TopologicalSortResult> topologicalSort() { |
| 843 | + CompletableFuture<TopologicalSortResult> topologicalSort( |
| 844 | + GraphName graphName, |
| 845 | + GraphParameters graphParameters, |
| 846 | + Optional<String> relationshipProperty, |
| 847 | + TopologicalSortParameters parameters, |
| 848 | + JobId jobId, |
| 849 | + boolean logProgress |
| 850 | + ) { |
841 | 851 | // Fetch the Graph the algorithm will operate on
|
| 852 | + var graph = graphStoreCatalogService.fetchGraphResources( |
| 853 | + graphName, |
| 854 | + graphParameters, |
| 855 | + relationshipProperty, |
| 856 | + new NoAlgorithmValidation(), |
| 857 | + Optional.empty(), |
| 858 | + user, |
| 859 | + databaseId |
| 860 | + ).graph(); |
| 861 | + |
842 | 862 | // Create ProgressTracker
|
| 863 | + var progressTracker = progressTrackerFactory.create( |
| 864 | + TopSortTask.create(graph), |
| 865 | + jobId, |
| 866 | + parameters.concurrency(), |
| 867 | + logProgress |
| 868 | + ); |
| 869 | + |
843 | 870 | // Create the algorithm
|
844 |
| - // Submit the algorithm for async computation |
| 871 | + var topologicalSort = new TopologicalSort( |
| 872 | + graph, |
| 873 | + progressTracker, |
| 874 | + parameters.concurrency(), |
| 875 | + parameters.computeMaxDistanceFromSource(), |
| 876 | + terminationFlag |
| 877 | + ); |
845 | 878 |
|
846 |
| - return CompletableFuture.failedFuture(new RuntimeException("Not yet implemented")); |
| 879 | + // Submit the algorithm for async computation |
| 880 | + return algorithmCaller.run( |
| 881 | + topologicalSort::compute, |
| 882 | + jobId |
| 883 | + ); |
847 | 884 | }
|
848 | 885 |
|
849 | 886 | }
|
0 commit comments