【发布时间】:2019-02-14 10:22:19
【问题描述】:
以下堆栈溢出问题
How to increase performance of shortest path using Gremlin?
展示了如何找到从id为687的单个起始顶点到id为1343的结束顶点的最短路径,并通过使用store、without确保没有重复路径来有效地做到这一点,和aggregate
g.V(687).store('x').repeat(out().where(without('x')).aggregate('x')).until(hasId(1343)).limit(1).path()
我想以相同的效率执行相同的查询,但是我需要从具有相同标签的多个起始顶点到相同结束顶点的所有最短路径,例如它看起来像这样(尽管这不起作用)
g.V().hasLabel('label').store('x').repeat(out().where(without('x')).aggregate('x')).until(hasId(1343)).limit(1).path()
我尝试了多个在语句中重复两次的构造,但无法为每个起始顶点获得独立的store('x')。我也在使用AWS Neptune 平台,因此它限制了在不允许循环/脚本的情况下使用 Gremlin。所有 gremlin 查询必须以 g. 开头,并且由与 . 链接在一起的命令组成
https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html
【问题讨论】:
标签: gremlin tinkerpop tinkerpop3 amazon-neptune