hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1673175 - in /hama/trunk: examples/src/main/java/org/apache/hama/examples/ graph/src/main/java/org/apache/hama/graph/ graph/src/test/java/org/apache/hama/graph/example/
Date Mon, 13 Apr 2015 12:50:55 GMT
Author: edwardyoon
Date: Mon Apr 13 12:50:54 2015
New Revision: 1673175

URL: http://svn.apache.org/r1673175
Log:
minor refactor.

Modified:
    hama/trunk/examples/src/main/java/org/apache/hama/examples/MaxFlow.java
    hama/trunk/examples/src/main/java/org/apache/hama/examples/PageRank.java
    hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
    hama/trunk/graph/src/main/java/org/apache/hama/graph/Vertex.java
    hama/trunk/graph/src/main/java/org/apache/hama/graph/VertexInterface.java
    hama/trunk/graph/src/test/java/org/apache/hama/graph/example/PageRank.java

Modified: hama/trunk/examples/src/main/java/org/apache/hama/examples/MaxFlow.java
URL: http://svn.apache.org/viewvc/hama/trunk/examples/src/main/java/org/apache/hama/examples/MaxFlow.java?rev=1673175&r1=1673174&r2=1673175&view=diff
==============================================================================
--- hama/trunk/examples/src/main/java/org/apache/hama/examples/MaxFlow.java (original)
+++ hama/trunk/examples/src/main/java/org/apache/hama/examples/MaxFlow.java Mon Apr 13 12:50:54
2015
@@ -459,7 +459,7 @@ public class MaxFlow {
     }
 
     private Text getSinkID() {
-      return new Text(String.valueOf(getNumVertices() - 1));
+      return new Text(String.valueOf(getTotalNumVertices() - 1));
     }
 
     private Text getSourceID() {

Modified: hama/trunk/examples/src/main/java/org/apache/hama/examples/PageRank.java
URL: http://svn.apache.org/viewvc/hama/trunk/examples/src/main/java/org/apache/hama/examples/PageRank.java?rev=1673175&r1=1673174&r2=1673175&view=diff
==============================================================================
--- hama/trunk/examples/src/main/java/org/apache/hama/examples/PageRank.java (original)
+++ hama/trunk/examples/src/main/java/org/apache/hama/examples/PageRank.java Mon Apr 13 12:50:54
2015
@@ -62,13 +62,13 @@ public class PageRank {
     public void compute(Iterable<DoubleWritable> messages) throws IOException {
       // initialize this vertex to 1 / count of global vertices in this graph
       if (this.getSuperstepCount() == 0) {
-        setValue(new DoubleWritable(1.0 / this.getNumVertices()));
+        setValue(new DoubleWritable(1.0 / getTotalNumVertices()));
       } else if (this.getSuperstepCount() >= 1) {
         double sum = 0;
         for (DoubleWritable msg : messages) {
           sum += msg.get();
         }
-        double alpha = (1.0d - DAMPING_FACTOR) / this.getNumVertices();
+        double alpha = (1.0d - DAMPING_FACTOR) / getTotalNumVertices();
         setValue(new DoubleWritable(alpha + (sum * DAMPING_FACTOR)));
         aggregate(0, this.getValue());
       }

Modified: hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
URL: http://svn.apache.org/viewvc/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java?rev=1673175&r1=1673174&r2=1673175&view=diff
==============================================================================
--- hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java (original)
+++ hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java Mon Apr 13 12:50:54
2015
@@ -496,7 +496,6 @@ public final class GraphJobRunner<V exte
     public void run() {
       try {
         for (GraphJobMessage msg : subList) {
-          System.out.println("adding vertex ");
           addVertex((Vertex<V, E, M>) msg.getVertex());
         }
       } catch (IOException e) {
@@ -517,9 +516,6 @@ public final class GraphJobRunner<V exte
 
     vertex.setRunner(this);
     vertices.put(vertex);
-
-    LOG.debug("Added VertexID: " + vertex.getVertexID() + " in peer "
-        + peer.getPeerName());
   }
 
   /**

Modified: hama/trunk/graph/src/main/java/org/apache/hama/graph/Vertex.java
URL: http://svn.apache.org/viewvc/hama/trunk/graph/src/main/java/org/apache/hama/graph/Vertex.java?rev=1673175&r1=1673174&r2=1673175&view=diff
==============================================================================
--- hama/trunk/graph/src/main/java/org/apache/hama/graph/Vertex.java (original)
+++ hama/trunk/graph/src/main/java/org/apache/hama/graph/Vertex.java Mon Apr 13 12:50:54 2015
@@ -189,7 +189,7 @@ public abstract class Vertex<V extends W
   }
 
   @Override
-  public long getNumVertices() {
+  public long getTotalNumVertices() {
     return runner.getNumberVertices();
   }
 

Modified: hama/trunk/graph/src/main/java/org/apache/hama/graph/VertexInterface.java
URL: http://svn.apache.org/viewvc/hama/trunk/graph/src/main/java/org/apache/hama/graph/VertexInterface.java?rev=1673175&r1=1673174&r2=1673175&view=diff
==============================================================================
--- hama/trunk/graph/src/main/java/org/apache/hama/graph/VertexInterface.java (original)
+++ hama/trunk/graph/src/main/java/org/apache/hama/graph/VertexInterface.java Mon Apr 13 12:50:54
2015
@@ -52,12 +52,12 @@ public interface VertexInterface<V exten
   public V getVertexID();
 
   /**
-   * @return the number of vertices in the input graph.
+   * @return the total number of vertices.
    */
-  public long getNumVertices();
+  public long getTotalNumVertices();
 
   /**
-   * The user-defined function
+   * The user-defined function.
    */
   public void compute(Iterable<M> messages) throws IOException;
 

Modified: hama/trunk/graph/src/test/java/org/apache/hama/graph/example/PageRank.java
URL: http://svn.apache.org/viewvc/hama/trunk/graph/src/test/java/org/apache/hama/graph/example/PageRank.java?rev=1673175&r1=1673174&r2=1673175&view=diff
==============================================================================
--- hama/trunk/graph/src/test/java/org/apache/hama/graph/example/PageRank.java (original)
+++ hama/trunk/graph/src/test/java/org/apache/hama/graph/example/PageRank.java Mon Apr 13
12:50:54 2015
@@ -63,13 +63,13 @@ public class PageRank {
     public void compute(Iterable<DoubleWritable> messages) throws IOException {
       // initialize this vertex to 1 / count of global vertices in this graph
       if (this.getSuperstepCount() == 0) {
-        this.setValue(new DoubleWritable(1.0 / this.getNumVertices()));
+        this.setValue(new DoubleWritable(1.0 / this.getTotalNumVertices()));
       } else if (this.getSuperstepCount() >= 1) {
         double sum = 0;
         for (DoubleWritable msg : messages) {
           sum += msg.get();
         }
-        double alpha = (1.0d - DAMPING_FACTOR) / this.getNumVertices();
+        double alpha = (1.0d - DAMPING_FACTOR) / this.getTotalNumVertices();
         this.setValue(new DoubleWritable(alpha + (sum * DAMPING_FACTOR)));
       }
 



Mime
View raw message