March 2019
Beginner to intermediate
182 pages
4h 6m
English
In this section, we will cover the total degree, then we'll split it into two parts—an in-degree and an out-degree—and we will understand how this works in the code.
For our first test, let's construct the graph that we already know about:
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.FunSuiteimport org.scalatest.Matchers._class CalculateDegreeTest extends FunSuite { val spark: SparkContext = SparkSession.builder().master("local[2]").getOrCreate().sparkContext test("should calculate degree of vertices") { //given val users: RDD[(VertexId, ...Read now
Unlock full access