Greedy and backtracking coloring of sparse graphs