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.

How to return path that includes all nodes and relationships filtered on a time property in the relationships?

Hi all,

My goal is to traverse a graph from start to end. 'Next' relationships (with a date property) exist between nodes denoting the order of travel. Would this been a path with only 1 relationship between every 2 nodes, it would be self-explanatory using (start)-[NEXT*]-(end). However, my graph contains cycles and relationships to the node itself, this causes (start)-[NEXT*]-(end) to return all possible paths, whereas I only want the path that contains all the traversals based on the time property containing all the nodes (as sometimes more than 2 relationships exist between two nodes), thus following the 'Next' relationships.

I was thinking about implementing the longest path algorithm with a filter to distinguish between time, but as I am inexperienced, I am looking for some advice.

Your help is much appreciated, thank you.

Kind regards,
Jacky

1 REPLY 1

Hi, It sounds like you may want to add a WHERE clause that filters by time? (eliminate nodes or relationships that are older than the time you specify), either that or sort all full paths by time and pick the most recent?

What is the graph metamodel, and where did you place a timestamp property, on the relationships or nodes?