Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
None
-
None
-
None
Description
Email:
---------- Forwarded message ----------
From: Yunkai Zhang <bennyzyk@gmail.com>
Date: Fri, Jun 24, 2011 at 9:51 AM
Subject: A bug in the PageRank example
To: hama-user@incubator.apache.org
Hi,
I am playing with the pagerank example from trunk and found there is a bug
in the code.
If I assign any value other than 0.85 to the damping factor, the results
won't sum to 1.
For example: Set damping factor to 0.5
11/06/23 17:28:05 INFO graph.PageRankBase: -------------------- RESULTS
--------------------
11/06/23 17:28:06 INFO graph.PageRankBase: stackoverflow.com |
0.052213531500120945
11/06/23 17:28:06 INFO graph.PageRankBase: nasa.gov | 0.04235399497763073
11/06/23 17:28:06 INFO graph.PageRankBase: facebook.com |
0.030321424044325564
11/06/23 17:28:06 INFO graph.PageRankBase: yahoo.com | 0.05650175656380897
11/06/23 17:28:07 INFO graph.PageRankBase: youtube.com |
0.025716796492259456
11/06/23 17:28:07 INFO graph.PageRankBase: google.com | 0.07350857237752877
11/06/23 17:28:07 INFO graph.PageRankBase: twitter.com |
0.030321424044325564
The sum is 0.3ish.
Therefore, I read the code. I think a possible reason is that the value of *
ALPHA* is hard-coded. (Formula: P = ALPHA + 0.85 * sum, ALPHA = 0.15 /
NumVertices() )
In PageRank.java, line 167: ALPHA = 0.15 / (double) numOfVertices;
I think 0.15 should be replaced by (1 - DAMPING_FACTOR).
---------------------
We have to change the alpha to (1 - DAMPING_FACTOR).