相关代码 |
|
N=13; for i=1:N for j=1:N C(i,j)=inf; end end for i=1:N C(i,i)=0; end C(1,2)=6.0;C(1,13)=12.9; C(2,3)=5.9;C(2,4)=10.3; C(3,4)=12.2;C(3,5)=17.6; C(4,13)=8.8;C(4,7)=7.4; C(4,5)=11.5; C(5,2)=17.6;C(5,6)=8.2; C(6,9)=14.9;C(6,7)=20.3; C(7,9)=19.0;C(7,8)=7.3; C(8,9)=8.1;C(8,13)=9.2; C(9,10)=10.3; C(10,11)=7.7; C(11,12)=7.2; C(12,13)=7.9; for i=1:N for j=1:N if C(i,j) < inf C(j,i)=C(i,j); end end end for i=1:N C(i,i)=0; end R=[4 7 6 5 3 2 1 13 12 11 10 9 8];