tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [17/20] tinkerpop git commit: Added a traversal example for SimplePath step using `from()` / `to()` modulators to build two acyclic paths that cross each other and thus are not acyclic as a whole. @okram
Date Fri, 24 Mar 2017 17:27:29 GMT
Added a traversal example for SimplePath step using `from()` / `to()` modulators to build two
acyclic paths that cross each other and thus are not acyclic as a whole. @okram


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/38dc621a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/38dc621a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/38dc621a

Branch: refs/heads/TINKERPOP-1095
Commit: 38dc621a3d50c6977d7766b36839a6fd2cb55922
Parents: b9111c9
Author: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Authored: Fri Mar 24 13:05:32 2017 +0100
Committer: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Committed: Fri Mar 24 13:05:32 2017 +0100

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/38dc621a/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index 31c0621..636cd33 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -2052,6 +2052,29 @@ g.V().out().as('a').out().as('b').out().as('c').
     by('name')
 ----
 
+By using the `from()` and `to()` modulators traversers can ensure that only certain sections
of the path are are acyclic.
+
+[gremlin-grovvy]
+----
+g.addV().property(id, "A").as("a").
+  addV().property(id, "B").as("b").
+  addV().property(id, "C").as("c").
+  addV().property(id, "D").as("d").
+  addE("link").from("a").to("b").
+  addE("link").from("b").to("c").
+  addE("link").from("c").to("d").iterate()
+g.V("A").repeat(both().simplePath()).times(3).path()  <1>
+g.V("D").repeat(both().simplePath()).times(3).path()  <2>
+g.V("A").as("a").
+  repeat(both().simplePath().from("a")).times(3).as("b").
+  repeat(both().simplePath().from("b")).times(3).path()  <3>
+----
+
+<1> Traverse all acyclic 3-hop paths starting from vertex `A`
+<2> Traverse all acyclic 3-hop paths starting from vertex `D`
+<3> Traverse all acyclic 3-hop paths starting from vertex `A` and from there again
all 3-hop paths. The second path may
+cross the vertices from the first path.
+
 [[store-step]]
 Store Step
 ~~~~~~~~~~


Mime
View raw message