How to specify maximum cost when running BFS Neo4j?

Viewed 40

The docs of Neo4j data science library state:

There are multiple termination conditions supported for the traversal, based on either reaching one of several target nodes, reaching a maximum depth, exhausting a given budget of traversed relationship cost, or just traversing the whole graph.

But in the algorithm specific parameters I could not find any parameter for constraining the maximum cost of the traversal (or simply number of relationships if cost is 1). The Only parameters listed are startNodeId, targetNodes and maxDepth.

Any Idea if this actually can be done or if the docs are incorrect?

1 Answers

Here is the list of procedures and functions for your reference. As you can see, Breadth First Search is still in Alpha stage and no estimate function is available yet. You can also see that functions in Beta and Production stages have this function *.estimate. These functions will give you an idea of how much memory will be used when you run those data science related functions. An example of gds.nodeSimilarity.write.estimate can be found below

  CALL gds.nodeSimilarity.write.estimate('myGraph', {
  writeRelationshipType: 'SIMILAR',
  writeProperty: 'score'})
  YIELD nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory


 nodeCount  relationshipCount   bytesMin    bytesMax    requiredMemory
 9          9                   2592        2808        "[2592 Bytes ... 2808 Bytes]"
Related