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.

Return all nodes reachable from a list of nodes and their `maximal` paths

Hi,

I am trying to see if there is an APOC procedure that will return all nodes reachable from a list of nodes and return only all the maximal paths from the input list. Currently, I am able to use the apoc.path.expand procedure to get all the paths from the input list of nodes. From this, I am post-processing and extracting only those maximal paths (paths that contain both the nodes and relationships of other paths and those that end at the same node). I am wondering if there can be a procedure that remembers this maximal requirement while traversing the graph and returns only the maximal paths. Thanks.

3 REPLIES 3

Update: The method I am looking for is similar to the method 2 in Find all reachable nodes from every node present in a given set - GeeksforGeeks, but for directed graphs.

Lavanya

Hi @lavanya.kannan2 !

How performant should it be? And more important... How confident do you feel about extending APOC? This looks like an specific requirement that could be easily attacked by creating your own procedure on the DB.

Take a look on

Bennu

Hi,

The new procedure should perform better than the approach of collecting all paths and then deciding. For small number of nodes, it would not be a great performance difference. However, for large amounts of input nodes that may be reachable from each other, I feel there would definitely be an improvement. I will look into writing my own procedure, when time and expertise permits. Thanks for the link.

Lavanya