4

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

Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
  • Sorry I added an answer by mistake. It was comment. Any way your https://github.com/geoHeil/graphFrameStarter reopository already good to the graph starters. And Belief Propagation examples seems manually run an iterator to propagate over multiple edges. https://github.com/graphframes/graphframes/blob/master/src/main/scala/org/graphframes/examples/BeliefPropagation.scala – Jihun No Jun 20 '17 at 00:20

0 Answers0