[ https://issues.apache.org/jira/browse/GIRAPH-137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13200008#comment-13200008 ]
Hudson commented on GIRAPH-137: ------------------------------- Integrated in Giraph-trunk-Commit #76 (See [https://builds.apache.org/job/Giraph-trunk-Commit/76/]) GIRAPH-137: De-duplicate pagerank implementation in PageRankBenchmark. Contributed by Harsh J. Chouraria. jghoman : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1240317 Files : * /incubator/giraph/trunk/CHANGELOG * /incubator/giraph/trunk/src/main/java/org/apache/giraph/benchmark/PageRankBenchmark.java > De-duplicate pagerank implementation in PageRankBenchmark > --------------------------------------------------------- > > Key: GIRAPH-137 > URL: https://issues.apache.org/jira/browse/GIRAPH-137 > Project: Giraph > Issue Type: Improvement > Reporter: Jakob Homan > Assignee: Harsh J > Priority: Minor > Labels: newbie > Fix For: 0.2.0 > > Attachments: GIRAPH-137.patch > > > Currently in PageRankBenchmark we have the code for pagerank duplicated in > each of the implementations of Vertex: > {noformat} public static class PageRankHashMapVertex extends HashMapVertex< > LongWritable, DoubleWritable, DoubleWritable, DoubleWritable> { > @Override > public void compute(Iterator<DoubleWritable> msgIterator) { > if (getSuperstep() >= 1) { > double sum = 0; > while (msgIterator.hasNext()) { > sum += msgIterator.next().get(); > } > DoubleWritable vertexValue = > new DoubleWritable((0.15f / getNumVertices()) + 0.85f * > sum); > setVertexValue(vertexValue); > } > if (getSuperstep() < getConf().getInt(SUPERSTEP_COUNT, -1)) { > long edges = getNumOutEdges(); > sendMsgToAllEdges( > new DoubleWritable(getVertexValue().get() / edges)); > } else { > voteToHalt(); > } > } > } > public static class PageRankEdgeListVertex extends EdgeListVertex< > LongWritable, DoubleWritable, DoubleWritable, DoubleWritable> { > @Override > public void compute(Iterator<DoubleWritable> msgIterator) { > if (getSuperstep() >= 1) { > double sum = 0; > while (msgIterator.hasNext()) { > sum += msgIterator.next().get(); > } > DoubleWritable vertexValue = > new DoubleWritable((0.15f / getNumVertices()) + 0.85f * > sum); > setVertexValue(vertexValue); > } > if (getSuperstep() < getConf().getInt(SUPERSTEP_COUNT, -1)) { > long edges = getNumOutEdges(); > sendMsgToAllEdges( > new DoubleWritable(getVertexValue().get() / edges)); > } else { > voteToHalt(); > } > } > }{noformat} > This code can be consolidated into private class and the two implementations > just extend that. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira