U10fix3
This commit is contained in:
parent
9903988d4d
commit
006c253ad8
@ -12,4 +12,18 @@ def shortest_path(number_of_nodes, connections):
|
||||
dist[start] = 0
|
||||
path[start] = [start]
|
||||
|
||||
change = True
|
||||
while change:
|
||||
change = False
|
||||
for i in connections:
|
||||
first = i[0]
|
||||
to = i[1]
|
||||
length = i[2]
|
||||
for i,j in [(first, to), (to, first)]:
|
||||
|
||||
if dist[i] is None:
|
||||
continue
|
||||
if j in path[i]:
|
||||
continue
|
||||
|
||||
return path[end]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user