Degree
run API
- API
graph.degrees graph.inDegrees graph.outDegrees
- 功能描述
- API描述
- 使用样例
val sparkconf = new SparkConf().setAppName("DegreeCompute").setMaster(host) val sc = new SparkContext(sparkconf) val edges = sc.parallelize(Array((1L,2L),(1L,3L),(2L,3L))) val graph = Graph.fromEdgeTuples(edges, 0) val resDegrees = graph.degrees val resInDegrees = graph.inDegrees val resOutDegrees = graph.outDegrees
- 样例结果
resDegrees=[ (1,2)(3,2)(2,2)] resInDegrees=[ (3,2)(2,1)] resOutDegrees=[ (1,2)(2,1)]
父主题: 算法API