aboutsummaryrefslogtreecommitdiff
path: root/graphx
diff options
context:
space:
mode:
authorZheng RuiFeng <ruifengz@foxmail.com>2016-02-21 00:53:15 -0800
committerReynold Xin <rxin@databricks.com>2016-02-21 00:53:15 -0800
commitd806ed34365aa27895547297fff4cc48ecbeacdf (patch)
tree6b476937e5fceb549df0ddae4652394e8043438e /graphx
parent7925071280bfa1570435bde3e93492eaf2167d56 (diff)
downloadspark-d806ed34365aa27895547297fff4cc48ecbeacdf.tar.gz
spark-d806ed34365aa27895547297fff4cc48ecbeacdf.tar.bz2
spark-d806ed34365aa27895547297fff4cc48ecbeacdf.zip
[SPARK-13416][GraphX] Add positive check for option 'numIter' in StronglyConnectedComponents
JIRA: https://issues.apache.org/jira/browse/SPARK-13416 ## What changes were proposed in this pull request? The output of StronglyConnectedComponents with numIter no greater than 1 may make no sense. So I just add require check in it. ## How was the this patch tested? unit tests passed Author: Zheng RuiFeng <ruifengz@foxmail.com> Closes #11284 from zhengruifeng/scccheck.
Diffstat (limited to 'graphx')
-rw-r--r--graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala b/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala
index 8dd958033b..7063137d47 100644
--- a/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala
+++ b/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala
@@ -36,7 +36,7 @@ object StronglyConnectedComponents {
* @return a graph with vertex attributes containing the smallest vertex id in each SCC
*/
def run[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED], numIter: Int): Graph[VertexId, ED] = {
-
+ require(numIter > 0, s"Number of iterations ${numIter} must be greater than 0.")
// the graph we update with final SCC ids, and the graph we return at the end
var sccGraph = graph.mapVertices { case (vid, _) => vid }
// graph we are going to work with in our iterations