From commits-return-37925-archive-asf-public=cust-asf.ponee.io@tinkerpop.apache.org Wed Oct 9 23:39:15 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9A9E8180658 for ; Thu, 10 Oct 2019 01:39:14 +0200 (CEST) Received: (qmail 30915 invoked by uid 500); 9 Oct 2019 23:39:14 -0000 Mailing-List: contact commits-help@tinkerpop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.apache.org Delivered-To: mailing list commits@tinkerpop.apache.org Received: (qmail 30898 invoked by uid 99); 9 Oct 2019 23:39:13 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2019 23:39:13 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id C72043A0917 for ; Wed, 9 Oct 2019 23:39:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1868209 [2/21] - in /tinkerpop/site: docs/3.3.9-SNAPSHOT/dev/developer/ docs/3.3.9-SNAPSHOT/dev/provider/ docs/3.3.9-SNAPSHOT/recipes/ docs/3.3.9-SNAPSHOT/reference/ docs/3.3.9-SNAPSHOT/tutorials/getting-started/ docs/3.3.9-SNAPSHOT/tutori... Date: Wed, 09 Oct 2019 23:39:10 -0000 To: commits@tinkerpop.apache.org From: spmallette@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20191009233912.C72043A0917@svn01-us-west.apache.org> Modified: tinkerpop/site/docs/3.3.9-SNAPSHOT/recipes/index.html URL: http://svn.apache.org/viewvc/tinkerpop/site/docs/3.3.9-SNAPSHOT/recipes/index.html?rev=1868209&r1=1868208&r2=1868209&view=diff ============================================================================== --- tinkerpop/site/docs/3.3.9-SNAPSHOT/recipes/index.html (original) +++ tinkerpop/site/docs/3.3.9-SNAPSHOT/recipes/index.html Wed Oct 9 23:39:08 2019 @@ -908,10 +908,10 @@ provide some basic building blocks for v traversal on the paths found between them. Consider the following examples using the modern toy graph:

- - - - + + + +
@@ -986,10 +986,10 @@ scenarios. For one such example, conside vertices:

- - - - + + + +
@@ -1038,10 +1038,10 @@ to extract the known job, the company th the known person completed an application.

- - - - + + + +
@@ -1177,10 +1177,10 @@ demonstrate how some of these different edges associated to each vertex. The following examples use the modern toy graph:

- - - - + + + +
@@ -1275,10 +1275,10 @@ graph for demonstration purposes:

betweeness example

- - - - + + + +
@@ -1406,10 +1406,10 @@ pairs). other reachable vertices in the graph. The following examples use the modern toy graph:

- - - - + + + +
@@ -1515,10 +1515,10 @@ relative importance of adjacent vertices give it the highest rank. Consider the following example using the Grateful Dead graph:

- - - - + + + +
@@ -1597,10 +1597,10 @@ can shorten the time required to get a r GraphComputer (OLAP) based traversals.

- - - - + + + +
@@ -1608,12 +1608,12 @@ can shorten the time required to get a r
gremlin> g = graph.traversal().withComputer()
 ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], graphcomputer]
 gremlin> g.V().pageRank().by('pageRank').values('pageRank')
-==>0.11375510357865541
-==>0.11375510357865541
 ==>0.3047200907912249
 ==>0.14598540152719106
 ==>0.14598540152719106
-==>0.17579889899708231
+==>0.17579889899708231 +==>0.11375510357865541 +==>0.11375510357865541
@@ -1658,10 +1658,10 @@ patterns described in this section.

appear by way of some side-effect steps like store():

