For the below graph...
I am struggling to compose a Cypher query that will return me the neighbourhood graph (relationships) of node 1. The neighbourhood graph of 1 includes the nodes connected by the relations I have marked with dotted lines. These are the nodes pointing to 1, pointed at by 1 and all other inter-connections between these nodes.
This below query
START a=node(15151) MATCH (a)-[r]-(b) RETURN r
gives me back the relations between 1 and 2,3,4,5 but I also need the relations between 2-4 and 3-5 to be returned in the same query.
Try this
START a= node(15151) MATCH (a)-[r1]-(b) WITH a,b,collect(b) as bAll,r1
MATCH (b)-[r2]->(c) WHERE (c IN bAll) and a <> c return r1,r2
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.