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 2016/06/13 18:10:43 UTC

tinkerpop git commit: Improved eigenvector centrality recipe CTR

Repository: tinkerpop
Updated Branches:
  refs/heads/master 82d9e3bb6 -> fbf476a14


Improved eigenvector centrality recipe CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/fbf476a1
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/fbf476a1
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/fbf476a1

Branch: refs/heads/master
Commit: fbf476a149d1aba84f0decce05bb6bafa7978519
Parents: 82d9e3b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 13 14:10:14 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 13 14:10:14 2016 -0400

----------------------------------------------------------------------
 docs/src/recipes/centrality.asciidoc | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fbf476a1/docs/src/recipes/centrality.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/centrality.asciidoc b/docs/src/recipes/centrality.asciidoc
index 90e73df..e8d71e4 100644
--- a/docs/src/recipes/centrality.asciidoc
+++ b/docs/src/recipes/centrality.asciidoc
@@ -138,15 +138,25 @@ Eigenvector Centrality
 A calculation of link:https://en.wikipedia.org/wiki/Centrality#Eigenvector_centrality[eigenvector centrality] uses the
 relative importance of adjacent vertices to help determine their centrality. In other words, unlike
 <<degree-centrality, degree centrality>> the vertex with the greatest number of incident edges does not necessarily
-give it the highest rank.
+give it the highest rank. Consider the following example using the Grateful Dead graph:
 
-[gremlin-groovy,modern]
+[gremlin-groovy]
 ----
-g.V().repeat(groupCount('m').out()).times(30).cap('m')
+graph.io(graphml()).readGraph('data/grateful-dead.xml')
+g.V().repeat(groupCount('m').by('name').out()).times(5).cap('m').                <1>
+  order(local).by(values, decr).limit(local, 10).next()                          <2>
+g.V().repeat(groupCount('m').by('name').out().timeLimit(100)).times(5).cap('m'). <3>
+  order(local).by(values, decr).limit(local, 10).next()
 ----
 
-The traversal iterates through each vertex in the graph and for each one repeatedly group counts each vertex that
+<1> The traversal iterates through each vertex in the graph and for each one repeatedly group counts each vertex that
 passes through using the vertex as the key. The `Map` of this group count is stored in a variable named "m". The
-`out()` traversal is repeated thirty times or until the paths are exhausted. Thirty iterations should provide enough
-time to converge on a solution. Calling `cap('m')` at the end simply extracts the `Map` side-effect stored in "m"
-and returns it from the traversal as the result.
\ No newline at end of file
+`out()` traversal is repeated thirty times or until the paths are exhausted. Five iterations should provide enough
+time to converge on a solution. Calling `cap('m')` at the end simply extracts the `Map` side-effect stored in "m".
+<2> The entries in the `Map` are then iterated and sorted with the top ten most central vertices presented as output.
+<3> The previous examples can be expanded on a little bit by including a
+link:http://tinkerpop.apache.org/docs/current/reference/#timelimit-step[time limit]. The `timeLimit()` prevents the
+traversal from taking longer than one hundred milliseconds to execute (the previous example takes considerably longer
+than that). While the answer provided with the `timeLimit()` is not the absolute ranking, it does provide a relative
+ranking that closely matches the absolute one. The use of `timeLimit()` in certain algorithms (e.g. recommendations)
+can shorten the time required to get a reasonable and usable result.
\ No newline at end of file