if (!currentPageRankIterator.hasNext()) {
long missingVertex = partialRanks.iterator().next().getVertexID();
throw new IllegalStateException("No current page rank for vertex [" + missingVertex + "]!");
}
VertexWithRankAndDangling currentPageRank = currentPageRankIterator.next();
long edges = 0;
double summedRank = 0;
for (VertexWithRank pr :partialRanks) {
summedRank += pr.getRank();
edges++;
}
double rank = BETA * summedRank + dampingFactor + danglingRankFactor;
double currentRank = currentPageRank.getRank();
boolean isDangling = currentPageRank.isDangling();
double danglingRankToAggregate = isDangling ? rank : 0;
long danglingVerticesToAggregate = isDangling ? 1 : 0;
double diff = Math.abs(currentRank - rank);
aggregator.aggregate(diff, rank, danglingRankToAggregate, danglingVerticesToAggregate, 1, edges, summedRank, 0);
accumulator.setVertexID(currentPageRank.getVertexID());
accumulator.setRank(rank);
accumulator.setDangling(isDangling);
collector.collect(accumulator);
}