Changes in PageRank
The PageRank formula \(\vec{PR}=\alpha \cdot A \cdot \vec{PR} + (1-\alpha)\cdot \vec{e}\) can be solved for \(\vec{PR}\) iteratively. In each iteration, the current value of \(\vec{PR}\) is used to compute a new value that is closer to the true value. This means that the difference between the \(\vec{PR}s\) of every two subsequent iterations becomes smaller and smaller until \(\vec{PR}\) converges to the true value and the difference becomes (almost) zero. In this exercise, you will inspect the PageRank algorithm and how it converges.
This exercise is part of the course
Predictive Analytics using Networked Data in R
Exercise instructions
- Compute one iteration with the PageRank algorithm using
page.rank()
withnetwork
and indicatingniter=1
. Extract the vector attribute and assign the result toiter1
. - Repeat the last step with
niter=2
. Assign the result toiter2
. - Compute the sum of the absolute difference between the vectors
iter1
anditer2
. - We have computed
iter9
anditer10
in the same way asiter1
anditer2
. Is the difference between these two iterations less than between iterations 1 and 2.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Compute one iteration of PageRank
iter1 <- page.rank(___, algo = 'power', options = list(niter = ___))$vector
# Compute two iterations of PageRank
iter2 <- ___(___, algo = 'power', options = list(niter = ___))$vector
# Inspect the change between one and two iterations
sum(abs(___ - ___))
# Inspect the change between nine and ten iterations
sum(___(___ - ___))