http://gremlindocs.spmallette.documentup.com/#shortest-path
尝试弄清楚如何在Gremlin脚本范围内对集合进行初始化,同时在Java中形成Gremlin管道,以优化最短路径查询
Pipe pipe;
pipe = Gremlin.compile("s = _() as Set;_().as('x').bothE().bothV().simplePath().loop('x'){it.loops<=7 }{ !(it.object.id in ['#"+fromId+"','#"+toId+"'])}.path.filter{it.last().TYPE==\""+toType+"\" && it.last().OBJECTREF==\""+toObjectRef+"\"}.path[0]");
pipe.setStarts(new SingleIterator<Vertex>(fromV));
我试图实现以下内容,这在上面的链接中有记录
gremlin> s = [root] as Set
==>v[0]
gremlin> target = '99'; c = 0;root.both().except(s).store(s).sideEffect{c++}.loop(4){it.object.id != target && it.loops <= 10}.has('id',target).path().iterate(); c
==>100
任何帮助将不胜感激