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"