Description
I just found a bug in the sendMsgToAllEdges() function of the LongDoubleFloatDoubleVertex class. The segment of the code that contains the bug is:
final LongWritable destVertex = new LongWritable();
final MutableVertex<LongWritable, DoubleWritable, FloatWritable,
DoubleWritable> vertex = this;
verticesWithEdgeValues.forEachKey(new LongProcedure() {
@Override
public boolean apply(long destVertexId)
});
Here destVertex is a final object, but this single object is reused in the forEachKey function many times. Each time its actual value is changed but the same object is put to the underlying message list (a hashmap) through vertex.sendMsg. Because the single destVertex object has been put into the underlying hashmap again and again, destVertex.set(destVertexId) will change the existing keys in the hashmap. Eventually, every keys added to the hash map will have the same value as the last key.
A simple fix is as follows:
final MutableVertex<LongWritable, DoubleWritable, FloatWritable,
DoubleWritable> vertex = this;
verticesWithEdgeValues.forEachKey(new LongProcedure() {
@Override
public boolean apply(long destVertexId)
});