
function [P,zerorows,n]=loadCaliforniaMatrix;



Datamatrix=load('/Users/langville/Documents/RESEARCH/LINK/LINKData/California9664.dat');
%load California9664.dat;
j=Datamatrix(:,2);
i=Datamatrix(:,1);
% j holds row indices for P' (col. indices for P), i holds column indices for 
%      P' (row indices for P).  But, indexing starts at 0
%      rather than 1. So increment each element in both vectors.
i=i+1;
j=j+1;
nnzPt=length(j);
n=max(max(i),max(j));
a=ones(nnzPt,1);
Pt=sparse(j,i,a,n,n);
colsumvector=ones(1,n)*Pt;
nonzerocols=find(colsumvector);
zerocols=setdiff(1:n,nonzerocols);
colsumvector(zerocols)=1;

for i=1:n
    Pt(:,i)=Pt(:,i)/colsumvector(i);
end


clear Datamatrix i j a colsumvector nonzerocols;

P=Pt';
zerorows=zerocols;
clear Pt zerocols;

