Make Graph{,Impl,Ops} serializable to work around capture
This commit is contained in:
parent
d4d9ece1af
commit
84d6af8021
|
@ -20,7 +20,7 @@ import org.apache.spark.storage.StorageLevel
|
|||
* @tparam VD the vertex attribute type
|
||||
* @tparam ED the edge attribute type
|
||||
*/
|
||||
abstract class Graph[VD: ClassTag, ED: ClassTag] {
|
||||
abstract class Graph[VD: ClassTag, ED: ClassTag] protected () extends Serializable {
|
||||
|
||||
/**
|
||||
* An RDD containing the vertices and their associated attributes.
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.apache.spark.rdd.RDD
|
|||
* @tparam VD the vertex attribute type
|
||||
* @tparam ED the edge attribute type
|
||||
*/
|
||||
class GraphOps[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED]) {
|
||||
class GraphOps[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED]) extends Serializable {
|
||||
|
||||
/** The number of edges in the graph. */
|
||||
lazy val numEdges: Long = graph.edges.count()
|
||||
|
|
|
@ -32,7 +32,7 @@ class GraphImpl[VD: ClassTag, ED: ClassTag] protected (
|
|||
@transient val replicatedVertexView: ReplicatedVertexView[VD])
|
||||
extends Graph[VD, ED] with Serializable {
|
||||
|
||||
/** Default construct is provided to support serialization */
|
||||
/** Default constructor is provided to support serialization */
|
||||
protected def this() = this(null, null, null, null)
|
||||
|
||||
/** Return a RDD that brings edges together with their source and destination vertices. */
|
||||
|
|
Loading…
Reference in a new issue