Search code examples
javaneo4jneo4j-embedded

Embedded Neo4j with Graph Data Science - BFS Procedure appears to be missing


The documentation here https://neo4j.com/docs/graph-data-science/1.1/algorithms/bfs/#algorithms-bfs describes a callable "gds.alpha.bfs.stream".

In order to call that, to the best of my knowledge, it needs to be registered with the embedded DB. Something along the lines of

Procedures proceduresService = ((GraphDatabaseAPI) graphDb).getDependencyResolver().resolveDependency(Procedures.class);
proceduresService.registerProcedure(AllShortestPathsProc.class, true);

Otherwise neo4j will throw an Exception, informing us of our misdeeds:

There is no procedure with the name gds.alpha.bfs.stream registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.

However, I can't seem to find any *Proc.class to include for BFS or BreadthFirstSearch.

Is this documentation incorrect? Do i need a different jar to use the described bfs algorithm?

OT: I'm linking to an older version of the documentation because it supports a maxCost condition for traversed relations. This is missing from newer versions (which also don't seem to actually have have BFSProc)


Solution

  • The required procedure is conveniently called "TraverseProc" and allows use of both BFS and DFS.

    The file doesn't include the name of the callable, either. Discovered it through search of all my neo4j dependencies with

    find . -name "*.jar" -exec zipgrep "gds.alpha" '{}' \;
    

    (from How to search for a string in JAR files)