Description: clear all
clc
D=[0 6 inf inf 5 6 inf 5 inf
6 0 9 inf inf 9 inf 3 inf
inf 9 0 7 inf inf 4 inf inf
inf inf 7 0 6 4 6 inf 3
5 inf inf 6 0 5 inf inf 4
6 9 inf 4 5 0 5 inf inf
inf inf 4 6 inf 5 0 inf inf
5 3 inf inf inf inf inf 0 inf
inf inf inf 3 4 inf inf inf 0]
[m,n]=size(D)
E=zeros(m,n)
for s=1:m
d=inf.*ones(1,m)
d(1,s)=0
ok=zeros(1,m)
pre=zeros(1,m)
while length(find(ok==1))<m
minD=inf
for k=1:m
if ok(k)==0&&minD>d(k)
minD=d(k)
y=k
end
end
if minD==inf
break
To Search:
File list (Check if you may need any files):
dijkstra.m