Thanks
On Fri, Jul 18, 2014 at 12:22 AM, Ankur Dave <ankurd...@gmail.com> wrote: > If your sendMsg function needs to know the incoming messages as well as > the vertex value, you could define VD to be a tuple of the vertex value and > the last received message. The vprog function would then store the incoming > messages into the tuple, allowing sendMsg to access them. > > For example, if the vertex value was a String and the message type was an > Int, you could call Pregel as follows: > > val graph: Graph[String, _] = ... > > graph.mapVertices((id, attr) => (attr, 0)).pregel(0)( > (id, attr: (String, Int), msg: Int) => (attr._1, msg), > edge => Iterator(...), // can use edge.srcAttr._2 and edge.dstAttr._2 to > access the messages (a: Int, b: Int) => a + b) > > > Ankur <http://www.ankurdave.com/> >