dandaosd
This commit is contained in:
parent
c58a389411
commit
756f05dac2
@ -38,5 +38,14 @@ def shortest_path(number_of_nodes, connections):
|
|||||||
|
|
||||||
boli[teraz] = True
|
boli[teraz] = True
|
||||||
|
|
||||||
|
# check susedov
|
||||||
|
for sused, weight in susedy[teraz]:
|
||||||
|
new_dist = distancii[teraz] + weight
|
||||||
|
new_path = paths[teraz] + [sused]
|
||||||
|
|
||||||
return paths[number_of_nodes - 1]
|
if new_dist < distancii[sused]:
|
||||||
|
distancii[sused] = new_dist # update dist + path
|
||||||
|
paths[sused] = new_path
|
||||||
|
|
||||||
|
|
||||||
|
return paths[number_of_nodes - 1]
|
||||||
Loading…
Reference in New Issue
Block a user