Graph Class
abstract class Graph[VD, ED] extends Serializable
The Graph abstractly represents a graph with arbitrary objects associated with vertices and edges. The graph provides basic operations to access and manipulate the data associated with vertices and edges as well as the underlying structure. Like Spark RDDs, the graph is a functional data-structure in which mutating operations return new graphs.
VD the vertex attribute type
ED the edge attribute type

Abstract methods:

1
abstract def cache(): Graph[VD, ED]
2
Caches the vertices and edges associated with this graph at the previously-specified target storage levels, which default to MEMORY_ONLY.
3
​
4
abstract def checkpoint(): Unit
5
Mark this Graph for checkpointing.
6
​
7
abstract val edges: EdgeRDD[ED]
8
An RDD containing the edges and their associated attributes.
9
​
10
abstract def getCheckpointFiles: Seq[String]
11
Gets the name of the files to which this Graph was checkpointed.
12
​
13
abstract def groupEdges(merge: (ED, ED) β‡’ ED): Graph[VD, ED]
14
Merges multiple edges between two vertices into a single edge.
15
​
16
abstract def isCheckpointed: Boolean
17
Return whether this Graph has been checkpointed or not.
18
​
19
abstract def mapEdges[ED2](map: (PartitionID, Iterator[Edge[ED]]) β‡’ Iterator[ED2])(implicit arg0: ClassTag[ED2]): Graph[VD, ED2]
20
Transforms each edge attribute using the map function, passing it a whole partition at a time.
21
​
22
abstract def mapTriplets[ED2](map: (PartitionID, Iterator[EdgeTriplet[VD, ED]]) => Iterator[ED2], tripletFields: TripletFields)(implicit arg0: ClassTag[ED2]): Graph[VD, ED2]
23
Transforms each edge attribute a partition at a time using the map function, passing it the adjacent vertex attributes as well.
24
​
25
abstract def mapVertices[VD2](map: (VertexId, VD) => VD2)(implicit arg0: ClassTag[VD2], eq: =:=[VD, VD2] = null): Graph[VD2, ED]
26
Transforms each vertex attribute in the graph using the map function.
27
​
28
abstract def mask[VD2, ED2](other: Graph[VD2, ED2])(implicit arg0: ClassTag[VD2], arg1: ClassTag[ED2]): Graph[VD, ED]
29
Restricts the graph to only the vertices and edges that are also in other, but keeps the attributes from this graph.
30
​
31
abstract def outerJoinVertices[U, VD2](other: RDD[(VertexId, U)])(mapFunc: (VertexId, VD, Option[U]) β‡’ VD2)(implicit arg0: ClassTag[U], arg1: ClassTag[VD2], eq: =:=[VD, VD2] = null): Graph[VD2, ED]
32
Joins the vertices with entries in the table RDD and merges the results using mapFunc.
33
​
34
abstract def partitionBy(partitionStrategy: PartitionStrategy, numPartitions: Int): Graph[VD, ED]
35
Repartitions the edges in the graph according to partitionStrategy.
36
​
37
abstract def partitionBy(partitionStrategy: PartitionStrategy): Graph[VD, ED]
38
Repartitions the edges in the graph according to partitionStrategy.
39
​
40
abstract def persist(newLevel: StorageLevel = StorageLevel.MEMORY_ONLY): Graph[VD, ED]
41
Caches the vertices and edges associated with this graph at the specified storage level, ignoring any target storage levels previously set.
42
​
43
abstract reverse: def Graph[VD, ED]
44
Reverses all edges in the graph.
45
​
46
abstract def subgraph(epred: (EdgeTriplet[VD, ED]) β‡’ Boolean = x => true, vpred: (VertexId, VD) β‡’ Boolean = (v, d) => true): Graph[VD, ED]
47
Restricts the graph to only the vertices and edges satisfying the predicates.
48
​
49
abstract val triplets: RDD[EdgeTriplet[VD, ED]]
50
An RDD containing the edge triplets, which are edges along with the vertex data associated with the adjacent vertices.
51
​
52
abstract def unpersist(blocking: Boolean = true): Graph[VD, ED]
53
Uncaches both vertices and edges of this graph.
54
​
55
abstract def unpersistVertices (blocking: Boolean = true): Graph[VD, ED]
56
Uncaches only the vertices of this graph, leaving the edges alone.
57
​
58
abstract vertices val VertexRDD[VD]
59
An RDD containing the vertices and their associated attributes
60
​
61
​
Copied!
Concrete methods:
1
def aggregateMessages[A](sendMsg: (EdgeContext[VD, ED, A]) β‡’ Unit, mergeMsg: (A, A) β‡’ A, tripletFields: TripletFields = TripletFields.All)(implicit arg0: ClassTag[A]): VertexRDD[A]
2
​
3
Aggregates values from the neighboring edges and vertices of each vertex.
4
​
5
def mapEdges[ED2](map: (Edge[ED]) β‡’ ED2)(implicit arg0: ClassTag[ED2]): Graph[VD, ED2]
6
​
7
Transforms each edge attribute in the graph using the map function.
8
​
9
def mapTriplets[ED2](map: (EdgeTriplet[VD, ED]) β‡’ ED2, tripletFields: TripletFields)(implicit arg0: ClassTag[ED2]): Graph[VD, ED2]
10
​
11
Transforms each edge attribute using the map function, passing it the adjacent vertex attributes as well.
12
​
13
def mapTriplets[ED2](map: (EdgeTriplet[VD, ED]) β‡’ ED2)(implicit arg0: ClassTag[ED2]): Graph[VD, ED2]
14
​
15
Transforms each edge attribute using the map function, passing it the adjacent vertex attributes as well.
16
​
17
val ops: GraphOps[VD, ED]
18
​
19
The associated GraphOps object.
Copied!
Reference:
Last modified 1yr ago
Copy link