This is an example of a greedy coloring algorithm.
The breadth first search (BFS) will implicitly choose an ordering for you.
So the algorithm is correct, but will not always give the optimal coloring (i.e. least number of colours used).
A more common ordering is to order the vertices by their degree, known as the Welsh–Powell algorithm.