0
votes

i have a following graph in neo4j graph database and by using the cypher query language, i want to retrieve the whole data with is connected to root node and their child node.

For example :

kindly find the below graph image.

[As per the image, node 1 has two child and their child also have too many child with the same relationship. now what i want, using Cypher, i hit the node 1 and it should response with the whole data of child node and there child node and so on, relationship between nodes are "Parent_of" relationship.]

enter image description here

can anyone help me on this.

2
Can you give us an example of the format of data you want back? Do you just want a list of all the children nodes for that tree?Nicholas
I asked the same question and gave a possible answer on the mailing list. :/Eve Freeman

2 Answers

2
votes
start n=node(1) // use the id, or find it using an index
match n-[:parent_of*0..]->m
return m

will get you all the graph nodes in m. You could also take m.some_property instead of m if you don't want the node itself, but some property that is stored in your nodes.

Careful though, as the path has no limit, this query could become pretty huge in a large graph.

0
votes