Neo4J / Cypher 需要编写一个查询,该查询显示通过特定数量的路径连接到初始节点的所有结果节点



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

路径数或跃点数?

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
我想

也许他正在寻找:

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

最新更新