简体   繁体   English

识别图遍历中的路径

[英]Identify the path in Graph traversing

In the graph database, I want to know from which route I traverse在图数据库中,我想知道我从哪条路线经过

eg例如

Path-1.路径-1。 a -1-2-3-4-5- b a -1-2-3-4-5- b

Path-2.路径 2。 a -1-2-7-4-5- b a -1-2-7-4-5- b

In both the above examples, it traverses from point a to point b through different routes.在上述两个示例中,它通过不同的路线从a点遍历到 b 点 Here I want to identify from which route I reach to point b .在这里,我想确定从哪条路线到达b 点

You can use the NODES function to list the nodes in a path.您可以使用NODES function 列出路径中的节点。 There is also a RELATIONSHIPS function for listing the relationships.还有一个RELATIONSHIPS function 用于列出关系。

For example, if this query finds the 2 paths in your question, it will return the nodes in each path:例如,如果此查询在您的问题中找到 2 个路径,它将返回每个路径中的节点:

MATCH path = (a:A)-[*]->(b:B)
RETURN NODES(path) AS nodesInPath

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

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