小女子floyd算法遇到一点问题 求大神指点一二
function [D,path]=floyd(a)n=size(a,1);
D=a;
path=zeros(n,n);
for i=1:n
for j=1:n
if D(i,j)~=inf
path(i,j)=j;
end
end
end
for k=1:n
for i=1:n
for j=1:n
if D(i,k)+D(k,j)<D(i,j)
D(i,j)=D(i,k)+D(k,j);
path(i,j)=path(i,k)
end
end
end
end
??? function [D,path]=floyd(a)
|
Error: Function definitions are not permitted in this context.