資源簡介
dijkstra算法,用matlab實現,本人自己寫的。有需要的可以參考下。
代碼片段和文件信息
w=[050inf402510;5001520inf25;
????inf1501020inf;40201001025;
????25inf2010055;1025inf25550];
S=[111111];%S集
SL=[123456];%S補集
L=[0infinfinfinfinf];%表從頂點u0到v的一條路的權
Z=[111111];%v的父親點,用以確定最短路的路線
n=1;?
u=1;
j=1;
while(1)
????count=0;
????for?i=2:6
????????if?SL(i)~=1
???????????count=count+1;
????????end
????end
????if?count==0
評論
共有 條評論