Repository: spark Updated Branches: refs/heads/branch-1.1 df5a62f51 -> e5ab11387
[graphX] GraphOps: random pick vertex bug When `numVertices > 50`, probability is set to 0. This would cause infinite loop. Author: yingjieMiao <[email protected]> Closes #2553 from yingjieMiao/graphx and squashes the following commits: 6adf3c8 [yingjieMiao] [graphX] GraphOps: random pick vertex bug (cherry picked from commit 51229ff7f4d3517706a1cdc1a2943ede1c605089) Signed-off-by: Ankur Dave <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e5ab1138 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e5ab1138 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e5ab1138 Branch: refs/heads/branch-1.1 Commit: e5ab113871a3cd5abe0dd2466bd855ff2fb1bd20 Parents: df5a62f Author: yingjieMiao <[email protected]> Authored: Mon Sep 29 18:01:27 2014 -0700 Committer: Ankur Dave <[email protected]> Committed: Mon Sep 29 18:02:21 2014 -0700 ---------------------------------------------------------------------- graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/e5ab1138/graphx/src/main/scala/org/apache/spark/graphx/GraphOps.scala ---------------------------------------------------------------------- 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 02afaa9..d0dd45d 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) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
