This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 094103b2e06c0fe8073848ca473c40825dd56881 Merge: 6821a5e0ab 9a0462b821 Author: Stephen Mallette <[email protected]> AuthorDate: Tue Jul 28 10:20:25 2026 -0400 Merge branch '3.8-dev' docs/src/reference/the-traversal.asciidoc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --cc docs/src/reference/the-traversal.asciidoc index 3a4db461e3,5473c8b1a2..53d4820c7b --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@@ -1621,9 -1455,23 +1621,23 @@@ g.V().hasLabel('person').outE('created' <1> `count()`-step is a <<a-note-on-barrier-steps,reducing barrier step>> meaning that all of the previous traversers are folded into a new traverser. <2> The path of the traverser emanating from `count()` starts at `count()`. - IMPORTANT: `count(local)` counts the current, local object (not the objects in the traversal stream). For a - `Collection` it returns the number of elements, for a `Map` the number of entries, for a `Path` the number of - objects in the path, and for a `Tree` the total number of nodes in the tree. For any other object, a count of 1 is returned. + The `count(local)`-step counts the current, local object rather than the objects in the traversal stream. The + value it returns depends on the type of that object: for a `Collection` it returns the number of elements, for a -`Map` it returns the number of entries, and for a <<path-data-structure,`Path`>> it returns the number of objects -in the path. For any other object, a count of `1` is returned. ++`Map` it returns the number of entries, for a <<path-data-structure,`Path`>> it returns the number of objects ++in the path, and for a `Tree` the total number of nodes in the tree. For any other object, a count of `1` is returned. + + [gremlin-groovy,modern] + ---- + g.V().fold().count(local) <1> + g.V().group().by(label).count(local) <2> + g.V(1).out().path().count(local) <3> + g.V(1).count(local) <4> + ---- + + <1> <<fold-step,`fold()`>> gathers all vertices into a single `Collection`, so `count(local)` returns the number of elements in that list. + <2> <<group-step,`group()`>> produces a `Map` keyed by vertex label, so `count(local)` returns the number of entries in the map (one per distinct label). + <3> <<path-step,`path()`>> emits a `Path` for each traverser, so `count(local)` returns the number of objects contained in each path. + <4> A single vertex is neither a `Collection`, a `Map`, nor a `Path`, so `count(local)` returns `1`. *Additional References*
