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 2015/04/07 13:25:19 UTC
[37/50] [abbrv] incubator-tinkerpop git commit: fixed a bug in the
PageRank section of the docs.
fixed a bug in the PageRank section of the docs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/3badf881
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/3badf881
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/3badf881
Branch: refs/heads/variables
Commit: 3badf881135cbc52cc0b5d326380be831795bcde
Parents: 1a628ad
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Apr 6 09:55:03 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Apr 6 09:55:03 2015 -0600
----------------------------------------------------------------------
docs/src/the-graphcomputer.asciidoc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3badf881/docs/src/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-graphcomputer.asciidoc b/docs/src/the-graphcomputer.asciidoc
index dc5a26b..964fabf 100644
--- a/docs/src/the-graphcomputer.asciidoc
+++ b/docs/src/the-graphcomputer.asciidoc
@@ -183,20 +183,20 @@ public class PageRankVertexProgram implements VertexProgram<Double> { <1>
}
- @Override
+ @Override
public void execute(final Vertex vertex, Messenger<Double> messenger, final Memory memory) { <6>
- if (memory.isInitialIteration()) { <7>
+ if (memory.isInitialIteration()) { <7>
messenger.sendMessage(this.countMessageScope, 1.0d);
- } else if (1 == memory.getIteration()) { <8>
+ } else if (1 == memory.getIteration()) { <8>
double initialPageRank = 1.0d / this.vertexCountAsDouble;
- double edgeCount = StreamFactory.stream(messenger.receiveMessages(this.countMessageScope)).reduce(0.0d, (a, b) -> a + b);
- vertex.property(single, PAGE_RANK, initialPageRank);
- vertex.property(single, EDGE_COUNT, edgeCount);
+ double edgeCount = IteratorUtils.reduce(messenger.receiveMessages(this.countMessageScope), 0.0d, (a, b) -> a + b);
+ vertex.property(PAGE_RANK, initialPageRank);
+ vertex.property(EDGE_COUNT, edgeCount);
messenger.sendMessage(this.incidentMessageScope, initialPageRank / edgeCount);
} else { <9>
- double newPageRank = StreamFactory.stream(messenger.receiveMessages(this.incidentMessageScope)).reduce(0.0d, (a, b) -> a + b);
+ double newPageRank = IteratorUtils.reduce(messenger.receiveMessages(this.incidentMessageScope), 0.0d, (a, b) -> a + b);
newPageRank = (this.alpha * newPageRank) + ((1.0d - this.alpha) / this.vertexCountAsDouble);
- vertex.property(single, PAGE_RANK, newPageRank);
+ vertex.property(PAGE_RANK, newPageRank);
messenger.sendMessage(this.incidentMessageScope, newPageRank / vertex.<Double>value(EDGE_COUNT));
}
}