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 2020/03/23 15:32:57 UTC

[tinkerpop] branch 3.4-dev updated: Add in example of using path with to or from modulators to the documentation (#1267)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch 3.4-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.4-dev by this push:
     new 179e643  Add in example of using path with to or from modulators to the documentation (#1267)
179e643 is described below

commit 179e643edb7543a0d823ac13f3a1f062feda72de
Author: Connor T. Skennerton <c....@gmail.com>
AuthorDate: Mon Mar 23 08:32:44 2020 -0700

    Add in example of using path with to or from modulators to the documentation (#1267)
    
    * add in example of using path with to or from modulators
    
    * fix misspelling vardas -> vadas
---
 docs/src/reference/the-traversal.asciidoc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index 982928d..06afaa5 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -2185,6 +2185,28 @@ g.V().out().out().path().by(
                                  __.in('created').values('name')).fold())
 ----
 
+It's possible to limit the path using the <<to-step,`to()`>> or <<from-step,`from()`>> step modulators.
+
+[gremlin-groovy,modern]
+----
+g.V().has('person','name','vadas').as('e').
+      in('knows').
+      out('knows').where(neq('e')).
+      path().by('name') <1>
+g.V().has('person','name','vadas').as('e').
+       in('knows').as('m').
+       out('knows').where(neq('e')).
+       path().to('m').by('name') <2>
+g.V().has('person','name','vadas').as('e').
+       in('knows').as('m').
+       out('knows').where(neq('e')).
+       path().from('m').by('name') <3>
+----
+
+<1> Obtain the full path from vadas to josh.
+<2> Save the middle node, marko, and use the `to()` modulator to show only the path from vadas to marko
+<3> Use the `from()` mdoulator to show only the path from marko to josh
+
 WARNING: Generating path information is expensive as the history of the traverser is stored into a Java list. With
 numerous traversers, there are numerous lists. Moreover, in an OLAP <<graphcomputer,`GraphComputer`>> environment
 this becomes exceedingly prohibitive as there are traversers emanating from all vertices in the graph in parallel.