Advertisement
HellFinger

DS

Oct 14th, 2019
242
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement