@Override public MsgList<DoubleWritable> finishFinal() { agg.set(sum); msgList.clear(); msgList.add(agg); return msgList; }
@Override public void compute(Iterator<DoubleWritable> msgIterator) { if (getSuperstep() == 1) { tmpVertexValue.set(1.0 / getNumVertices()); setVertexValue(tmpVertexValue); } if (getSuperstep() >= 2 && getSuperstep() <= maxIteration) { double sum = 0; while (msgIterator.hasNext()) { sum += msgIterator.next().get(); } tmpVertexValue.set(0.15 / getNumVertices() + 0.85 * sum); setVertexValue(tmpVertexValue); } if (getSuperstep() >= 1 && getSuperstep() < maxIteration) { long edges = getNumOutEdges(); outputValue.set(getVertexValue().get() / edges); sendMsgToAllEdges(outputValue); } else { voteToHalt(); } }
@Override public void setPartialCombineState(DoubleWritable combineState) { sum = combineState.get(); }
@Override public void stepFinal(VLongWritable vertexIndex, DoubleWritable partialAggregate) throws HyracksDataException { sum += partialAggregate.get(); }
@Override public DoubleWritable finishPartial() { agg.set(sum); return agg; }
@Override public void stepPartial(VLongWritable vertexIndex, DoubleWritable msg) throws HyracksDataException { sum += msg.get(); }