function [pR,pRValues] = PageRank0(G)
% G is an n-by-n connectivity array with no columns that are all zeros,
%   i.e., no dead ends.
% pR is an n-by-1 array with the property that pR(j) is the page rank
%   of page j.

% Generate the transition matrix
[n,n] = size(G);
P = zeros(n,n);
for j=1:n
    P(:,j) = G(:,j)/sum(G(:,j));
end

% Compute the stationary vector
[v,err,its] = StatVec(P,ones(n,1),.00001,1000);
% Sort from large to small...
[w,ind] = sort(-v);
% Set up the page rank vector...
pR = zeros(n,1);
for k=1:n
    % Index of the kth most important webpage is j where
    j = ind(k);
    % The jth webpage has pageRank k...
    pR(j) = k;
end

