GIRAPH-1253 trunk 4/head
authorSiddhant Benadikar <siddhantbenadikar>
Wed, 9 Mar 2022 03:51:20 +0000 (19:51 -0800)
committerDionysios Logothetis <dionysios@fb.com>
Wed, 9 Mar 2022 03:51:20 +0000 (19:51 -0800)
closes #152

giraph-block-app-8/src/main/java/org/apache/giraph/block_app/library/pagerank/PageRankBlockUtils.java
giraph-block-app-8/src/main/java/org/apache/giraph/block_app/library/pagerank/PageRankInitializeAndNormalizeEdgesPiece.java
giraph-block-app-8/src/test/java/org/apache/giraph/block_app/library/pagerank/PageRankTest.java

index a14870b2d497fd05a562a3d3cd495f533018158a..b64ff78474863cc813a426f4a7d01910a9d8bb54 100644 (file)
@@ -44,7 +44,7 @@ public class 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));
   }
index 715deb13662dca3f3a8e5eb896279d332c790914..6e9ad4427a313edf99fc452ad6d75145ba1f4481 100644 (file)
@@ -24,11 +24,9 @@ import org.apache.giraph.block_app.framework.piece.Piece;
 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 @@ public class PageRankInitializeAndNormalizeEdgesPiece<
     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 class PageRankInitializeAndNormalizeEdgesPiece<
   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
     };
   }
 
index 7b19d93ef1b0529b04133a2cc2fecff3907d8ae0..7d92e9c7d47aa0cc387aee40a3437d1590829754 100644 (file)
@@ -202,7 +202,7 @@ public class PageRankTest {
       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);
   }