You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/08/31 19:51:40 UTC

[1/2] tinkerpop git commit: Add self loop example to Cycle Detection recipe.

Repository: tinkerpop
Updated Branches:
  refs/heads/tp33 94d9de04c -> 98ab1b05a


Add self loop example to Cycle Detection recipe.


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

Branch: refs/heads/tp33
Commit: 3afc57653a9ca81ba560b1b9a6be8c3ad7b1251d
Parents: 47e0600
Author: Kevin Gallardo <ke...@datastax.com>
Authored: Fri Aug 24 17:18:43 2018 -0400
Committer: Kevin Gallardo <ke...@datastax.com>
Committed: Fri Aug 31 15:35:22 2018 -0400

----------------------------------------------------------------------
 docs/src/recipes/cycle-detection.asciidoc | 33 +++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3afc5765/docs/src/recipes/cycle-detection.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/cycle-detection.asciidoc b/docs/src/recipes/cycle-detection.asciidoc
index 57adc6e..1e25740 100644
--- a/docs/src/recipes/cycle-detection.asciidoc
+++ b/docs/src/recipes/cycle-detection.asciidoc
@@ -48,9 +48,36 @@ the length of the cycle is known to be three and there is no need to exceed that
 cycle. It returned three, because there was one for each vertex that started the cycle (i.e. one for `A`, one for `B`
 and one for `C`). This next line introduce deduplication to only return unique cycles.
 
-The above case assumed that the need was to only detect cycles over a path length of three. It also respected the
-directionality of the edges by only considering outgoing ones. What would need to change to detect cycles of
-arbitrary length over both incoming and outgoing edges in the modern graph?
+The above case assumed that the need was to only detect cycles over a path length of three.
+It also respected the directionality of the edges by only considering outgoing ones.
+
+Also note that the traversal above won't detect self-loops (vertices directly connected to
+themselves). To do so, you would need to `.emit()` a Traverser before the repeat()-loop.
+
+[gremlin-groovy]
+----
+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('knows').from('a').to('b').
+  addE('knows').from('b').to('c').
+  addE('knows').from('c').to('a').
+  addE('knows').from('a').to('d').
+  addE('knows').from('c').to('d').
+  addE('self').from('a').to('a').iterate()
+g.V().as('a').
+  emit().
+    repeat(outE().inV().simplePath()).
+    times(2).
+  outE().inV().where(eq('a')).
+  path().
+    by(id).
+    by(label)
+----
+
+What would need to change to detect cycles of arbitrary length over both incoming and
+outgoing edges, in the modern graph?
 
 [gremlin-groovy,modern]
 ----


[2/2] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33


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

Branch: refs/heads/tp33
Commit: 98ab1b05a731ce81f6a5d09310cda4fd4e1cd441
Parents: 94d9de0 3afc576
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Aug 31 15:51:08 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Aug 31 15:51:08 2018 -0400

----------------------------------------------------------------------
 docs/src/recipes/cycle-detection.asciidoc | 33 +++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------