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
The following commit(s) were added to refs/heads/master by this push:
new b7cb93d96c Show visible output for simplePath() from()/to() by(label)
examples
b7cb93d96c is described below
commit b7cb93d96cc5d9ba782baf1b2127a52eca668842
Author: Stephen Mallette <[email protected]>
AuthorDate: Wed Sep 9 23:53:35 2026 +0000
Show visible output for simplePath() from()/to() by(label) examples
The last two simplePath() examples in the modern-graph block used three
out() hops, but the modern graph has no three-hop outgoing paths, so both
examples rendered empty output with no explanation. This left the
from()/to() segment-scoping semantics undemonstrated and made the empty
results look like a mistake.
Reduce the examples to two out() hops and add callouts. The whole-path
by(label) example is now meaningfully empty (each path starts with two
person vertices), while scoping the check to the b..c segment with
from()/to() retains the paths, producing visible contrasting output.
Assisted-by: Kiro:claude-opus-4.8
---
docs/src/reference/the-traversal.asciidoc | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/docs/src/reference/the-traversal.asciidoc
b/docs/src/reference/the-traversal.asciidoc
index 505d2d1210..665e0e4bd5 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -5318,19 +5318,23 @@ g.V(1).both().both()
g.V(1).both().both().simplePath()
g.V(1).both().both().simplePath().path()
g.V(1).both().both().simplePath().by('age') <1>
-g.V().out().as('a').out().as('b').out().as('c').
+g.V().as('a').out().as('b').out().as('c').
simplePath().by(label).
- path()
-g.V().out().as('a').out().as('b').out().as('c').
+ path().by('name') <2>
+g.V().as('a').out().as('b').out().as('c').
simplePath().
by(label).
from('b').
to('c').
path().
- by('name')
+ by('name') <3>
----
<1> The "age" property is not <<by-step,productive>> for all vertices and
therefore those values are filtered.
+<2> Comparing labels across the whole path filters every result: each two-hop
out-path begins with two `person`
+vertices (e.g. `marko` then `josh`), so no path is simple when analyzed by
label.
+<3> Restricting the `simplePath()` check to the `b`..`c` segment with
`from()`/`to()` compares only those two
+labels (`person` and `software`), so the paths are retained.
By using the `from()` and `to()` modulators traversers can ensure that only
certain sections of the path are acyclic.