neo4j - Find last node in unknown amount of relationships -
i can find last node
match p=(a)-->(b)-->(c) a.name='object' , c:prime return c   but how find last node if don't know how many relationships -->()-->() between 2 nodes?
i trying find last node name lable name. last node doesn't have outgoing relationships.
this find c in arbitrarily long path c has not outgoing relationships.
match p=(a)-[*]->(c:prime) a.name='object'  , not( c-->() ) return c   it advisable use relationship types (if possible / practical) in query , put upward boundary on number of hops match can make.  example below follows relationships of type connection in 1 direction maximum of 5 relationships.
match p=(a)-[:connection*..5]->(c:prime) a.name='object'  , not( c-->() ) return c      
Comments
Post a Comment