Edge Class
case class Edge[ED](srcId: VertexId = 0, dstId: VertexId = 0, attr: ED = null.asInstanceOf[ED]) extends Serializable with Product
An Instance Constructor
new
Edge(srcId: VertexId = 0, dstId: VertexId = 0, attr: ED = null.asInstanceOf[ED])
A single directed edge consisting of a source id, target id, and the data associated with the edge.
srcId The vertex id of the source vertex
dstId The vertex id of the target vertex
attr The attribute associated with the edge
Example:
val relationships: RDD[Edge[String]] = sc.parallelize(Array(Edge(1L, 2L, "boss"), Edge(1L, 3L, "boss"),
Edge(2L, 3L, "coworker"), Edge(4L, 1L, "boss")))Reference:
https://github.com/apache/spark/blob/v2.4.5/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala
Last updated
Was this helpful?