neo4j - get all transitive relationships from a node via cypher -


do know how write cypher query return transitive relationships related node.

for instance if have : (node1)-[rel1]->(node2)-[rel2]->(node3).

i'd query that, given node1 returns rel1 , rel2.

thanks !

you need use variable path match, assuming start node node 1 having label label , name='node1':

match path=(node1:label {name:'node1'})-[*..100]->() return relationships(path) rels 

the relationships function returns list holding relationships along path. best practice provide upper limit variable depth matches, here i've set arbitrarily 100.

update regarding comment below

to id's of relationships:

match path=(node1:label {name:'node1'})-[*..100]->() return [r in relationships(path) | id(x)] relids 

Comments

Popular posts from this blog

c - CUDA code not processing if block properly -

oracle11g - get root domain from url Oracle sql regex_substr -

xcode - Swift Playground - Files are not readable -