ajout de tous les cours et TP préparés cet été
This commit is contained in:
@@ -24,13 +24,13 @@ def dijkstra(g, s):
|
||||
res[IND[s]] = 0
|
||||
a_faire = [e for e in g[0]]
|
||||
while a_faire != []:
|
||||
ind_courrant = select_min(res, a_faire)
|
||||
sommet_courrant = g[0][ind_courrant]
|
||||
a_faire.remove(sommet_courrant)
|
||||
cout_courrant = res[ind_courrant]
|
||||
ind_courant = select_min(res, a_faire)
|
||||
sommet_courant = g[0][ind_courant]
|
||||
a_faire.remove(sommet_courant)
|
||||
cout_courant = res[ind_courant]
|
||||
for l in g[1]:
|
||||
if l[0]==sommet_courrant:
|
||||
cout_tmp=l[2]+cout_courrant
|
||||
if l[0]==sommet_courant:
|
||||
cout_tmp=l[2]+cout_courant
|
||||
if res[IND[l[1]]]>=cout_tmp:
|
||||
res[IND[l[1]]] = cout_tmp
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user