i got this cypher to get all the shortest paths between two nodes, and i think it is working pretty well. Can you tell me how can i write a cypher to get all paths up to a maximum number of hops from a specific node and no specific destination ? With this i want to see the possible ending nodes starting at my given node.
Thank you !
José Salvador
MATCH (n:Perception_Group)
WHERE ID(n)=252 OR ID(n)=801
WITH collect(n) as nodes
UNWIND nodes as n
UNWIND nodes as m
WITH * WHERE id(n) < id(m)
MATCH path = allShortestPaths( (n)-[*..5]-(m) )
RETURN path
Try this:
MATCH (a)
WHERE id(a) = 801
CALL apoc.path.spanningTree(a, {}) YIELD path
return path
Returns all available levels, nodes and relationships.
If you want to restrict level to say 3 then
CALL apoc.path.spanningTree(a, {maxLevel:3}) YIELD path
Check the syntax as you can include/exclude nodes and relationships.