使用mapReduceTriplets、mapEdges、mapVertices操作修改属性
import org.apache.spark._
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.graphx._
import org.apache.spark.rdd.RDD
object Day05 {
def main(args: Array[String]) = {
val conf = new SparkConf()
val sc = new SparkContext("local", "test", conf)
// day05-vertices.csv
// 1,Taro,100
// 2,Jiro,200
// 3,Sabo,300
val vertexLines: RDD[String] = sc.textFile("graphdata/day05-vertices.csv")
val vertices: RDD[(VertexId, (String, Long))] = vertexLines.map(line => {
val cols = line.split(",")
(cols(0).toLong, (cols(1), cols(2).toLong))
})
// day05-edges.csv
// 1,2,100,2014/12/1
// 2,3,200,2014/12/2
// 3,1,300,2014/12/3
val format = new java.text.SimpleDateFormat("yyyy/MM/