Skip to content

Commit b8f12f9

Browse files
committed
Fix API to retain binary compatibility
1 parent da219dc commit b8f12f9

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ object Pregel extends Logging {
115115
def apply[VD: ClassTag, ED: ClassTag, A: ClassTag]
116116
(graph: Graph[VD, ED],
117117
initialMsg: A,
118-
maxIterations: Int = Int.MaxValue,
119-
activeDirection: EdgeDirection = EdgeDirection.Either)
118+
maxIterations: Int,
119+
activeDirection: EdgeDirection,
120+
tripletFields: TripletFields)
120121
(vprog: (VertexId, VD, A) => VD,
121122
sendMsg: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)],
122-
mergeMsg: (A, A) => A,
123-
tripletFields: TripletFields = TripletFields.All)
123+
mergeMsg: (A, A) => A)
124124
: Graph[VD, ED] =
125125
{
126126
var g = graph.mapVertices((vid, vdata) => vprog(vid, vdata, initialMsg)).cache()
@@ -163,6 +163,24 @@ object Pregel extends Logging {
163163
g
164164
} // end of apply
165165

166+
/**
167+
* This old Pregel API (<=1.2.0) is left because of
168+
* binary compatibility.
169+
*/
170+
def apply[VD: ClassTag, ED: ClassTag, A: ClassTag]
171+
(graph: Graph[VD, ED],
172+
initialMsg: A,
173+
maxIterations: Int = Int.MaxValue,
174+
activeDirection: EdgeDirection = EdgeDirection.Either)
175+
(vprog: (VertexId, VD, A) => VD,
176+
sendMsg: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)],
177+
mergeMsg: (A, A) => A)
178+
: Graph[VD, ED] =
179+
{
180+
Pregel(graph, initialMsg, maxIterations, activeDirection, TripletFields.All)(
181+
vprog, sendMsg, mergeMsg)
182+
}
183+
166184
private def mapReduceTriplets[VD: ClassTag, ED: ClassTag, A: ClassTag](
167185
g: Graph[VD, ED],
168186
mapFunc: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)],

0 commit comments

Comments
 (0)