page rank algorithm iterative conversion

159 Views Asked by At

I am trying to implement a pagerank algorithm using the formula: p = the probability vector og getting on a page Pbeginning = matrix(n,1) full with 1/n

S = the matrix with damping factor of the network.

now I have to do iterative till they converge:

for i in range(10): p = S * p

Howerver how do I know when they converge? Some people suggest abs(pn-1 - pn) and keep iterating till this is small, others suggest just iterating 20 times or so.

1

There are 1 best solutions below

0
On

$20$ iterations need not work for some graph network.

According to "The PageRank Citation Ranking - Bringing Order to the Web" by Page, Brin, Motwani, Winograd, Section $2.6$, we set a small positive number $\delta$, which is an error tolerance, we terminate when $$\|R_{i+1}-R_i\|_1 \le \delta.$$

We can also see other norms are used as well on Wikipedia page.

Remark: Neither proved convergence has attained, but it is a common practice.