On Tue, Mar 19, 2013 at 4:21 PM, Tamás Nepusz
<address@hidden> wrote:
Hi,
> I am trying to compute pagerank for a graph and I am getting strange values for pagerank. to my knowledge, the page rank values should be between 0 and 1 but i get very large or very small number (> 1 and < 0). I attach the .gml file and here is the output. Please let me know what I am doing wrong or is this graph some strange special case?
So I've tried your code with an experimental branch of igraph which uses the excellent PRPACK package to calculate PageRank scores instead of the ARPACK solver. The good news is that it works flawlessly with your graph as well as all our test cases. The not-so-good news is that it will make its way into igraph 0.7 only. In the 0.6.5 version, I found that lowering the damping value (i.e. increasing the teleportation probability during the PageRank calculation) seemed to resolve the stability issues for your particular graph; for instance, g.pagerank(damping=0.75) seems to work reliably:
>>> g = igraph.load(f)
>>> for i in xrange(1000):
... pr = g.pagerank(damping=0.75)
... if min(pr) < 0 or max(pr) > 1:
... raise ValueError("bug")
...
The above code snippet runs fine for me, meaning that PageRank managed to converge in all the 1000 executions. Note that changing the damping value changes the value of all the PageRank scores, but the ordering of the nodes should be the same (I guess).
Best,
--
Tamas