function [A,zerorows,n]=loadNotreDameMatrix; fid=fopen('/Users/langville/Documents/RESEARCH/LINK/LINKData/notredame.dat','r'); [IJ,count]=fscanf(fid,'%i %i', [2, inf]); fclose(fid); IJ=IJ'; i=IJ(:,1); j=IJ(:,2); % webpages are labeled 0,1,2,.... Change to labels 1,2,3,... i=i+1; j=j+1; nlinks=length(i); %Form v vector v=ones(nlinks,1); %form A' since this is better for Matlab to compute with, then % switch back to A at the end using A=At'; At=sparse(j,i,v); n=max(size(At)); colsumvector=ones(1,n)*At; nonzerocols=find(colsumvector); zerocols=setdiff(1:n,nonzerocols); colsumvector(zerocols)=1; for i=1:n At(:,i)=At(:,i)/colsumvector(i); end A=At'; zerorows=zerocols; clear At zerocols;