# グラフgと始点ノードs breadthFirstSearch(g, s): Queue que for i ← 0 to g.N - 1: color[i] ← WHITE color[s] ← GRAY que.enqueue(s) while not que.empty(): u ← que.dequeue() color[u] ← BLACK for v in g.adjLists[u]: if color[v] = WHITE: color[v] ← GRAY que.enqueue(v)