class AggregateMessages extends Arguments with Serializable

This is a primitive for implementing graph algorithms. This method aggregates messages from the neighboring edges and vertices of each vertex.

For each triplet (source vertex, edge, destination vertex) in GraphFrame.triplets, this can send a message to the source and/or destination vertices.

  • AggregateMessages.sendToSrc() sends a message to the source vertex of each triplet
  • AggregateMessages.sendToDst() sends a message to the destination vertex of each triplet
  • AggregateMessages.agg specifies an aggregation function for aggregating the messages sent to each vertex. It also runs the aggregation, computing a DataFrame with one row for each vertex which receives > 0 messages. The DataFrame has 2 columns:
    • vertex column ID (named GraphFrame.ID)
    • aggregate from messages sent to vertex (with the name given to the Column specified in AggregateMessages.agg())

When specifying the messages and aggregation function, the user may reference columns using:

Note: If you use this operation to write an iterative algorithm, you may want to use getCachedDataFrame() as a workaround for caching issues.

Example:
  1. We can use this function to compute the in-degree of each vertex

    val g: GraphFrame = Graph.textFile("twittergraph")
    val inDeg: DataFrame =
      g.aggregateMessages().sendToDst(lit(1)).agg(sum(AggregateMessagesBuilder.msg))
Linear Supertypes
Serializable, Serializable, Arguments, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AggregateMessages
  2. Serializable
  3. Serializable
  4. Arguments
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from AggregateMessages to any2stringadd[AggregateMessages] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (AggregateMessages, B)
    Implicit
    This member is added by an implicit conversion from AggregateMessages to ArrowAssoc[AggregateMessages] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def agg(aggCol: String): DataFrame

    Run the aggregation, specifying SQL expression as a String

    Run the aggregation, specifying SQL expression as a String

    See the overloaded method documentation for more details.

  7. def agg(aggCol: Column): DataFrame

    Run the aggregation, returning the resulting DataFrame of aggregated messages.

    Run the aggregation, returning the resulting DataFrame of aggregated messages. This is a lazy operation, so the DataFrame will not be materialized until an action is executed on it.

    This returns a DataFrame with schema:

    • column "id": vertex ID
    • aggCol: aggregate result If you need to join this with the original GraphFrame.vertices, you can run an inner join of the form:
    val g: GraphFrame = ...
    val aggResult = g.AggregateMessagesBuilder.sendToSrc(msg).agg(aggFunc)
    aggResult.join(g.vertices, ID)
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. def ensuring(cond: (AggregateMessages) ⇒ Boolean, msg: ⇒ Any): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages to Ensuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: (AggregateMessages) ⇒ Boolean): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages to Ensuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean, msg: ⇒ Any): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages to Ensuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages to Ensuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def sendToDst(value: String): AggregateMessages.this.type

    Send message to destination vertex, specifying SQL expression as a String

  24. def sendToDst(value: Column): AggregateMessages.this.type

    Send message to destination vertex

  25. def sendToSrc(value: String): AggregateMessages.this.type

    Send message to source vertex, specifying SQL expression as a String

  26. def sendToSrc(value: Column): AggregateMessages.this.type

    Send message to source vertex

  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  32. def [B](y: B): (AggregateMessages, B)
    Implicit
    This member is added by an implicit conversion from AggregateMessages to ArrowAssoc[AggregateMessages] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Deprecated Value Members

  1. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from AggregateMessages to StringFormat[AggregateMessages] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

Inherited from Serializable

Inherited from Serializable

Inherited from Arguments

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from AggregateMessages to any2stringadd[AggregateMessages]

Inherited by implicit conversion StringFormat from AggregateMessages to StringFormat[AggregateMessages]

Inherited by implicit conversion Ensuring from AggregateMessages to Ensuring[AggregateMessages]

Inherited by implicit conversion ArrowAssoc from AggregateMessages to ArrowAssoc[AggregateMessages]

Ungrouped