Branching Traversals
Branching traversals allow decision points to be inserted into the traversal processing. Prior to trying out branching traversals shown here, you must create the data as described in Simple Traversals.
This branching traversal example chooses between two edge labels, either created
or reviewed
to fork the traversal.
The count for each type of edge is returned.
g.V().choose(label()).
option('person', out('created').count()).
option('person', out('reviewed').count())
The output for this traversal lists the count returned for each option. This type of traversal is useful as an intermediary step in a query process, but clearly the output is not useful without reference.
==>8
==>7