Smartsheet interview question

implement a coloring algorithm using bfs/dfs