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.

  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.


Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000,