資源簡(jiǎn)介
dijkstra算法,用matlab實(shí)現(xiàn),本人自己寫的。有需要的可以參考下。
代碼片段和文件信息
w=[050inf402510;5001520inf25;
????inf1501020inf;40201001025;
????25inf2010055;1025inf25550];
S=[111111];%S集
SL=[123456];%S補(bǔ)集
L=[0infinfinfinfinf];%表從頂點(diǎn)u0到v的一條路的權(quán)
Z=[111111];%v的父親點(diǎn),用以確定最短路的路線
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
評(píng)論
共有 條評(píng)論