gremlin> g.V('0').repeat(__.in()).until(has('foo','bar')).tree()==>[v[0]:[v[B]:[v[B.1]:[]],v[C]:[v[C.2]:[]]]]
gremlin> g.V().has('foo','bar').aggregate('v').repeat(outE().simplePath().as('e').inV()).until(hasId('0')).as('x').select(all, 'e').unfold().aggregate('y').select('x').dedup().fold(). /* fold() destroys the path history, side-effects will survive */limit(local, 1). /* this step adds an extra root element to the tree, which is later removed by select(values).unfold() */repeat(flatMap(inE().where(within('y')).outV())).until(where(within('v'))).tree().select(values).unfold()==>[v[0]:[v[B]:[v[B.1]:[]],v[C]:[v[C.2]:[]]]]
gremlin> g.V().has('foo','bar').repeat(outE().simplePath().as('e').inV()).until(hasId('0')).as('x').select(all, 'e').unfold().subgraph('sg').cap('sg').next().traversal(). /* new traversal, thus a fresh path history */V('0').repeat(__.in()).emit().tree()==>[v[0]:[v[B]:[v[B.1]:[]],v[C]:[v[C.2]:[]]]]
g = TinkerGraph.open().traversal()g.addV().property(id, '0').addV().property(id, 'A').addV().property(id, 'B').addV().property(id, 'C').addV().property(id, 'A.1').addV().property(id, 'A.2').addV().property(id, 'B.1').property('foo', 'bar').addV().property(id, 'B.2').addV().property(id, 'C.1').addV().property(id, 'C.2').property('foo', 'bar').addE('link').from(V('A.1')).to(V('A')).addE('link').from(V('A.2')).to(V('A')).addE('link').from(V('B.1')).to(V('B')).addE('link').from(V('B.2')).to(V('B')).addE('link').from(V('C.1')).to(V('C')).addE('link').from(V('C.2')).to(V('C')).addE('link').from(V('A')).to(V('0')).addE('link').from(V('B')).to(V('0')).addE('link').from(V('C')).to(V('0')).iterate()
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/5833d83b-f294-48ba-9a7e-5b9bf361c9e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.