I need to find out all the related nodes from a given node. I also need to identify the direction, whether it is incoming or outgoing, plus the ID, labels on each related node. Following is the query I am trying out. Would it be effective query? Is there any other simpler way?
MATCH (o)<-[or]-(e)<-[ir]-(i)
WHERE e.firstName='Sid'
RETURN o,ID(o),TYPE(or),or,e,ID(e),TYPE(ir),ir,i,ID(i)
With above query I am able to identify o
as outgoing node and i
as incoming node.
this statement:
MATCH (n:Foo)-[r]-(m) WHERE n.id = "bar"
RETURN n,m,type(r), (startNode(r) = n) as out_n
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.