I am writing a distributed clustering algorithm using Apache Giraph. In the compute() method I need to access the value that each neighbors sent plus the weight of the edge between the current vertex and the neighbor who sent that message. However, the only message type that I see in the Giraph examples are single-type message (DoubleWritable, IntWritable, etc), which can only passes the value but not the sender information,
How can we access the sender information or the edge information as well?
For instance, in the above code we can get the value of each message, but we do not know which node sent this value to the current node.
public void compute(Iterator<DoubleWritable> msgIterator) {
...
double minDist = isSource() ? 0d : Double.MAX_VALUE;
while (msgIterator.hasNext()) {
// Get who sent this message, how?
minDist = Math.min(minDist, msgIterator.next().get());
}
...
}
Thanks,