Hello, all,

Here's the "compute" function is the SSSP sample.

@Override
    public void compute(Iterable<IntWritable> messages) throws IOException {
      int minDist = isStartVertex() ? 0 : Integer.MAX_VALUE;

      for (IntWritable msg : messages) {
        if (msg.get() < minDist) {
          minDist = msg.get();
        }
      }

      if (minDist < this.getValue().get()) {
        this.setValue(new IntWritable(minDist));
        for (Edge<Text, IntWritable> e : this.getEdges()) {
          sendMessage(e, new IntWritable(minDist + e.getValue().get()));
        }
      } else {
        voteToHalt();
      }
    }

Why does it fall through the end of the compute() without explicitly
calling the voteToHalt() after sending out all messages?  Does reaching the
end of the compute() imply calling the voteToHalt()?


Thanks,
Chui-hui

Reply via email to