开始使用免费开始使用

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.

本练习是课程的一部分

Predictive Analytics using Networked Data in R

查看课程

练习说明

  • 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.

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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(___(___ - ___))
编辑并运行代码