1

在 Neo4J 中,如何编写一个 Cypher 查询来显示通过特定数量的路径连接到初始节点的所有节点?

4

2 回答 2

1

路径数还是跳数?

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
于 2012-12-05T02:03:37.707 回答
0

我想也许他正在寻找:

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
于 2012-12-05T02:19:15.487 回答