
260
Complex Networks: An Algorithmic Perspective
Algorithm 12.2 Page Rank Alg
1: Input : P = {p
1
,..., p
n
} ⊲ set of n pages
2: k steps
3: Output : page rank values rank
p
, p ∈P
4: E
p
(in) ← ingoing edges to page p
5: E
p
(out) ← outgoing edges from page p
6: for all p ∈P do ⊲ initialize page rank values
7: rank
p
← 1/n
8: end for
9: for r ←1 to k do ⊲ implement for k steps
10: for all p ∈ P do
11: for all e ∈E
p
(out) do
12: w
e
← rank
p
/|E
p
(out)|
13: end for
14: rank
p
←
P
e∈E
p
(in)
w
e
⊲ the sum of the weights of all links pointing to p
i
15: end for
16: end for
and then, the new page rank values are calculated as the sum of the weights of the
ingoing links of pages.
Execution