O'Reilly logo

Apache Spark Graph Processing by Rindra Ramamonjison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data operations on VertexRDD and EdgeRDD

All of the operations we've seen previously are graph operations. They are invoked on a graph and they return a new graph object. In this section, we will introduce operations that transform VertexRDD and EdgeRDD collections. The types of these collections are subtypes of RDD[(VertexID, VD)] and RDD[Edge[ED]] respectively.

Mapping VertexRDD and EdgeRDD

First, mapValues takes a map function as input, which transforms each vertex attribute in the VertexRDD. Then, it returns a new VertexRDD object while preserving the original vertex indices. The method mapValues is overloaded so that the map function can take an input with a type VD or (VertexId, VD). The type of the new vertex attributes can be different to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required