第八章 图与网络模型及方法应用 end end end for k=1:n for i=1:n for j=1:n if a(i,j)>a(i,k)+a(k,j) a(i,j)=a(i,k)+a(k,j); path(i,j)=path(i,k); end end end end dist=a(sb,db); mypath=sb; t=sb; while t~=db temp=path(t,db); mypath=[mypath,temp]; t=temp; end return 205