Hej,
I have modified the connected component example to fit my input data. I
expect it to be deterministic.
But when I run it multiple times it takes a different number of Super
steps. This only happens on the complete dataset and not on my small test
dataset.
(So I cannot check the output for correctness in a simple way)
Has anyone an Idea how this could happen?
cheers Martin
In case its useful here the computation class:
@Override
public void compute(Vertex<Text, Text, NullWritable> vertex,
Iterable<Text> inmessage) throws IOException {
boolean changed = false;
// first superstep && setup
if (getSuperstep() == 0) {
//initialize value
vertex.setValue(vertex.getId());
//cheating by checking the neighbors ID's (cuts down 1
iteration)
for (Edge<Text, NullWritable> e : vertex.getEdges()) {
Text candidate = e.getTargetVertexId();
if (candidate.compareTo(vertex.getValue()) < 0) {
changed = true;
vertex.setValue(candidate);
}
}
}
// other superstep
else {
// read all messages and compare with own state
for (Text message : inmessage) {
if (message.compareTo(vertex.getValue()) < 0) {
changed = true;
vertex.setValue(message);
}
}
}
// if state has changed send a message to all neighbors
if (changed && getSuperstep() < limiter) {
sendMessageToAllEdges(vertex, vertex.getValue());
}
vertex.voteToHalt();
}