Graphx作为Spark的图计算组件,提供了丰富的图操作接口,以及常用的算法(在graphx lib中)。本文介绍Connected Components算法,并提供使用示例;
1. 相关知识
图的相关概念,参见: 图的基本概念--包括图、连通图、完全图、团、网、子图的概念及示例
如下图有3个极大连通子图(连通分量)
2. 计算图的连通子图
Compute the connected component membership of each vertex and return a graph with the vertex value containing the lowest vertex id in the connected component containing that vertex
计算每个顶点的连通分量(c