Creating your first Graph (RDD API)

For the RDD API, the basic class in GraphX is called a Graph (org.apache.spark.graphx.Graph), which contains two types of RDDs as you might have guessed:

  • Edges
  • Vertices

In the following graph, you can see we have a number of different vertices, namely Fawad, Aznan, Ben, Tom, and Marathon.

Creating your first Graph (RDD API)

Figure 7.6: Depiction of a graph

This is a labeled graph where the edges and vertices have labels associated with them.

Following the Graph, we will look at a code example, where we:

  • Create the vertices
  • Create the edges
  • Instantiate a graph object
  • View the vertices configured with the graph

The following code example ...

Get Learning Apache Spark 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.