BFS
BFS uses Queue.
There are 3 color stages in every vertex: White (not visited yet), Grey (already visited, not printed yet), and Black (already printed).
Vertex v
While (semua v belum hitam)
v = paling kiri di queue Q
print v
while (v ada tetangga)
cek tetangga v
If (tetangga = putih)
u = tetangga warna putih
Input u ke Q
u = jadi warna abu
jadikan u sebagai anak (child) dari v di BFS-Tree T
v = jadi warna hitam
Dequeueing v from Q
Time Complexity: O(V+E) where V is number of vertices in the graph and E is number of edges in the graph.