Reputation: 657
I have a graph which looks like
a --father_of--> 1 --wife_of--> b --father_of-->2 --wife_of--> c --father_of--> 3--wife_of--> d --father_of --> 5--wife_of-->e
I want to write a query which gives me all fathers in the tree starting from a
I can get to one level by writing
g.V('name','a').out(father_of).out(wife_of)
which gives b
How can I write a recursive query giving b as input of the pipe so that the query gives me nodes b, c, d and e.
Upvotes: 0
Views: 196
Reputation: 1702
You can use the loop() and an emit-closure:
g.V('name','a').as('here').out('fatherOf').out('wifeOf').loop('here'){true}{true}
Upvotes: 5