diff options
author | yingjieMiao <yingjie@42go.com> | 2014-09-29 18:01:27 -0700 |
---|---|---|
committer | Ankur Dave <ankurdave@gmail.com> | 2014-09-29 18:01:27 -0700 |
commit | 51229ff7f4d3517706a1cdc1a2943ede1c605089 (patch) | |
tree | e8ff7274f4a552aad66bf202caadf103c597b7e2 /graphx/src/main | |
parent | 0bbe7faeffa17577ae8a33dfcd8c4c783db5c909 (diff) | |
download | spark-51229ff7f4d3517706a1cdc1a2943ede1c605089.tar.gz spark-51229ff7f4d3517706a1cdc1a2943ede1c605089.tar.bz2 spark-51229ff7f4d3517706a1cdc1a2943ede1c605089.zip |
[graphX] GraphOps: random pick vertex bug
When `numVertices > 50`, probability is set to 0. This would cause infinite loop.
Author: yingjieMiao <yingjie@42go.com>
Closes #2553 from yingjieMiao/graphx and squashes the following commits:
6adf3c8 [yingjieMiao] [graphX] GraphOps: random pick vertex bug
Diffstat (limited to 'graphx/src/main')
-rw-r--r-- | graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala b/graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala index 02afaa987d..d0dd45dba6 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala @@ -254,7 +254,7 @@ class GraphOps[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED]) extends Seriali * Picks a random vertex from the graph and returns its ID. */ def pickRandomVertex(): VertexId = { - val probability = 50 / graph.numVertices + val probability = 50.0 / graph.numVertices var found = false var retVal: VertexId = null.asInstanceOf[VertexId] while (!found) { |