10 lines
169 B
Plaintext
10 lines
169 B
Plaintext
|
BFS(G, s):
|
||
|
queue Q
|
||
|
s <- visited
|
||
|
Q.add(s)
|
||
|
while (Q.not_empty):
|
||
|
u = Q.pop
|
||
|
for a in u.connections:
|
||
|
if a is unvisited:
|
||
|
Q.add(a)
|
||
|
a <- visited
|