March 2019
Beginner to intermediate
182 pages
4h 6m
English
In this section, we will create couple relationships and edges between our vertices. Here, we'll have a relationship that is an Edge. An Edge is a case class from the org.apache.spark.graphx package. It is a bit more involved because we need to specify the source vertex ID and destination vertex ID. We want to specify that vertex ID 1 and 2 have a relationship, so let's make a label for this relationship. In the following code, we will specify vertex ID 1 and ID 2 as a friend, then we will specify vertex ID 1 and ID 3 as a friend as well. Lastly, vertex ID 2 and ID 4 will be a wife:
val relationships = spark.parallelize(Array( Edge(1L, 2L, "friend"), Edge(1L, 3L, "friend"), Edge(2L, 4L, "wife") ))
Also, a label ...
Read now
Unlock full access