Greedy coloring

Color the map so neighbours always have different colors. The same idea helps schedule games. Games that share a team need different time slots, and each slot can have its own color.

Mark the colors used by earlier neighbors. Choose the first available color. Another order may use fewer colors.

With adjacency lists, traversal takes O(V + E) time for V vertices and E edges.