neo4j - Count each node number of parents in a tree graph -


i pretty new cypher.

i have hierarchical tree built in neo4j, , need set "depth" property on each node, contains number of parents. there single cypher query set/update properties ?

         / \    b   c   / \  d   e 

so in tree, a.depth = 0, b.depth = 1, c.depth =1, d.depth = 2, e.depth = 2, , on...

thanks !

you can assign path variable , use length:

 match p=(a:mylabel {key:''value'})-[*..20]->(x)  set x.depth = length(p) 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -