简体   繁体   English

密码:匹配未通过路径连接的多个节点

[英]Cypher: Matching multiple nodes not connected by path

I'm having a problem using Neo4j at the moment where I want to match two ore more nodes, that are not connected by any path. 我想匹配两个或两个以上没有任何路径连接的节点时,正在使用Neo4j遇到问题。

Let's say we have a graph with two context components (is this the right word?), for example 4 nodes (A)-->(B) and (C)-->(D) . 假设我们有一个具有两个上下文成分的图(这是正确的词吗?),例如4个节点(A)-->(B)(C)-->(D)

When I run MATCH (A), (C) in this situation, i get "No Rows" as result, probably because the algorithm can't reach (C) after having chosen (A) as starting node. 在这种情况下运行MATCH (A), (C)时,结果为“ No Rows”,这可能是因为算法在选择(A)作为起始节点后无法达到(C)

How can I still match those nodes? 我如何仍然匹配那些节点?

It turns out the problem is caused from something other than Neo4j. 事实证明,问题是由Neo4j以外的其他因素引起的。 I can't recreate it on another computer. 我无法在另一台计算机上重新创建它。 The approach to use MATCH (A), (B) was the correct one. 使用MATCH (A), (B)是正确的。

I think you really want MATCH (A) MATCH (C) ... without the comma. 我想您真的希望MATCH (A) MATCH (C) ...没有逗号。 This will give you two starting points which you can either RETURN or pass forward with WITH . 这将为您提供两个起点,您可以使用WITH RETURN或前进。 As Tezra says, using the comma will create a cartesian product. 正如Tezra所说,使用逗号将创建笛卡尔乘积。

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

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