hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward J. Yoon (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HAMA-518) Add MinIntCombiner to SSSP example
Date Mon, 27 Feb 2012 07:42:51 GMT
Add MinIntCombiner to SSSP example

                 Key: HAMA-518
                 URL: https://issues.apache.org/jira/browse/HAMA-518
             Project: Hama
          Issue Type: New Feature
          Components: examples, graph
    Affects Versions: 0.4.0
            Reporter: Edward J. Yoon
            Assignee: Edward J. Yoon
             Fix For: 0.5.0

If we able to use BSP's combiner function, MinIntCombiner can be implemented like this:

  public static class MinIntCombiner extends Combiner<IntWritable> {

    public BSPMessageBundle<IntWritable> combine(Iterable<IntWritable> messages)
      BSPMessageBundle<IntWritable> bundle = new BSPMessageBundle<IntWritable>();
      int minDist = Integer.MAX_VALUE;

      Iterator<IntWritable> it = messages.iterator();
      while (it.hasNext()) {
         int msgValue = it.next().get();
         if(minDIst > msgValue)
           minDist = msgValue;

      bundle.addMessage(new IntWritable(minDist));
      return bundle;

By the way, unfortunately, MapWritable was used to send destination VertexID together.

        for (Entry<Writable, Writable> e : msg.entrySet()) {
          String vertexID = ((Text) e.getKey()).toString();
          Writable value = e.getValue();

Should we implement Graph's own Combiners? or use anyhow BSP's combiner function?

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


View raw message