You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/01/14 07:59:56 UTC
[32/50] git commit: More cleanup.
More cleanup.
Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/9317286b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/9317286b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/9317286b
Branch: refs/heads/master
Commit: 9317286b72ec8bb065b0422c344c267cc49189e3
Parents: 8e5c732
Author: Reynold Xin <rx...@apache.org>
Authored: Mon Jan 13 18:45:35 2014 -0800
Committer: Reynold Xin <rx...@apache.org>
Committed: Mon Jan 13 18:45:35 2014 -0800
----------------------------------------------------------------------
graphx/src/main/scala/org/apache/spark/graphx/Edge.scala | 2 +-
.../scala/org/apache/spark/graphx/EdgeDirection.scala | 3 +++
.../org/apache/spark/graphx/lib/ConnectedComponents.scala | 4 +---
.../scala/org/apache/spark/graphx/lib/TriangleCount.scala | 10 +++++-----
4 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/9317286b/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala
----------------------------------------------------------------------
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 8546305..21be58e 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
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/9317286b/graphx/src/main/scala/org/apache/spark/graphx/EdgeDirection.scala
----------------------------------------------------------------------
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 5b58a61..f265764 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")
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/9317286b/graphx/src/main/scala/org/apache/spark/graphx/lib/ConnectedComponents.scala
----------------------------------------------------------------------
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 121df5a..4d1f5e7 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) {
http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/9317286b/graphx/src/main/scala/org/apache/spark/graphx/lib/TriangleCount.scala
----------------------------------------------------------------------
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 4b04557..23c9c40 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