Example #1
0
 @Override
 public MsgList<DoubleWritable> finishFinal() {
   agg.set(sum);
   msgList.clear();
   msgList.add(agg);
   return msgList;
 }
Example #2
0
  @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();
    }
  }
Example #3
0
 @Override
 public void setPartialCombineState(DoubleWritable combineState) {
   sum = combineState.get();
 }
Example #4
0
 @Override
 public void stepFinal(VLongWritable vertexIndex, DoubleWritable partialAggregate)
     throws HyracksDataException {
   sum += partialAggregate.get();
 }
Example #5
0
 @Override
 public DoubleWritable finishPartial() {
   agg.set(sum);
   return agg;
 }
Example #6
0
 @Override
 public void stepPartial(VLongWritable vertexIndex, DoubleWritable msg)
     throws HyracksDataException {
   sum += msg.get();
 }