Skip to content
Permalink
Browse files
GIRAPH-1253
closes #152
  • Loading branch information
Siddhant Benadikar authored and dlogothetis committed Mar 9, 2022
1 parent 7ee6c39 commit 14a74297378dc1584efbb698054f0e8bff4f90bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
@@ -44,7 +44,7 @@ private PageRankBlockUtils() {
SupplierFromVertex<I, V, DoubleWritable, DoubleWritable> valueGetter,
GiraphConfiguration conf) {
return new SequenceBlock(
new PageRankInitializeAndNormalizeEdgesPiece<>(valueSetter, conf),
new PageRankInitializeAndNormalizeEdgesPiece<>(),
pagerank(valueSetter, valueGetter,
(vertex, edgeValue) -> edgeValue.get(), conf));
}
@@ -24,11 +24,9 @@
import org.apache.giraph.block_app.framework.piece.interfaces.VertexReceiver;
import org.apache.giraph.block_app.framework.piece.interfaces.VertexSender;
import org.apache.giraph.combiner.NullMessageCombiner;
import org.apache.giraph.conf.GiraphConfiguration;
import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
import org.apache.giraph.edge.Edge;
import org.apache.giraph.edge.MutableEdge;
import org.apache.giraph.function.vertex.ConsumerWithVertex;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Writable;
@@ -44,22 +42,8 @@
I extends WritableComparable, V extends Writable>
extends Piece<I, V, DoubleWritable, NullWritable, Object> {
/** Consumer which sets pagerank value in vertex */
private final ConsumerWithVertex<I, V, DoubleWritable, DoubleWritable>
valueSetter;
/** Default initial value pagerank value */
private final DoubleWritable initialValue;

/**
* Constructor
*
* @param valueSetter Consumer which sets pagerank value in vertex
* @param conf Configuration
*/
public PageRankInitializeAndNormalizeEdgesPiece(
ConsumerWithVertex<I, V, DoubleWritable, DoubleWritable> valueSetter,
GiraphConfiguration conf) {
this.valueSetter = valueSetter;
initialValue = new DoubleWritable(PageRankSettings.getInitialValue(conf));
public PageRankInitializeAndNormalizeEdgesPiece() {
}

@Override
@@ -87,8 +71,7 @@ public VertexSender<I, V, DoubleWritable> getVertexSender(
public VertexReceiver<I, V, DoubleWritable, NullWritable> getVertexReceiver(
BlockWorkerReceiveApi<I> workerApi, Object executionStage) {
return (vertex, messages) -> {
// Set initial pagerank value on all vertices
valueSetter.apply(vertex, initialValue);
// Do nothing
};
}

@@ -202,7 +202,7 @@ public static void addVertex(int id, long[] edges, double[] weights,
TestGraph<LongWritable, DoubleWritable, DoubleWritable> graph) {
Vertex<LongWritable, DoubleWritable, DoubleWritable> v = graph.getConf().createVertex();
v.setConf(graph.getConf());
v.initialize(new LongWritable(id), new DoubleWritable(), newEdges(edges, weights));
v.initialize(new LongWritable(id), new DoubleWritable(1), newEdges(edges, weights));
graph.addVertex(v);
}

0 comments on commit 14a7429

Please sign in to comment.