Re-roll last iteration of static Pregel loop

This commit is contained in:
Ankur Dave 2013-12-05 16:59:49 -08:00
parent 3d57be6151
commit 7457abe282

View file

@ -99,7 +99,7 @@ object Pregel {
var g = graph.mapVertices( (vid, vdata) => vprog(vid, vdata, initialMsg)).cache()
var i = 0
while (i < numIter - 1) {
while (i < numIter) {
// compute the messages
val messages = g.mapReduceTriplets(sendMsg, mergeMsg) // broadcast & aggregation
// receive the messages
@ -113,17 +113,6 @@ object Pregel {
i += 1
}
// compute the messages
val messages = g.mapReduceTriplets(sendMsg, mergeMsg)
// receive the messages
g = g.outerJoinVertices(messages) { (vid, vd, msgOption) =>
if (msgOption.isDefined) {
vprog(vid, vd, msgOption.get)
} else {
vd
}
}.cache()
// Return the final graph
g
} // end of apply