【问题标题】:Traverse through graph based on edge's properties values | Gremlin基于边的属性值遍历图 |小精灵
【发布时间】:2018-11-15 00:04:23
【问题描述】:

我有一个图表,其中所有边都具有相同的属性,但顶点之间的值可能不同。我需要从特定顶点遍历图形,尽管所有边都具有该属性的特定值。

例如我有这个图表:

example graph

From Vertex:A 遍历所有顶点的边color == blue。 预期的答案应该是:[A, B, D, C, H, G]

【问题讨论】:

  • 我正在尝试这样的事情:g.V('A').until(has("color", neq("blue"))).repeat(outE()).inV().dedup()
  • 图片不错,但在询问有关 Gremlin 的问题时,示例数据脚本会更好 - 这是一个示例 stackoverflow.com/questions/51388315/…

标签: graph gremlin graph-traversal


【解决方案1】:

您尝试的查询仅检查顶点属性,它使blue 成为中断条件,而不是继续条件。

这就是你要找的:

g.V('A').emit().repeat(outE().has("color", "blue").inV().dedup())

【讨论】:

  • 那个查询是我所期待的。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-16
  • 1970-01-01
  • 2018-10-26
  • 1970-01-01
相关资源
最近更新 更多