class AggregateMessages extends Arguments with Serializable with WithIntermediateStorageLevel with Logging

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 checkpoint() (localCheckpoint()) 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
WithIntermediateStorageLevel, Logging, Serializable, Arguments, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AggregateMessages
  2. WithIntermediateStorageLevel
  3. Logging
  4. Serializable
  5. Arguments
  6. AnyRef
  7. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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 toany2stringadd[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 toArrowAssoc[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, aggCols: 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: String): DataFrame
  8. def agg(aggCol: Column): DataFrame
  9. def agg(aggCol: Column, aggCols: 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
    • aggCols: one column with the result of each additional defined aggregation 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)
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  12. def ensuring(cond: (AggregateMessages) => Boolean, msg: => Any): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages toEnsuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (AggregateMessages) => Boolean): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages toEnsuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: => Any): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages toEnsuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): AggregateMessages
    Implicit
    This member is added by an implicit conversion from AggregateMessages toEnsuring[AggregateMessages] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  19. def getIntermediateStorageLevel: StorageLevel

    Gets storage level for intermediate datasets that require multiple passes.

    Gets storage level for intermediate datasets that require multiple passes.

    Definition Classes
    WithIntermediateStorageLevel
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  21. val intermediateStorageLevel: StorageLevel
    Attributes
    protected
    Definition Classes
    WithIntermediateStorageLevel
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. def logDebug(s: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  24. def logInfo(s: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  25. def logTrace(s: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. def logWarn(s: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  30. def resultIsPersistent(): Unit
    Attributes
    protected
    Definition Classes
    Logging
  31. def sendToDst(value: String, values: String*): AggregateMessages.this.type

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

  32. def sendToDst(value: Column): AggregateMessages.this.type
  33. def sendToDst(value: String): AggregateMessages.this.type
  34. def sendToDst(value: Column, values: Column*): AggregateMessages.this.type

    Send message to destination vertex

  35. def sendToSrc(value: String, values: String*): AggregateMessages.this.type

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

  36. def sendToSrc(value: String): AggregateMessages.this.type
  37. def sendToSrc(value: Column): AggregateMessages.this.type
  38. def sendToSrc(value: Column, values: Column*): AggregateMessages.this.type

    Send message to source vertex

  39. def setIntermediateStorageLevel(value: StorageLevel): AggregateMessages.this.type

    Sets storage level for intermediate datasets that require multiple passes (default: MEMORY_AND_DISK).

    Sets storage level for intermediate datasets that require multiple passes (default: MEMORY_AND_DISK).

    Definition Classes
    WithIntermediateStorageLevel
  40. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  41. def toString(): String
    Definition Classes
    AnyRef → Any
  42. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  43. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  44. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from AggregateMessages toStringFormat[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.

  3. def [B](y: B): (AggregateMessages, B)
    Implicit
    This member is added by an implicit conversion from AggregateMessages toArrowAssoc[AggregateMessages] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from WithIntermediateStorageLevel

Inherited from Logging

Inherited from Serializable

Inherited from Arguments

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromAggregateMessages to any2stringadd[AggregateMessages]

Inherited by implicit conversion StringFormat fromAggregateMessages to StringFormat[AggregateMessages]

Inherited by implicit conversion Ensuring fromAggregateMessages to Ensuring[AggregateMessages]

Inherited by implicit conversion ArrowAssoc fromAggregateMessages to ArrowAssoc[AggregateMessages]

Ungrouped