How to create EdgeRDD in Graphx

995 views Asked by At

I am using spark 1.4.0 and graphx and I have my graph edges stored in file and I use the following lines of code to store them in an RDD. I would like to use EdgeRDD instead of RDD[Edge[String]]

val edges: RDD[Edge[String]] = edge_file.map(line => {val x = line.split("\\s+")
Edge(x(0).toLong, x(1).toLong, " "); })

I tried this

val edgesRDD = EdgeRDD(edges)

How can I solve this.

1

There are 1 answers

0
zero323 On BEST ANSWER

EdgeRDD.fromEdges(edges) should do the trick.