Basic graph operators (RDD API)
We have already looked at some basic RDD operators while discussing the RDD API earlier in this book. Graphs also support basic operators to help create new graphs and manipulate them. The two major classes for graphs are:
org.apache.spark.graphx.Graph
: This is an abstract class that represents a graph with arbitrary objects associated with vertices and edges. This class provides basic operations to access and manipulate the data associated with the vertices and edges, as well as the underlying structure. Like the RDD API, graph API provides a functional structure in which mutating operations would return a new Graph object.org.apache.spark.graphx.GraphOps
: TheGraphOps
class contains additional functionality for graphs. All operations are expressed in terms of efficientGraphXAPI.
This class is implicitly constructed for each graph object and can be obtained from the ops value member as follows. You do not need to explicitly get aGraphOps
object as Scala...