March 2019
Beginner to intermediate
182 pages
4h 6m
English
Next, we have the GraphBuilder method, which is our own component:
//when val graph = GraphBuilder.loadFromFile(spark, path)
The following is our GraphBuilder.scala file for our GraphBuilder method:
package com.tomekl007.chapter_7import org.apache.spark.SparkContextimport org.apache.spark.graphx.{Graph, GraphLoader}object GraphBuilder { def loadFromFile(sc: SparkContext, path: String): Graph[Int, Int] = { GraphLoader.edgeListFile(sc, path) }}
It uses a GraphLoader class from the org.apache.spark.graphx.{Graph, GraphLoader} package and we are specifying the format.
The format that's specified here is edgeListFile. We are passing the sc parameter, which is the SparkContext and path parameter, which contains the ...
Read now
Unlock full access