Advertisement
PlotnikovPhilipp

Untitled

Nov 17th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def bfc(graph):
  2.     visited = []
  3.     distance = {str(i): '' for i in range(1, len(graph) + 1)}
  4.     for i in graph:
  5.         for s, w in i:
  6.             if s in visited:
  7.                 continue
  8.             visited.append(s)
  9.             distance[str(s)] = w
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement