【问题标题】:Construct NEO4J Cypher Graph Query to show intermediate nodes in path构建 NEO4J Cypher Graph Query 以显示路径中的中间节点
【发布时间】:2014-10-04 23:21:30
【问题描述】:

所以我看到了这篇 StackOverflow 帖子,内容是关于如何在一定距离深度内获取所有节点。 Neo4j/Gremlin/Cypher: how to get all nodes until i reach a certain distance (depth) in a map-like setup?

但是,我还想可视化这个节点集合。但是,结果查询

MATCH (n { handle: '" + handle + "' })-[r:EDGE*1..4]->x "
              "RETURN r, n.handle,x.handle")

n 会给我起始节点,x 会给我每条路径的最后一个节点。 r 给了我一个关系列表。我想查看每条路径中的中间节点列表。但是,关系似乎存储在 urls 中,爬取每个 URL 并解析它似乎效率低下。

有没有办法构造查询,以便我可以获取路径中的中间节点?

【问题讨论】:

    标签: graph neo4j cypher


    【解决方案1】:

    您可以根据需要返回路径或路径的节点。

    MATCH path = (n:Label { handle: {handle} })-[r:EDGE*1..4]->(x)
    RETURN r, n.handle,x.handle, path, nodes(path)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多