0
我试图构建某物。像GraphX的Pregel实现,但我不想使用mapReduceTriplets
函数。相反,我尝试使用graph.vertices.flatMap
,因为我不需要三元组,顶点就足够了。Apache Spark/GraphX限制映射阶段
我的代码框架看起来(或多或少)像
while(){
// Create messages for other nodes and run program logic,
// should only run on nodes that have received a message on round before
messages = graph.vertices.flatMap()
// Join back nodes into graph
newVerts= graph.innerJoin(messages)
g : Graph = graph.outerJoinVertices(newVerts)
}
我的问题是,在迭代i
我想做的事情只在收到上一轮i-1
一条消息,节点flatMap操作。通过使用mapReduceTriplets,可以通过使用只有该节点处于活动状态的activeSet来完成,但对于仅使用节点的VertexRDD,我找不到这样的操作。
有人想法如何有效地解决这个问题?
在此先感谢!