@X-W
2017-06-01T22:07:14.000000Z
字数 1313
阅读 496
作业
<matlab code>
a= [0 15 10 inf inf inf inf;
15 0 3 6 inf inf 17;
10 3 0 inf 4 inf inf;
inf 6 inf 0 4 inf 5;
inf inf 4 4 0 2 inf ;
inf inf inf inf 2 0 6 ;
inf 17 inf 5 inf 6 0 ;]
G=sparse(a);
[Dist,Path]=graphshortestpath(G,3,5)
结果
Dist =
4
Path =
3 5