% Experimenting with the adjacency matrix from the five-page internet
% example and the power method
%
% Samuli Siltanen November 2012

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]];

[V,D] = eig(A);

% Choose a vector
x_current = [1;3;3;3;-1];

% Iterate
for iii = 1:40
    x_old     = x_current;
    x_current = A*x_old;
    
    
    datavec = zeros(size(x_old));
    for jjj = 1:length(x_old)
        datavec(jjj) = x_current(jjj)/x_old(jjj);
    end
    disp([datavec.'])
    
    pause
end


