simplePath

Use to prevent a traverser from repeating a path through the graph.

Synopsis

simplePath()

Description

The simplePath() step is a filter step. When it is important that a traverser not repeat its path through the graph, this step should be used.

Examples

Find the expanded neighborhood of all the people who know each other, without repeating any edges:

g.V().has('person', 'name', 'John Doe').
  repeat(both('knows').simplePath()).
    emit().
  path().
    by('name')
  *.objects()
  *.join(" > ")

This query uses Groovy notation (*.objects, *.join) in a Gremlin query, to return pretty results.

The results:

"John Doe > John Smith",
"John Doe > Jane Doe",
"John Doe > Betsy Jones",
"John Doe > John Smith > Jane Doe",
"John Doe > Jane Doe > Sharon Smith",
"John Doe > Jane Doe > John Smith",
"John Doe > Betsy Jones > Sharon Smith",
"John Doe > John Smith > Jane Doe > Sharon Smith",
"John Doe > Jane Doe > Sharon Smith > Betsy Jones",
"John Doe > Jane Doe > Sharon Smith > Jim Walsh",
"John Doe > Betsy Jones > Sharon Smith > Jane Doe",
"John Doe > Betsy Jones > Sharon Smith > Jim Walsh",
"John Doe > John Smith > Jane Doe > Sharon Smith > Betsy Jones",
"John Doe > John Smith > Jane Doe > Sharon Smith > Jim Walsh",
"John Doe > Betsy Jones > Sharon Smith > Jane Doe > John Smith"

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, info@datastax.com