Building graphs
Now that we have our data, the next step is to create a graph. Let's fire up the Spark Shell. Run it from the directory where you have installed Spark:
We create the graph in two steps: first we create an RDD list of the vertices and edges, then we create RDDs and eventually the graph. You don't need to type the code; the graphx-0x.scala
files have the programs to create a graph and do the rest of the API stuff.
First we create the lists:
Let's quickly run through the code:
case class Person(name:String,age:Int) val defaultPerson = ...
Get Fast Data Processing with Spark 2 - Third Edition 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.