简体   繁体   English

路径中的一个节点重复-密码(查询两个节点之间的所有路径)

[英]duplicated one node in path - cypher (query all path between two nodes)

I have got nodes connected like in the picture from the link 我已经连接了节点,就像链接中的图片一样

I do query START a=node(27), b=node(0) MATCH p=b<-[*]-a RETURN p 我确实查询START a=node(27), b=node(0) MATCH p=b<-[*]-a RETURN p

I expect that I will get 3 paths but got 6. First 3 are correct but the last 3 have got duplicate 'node 0' 我希望我得到3条路径,但得到6条。前3条是正确的,但后3条具有重复的“节点0”

For example: 例如:

correct path: 0 -> 41 -> 2 -> ... -> 27 正确的路径:0-> 41-> 2-> ...-> 27
duplicate node path: 0 -> 0 -> 41 -> 2 -> 27 重复的节点路径:0-> 0-> 41-> 2-> 27

The lengths of incorrect paths are exactly incremented by one. 错误路径的长度正好增加一。

How to write a query to get (in this example) exactly 3 path without duplicate nodes? 如何编写查询以获取(在此示例中)准确的3条路径而没有重复的节点?

Your query is correct and there probably is a problem in the database. 您的查询是正确的,并且数据库中可能存在问题。 I replicated your graph structure: console.neo4j . 我复制了您的图形结构: console.neo4j Run START n=node(*) RETURN n to get the ids of node 27 and 0 and then run your query. 运行START n=node(*) RETURN n以获取节点27和0的ID,然后运行查询。 It returns exactly 3 results. 它恰好返回3个结果。

To check whether you have loops on node 0 execute: 要检查节点0上是否有循环,请执行:

START n=node(0) MATCH n-[r]-n RETURN r

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 两个节点之间的最短路径与从一个节点到所有其他节点的最短路径 - Shortest path between two nodes vs shortest path from one node to all other nodes 如何在 Neo4J 中使用 Cypher 查询节点之间的扩展路径? - How to query extended path between nodes with Cypher in Neo4J? Neo4j:以特定的关系顺序查询两个节点之间的路径,并且仅知道最后一个节点的标签 - Neo4j: Query for a path between two nodes in a specific order of relationships and knowing only label of the last node 两个节点之间所有路径的密码 - Cypher for all paths between two nodes 如何获得从一个节点到另一个节点的路径,包括所有其他节点以及它们之间涉及的关系 - How to get a path from one node to another including all other nodes and relationships involved in between 删除无向图中的一个节点,该节点破坏了其他两个节点之间的路径 - Removing a node in an undirected graph that destroys a path between two other nodes 在无向加权图中找到两个节点之间的所有路径的算法 - Algorithm to find all path between two nodes in an undirected weighed graph 如何删除图中特定路径的所有边(例如两个节点之间的最短路径)? - How can i remove all edges of a specific path(for example the shortest path between two nodes) in a graph? 两个图节点之间的固定长度路径 - Fixed length path between two graph nodes 有效地找到有向图中两个节点之间某个路径上的所有节点 - Efficiently finding all nodes on some path between two nodes in a directed graph
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM