Speed coloring individual vertices
Speed coloring individual vertices

Instead of iterating over potential colors and searching for each neighbor to see if it already has that color (requires hashing to search the unordered map), first iterate over all the neighbors and put their colors in a set. Then find the lowest gap in this set and make that the color.

leonoverweel/graph-coloring,leonoverweel/graph-coloring