在Neo4J中,如何编写一个Cypher查询来显示通过特定数量的路径连接到初始节点的所有节点?
Number of paths or number of hops?
start n=node(x)
match path = n-[:TYPE*..3]->end // number of hops *..3 is up to 3 hops
return path
limit 10 // number of paths
I think maybe he's looking for:
start n=node(x)
match path = n-[*]->end // maybe specify a max length and type?
with count(path) as cnt, end // group by end node, get count of paths
where cnt = <numpaths> // replace <numpaths> with the number of paths you want to match
return end
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.