I have a graph that looks like this:
Using gremlin-scala, I'm trying to traverse from A and collect these tuples:
(A, Some(A1)), (B, None), (C, Some(A2))
So essentially I want to repeatedly take α
out edges and optionally branch to β
, collecting those outs. I am guessing I need to inject an empty "step" if there's no β
edge but I haven't been able to figure out how to do that.
I'm also a bit confused about how to rewind after traversing β
now that jump
has been mysteriously removed (TP 3.1+)
So far I have something like:
graph.V("A").untilWithTraverser(t => t.get.outE(α).notExists()
).repeat(_.out(α).as(foo).out(β).as(bar)).select((foo,bar)).toList
But this doesn't rewind back to the main traversal and fails if any nodes on the "trunk" are missing a β
out edge