From e962f5964f59f116f58c3294f38ac5c4904732e9 Mon Sep 17 00:00:00 2001 From: "Marko A. Rodriguez" Date: Fri, 30 Jun 2017 12:48:35 -0600 Subject: [PATCH] added a tree() example to the docs to clear up any confusion about what happens when duplicate nodes are realized in a tree projection. --- docs/src/reference/the-traversal.asciidoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc index f39fe11ed73..4c95f72381e 100644 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@ -2283,6 +2283,20 @@ tree['marko']['josh'] tree.getObjectsAtDepth(3) ---- +Note that when using `by()`-modulation, tree nodes are combined based on projection uniqueness, not on the +uniqueness of the original objects being projected. For instance: + +[gremlin-groovy,modern] +---- +g.V().has('name','josh').out('created').values('name').tree() <1> +g.V().has('name','josh').out('created').values('name'). + tree().by('name').by(label).by() <2> +---- + +<1> When the `tree()` is created, vertex 3 and 5 are unique and thus, form unique branches in the tree structure. +<2> When the `tree()` is `by()`-modulated by `label`, then vertex 3 and 5 are both "software" and thus are merged to a single node in the tree. + + [[unfold-step]] Unfold Step ~~~~~~~~~~~