Advertisement
HellFinger

DS

Oct 14th, 2019
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. while q:
  2.     now = q[0]
  3.     q.popleft()
  4.     for i in range(0, (len(matrix[now]))):
  5.         if (matrix[now][i] != 0):
  6.             if used[i] == 0 or used[i] > used[now] + matrix[now][i]:
  7.                 q.append(i)
  8.                 used[i] = used[now] + matrix[now][i]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement