g.traversal().V("start vertex id").repeat().out("friend").until(untilCriterion)
g.traversal()
.V(startVertex)
.repeat(out("friend")).until(t -> false)
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/41f182d9-a797-41be-bbaf-81c89b51326d%40googlegroups.com.
You might want to look at cyclicPath() [1] and simplePath() [2]. There are also good examples of using these in loops in Recipes[3].
Robert Dale
On Mon, Feb 12, 2018 at 1:34 PM, Martin Häusler <alanda...@gmail.com> wrote:
Okay I've figured it out. I had a wrong line of thought there. In a TinkerPop traversal, it's perfectly fine to have an "infinite" loop, like:
g.traversal()
.V(startVertex)
.repeat(out("friend")).until(t -> false)... because the traversal will terminate upon exhaustion of the graph anyways! Be careful with loops though. I think you might need to use a side effect and carry along a hash set of already traversed vertices to deal with loops in the graph structure.
Am Sonntag, 21. Januar 2018 16:15:54 UTC+1 schrieb Martin Häusler:The solution should be something like discussed here:... except for Gremlin 3.x. Right now I just can't figure out how to do it in the 3.x API.
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.