spark graph frames聚合消息多次迭代

时间:2017-02-19 11:36:44

标签: apache-spark spark-graphx graphframes bulk-synchronous-parallel

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()
     

https://github.com/sparkling-graph/sparkling-graph/blob/master/operators/src/main/scala/ml/sparkling/graph/operators/measures/vertex/eigenvector/EigenvectorCentrality.scala

0 个答案:

没有答案