cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Find all simple paths in a graph

I have a graph database representing a subway system. I am interested in finding all simple paths (paths that do not visit the same station twice) possible from one station to another. Due to the complexity of the train network, there may be thousands of possible ways to get from one "A" to station "B".

I am currently using this query:

MATCH (start:Station{sid:'351'}), (end:Station{sid:'355'})
CALL algo.kShortestPaths.stream(start, end, 50, 'cost' ,{})

YIELD index, nodeIds, costs
RETURN [node in algo.getNodesById(nodeIds) | node.name] AS places

However, that only finds the first 50 shortest paths. If I try to query the first 1000 paths the DB crashes.
I am not too concerned with how long it will take but I want to be certain I have all possible paths.

Thoughts?

0 REPLIES 0