% Testing the PageRank algorithm for a five-page
% "Internet."
%
% Samuli Siltanen Nov 2015

% Collect the link information into a matrix
A = [...
    [0 1 0 1 1];...
    [0 0 1 1 1];...
    [1 0 0 1 0];...
    [0 0 0 0 1];...
    [0 0 1 0 0];...
    ];

% Solve the matrix eigenvalue problem
[V,D] = eig(A)

% Pick out the eigenvector containing
% the page rankings
rankvec = V(:,1);
rankvec = rankvec/sum(rankvec);

    