"numbered" path

Is there a way to acquire the ordnial number of a node in the resultset of an expression like
match (n {name:'xyz'})-[:HAS_FOLLOWUP*]->(m) return n,m
given that :HAS_FOLLOWUP is always a 1-to-1 relationship - and to do it in cypher?

I DO want to do it in cypher because I'm on GRANDstack and I don't want to pass around arrays just to determine one element's position.

Thanks for any input!


Yes, if you add in a path variable for the pattern, you can use the length() of the path as the distance from it:

match path = (n {name:'xyz'})-[:HAS_FOLLOWUP*]->(m) 
return n, m, length(path) as distance
1 Like

Thanks, that's what I was looking for.