U10fix4
This commit is contained in:
parent
006c253ad8
commit
09f655e794
@ -26,4 +26,17 @@ def shortest_path(number_of_nodes, connections):
|
||||
if j in path[i]:
|
||||
continue
|
||||
|
||||
new_dist = dist[i] + length
|
||||
new_path = path[i] + [j]
|
||||
|
||||
bet = False
|
||||
if dist[j] is None:
|
||||
bet = True
|
||||
elif new_dist < dist[j]:
|
||||
bet = True
|
||||
if bet:
|
||||
dist[j] = new_dist
|
||||
path[j] = new_path
|
||||
change = True
|
||||
|
||||
return path[end]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user