简体   繁体   English

在 neo4j 中使用 cypher 命令创建两个节点之间通过另一个节点的路径?

[英]Create a path between two nodes through another node using cypher command in neo4j?

For example, I have three nodes a, b, c.比如我有三个节点a、b、c。 I want to create a path (not relationship) between nodes a and c via node b.我想通过节点 b 在节点 a 和 c 之间创建一条路径(不是关系)。 I referred some official docs but I cannot find exact query.我参考了一些官方文档,但找不到确切的查询。

What I referred https://neo4j.com/docs/cypher-manual/current/clauses/create/#create-create-a-full-path我提到的 https://neo4j.com/docs/cypher-manual/current/clauses/create/#create-create-a-full-path

I think this might be what you are looking for: https://neo4j.com/labs/apoc/4.2/overview/apoc.nodes/apoc.nodes.link/ .我认为这可能是您正在寻找的内容: https://neo4j.com/labs/apoc/4.2/overview/apoc.nodes/apoc.nodes.link/ This will take a list of nodes and create relationships between them to give you a path.这将获取一个节点列表并在它们之间创建关系以为您提供路径。

You could also do this with Cypher, but it's a bit more cumbersome.您也可以使用 Cypher 执行此操作,但它有点麻烦。 There's a knowledgebase article showing each method here: https://neo4j.com/developer/kb/creating-and-working-with-linked-lists/ .这里有一篇知识库文章展示了每种方法: https://neo4j.com/developer/kb/creating-and-working-with-linked-lists/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM