【问题标题】:Gremlin Match Traversal that contains a repetitive structure包含重复结构的 Gremlin 匹配遍历
【发布时间】:2017-03-14 08:24:58
【问题描述】:
您好,我正在尝试匹配可能具有Extends 边路径的子图。
已知部分是 id 为 1、2、3 和 6 的顶点及其边。不知道的是顶点的数量及其 id 介于 1 和 6 之间。匹配从 id=1 的顶点开始。匹配遍历需要匹配整个子图,限制为 4 到 6 之间的 10 步。在普通情况下,id 为 6 的顶点通过边 ContainsB 与 id = 1 的顶点直接连接。
感谢任何帮助!
【问题讨论】:
标签:
gremlin
graph-traversal
tinkerpop3
【解决方案1】:
我认为这似乎是我想要的方式:
g.V().match(
__.as("s").hasId("1").outE("ContainsB").inV().until(hasId("6")).repeat(out("Extends")).limit(10),
__.as("s").hasId("1").outE("ContainsA").inV().hasId("2"),
__.as("s").hasId("1").outE("ContainsC").inV().hasId("3")
)