hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward J. Yoon" <edwardy...@apache.org>
Subject Re: Refactor o.a.hama.examples.graph package
Date Tue, 28 Jun 2011 10:13:22 GMT
That's great. Here's my rough suggestion.

We can add a abstract class for the vertex that can be overrided. I
think, Vertex class can be like this:

abstract class Vertex {
  public void compute(Iterator<Message> msgs);
  public String getVertexID();
  public int getSuperStep();
  public double getValue();
  public setValue(double nValue);
  public void Iterator<Message> getMessages();
  public void sendMessageTo(Edge edge, double messageValue);
  public List<Edge> getOutEdgeIterator();
  public void voteToHalt();
  ...
}

Then, you can simplify the ShortestPathVertex and PageRankVertex as below:

public cass ShortestPathVertex extends Vertex {
}

or

public class PageRankVertex extends Vertex {
}

And, finally the code will become the same with Google's Pregel.

  public void compute() {
    int minDist = isSource(this.getVertexID()) ? 0 : INF;
    int newPrevVertexID = -1;

    for (Message msgs : this.getMessages()) {
      minDist = min(minDist, msgs.getValue());
    }

    if (minDist < this.getValue()) {
      this.setValue(minDist);
      for (Edge e : this.getOutEdgeIterator()) {
        this.sendMessageTo(e, minDist + e.getCost());
      }
    }
    this.voteToHalt();
  }

On Tue, Jun 28, 2011 at 6:56 PM, Thomas Jungblut
<thomas.jungblut@googlemail.com> wrote:
> Hey,
>
> I always thought of adding some new methods to our abstract BSP Class. For
> example sendMessage(List<Hosts>) or something like that.
> I would change these API things after we added the IO System, because much
> stuff is related and needs the information of it. (getVertexID() for
> example).
>
> Regards,
> Thomas
>
> 2011/6/28 Edward J. Yoon <edwardyoon@apache.org>
>
>> Hi,
>>
>> I think, the code quantity of Dijkstra's shortest path and PageRank
>> can be dramatically reduced by adding Google's Pregel APIs e.g.,
>> compute(List<BSPMessage> msgs), getVertexID(), .. and APIs can be
>> moved in o.a.hama.graph package.
>>
>> Does anyone volunteer here?
>>
>> --
>> Best Regards, Edward J. Yoon
>> @eddieyoon
>>
>
>
>
> --
> Thomas Jungblut
> Berlin
>
> mobile: 0170-3081070
>
> business: thomas.jungblut@testberichte.de
> private: thomas.jungblut@gmail.com
>



-- 
Best Regards, Edward J. Yoon
@eddieyoon

Mime
View raw message