1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| a = zeros(14); a(1,2)=600;a(1,3)=500;a(1,4)=800;
a(2,5)=500;a(2,6)=900;a(2,7)=640; a(3,5)=660;a(3,6)=800;a(3,7)=600; a(4,5)=800;a(4,6)=1000;a(4,7)=400;
a(5,8)=800;a(5,9)=1000;a(5,10)=1240; a(6,8)=960;a(6,9)=900;a(6,10)=1200; a(7,8)=1100;a(7,9)=1100;a(7,10)=1000;
a(8,11)=1200;a(8,12)=1300;a(8,13)=1440; a(9,11)=1100;a(9,12)=1000;a(9,13)=1200; a(10,11)=1200;a(10,12)=1100;a(10,13)=900;
a(11,14)=1;a(12,14)=1;a(13,14)=1;
G = digraph(a); plot(G) [path1,d] = shortestpath(G,1,14); highlight(plot(G),path1,'EdgeColor','g') path1 d-1
|