Skip to content

Commit 46af7f4

Browse files
committed
Added some docs on tree() about lazy/eager evaluation forms CTR
1 parent 1915b21 commit 46af7f4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

docs/src/reference/the-traversal.asciidoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4840,6 +4840,22 @@ g.V().has('name','josh').out('created').values('name').
48404840
<1> When the `tree()` is created, vertex 3 and 5 are unique and thus, form unique branches in the tree structure.
48414841
<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.
48424842
4843+
The `tree()` step can also take a side-effect key as an argument. When using this form, the `Tree` is constructed
4844+
lazily, such that it becomes possible to assess its contents as each traverser passes through.
4845+
4846+
[gremlin-groovy,modern]
4847+
----
4848+
g.V().has('name','josh').out('created').values('name').tree('x').select('x')
4849+
----
4850+
4851+
You can use `cap()` step to force `tree()` to consume the traversal stream eagerly and output results similar to prior
4852+
examples.
4853+
4854+
[gremlin-groovy,modern]
4855+
----
4856+
g.V().has('name','josh').out('created').values('name').tree('x').cap('x')
4857+
----
4858+
48434859
*Additional References*
48444860
48454861
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#tree()++[`tree()`],

0 commit comments

Comments
 (0)