Introduction Case

The order of paid advertisements that you see on Google is partially determined by Google adwords. However, the website ranking for all other websites is determined by the Google PageRank algorithm. This exercise will cover this algorithm, using the following example.

PageRank

STEP 3: Optimal k determination

How many updates do we need to arrive at equilibrium? To answer this question, we need to check when the rows have the same value as the previous row. If this sum is 8, all values are the same as in the previous iteration, so we have reached equilibrium state.

min(which(rowSums(pagerank==rbind(rep(1,8), pagerank[1:nrow(pagerank)-1,]))==ncol(pagerank)))-1

Note: we subtract 1 because the first line is the initial state

Practice

PageRank_Exercise

Exercise

Determine the optimal k of the network that is shown above and store it as k.