%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % FIFO label-correcting algorithm % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % T,H are tail and head nodes of all arcs, COST is the cost vector. % A{} are the out-arc cells given by netdata. % s---starting node s = input('give the starting node '); pred=zeros(1,N); d=inf*ones(1,N); % initialization d(s)=0; LIST=[s]; while ~isempty(LIST) i=LIST(1); LIST=setdiff(LIST,[i]); kk=A{i}; jj=H(kk); [d(jj), index]=min([d(jj); d(i)+COST(kk)']); pred(jj(find(index==2)))=i; LIST=[LIST setdiff(jj(find(index==2))',LIST)]; end%while pred d