两个节点neo4j之间的所有路径-错误答案(来自neo4j) [英] All paths between two nodes neo4j - incorrect answer (from neo4j)

查看:476
本文介绍了两个节点neo4j之间的所有路径-错误答案(来自neo4j)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得两个节点之间的所有路径,它们之间的关系为->". 我用这样的查询(Cypher)询问数据库:

I want to get all path between two nodes with the relation "->" between them. I ask my DB using query (Cypher) like that:

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

在Neo4j可视化中,我得到了:

In Neo4j visualization I get this:

Cypher支架查询可视化

我想获取3条路径的列表:

I want to get list of 3 path:

  • 27-> 81-> ....-> 0
  • 27-> 67-> ....-> 0
  • 27-> 24-> ....-> 0

但是结果是我有6条路径(而不是3条). 我想找出原因.

but in the result I have got 6 paths (instead of 3). I want to figure out why.

推荐答案

之所以会发生这种情况,是因为查询包含从'a'开始的0个长度路径.如果查看提供的文件,则最后三个结果与前三个结果相同,除了在路径开始处复制Node [0]之外.

This happens because the query includes the 0 length paths starting from 'a'. If you look at the file you provided, the last three results are the same as the first three ones, except for the duplication of Node[0] at the beginning of the path.

这篇关于两个节点neo4j之间的所有路径-错误答案(来自neo4j)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