Matlab code of the original Google Page rank algorithm is given below. Using this Matlab code, you can simply put rotated adjacency matrix of any directed network graph as input. That is
L =rot90(rot90( A ))
Similarly, we can say
A =rot90(rot90( L ))
The code can run without any input because the input example and parameter are given exactly as explained in the
of this tutorial. The basic computation in this code is based on
recursive Page Rank formula
% return PageRank vector
% L = Link Matrix (=rotated adjacency matrix)
% d = constant parameter
% Example from Kardi Teknomo's Page Rank tutorial
% is given as input and output of this function.
% Read the full tutorial for more explanation.
% (c) 2012 Kardi Teknomo
L=[1 1 1 1 1 1;
0 1 1 1 1 1;
0 0 1 1 1 1;
0 0 0 1 1 1;
0 0 0 0 1 1;
0 0 0 0 0 1;];
L_c=L./ repmat (c,m,1);
if sum(sum(p))==m || k>256,
Variable k represent the number of iteration and we set limit the loop up to 256 iterations. If you run the code above, it will produce row vector p = [4.3254 0.6488 0.3731 0.2674 0.2106 0.1748].
In the next section, we will encourage you to use the Page Rank tool to compare the Page Rank