MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / bfs

Function bfs

Graphs/basic_graphs.py:89–98  ·  view source on GitHub ↗
(G, s)

Source from the content-addressed store, hash-verified

87
88
89def bfs(G, s):
90 vis, Q = set([s]), deque([s])
91 print(s)
92 while Q:
93 u = Q.popleft()
94 for v in G[u]:
95 if v not in vis:
96 vis.add(v)
97 Q.append(v)
98 print(v)
99
100
101"""

Callers

nothing calls this directly

Calls 1

addMethod · 0.80

Tested by

no test coverage detected