Spark graphFrames文档有一个很好的例子,说明如何应用聚合消息功能。
对我来说,似乎只计算单个和第一个顶点的朋友/连接,而不是像graphXs pregel运算符那样深入迭代到图中。
如何在graphFrame中完成此类迭代以及使用类似于如何在graphX中处理迭代的聚合消息?{/ p>
import org.graphframes.examples import org.graphframes.lib.AggregateMessages val g: GraphFrame = examples.Graphs.friends // get example graph // We will use AggregateMessages utilities later, so name it "AM" for short. val AM = AggregateMessages // For each user, sum the ages of the adjacent users. val msgToSrc = AM.dst("age") val msgToDst = AM.src("age") val agg = g.aggregateMessages .sendToSrc(msgToSrc) // send destination user's age to source .sendToDst(msgToDst) // send source user's age to destination .agg(sum(AM.msg).as("summedAges")) // sum up ages, stored in AM.msg column agg.show()