I am trying to find the nodes connected that are connected by the relationships having a given label and a given attribute.
For example I want to find all nodes connected by a relationship Edge
having as myID
123
I started from this query that returns the data on the relationships.
MATCH ()-[r:Edge{myID: "123"}]->()RETURN r;
Counting these relationships with
MATCH ()-[r:Edge{myID: "123"}]->()RETURN count(r)
I get 45.
I then created the following:
MATCH (a)-[r:Edge{myID: "123"}]->(b)RETURN a,b,r LIMIT 25
However this is not working: it seems to return much more nodes than expected: first of all LIMIT
is not limiting and hence the subgraph becomes very big and difficult to analyze but it seems that it is returning even nodes-relationship with a myID
property different than 123
, for sure more than 45.
How can I do that?
答案 0 :(得分:2)
如果使用neo4j浏览器输入查询并可视化结果,则应注意浏览器的“连接结果节点”选项。启用该选项后,浏览器会自动查询(并显示)Cypher查询返回的节点之间的关系。 (请注意,返回的关系引用了2个节点。)
您可以通过单击浏览器窗口左侧的齿轮图标,滚动到“浏览器设置”面板的底部,并选中/取消选中“连接结果节点”框,来启用/禁用“连接结果节点”选项。
答案 1 :(得分:0)
默认情况下,Neo4J浏览器尝试扩展返回节点时在视图中显示的节点。
可以请您尝试
MATCH p =(a)-[r:Edge {myID:“ 123”}]->(b)返回p限制25。
Neo4J浏览器现在不应该尝试扩展节点。