- - - - + + + +
@@ -1690,10 +1690,10 @@ g.V().store(
- - - - + + + +
@@ -1726,10 +1726,10 @@ means than what is demonstrated.

It may seem simple, but the most obvious choice to modifying what is in a list is to simply unfold() the List:

- - - - + + + +
@@ -1769,10 +1769,10 @@ traverser as it just flattens List result, but consider what happens when there is more than one:

- - - - + + + +
@@ -1814,10 +1814,10 @@ While this approach may be acceptable, t structure of the List traversers "locally" unfold() the lists to transform them:

- - - - + + + +
@@ -1852,10 +1852,10 @@ thus maintaining two traverser results.<

This pattern for unfolding and folding List traversers ends up having other applications:

- - - - + + + +
@@ -1933,10 +1933,10 @@ especially in cases where the expected o form of a List. For example, consider the following three traversals:

- - - - + + + +
@@ -2017,10 +2017,10 @@ three results (i.e. triple) that could t the use of store() to aid in construction of this List:

- - - - + + + +
@@ -2131,10 +2131,10 @@ means that each traverser can effectivel vertices each:

- - - - + + + +
@@ -2161,10 +2161,10 @@ vertices each:

results.

- - - - + + + +
@@ -2231,10 +2231,10 @@ the stream from union() to to end up with a Map is with valueMap():

- - - - + + + +
@@ -2261,10 +2261,10 @@ property stored as a List. by avoiding use of valueMap():

- - - - + + + +
@@ -2294,10 +2294,10 @@ by avoiding use of valueMap()Map instances with any sorts of values:

- - - - + + + +
@@ -2347,10 +2347,10 @@ desired output before taking this approa unavoidable extraneous keys in the output Map:

- - - - + + + +
@@ -2390,10 +2390,10 @@ every single vertex in the traversal str supplied. While this may be an acceptable output, it is possible to shape the Map to be "nicer":

- - - - + + + +
@@ -2443,10 +2443,10 @@ prior to reconstructing the MapList values within a Map:

- - - - + + + +
@@ -2496,10 +2496,10 @@ here involves the use of a union() reconstructed as a new Map that has been merged together:

- - - - + + + +
@@ -2513,7 +2513,7 @@ reconstructed as a new Map group(). by(keys). by(select(values).unfold()) -==>[id:1,degree:3,name:marko,label:person,age:29] +==>[degree:3,name:marko,label:person,age:29,id:1]
@@ -2557,10 +2557,10 @@ a List back for all the val List instances when necessary:

- - - - + + + +
@@ -2577,7 +2577,7 @@ a List back for all the val unfold(). fold(). choose(count(local).is(eq(1)), unfold())) -==>[id:1,name:marko,label:person,age:[29,100]] +==>[name:marko,label:person,age:[29,100],id:1]
@@ -2616,10 +2616,10 @@ in a graph. Consider the following graph

connected components

- - - - + + + +
@@ -2659,10 +2659,10 @@ in a graph. Consider the following graph

One way to detect the various subgraphs would be to do something like this:

- - - - + + + +
@@ -2743,10 +2743,10 @@ approach, but one more suited for OLAP e GraphComputer is forced to analyze far more paths):

- - - - + + + +
@@ -2792,10 +2792,10 @@ depicted below Gremlin could be use to d

graph cycle

- - - - + + + +
@@ -2869,10 +2869,10 @@ It also respected the directionality of themselves). To do so, you would need to .emit() a Traverser before the repeat()-loop.

