I want a query in which if I send Name: "Johnson" it should all nodes that are directly and indirectly connected in a data format shown in the image. How would I query to get all connected nodes in data format with relationship between primary node and related node?
You can use a variable-length relationship pattern.
For example, to get the desired paths from a person named 'Johnson' (which I presume is unique) to each relative:
MATCH path = (p:Person)-[:Father|Mother|Son|daughter|Wife *]-(:Person)
WHERE p.name = 'Johnson'
RETURN path
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.