Skip to content

Commit

Permalink
Adding minimal additional functionality to EdgeRDD
Browse files Browse the repository at this point in the history
  • Loading branch information
jegonzal committed Jan 14, 2014
1 parent 4bafc4f commit 80e73ed
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions graphx/src/main/scala/org/apache/spark/graphx/EdgeRDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ class EdgeRDD[@specialized ED: ClassTag](
}, preservesPartitioning = true))
}

/**
* 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]].
Expand Down

0 comments on commit 80e73ed

Please sign in to comment.