簡體   English   中英

Neo4J / Cypher需要幫助編寫查詢,以顯示通過特定數量的路徑連接到初始節點的所有結果節點

[英]Neo4J / Cypher need hel writing a query that shows all the result nodes that connect to an initial node by a specific number of paths

在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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM