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