check if a graph can be colored with m colors