K-Core
run API
- API
def run(edgeList: RDD[(Long, Long)]): RDD[(Long, Int)]
- 功能描述
计算图中所有结点的coreness值。本算法的输入为无权无向图,输入仅需输入单向边(1L, 2L),无需包含(2L, 1L)。
- API描述
- 使用样例
val sc = new SparkContext(new SparkConf().setMaster("yarn").setAppName("KCore")) val inputGraphRaw = Array((1L, 2L), (3L, 2L), (3L, 1L), (4L, 5L)) val edegeList = sc.parallelize(inputGraphRaw) val res = KCoreDecomposition.run(edgeList).collectAsMap()
- 样例结果:
Res = Map(1L -> 2, 2L -> 2, 3L -> 2, 4L -> 1, 5L ->1)
父主题: 中心性分析