spark graph frames aggregate messages multiple iterations

1.9k Views Asked by At

Spark graphFrames documentation has a nice example how to apply aggregate messages function.

To me, it seems to only calculate the friends /connections of the single and first vertices and not iterate deeper into the graph as graphXs pregel operator.

How can I accomplish such iterations in graphFrames as well using aggregate messages similar to how iteration is handled here https://github.com/sparkling-graph/sparkling-graph/blob/master/operators/src/main/scala/ml/sparkling/graph/operators/measures/vertex/eigenvector/EigenvectorCentrality.scala in graphX?

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

http://graphframes.github.io/user-guide.html#message-passing-via-aggregatemessages

0

There are 0 best solutions below