scala implementation graph coloring