This commit is contained in:
2021-12-15 14:07:38 +01:00
parent 5ae8933fca
commit 57b2d0201d

View File

@@ -28,7 +28,7 @@ def dijkstra(grid):
for neighbour in neighbors(u, grid.shape):
new = dist[u] + grid[neighbour]
if dist[neighbour] > new:
if new < dist[neighbour]:
dist[neighbour] = new
heappush(q, (new, neighbour))