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:
{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