Skip to content

Commit

Permalink
Fix API to retain binary compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
maropu committed Dec 26, 2014
1 parent da219dc commit b8f12f9
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ object Pregel extends Logging {
def apply[VD: ClassTag, ED: ClassTag, A: ClassTag]
(graph: Graph[VD, ED],
initialMsg: A,
maxIterations: Int = Int.MaxValue,
activeDirection: EdgeDirection = EdgeDirection.Either)
maxIterations: Int,
activeDirection: EdgeDirection,
tripletFields: TripletFields)
(vprog: (VertexId, VD, A) => VD,
sendMsg: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)],
mergeMsg: (A, A) => A,
tripletFields: TripletFields = TripletFields.All)
mergeMsg: (A, A) => A)
: Graph[VD, ED] =
{
var g = graph.mapVertices((vid, vdata) => vprog(vid, vdata, initialMsg)).cache()
Expand Down Expand Up @@ -163,6 +163,24 @@ object Pregel extends Logging {
g
} // end of apply

/**
* This old Pregel API (<=1.2.0) is left because of
* binary compatibility.
*/
def apply[VD: ClassTag, ED: ClassTag, A: ClassTag]
(graph: Graph[VD, ED],
initialMsg: A,
maxIterations: Int = Int.MaxValue,
activeDirection: EdgeDirection = EdgeDirection.Either)
(vprog: (VertexId, VD, A) => VD,
sendMsg: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)],
mergeMsg: (A, A) => A)
: Graph[VD, ED] =
{
Pregel(graph, initialMsg, maxIterations, activeDirection, TripletFields.All)(
vprog, sendMsg, mergeMsg)
}

private def mapReduceTriplets[VD: ClassTag, ED: ClassTag, A: ClassTag](
g: Graph[VD, ED],
mapFunc: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)],
Expand Down

0 comments on commit b8f12f9

Please sign in to comment.