- - - - + + + +
@@ -2935,10 +2935,10 @@ g.V().as(
- - - - + + + +
@@ -2976,10 +2976,10 @@ that happens to have an eighth bridge (t

Gremlin can detect if such a cycle exists with:

- - - - + + + +
@@ -3061,10 +3061,10 @@ the first step above, which would mean t detected circuit can be displayed with:

- - - - + + + +
@@ -3114,10 +3114,10 @@ label and direction will be considered " that is duplicative of the "created" edge between vertex "1" and "3".

- - - - + + + +
@@ -3145,10 +3145,10 @@ g.V(1).outE

One way to find the duplicate edges would be to do something like this:

- - - - + + + +
@@ -3211,10 +3211,10 @@ contain duplicate.

that uses less memory might look like this:

- - - - + + + +
@@ -3283,10 +3283,10 @@ value.

Note that the above traversal could also be written using match step:

- - - - + + + +
@@ -3335,10 +3335,10 @@ The previous examples invoke traversal s as a performance optimization.

- - - - + + + +
@@ -3394,10 +3394,10 @@ example, a "duplicate" definition could demonstration, an additional edge is added to the "modern" graph:

- - - - + + + +
@@ -3405,9 +3405,9 @@ demonstration, an additional edge is add
gremlin> g.V(1).as("a").V(3).addE("created").property("weight",0.4d).from("a").iterate()
 gremlin> g.V(1).as("a").V(3).addE("created").property("weight",0.5d).from("a").iterate()
 gremlin> g.V(1).outE("created").valueMap(true)
-==>[id:9,weight:0.4,label:created]
-==>[id:13,weight:0.4,label:created]
-==>[id:14,weight:0.5,label:created]
+==>[weight:0.4,label:created,id:9] +==>[weight:0.4,label:created,id:13] +==>[weight:0.5,label:created,id:14]
@@ -3428,10 +3428,10 @@ g.V(1).outE

To identify the duplicate with this revised definition, the previous traversal can be modified to:

- - - - + + + +
@@ -3444,8 +3444,8 @@ g.V(1).outE where(outV().as("ov")).as("e2"). where("e1", eq("e2")).by(label). where("e1", eq("e2")).by("weight").valueMap(true) -==>[id:13,weight:0.4,label:created] -==>[id:9,weight:0.4,label:created] +==>[weight:0.4,label:created,id:13] +==>[weight:0.4,label:created,id:9]
@@ -3481,10 +3481,10 @@ group for duplicates.

Consider the following example with some duplicate vertices added to the "modern" graph:

- - - - + + + +
@@ -3530,10 +3530,10 @@ the Map provided by the
- - - - + + + +
@@ -3582,10 +3582,10 @@ be created with the same properties and follows:

- - - - + + + +
@@ -3593,9 +3593,9 @@ follows:

gremlin> g.V().has('name','marko').
            outE().inV().
            path().by('name').by(valueMap(true))
-==>[marko,[id:9,weight:0.4,label:created],lop]
-==>[marko,[id:7,weight:0.5,label:knows],vadas]
-==>[marko,[id:8,weight:1.0,label:knows],josh]
+==>[marko,[weight:0.4,label:created,id:9],lop] +==>[marko,[weight:0.5,label:knows,id:7],vadas] +==>[marko,[weight:1.0,label:knows,id:8],josh]
@@ -3617,10 +3617,10 @@ follows:

the "peter" vertex in a single traversal:

- - - - + + + +
@@ -3637,9 +3637,9 @@ the "peter" vertex in a single traversal gremlin> g.V().has('name','marko'). outE().inV(). path().by('name').by(valueMap(true)) -==>[marko,[id:9,weight:0.4,label:created],lop] -==>[marko,[id:8,weight:1.0,label:knows],josh] -==>[marko,[id:13,weight:0.5,label:knows],peter] +==>[marko,[weight:0.4,label:created,id:9],lop] +==>[marko,[weight:1.0,label:knows,id:8],josh] +==>[marko,[weight:0.5,label:knows,id:13],peter]
@@ -3691,10 +3691,10 @@ properties to transfer to the new "moved

Checking for whether or not a graph element is present in the graph is simple:

- - - - + + + +
@@ -3725,10 +3725,10 @@ determine whether or not to add a new ve entire operation can occur in a single traversal.

- - - - + + + +
@@ -3783,10 +3783,10 @@ then the vertex does not exist and it is

This "get or create" logic can be expanded to be "upsert" like functionality as follows:

- - - - + + + +
@@ -3848,10 +3848,10 @@ execution.

It is possible to do similar sorts of operations with edges using the same pattern:

- - - - + + + +
@@ -3892,10 +3892,10 @@ found between these two vertices, then i

Consider the following traversal over the "modern" toy graph:

- - - - + + + +
@@ -3923,10 +3923,10 @@ different picture of the result. For exa a domain concept such as "young", "old" and "very old".

- - - - + + + +
@@ -3978,10 +3978,10 @@ like the following in Java:

there is another option to consider with coalesce:

- - - - + + + +
@@ -4030,10 +4030,10 @@ second ten records and so on, until pote

In Gremlin, a basic approach to paging would look something like the following:

- - - - + + + +
@@ -4099,10 +4099,10 @@ to getting a total count without doing a removed then the traversals become more simple:

- - - - + + + +
@@ -4152,10 +4152,10 @@ second traversal, the graph will still r

The only way to completely avoid that problem is to re-use the same traversal instance:

- - - - + + + +
@@ -4219,10 +4219,10 @@ specific person as to what their opinion following script generates some data for the graph using that basic schema:

- - - - + + + +
@@ -4300,10 +4300,10 @@ gremlin> 2The first step to making a recommendation to "alice" using collaborative filtering is to understand what she bought:

- - - - + + + +
@@ -4340,10 +4340,10 @@ focus on the neighborhood around that pr

The next step is to determine who else purchased those products:

- - - - + + + +
@@ -4373,10 +4373,10 @@ focus on the neighborhood around that pr interest is in what individuals other than herself purchased:

- - - - + + + +
@@ -4417,10 +4417,10 @@ interest is in what individuals other th they bought:

- - - - + + + +
@@ -4467,10 +4467,10 @@ already purchased some of these products that she already owns. Those products she already purchased can be excluded as follows:

- - - - + + + +
@@ -4511,10 +4511,10 @@ that she already owns. Those products sh purposes) to form a ranking:

- - - - + + + +
@@ -4577,10 +4577,10 @@ vertices that make up the recommendation who have at least one product in common:

- - - - + + + +
@@ -4612,10 +4612,10 @@ who have at least one product in common:

Next, do some grouping to find count how many products they have in common:

- - - - + + + +
@@ -4651,10 +4651,10 @@ who have at least one product in common: that maximum:

- - - - + + + +
@@ -4696,10 +4696,10 @@ that maximum:

common:

- - - - + + + +
@@ -4746,10 +4746,10 @@ common:

purchased:

- - - - + + + +
@@ -4799,10 +4799,10 @@ purchased:

The above output shows that one product is held in common making it the top recommendation:

- - - - + + + +
@@ -4862,10 +4862,10 @@ purchased:

recommendation algorithm:

- - - - + + + +
@@ -4912,10 +4912,10 @@ place additional limits on the traversal traversal sample the data for no longer than one second, the previous "basic" recommendation could be changed to:

- - - - + + + +
@@ -4969,10 +4969,10 @@ achieve the desired outcome.

is a simple example that identifies the shortest path between vertex "1" and vertex "5" while traversing over out edges:

- - - - + + + +
@@ -5046,10 +5046,10 @@ be measured by data within the graph its but includes a "weight" on the edges, that will be used to help determine the "cost" of a particular path:

- - - - + + + +
@@ -5152,10 +5152,10 @@ structure.

in the modern toy graph.

- - - - + + + +
@@ -5276,10 +5276,10 @@ in the modern toy graph.

arguments.

- - - - + + + +
@@ -5308,10 +5308,10 @@ no longer suffice. There are multiple wa obvious to any programmer - use a variable:

- - - - + + + +
@@ -5342,10 +5342,10 @@ filter the people he knows. In this way itself.

- - - - + + + +
@@ -5396,10 +5396,10 @@ contained people, their friendship relat

traversal induced values 3

- - - - + + + +
@@ -5445,10 +5445,10 @@ contained people, their friendship relat

Getting a list of all the movies that Alice’s friends like could be done like this:

- - - - + + + +
@@ -5477,10 +5477,10 @@ contained people, their friendship relat mean filtering out "the wild bunch" and "unforgiven".

- - - - + + + +
[... 978 lines stripped ...]