Skip to content
Snippets Groups Projects
Commit e5ab1138 authored by yingjieMiao's avatar yingjieMiao Committed by Ankur Dave
Browse files

[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

(cherry picked from commit 51229ff7)
Signed-off-by: default avatarAnkur Dave <ankurdave@gmail.com>
parent df5a62f5
No related branches found
No related tags found
No related merge requests found
...@@ -254,7 +254,7 @@ class GraphOps[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED]) extends Seriali ...@@ -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. * Picks a random vertex from the graph and returns its ID.
*/ */
def pickRandomVertex(): VertexId = { def pickRandomVertex(): VertexId = {
val probability = 50 / graph.numVertices val probability = 50.0 / graph.numVertices
var found = false var found = false
var retVal: VertexId = null.asInstanceOf[VertexId] var retVal: VertexId = null.asInstanceOf[VertexId]
while (!found) { while (!found) {
......
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