You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hama.apache.org by "Edward J. Yoon (Updated) (JIRA)" <ji...@apache.org> on 2012/03/08 03:20:58 UTC

[jira] [Updated] (HAMA-518) Add MinIntCombiner to SSSP example

     [ https://issues.apache.org/jira/browse/HAMA-518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon updated HAMA-518:
--------------------------------

    Attachment: Combiner.patch

attach my test patch.


                
> 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
>
>         Attachments: Combiner.patch
>
>
> If we able to use BSP's combiner function, MinIntCombiner can be implemented like this:
> {code}
>   public static class MinIntCombiner extends Combiner<IntWritable> {
>     @Override
>     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;
>     }
>   }
> {code}
> By the way, unfortunately, MapWritable was used to send destination VertexID together.
> {code}
>         for (Entry<Writable, Writable> e : msg.entrySet()) {
>           String vertexID = ((Text) e.getKey()).toString();
>           Writable value = e.getValue();
> {code}
> 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