From 04c20e7f4f98b18187f2320ddd7dedce69017de7 Mon Sep 17 00:00:00 2001 From: Ankur Dave <ankurdave@gmail.com> Date: Fri, 10 Jan 2014 15:58:30 -0800 Subject: [PATCH] Minor cleanup to docs --- .../scala/org/apache/spark/graphx/Edge.scala | 2 +- .../apache/spark/graphx/EdgeDirection.scala | 3 +- .../spark/graphx/GraphKryoRegistrator.scala | 4 ++- .../org/apache/spark/graphx/Pregel.scala | 32 +++++++++---------- .../org/apache/spark/graphx/VertexRDD.scala | 2 +- 5 files changed, 21 insertions(+), 22 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 29b46674f1..c6b62ebaca 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/Edge.scala @@ -3,7 +3,7 @@ package org.apache.spark.graphx /** * A single directed edge consisting of a source id, target id, - * and the data associated with the Edgee. + * and the data associated with the edge. * * @tparam ED type of the edge attribute */ 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 785f941650..99910ab87b 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/EdgeDirection.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/EdgeDirection.scala @@ -2,8 +2,7 @@ package org.apache.spark.graphx /** - * The direction of directed edge relative to a vertex used to select - * the set of adjacent neighbors when running a neighborhood query. + * The direction of a directed edge relative to a vertex. */ sealed abstract class EdgeDirection { /** diff --git a/graphx/src/main/scala/org/apache/spark/graphx/GraphKryoRegistrator.scala b/graphx/src/main/scala/org/apache/spark/graphx/GraphKryoRegistrator.scala index f8aab951f0..681074ba10 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/GraphKryoRegistrator.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/GraphKryoRegistrator.scala @@ -7,7 +7,9 @@ import org.apache.spark.serializer.KryoRegistrator import org.apache.spark.util.collection.BitSet import org.apache.spark.util.BoundedPriorityQueue - +/** + * Registers GraphX classes with Kryo for improved performance. + */ class GraphKryoRegistrator extends KryoRegistrator { def registerClasses(kryo: Kryo) { diff --git a/graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala b/graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala index 0af230ed29..2e6453484c 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala @@ -4,26 +4,24 @@ import scala.reflect.ClassTag /** - * This object implements a Pregel-like bulk-synchronous - * message-passing API. However, unlike the original Pregel API the - * GraphX pregel API factors the sendMessage computation over edges, - * enables the message sending computation to read both vertex - * attributes, and finally constrains messages to the graph structure. - * These changes allow for substantially more efficient distributed - * execution while also exposing greater flexibility for graph based - * computation. + * Implements a Pregel-like bulk-synchronous message-passing API. * - * @example We can use the Pregel abstraction to implement PageRank + * Unlike the original Pregel API, the GraphX Pregel API factors the sendMessage computation over + * edges, enables the message sending computation to read both vertex attributes, and constrains + * messages to the graph structure. These changes allow for substantially more efficient + * distributed execution while also exposing greater flexibility for graph-based computation. + * + * @example We can use the Pregel abstraction to implement PageRank: * {{{ * val pagerankGraph: Graph[Double, Double] = graph * // Associate the degree with each vertex - * .outerJoinVertices(graph.outDegrees){ + * .outerJoinVertices(graph.outDegrees) { * (vid, vdata, deg) => deg.getOrElse(0) * } * // Set the weight on the edges based on the degree - * .mapTriplets( e => 1.0 / e.srcAttr ) + * .mapTriplets(e => 1.0 / e.srcAttr) * // Set the vertex attributes to the initial pagerank values - * .mapVertices( (id, attr) => 1.0 ) + * .mapVertices((id, attr) => 1.0) * * def vertexProgram(id: VertexID, attr: Double, msgSum: Double): Double = * resetProb + (1.0 - resetProb) * msgSum @@ -31,7 +29,7 @@ import scala.reflect.ClassTag * Some(edge.srcAttr * edge.attr) * def messageCombiner(a: Double, b: Double): Double = a + b * val initialMessage = 0.0 - * // Execute pregel for a fixed number of iterations. + * // Execute Pregel for a fixed number of iterations. * Pregel(pagerankGraph, initialMessage, numIter)( * vertexProgram, sendMessage, messageCombiner) * }}} @@ -54,7 +52,7 @@ object Pregel { * then the vertex-program is not invoked. * * This function iterates until there are no remaining messages, or - * for maxIterations iterations. + * for `maxIterations` iterations. * * @tparam VD the vertex data type * @tparam ED the edge data type @@ -63,9 +61,9 @@ object Pregel { * @param graph the input graph. * * @param initialMsg the message each vertex will receive at the on - * the first iteration. + * the first iteration * - * @param maxIterations the maximum number of iterations to run for. + * @param maxIterations the maximum number of iterations to run for * * @param vprog the user-defined vertex program which runs on each * vertex and receives the inbound message and computes a new vertex @@ -76,7 +74,7 @@ object Pregel { * * @param sendMsg a user supplied function that is applied to out * edges of vertices that received messages in the current - * iteration. + * iteration * * @param mergeMsg a user supplied function that takes two incoming * messages of type A and merges them into a single message of type diff --git a/graphx/src/main/scala/org/apache/spark/graphx/VertexRDD.scala b/graphx/src/main/scala/org/apache/spark/graphx/VertexRDD.scala index 3ef9d6e9cf..3ef4fec405 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/VertexRDD.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/VertexRDD.scala @@ -28,7 +28,7 @@ import org.apache.spark.graphx.impl.MsgRDDFunctions import org.apache.spark.graphx.impl.VertexPartition /** - * A `VertexRDD[VD]` extends the `RDD[(VertexID, VD)]` by ensuring that there is only one entry for + * `VertexRDD[VD]` extends the `RDD[(VertexID, VD)]` by ensuring that there is only one entry for * each vertex and by pre-indexing the entries for fast, efficient joins. Two VertexRDDs with the * same index can be joined efficiently. * -- GitLab