% Experiments with a simple pagerank algorithm
%
% Samuli Siltanen November 2012

% Define adjacency matrix corresponding to the "five-page Internet"
% described in the lectures
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]]

% Compute eigenvalues and eigenvectors
[V,D] = eig(A)


% Pick out the relevant eigenvector
r = V(:,1);

% Normalize and display the ranking vector
r = r/sum(r)

