Skip to content
Snippets Groups Projects
Commit d806ed34 authored by Zheng RuiFeng's avatar Zheng RuiFeng Committed by Reynold Xin
Browse files

[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.
parent 79250712
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment