I'm trying to create a Graph using some Google Web Graph data which can be found here:
https://snap.stanford.edu/data/web-Google.html
import org.apache.spark._
import org.apache.spark.graphx._
import org.apache.spark.rdd.RDD
val textFile = sc.textFile("hdfs://n018-data.hursley.ibm.com/user/romeo/web-Google.txt")
val arrayForm = textFile.filter(_.charAt(0)!='#').map(_.split("\\s+")).cache()
val nodes = arrayForm.flatMap(array => array).distinct().map(_.toLong)
val edges = arrayForm.map(line => Edge(line(0).toLong,line(1).toLong))
val graph = Graph(nodes,edges)
Unfortunately, I get this error:
<console>:27: error: type mismatch;
found : org.apache.spark.rdd.RDD[Long]
required: org.apache.spark.rdd.RDD[(org.apache.spark.graphx.VertexId, ?)]
Error occurred in an application involving default arguments.
val graph = Graph(nodes,edges)
So how can I create a VertexId object? For my understanding it should be sufficient to pass a Long.
Any ideas?
Thanks a lot!
romeo