Recursive Traversals
Recursive traversals allow iterative processing over traversal paths. Prior to trying out branching traversals shown here, you must create the data as described in Simple Traversals.
This recursive traversal example returns the names of vertices that are two outgoing steps from the author
vertex named Julia Child using the times(2)
step.
Books, meals, and ingredients are returned by this query.
g.V().has('name','Julia Child').repeat(out()).times(2).valueMap()
The output for this traversal lists each result:
==>{name=[onion]}
==>{name=[beef]}
==>{name=[mashed garlic]}
==>{name=[butter]}
==>{name=[tomato paste]}
==>{name=[JuliaDinner], calories=[900], timestamp=[2016-01-14T00:00:00Z]}
==>{year=[1961], name=[The Art of French Cooking, Vol. 1]}
==>{name=[Saturday Feast], calories=[1000], timestamp=[2015-11-30T00:00:00Z]}
==>{name=[olive oil]}
==>{name=[green beans]}
==>{name=[tuna]}
==>{name=[hard-boiled egg]}
==>{name=[tomato]}
==>{name=[JuliaDinner], calories=[900], timestamp=[2016-01-14T00:00:00Z]}
==>{year=[1961], name=[The Art of French Cooking, Vol. 1]}
==>{name=[olive oil]}
==>{name=[yellow onion]}
==>{name=[zucchini]}
==>{name=[mashed garlic]}
==>{name=[eggplant]}