March 2019
Beginner to intermediate
182 pages
4h 6m
English
In this section, we will load data about users and reload data about their followers. We will use the graph API and the structure of our data, and we will calculate PageRank to calculate the rank of users.
First, we need to load edgeListFile, as follows:
package com.tomekl007.chapter_7import org.apache.spark.graphx.GraphLoaderimport org.apache.spark.sql.SparkSessionimport org.scalatest.FunSuiteimport org.scalatest.Matchers._class PageRankTest extends FunSuite { private val sc = SparkSession.builder().master("local[2]").getOrCreate().sparkContext test("should calculate page rank using GraphX API") { //given val graph = GraphLoader.edgeListFile(sc, getClass.getResource("/pagerank/followers.txt").getPath)
We have a followers.txt ...
Read now
Unlock full access