You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2018/08/01 19:30:11 UTC
[47/50] [abbrv] tinkerpop git commit: split ShortestPath example code
block in the docs
split ShortestPath example code block in the docs
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/362ed16e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/362ed16e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/362ed16e
Branch: refs/heads/TINKERPOP-1990
Commit: 362ed16e4cb6e7d762f5b21863a840b45a8e7491
Parents: 101e5d8
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Jul 30 09:49:26 2018 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Wed Aug 1 12:26:30 2018 -0700
----------------------------------------------------------------------
docs/src/reference/the-traversal.asciidoc | 33 +++++++++++++++-----------
1 file changed, 19 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/362ed16e/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index f4a60fb..edc0645 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -2681,29 +2681,24 @@ using the `with()`-modulator with the options given below.
[gremlin-groovy,modern]
----
-a = g.withComputer()
-a.V().shortestPath() <1>
-a.V().has('person','name','marko').shortestPath() <2>
-a.V().shortestPath().with(ShortestPath.target, __.has('name','peter')) <3>
-a.V().shortestPath().
+g = g.withComputer()
+g.V().shortestPath() <1>
+g.V().has('person','name','marko').shortestPath() <2>
+g.V().shortestPath().with(ShortestPath.target, __.has('name','peter')) <3>
+g.V().shortestPath().
with(ShortestPath.edges, Direction.IN).
with(ShortestPath.target, __.has('name','josh')) <4>
-a.V().has('person','name','marko').
+g.V().has('person','name','marko').
shortestPath().
with(ShortestPath.target, __.has('name','josh')) <5>
-a.V().has('person','name','marko').
+g.V().has('person','name','marko').
shortestPath().
with(ShortestPath.target, __.has('name','josh')).
with(ShortestPath.distance, 'weight') <6>
-a.V().has('person','name','marko').
+g.V().has('person','name','marko').
shortestPath().
with(ShortestPath.target, __.has('name','josh')).
with(ShortestPath.includeEdges, true) <7>
-g.inject(a.V().shortestPath().
- with(ShortestPath.distance, 'weight').
- with(ShortestPath.includeEdges, true).
- with(ShortestPath.maxDistance, 1).toList().toArray()).
- map(unfold().values('name','weight').fold()) <8>
----
<1> Find all shortest paths.
@@ -2713,7 +2708,17 @@ g.inject(a.V().shortestPath().
<5> Find all shortest paths from `marko` to `josh`.
<6> Find all shortest paths from `marko` to `josh` using a custom distance property.
<7> Find all shortest paths from `marko` to `josh` and include edges in the result.
-<8> Find all shortest paths using a custom distance property and limit the distance to 1. Inject the result into a OLTP GraphTraversal in order to be able to select properties from all elements in all paths.
+
+[gremlin-groovy,modern]
+----
+g.inject(g.withComputer().V().shortestPath().
+ with(ShortestPath.distance, 'weight').
+ with(ShortestPath.includeEdges, true).
+ with(ShortestPath.maxDistance, 1).toList().toArray()).
+ map(unfold().values('name','weight').fold()) <1>
+----
+
+<1> Find all shortest paths using a custom distance property and limit the distance to 1. Inject the result into a OLTP `GraphTraversal` in order to be able to select properties from all elements in all paths.
*Additional References*