This commit is contained in:
va270fv 2026-11-17 12:35:33 +00:00
parent c58a389411
commit 756f05dac2

View File

@ -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]
if new_dist < distancii[sused]:
distancii[sused] = new_dist # update dist + path
paths[sused] = new_path
return paths[number_of_nodes - 1] return paths[number_of_nodes - 1]