faire en utilisant l'algorithme de Dijkstra en matlab?
Show older comments
je voulais que vous m'aider j'ai 4 (A,B,C,D,E)nodes de A,B=5,A,C=2;B,C=1;C,D=1;B,E=7;D,E=6;.comment faire en utilisant l'algorithme de Dijkstra en matlab pour avoir le chemin le plus court si vous pouvez me donner le programme de faire ça merci bcq !
1 Comment
Ashish Uthama
on 22 Feb 2011
translation:
http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=en&u=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fanswers%2F1703-je-voulais-que-vous-m-aider-j-ai-4-a-b-c-d-e-nodes-de-a-b-5-a-c-2-b-c-1-c-d-1-b-e-7-d-e-6-comment
Answers (2)
Oliver Woodford
on 21 Feb 2011
0 votes
clc;
s=[1 1 1 2 3 3 3 4 4 5 5 6 6 6 7 7 7 8 8 9 9 10 10 11];
t=[2 3 4 5 5 7 13 7 8 6 12 10 12 13 8 10 13 9 10 10 12 11 13 12];
weights=[3 5 4 1 3 7 6 4 2 5 10 3 2 1 1 3 1 2 5 6 7 1 1 1];
G=graph(s,t,weights)
plot(G,'EdgeLabel',G.Edges.Weight)
s1=[1 2 5];
t1=[2 5 10 ];
weights1=[3,1,10];
hold on
L=graph(s1,t1,weights1)
plot(L,'r',L.Edges.Weight,)
Categories
Find more on Dijkstra algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!