0

我已经像链接中的图片一样连接了节点

我做查询START a=node(27), b=node(0) MATCH p=b<-[*]-a RETURN p

我希望我会得到 3 条路径,但得到了 6 条。前 3 条是正确的,但最后 3 条有重复的“节点 0”

例如:

正确路径:0 -> 41 -> 2 -> ... -> 27
重复节点路径:0 -> 0 -> 41 -> 2 -> 27

错误路径的长度恰好加一。

如何编写查询以获取(在此示例中)恰好 3 个没有重复节点的路径?

4

1 回答 1

0

Your query is correct and there probably is a problem in the database. I replicated your graph structure: console.neo4j. Run START n=node(*) RETURN n to get the ids of node 27 and 0 and then run your query. It returns exactly 3 results.

To check whether you have loops on node 0 execute:

START n=node(0) MATCH n-[r]-n RETURN r
于 2014-02-21T10:22:31.750 回答