how can i re-use previous results of a pagerank calculation in python-igraph

366 views Asked by At

I have an ever-changing graph. Over time, a few number of vertices are added and a few new edges appear (nodes are not deleted). If i have a previous pagerank calculation result, how can i re-use it in order to improve speed?

The python igraph module seems nifty and all, but i can't find anything relevant. The specified improvement should be useful, as pr is a random algorithm. I have a prototype written in python, but i'd really like to use a C library wrapper for this. Anyone else experienced that?

1

There are 1 answers

0
Tamás On

First of all, PageRank is not a random algorithm. The PageRank equation boils down to calculating the dominant eigenvector of a sparse matrix (well, not exactly a sparse matrix but the sum of a sparse matrix plus some other matrix for which we can calculate vector products as fast as if it were sparse), so it's completely deterministic.

Second, unfortunately there is no way to tell the internal implementation of the PageRank algorithm that the result is expected to be "close" to a previous PageRank vector, although theoretically it could be useful because the eigenvector calculation might converge faster if it starts from a vector that is already close to the real eigenvector.

However, igraph uses PRPACK to calculate PageRank vectors since version 0.7, and PRPACK is already highly optimized, so it might turn out that it's fast on your graph even if you don't specify an "eigenvector hint" in advance. I would give it a try first and see how it goes.