How to exclude subtree in Neo4j? -


i have simple tree graph in neo4j. each node of type object, has id , name properties, , can linked parent-child aggregation link other nodes (graph tree, no cycles allowed).

i run simple query returns particular subtree (rooted node id 127 in example below):

match network = (:object { id: 127 })-[*]->() return network 

but need query, excludes subtree, rooted specified node (say 131), subtree returned query above. how query like?

(i tried:

match network = (:object { id: 127 })-[*]->(x:object) x.id <> 131 return network 

, excludes single node if doesn't have children.

match network = (:object { id: 127 })-[*]->(x:object)-[*]->() x.id <> 131 return network 

, doesn't work.)

i found way through list comprehensions

match network = (:object { id: 127 })-[*]->(x:object) none (n in nodes(network) n.id = 131) return network 

this works pretty fast, maybe better solutions exist?...


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -