diff options
author | Joseph E. Gonzalez <joseph.e.gonzalez@gmail.com> | 2014-01-13 22:56:57 -0800 |
---|---|---|
committer | Joseph E. Gonzalez <joseph.e.gonzalez@gmail.com> | 2014-01-13 22:56:57 -0800 |
commit | 80e73ed0004cceb47a450c79aa4faa598502fa45 (patch) | |
tree | cf920ead084b88ba9d66d79ad98784bbe7b39673 /graphx | |
parent | 4bafc4f41f5c5ed686c024d5f49cf31bbc08ce88 (diff) | |
download | spark-80e73ed0004cceb47a450c79aa4faa598502fa45.tar.gz spark-80e73ed0004cceb47a450c79aa4faa598502fa45.tar.bz2 spark-80e73ed0004cceb47a450c79aa4faa598502fa45.zip |
Adding minimal additional functionality to EdgeRDD
Diffstat (limited to 'graphx')
-rw-r--r-- | graphx/src/main/scala/org/apache/spark/graphx/EdgeRDD.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/graphx/src/main/scala/org/apache/spark/graphx/EdgeRDD.scala b/graphx/src/main/scala/org/apache/spark/graphx/EdgeRDD.scala index c0a23d1986..832b7816fe 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/EdgeRDD.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/EdgeRDD.scala @@ -58,6 +58,23 @@ class EdgeRDD[@specialized ED: ClassTag]( } /** + * Map the values in an edge partitioning preserving the structure but changing the values. + * + * @tparam ED2 the new edge value type + * @param f the function from an edge to a new edge value + * @return a new EdgeRDD containing the new edge values + */ + def mapValues[ED2: ClassTag](f: Edge[ED] => ED2): EdgeRDD[ED2] = + mapEdgePartitions((pid, part) => part.map(f)) + + /** + * Reverse all the edges in this RDD. + * + * @return a new EdgeRDD containing all the edges reversed + */ + def reverse: EdgeRDD[ED] = mapEdgePartitions((pid, part) => part.reverse) + + /** * Inner joins this EdgeRDD with another EdgeRDD, assuming both are partitioned using the same * [[PartitionStrategy]]. * |