I am trying to add a maxDepth for Dijkstra's search.
I've looked in the apoc procedures repo source code and found out that they pass the PathFinder alongside the startNode and enNode in WeightedPathResult.streamWeightedPathResult which calls the findAllPaths method of PathFinder interface to find all paths.
I need to change the code in findAllPaths methods in order to break the search when path.length()>maxDepth.But the probleme is that i can't find this methode overrode in any files.
here is a snippet of the apoc dijkstra procedure
@Procedure
@Description("apoc.algo.dijkstra(startNode, endNode, 'KNOWS|<WORKS_WITH|IS_MANAGER_OF>', 'distance', defaultValue, numberOfWantedResults) YIELD path," +
" weight - run dijkstra with relationship property name as cost function")
public Stream<WeightedPathResult> dijkstra(
@Name("startNode") Node startNode,
@Name("endNode") Node endNode,
@Name("relationshipTypesAndDirections") String relTypesAndDirs,
@Name("weightPropertyName") String weightPropertyName,
@Name(value = "defaultWeight", defaultValue = "NaN") double defaultWeight,
@Name(value = "numberOfWantedPaths", defaultValue = "1") long numberOfWantedPaths) {PathFinder<WeightedPath> algo = GraphAlgoFactory.dijkstra(
buildPathExpander(relTypesAndDirs),
(relationship, direction) -> Util.toDouble(relationship.getProperty(weightPropertyName, defaultWeight)),
(int)numberOfWantedPaths
);
return WeightedPathResult.streamWeightedPathResult(startNode, endNode, algo);
}
And here is the streamWeightedPathResult method
public static Stream<WeightedPathResult> streamWeightedPathResult(Node startNode, Node endNode, PathFinder<WeightedPath> algo) {
Iterable<WeightedPath> allPaths = algo.findAllPaths(startNode, endNode);
return StreamSupport.stream(allPaths.spliterator(), false)
.map(WeightedPathResult::new);
}}
They call the findAllPaths method from the PathFinder interface but it was not overrode so where can i do the changes on this method??