I am trying to build a chaining mechanism with my query and I want to start my next invocation from the end of the previous. I've tried using the by
step, but I can't seem to get it to work or do what I would like. What is the best way to get the last vertex in all the paths from the below query?
g.V(1).repeat(out()).times(2).emit().path();
If this returned:
[v[1], v[2], v[3]]
[v[1], v[3], v[4]]
All I want is:
v[3]
v[4]
Thanks!
CodePudding user response:
You can take the tail
of a path
gremlin> g.V(44).out().out().limit(5).path()
==>[v[44],v[8],v[47]]
==>[v[44],v[8],v[48]]
==>[v[44],v[8],v[49]]
==>[v[44],v[8],v[51]]
==>[v[44],v[8],v[52]]
gremlin> g.V(44).out().out().limit(5).path().tail(local)
==>v[47]
==>v[48]
==>v[49]
==>v[51]
==>v[52]