SanS
SanS

Reputation: 425

How to create EdgeRDD in Graphx

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.

Upvotes: 2

Views: 980

Answers (1)

zero323
zero323

Reputation: 330383

EdgeRDD.fromEdges(edges) should do the trick.

Upvotes: 3

Related Questions