GraphLoader Object

Provides utilities for loading Graphs from files.

def edgeListFile(sc: SparkContext, path: String, canonicalOrientation: Boolean = false, numEdgePartitions: Int = 1, edgeStorageLevel: StorageLevel = StorageLevel.MEMORY_ONLY, vertexStorageLevel: StorageLevel = StorageLevel.MEMORY_ONLY): Graph[Int, Int]

Loads a graph from an edge list formatted file where each line contains two integers: a source id and a target id.

Example:

val graph = GraphLoader.edgeListFile(sc, "file:///home/dv6/spark/spark/data/graphx/followers.txt")

Reference:

https://github.com/apache/spark/blob/v2.4.5/graphx/src/main/scala/org/apache/spark/graphx/GraphLoader.scala

Last updated