赞
踩
- import org.apache.log4j.{Level, Logger}
- import org.apache.spark.{SparkConf, SparkContext}
- import org.apache.spark.graphx._
- object farthest_distance{
- def main(args: Array[String]): Unit = {
- val conf = new SparkConf().setAppName("farthest distance").setMaster("local[4]")
- val sc = new SparkContext(conf) //屏蔽日志
- Logger.getLogger("org.apache.spark").setLevel(Level.WARN)
- Logger.getLogger("org.eclipse.jetty.server").setLevel(Level.OFF)
- //构造图
- val myVertices = sc.parallelize(Array((1L,"Ann"),(2L,"Bill"),(3L,"Diane"),(4L,"Cody"),(5L,"Adam"),(6L,"Bob")))
- val myEdges = sc.parallelize(Array(Edge(1L,2L,""),Edge(2L,3L,""),Edge(2L,4L,""),Edge(3L,4L,""),Edge(4L,5L,"C"),Edge(4L,6L,""),Edge(5L,6L,""))) //构造EdgeRDD
- val myGraph = Graph(myVertices,myEdges)
- //***********
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。