Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-04-2019 07:52 AM
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!
Cheers,
Christoph
Solved! Go to Solution.
07-05-2019 01:56 PM
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
07-05-2019 01:56 PM
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
07-05-2019 02:45 PM
Thanks, that's what I was looking for.
All the sessions of the conference are now available online