diff options
author | Reynold Xin <rxin@apache.org> | 2014-01-13 18:45:35 -0800 |
---|---|---|
committer | Reynold Xin <rxin@apache.org> | 2014-01-13 18:45:35 -0800 |
commit | 9317286b72ec8bb065b0422c344c267cc49189e3 (patch) | |
tree | b825788a7abf67cc24872fe77e821b9ec4a1ab06 /graphx/src | |
parent | 8e5c7324303ee9a9a61ad35e94ada5638ca0cf70 (diff) | |
download | spark-9317286b72ec8bb065b0422c344c267cc49189e3.tar.gz spark-9317286b72ec8bb065b0422c344c267cc49189e3.tar.bz2 spark-9317286b72ec8bb065b0422c344c267cc49189e3.zip |
More cleanup.
Diffstat (limited to 'graphx/src')
4 files changed, 10 insertions, 9 deletions
diff --git a/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala b/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala index 85463052bc..21be58e740 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala @@ -37,7 +37,7 @@ case class Edge[@specialized(Char, Int, Boolean, Byte, Long, Float, Double) ED] if (vid == srcId) EdgeDirection.Out else { assert(vid == dstId); EdgeDirection.In } } -object Edge { +private[graphx] object Edge { def lexicographicOrdering[ED] = new Ordering[Edge[ED]] { override def compare(a: Edge[ED], b: Edge[ED]): Int = (if (a.srcId != b.srcId) a.srcId - b.srcId else a.dstId - b.dstId).toInt diff --git a/graphx/src/main/scala/org/apache/spark/graphx/EdgeDirection.scala b/graphx/src/main/scala/org/apache/spark/graphx/EdgeDirection.scala index 5b58a61bbd..f265764006 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/EdgeDirection.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/EdgeDirection.scala @@ -26,6 +26,9 @@ class EdgeDirection private (private val name: String) extends Serializable { } +/** + * A set of [[EdgeDirection]]s. + */ object EdgeDirection { /** Edges arriving at a vertex. */ final val In = new EdgeDirection("In") diff --git a/graphx/src/main/scala/org/apache/spark/graphx/lib/ConnectedComponents.scala b/graphx/src/main/scala/org/apache/spark/graphx/lib/ConnectedComponents.scala index 121df5ad67..4d1f5e74df 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/lib/ConnectedComponents.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/lib/ConnectedComponents.scala @@ -14,13 +14,11 @@ object ConnectedComponents { * @tparam ED the edge attribute type (preserved in the computation) * * @param graph the graph for which to compute the connected components - * @param undirected compute reachability ignoring edge direction. * * @return a graph with vertex attributes containing the smallest vertex in each * connected component */ - def run[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED]): - Graph[VertexID, ED] = { + def run[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED]): Graph[VertexID, ED] = { val ccGraph = graph.mapVertices { case (vid, _) => vid } def sendMessage(edge: EdgeTriplet[VertexID, ED]) = { if (edge.srcAttr < edge.dstAttr) { diff --git a/graphx/src/main/scala/org/apache/spark/graphx/lib/TriangleCount.scala b/graphx/src/main/scala/org/apache/spark/graphx/lib/TriangleCount.scala index 4b04557bc2..23c9c40594 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/lib/TriangleCount.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/lib/TriangleCount.scala @@ -9,11 +9,11 @@ import org.apache.spark.graphx._ * * The algorithm is relatively straightforward and can be computed in three steps: * - * 1) Compute the set of neighbors for each vertex - * 2) For each edge compute the intersection of the sets and send the - * count to both vertices. - * 3) Compute the sum at each vertex and divide by two since each - * triangle is counted twice. + * <ul> + * <li>Compute the set of neighbors for each vertex + * <li>For each edge compute the intersection of the sets and send the count to both vertices. + * <li> Compute the sum at each vertex and divide by two since each triangle is counted twice. + * </ul> * * Note that the input graph should have its edges in canonical direction * (i.e. the `sourceId` less than `destId`). Also the graph must have been partitioned |