for each u ∈ G.V - {s}
u.color = white
s.color = red
Q = ∅
Q.enqueue(s)
while Q ≠ ∅
u = Q.dequeue()
for each v ∈ G.Adj[u]
if v.color = u.color
output "not bipartite!"
if v.color = white
if u.color = blue
v.color = red
else
v.color = blue
Q.enqueue(v)