March 2019
Beginner to intermediate
182 pages
4h 6m
English
Constructing a graph is not a trivial task; we need to supply vertices and edges between them. Let's focus on the first part. The first part consists of our users, users is an RDD of VertexId and String as follows:
package com.tomekl007.chapter_7import org.apache.spark.SparkContextimport org.apache.spark.graphx.{Edge, Graph, VertexId}import org.apache.spark.rdd.RDDimport org.apache.spark.sql.SparkSessionimport org.scalatest.FunSuiteclass VertexAPI extends FunSuite { val spark: SparkContext = SparkSession.builder().master("local[2]").getOrCreate().sparkContext test("Should use Vertex API") { //given val users: RDD[(VertexId, (String))] = spark.parallelize(Array( (1L, "a"), (2L, "b"), (3L, "c"), (4L, "d") ...Read now
Unlock full access