LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Predictive Analytics using Networked Data in R

Kurs anzeigen

Anleitung zur Übung

  • Compute one iteration with the PageRank algorithm using page.rank() with network and indicating niter=1. Extract the vector attribute and assign the result to iter1.
  • Repeat the last step with niter=2. Assign the result to iter2.
  • Compute the sum of the absolute difference between the vectors iter1 and iter2.
  • We have computed iter9 and iter10 in the same way as iter1 and iter2. Is the difference between these two iterations less than between iterations 1 and 2.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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(___(___ - ___))
Code bearbeiten und ausführen