> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-and-apache-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-and-apache-spark/edge-class.md).

# 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>
