Exponential time algorithms for graph coloring


Similar documents
Small Maximal Independent Sets and Faster Exact Graph Coloring

Spectral graph theory

Lecture 4: The Chromatic Number

P versus NP, and More


CSC 373: Algorithm Design and Analysis Lecture 16


Mean Ramsey-Turán numbers

Definition Given a graph G on n vertices, we define the following quantities:

Partitioning edge-coloured complete graphs into monochromatic cycles and paths

princeton univ. F 13 cos 521: Advanced Algorithm Design Lecture 6: Provable Approximation via Linear Programming Lecturer: Sanjeev Arora

Generating models of a matched formula with a polynomial delay

Lecture 17 : Equivalence and Order Relations DRAFT

The chromatic spectrum of mixed hypergraphs

Zachary Monaco Georgia College Olympic Coloring: Go For The Gold

Even Faster Algorithm for Set Splitting!

Every tree contains a large induced subgraph with all degrees odd

Lecture 7: NP-Complete Problems

Combinatorics: The Fine Art of Counting

Lecture 6: Approximation via LP Rounding

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms


Best Monotone Degree Bounds for Various Graph Parameters

Sample Induction Proofs

5.1 Bipartite Matching

High degree graphs contain large-star factors


Definition. A graph is a collection of vertices, and edges between them. They are often represented by a drawing:

CSL851: Algorithmic Graph Theory Semester I Lecture 1: July 24

Approximation Algorithms: LP Relaxation, Rounding, and Randomized Rounding Techniques. My T. Thai

Solutions to Exercises 8

Homework MA 725 Spring, 2012 C. Huneke SELECTED ANSWERS

Chapter 8 Independence

What s next? Reductions other than kernelization

Combinatorial 5/6-approximation of Max Cut in graphs of maximum degree 3

Coloring Eulerian triangulations of the projective plane

Two General Methods to Reduce Delay and Change of Enumeration Algorithms

Chapter 4. Trees. 4.1 Basics

1 Basic Definitions and Concepts in Graph Theory

An Empirical Study of Two MIS Algorithms

Introduction to Logic in Computer Science: Autumn 2006

1 Approximating Set Cover

A Turán Type Problem Concerning the Powers of the Degrees of a Graph

Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24

Algorithm Design and Analysis Homework #6 Due: 1pm, Monday, January 9, === Homework submission instructions ===


3. Markov property. Markov property for MRFs. Hammersley-Clifford theorem. Markov property for Bayesian networks. I-map, P-map, and chordal graphs

The positive minimum degree game on sparse graphs

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs


Generalized Induced Factor Problems

Ph.D. Thesis. Judit Nagy-György. Supervisor: Péter Hajnal Associate Professor

A Working Knowledge of Computational Complexity for an Optimizer

JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004

The Approximability of the Binary Paintshop Problem

Weighted Sum Coloring in Batch Scheduling of Conflicting Jobs

Resource Allocation with Time Intervals

2.3 Scheduling jobs on identical parallel machines

Mathematical Induction

Finding and counting given length cycles

Rational exponents in extremal graph theory

Instructor: Bobby Kleinberg Lecture Notes, 5 May The Miller-Rabin Randomized Primality Test

Lecture Notes on Spanning Trees

On the Relationship between Classes P and NP

Fair cost allocations under conflicts a game-theoretic point of view


OHJ-2306 Introduction to Theoretical Computer Science, Fall


Introduction to Graph Theory

MATH 304 Linear Algebra Lecture 16: Basis and dimension.

Basic Notions on Graphs. Planar Graphs and Vertex Colourings. Joe Ryan. Presented by

The degree, size and chromatic index of a uniform hypergraph

R u t c o r Research R e p o r t. Boolean functions with a simple certificate for CNF complexity. Ondřej Čepeka Petr Kučera b Petr Savický c

More Mathematical Induction. October 27, 2016

Introduction to Algorithms. Part 3: P, NP Hard Problems

Energy Efficient Monitoring in Sensor Networks

Cycle transversals in bounded degree graphs

Lecture 1: Course overview, circuits, and formulas



Large induced subgraphs with all degrees odd

Tutorial 8. NP-Complete Problems

Cycles and clique-minors in expanders

Weighted Sum Coloring in Batch Scheduling of Conflicting Jobs

Induction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition

Sample Problems in Discrete Mathematics

Discrete Mathematics, Chapter 5: Induction and Recursion

Satisfiability of Boolean Expressions

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, Notes on Algebra

Graph Classification and Easy Reliability Polynomials

Graphs without proper subgraphs of minimum degree 3 and short cycles

On the k-path cover problem for cacti

Diversity Coloring for Distributed Data Storage in Networks 1

1 Definitions. Supplementary Material for: Digraphs. Concept graphs

Clique coloring B 1 -EPG graphs

Lecture 22: November 10

2.1 Complexity Classes



Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V [k]. Given a k-labeling, an edge is monochromatic if both its endpoints are assigned the same label. A k-labeling is a k-coloring if no edge is monochromatic. The chromatic number of a graph is the minimum k for which a k-coloring exists. Observe that in a k-coloring, every color class is an independent set (no two vertices induce an edge of G), and hence a k-coloring is a partitioning of V into k independent sets, and also a covering V by k independent sets. Deciding whether a graph has a k-coloring for k 3 is NP-hard. Hence one would not expect to find a polynomial time algorithm for it. The trivial algorithm will try all possible k-labeling, and would take time k n. The purpose of this write-up is to show that despite NP-hardness, there is plenty of room for designing algorithms that are substantially more efficient than the trivial algorithm. Throughout we assume that all graphs are connected, since otherwise each connected component can be colored separately. In analyzing running times of algorithms, we shall omit factors that are polynomial in n and shall only be concerned with the exponential terms. For example, a running time of n 3 2 n will be denoted as O (2 n ). 2 Algorithms for 2-coloring 2-coloring, or equivalently, determining whether a graph is bipartite, can be solved in polynomial time. A polynomial time algorithm for 2-coloring can assign an arbitrary color to an arbitrary vertex, and thereafter iteratively pick a yet uncolored vertex that has a colored neighbor and color it with the color not assigned to its neighbor. This algorithm must produce a 2-coloring if it exists, and must run into a monochromatic edge otherwise. An optimization problem associated with 2-coloring is to find a 2-labeling with fewest monochromatic edges, or equivalently, with the largest number of properly colored edges. This last problem is known as max-cut and is NP-hard. We remark here that this is a prototypical example of what we shall later in the course call a unique game. Take home message. 2-coloring is in P. Its optimization version max-cut is NP-hard. 3 Algorithms for 3-coloring 3.1 Spanning trees Observe that a tree on n-vertices has exactly 3 2 n 1 different 3-colorings: color one vertex arbitrarily, and then iteratively every uncolored vertex with a colored neighbor has two possible colors. 1

Hence to 3-color a graph, pick an arbitrary spanning tree and check whether any of the 3-coloring of the spanning tree is a 3-coloring of the graph. Running time O (2 n ). 3.2 Deterministic reduction to 2-coloring Recall that 3-coloring is the same as partitioning V into three independent sets. Once one color class is given, the remaining graph needs to be 2-colored, which can be done in polynomial time. The smallest color class has size at most n/3. Finding it by exhaustive search involves checking n/3 ( n ) i=1 i sets. As we ignore polynomial factors, this last term can be replaced by ( ) n n/3 = n! (n/3)!(2n/3)! 3 n/3 (3/2) 2n/3 = (27/4) n/3. Running time O ( (27/4) n/3) O (1.89 n ). Take home message. To design exponential time algorithms, one needs to know polynomial time algorithms. 3.3 Randomized reduction to 2-SAT Associate with vertex v i a Boolean variable x i. Decide on a random interpretation as colors for the Boolean values of the variables. That is, for every v i independently, pick a random color to correspond to x i = 1, a different random color to correspond to x i = 0, and discard the remaining color. Given this interpretation, set up a 2CNF formula where each edge (v i, v j ) contributes either one or two clauses involving the respective x i, x j, and expressing that the values of its endpoints correspond to a legal coloring of the edge. There is a 3-coloring consistent with the random interpretation if and only if the corresponding 2CNF formula is satisfiable. As 2SAT can be solved in polynomial time (if you do not know how, please look this up), this gives a polynomial time algorithm for 3-coloring provided that the random interpretation did not discard the correct color of any vertex (correct with respect to some arbitrary 3-coloring). The probability of not discarding the correct color of a vertex is 2/3, and by independence, the probability of this happening for all vertices is (2/3) n. Hence running the above algorithm multiple times, each time with fresh randomness, the expected number of tries needed in order to find a 3-coloring (if it exists) is at most (3/2) n (and perhaps smaller as the graph may have several 3-colorings). An alternative view of the above algorithm is through the notion of list coloring. In a list coloring problem, every vertex is given a list of permissible colors, and one is required to obtain a legal coloring by selecting one color from each list. The randomized algorithm above takes a list coloring problem with lists of size 3 (in our case, initially all vertices have identical lists, but the algorithm applies more generally), discards at random one color from each list, and obtains a list coloring problem with lists of size 2. List coloring problems with lists of size 2 are solvable in polynomial time, by using a variation on the algorithm for 2-coloring (or by viewing them as 2SAT instances). We note that the above algorithm is randomized. If stopped after any fixed number of iterations it might fail to find a 3-coloring even if one exists. This is one reason for preferring deterministic algorithms. There are various techniques for converting randomized algorithms into deterministic ones, and the term commonly used in this context is derandomization. However, this topic is beyond the scope of the current course, and we shall consider randomized algorithms to be essentially as legitimate as deterministic ones. Expected running time O(1.5 n ). Take home message. Randomized algorithms are useful. 2

3.4 Tighter reduction to 2-coloring The homework assignment presents an approach that combines Section 3.2 with bounds on the number of maximal independent sets [5], and gives a 3-coloring algorithm with running time O (3 n/3 ) O (1.45 n ). 3.5 The exponential time hypothesis ETH For 3-coloring we have seen a sequence of algorithms which improves the base of the exponent for the running time from 3 (the trivial algorithm) to around 1.45 (the homework assignment). Even better bounds, below 1.33, are known [1]. It is a major open question whether for every b > 1, there is an algorithm for 3-coloring running in time O (b n ). A question of a similar nature can be asked for other NP-hard questions, such as 3SAT. The exponential time hypothesis ETH [3] conjectures that for 3SAT, the answer is negative. If true, this would imply (by an appropriate reduction from 3SAT to 3-coloring) that the answer for 3-coloring is negative as well. Take home message. For 3-coloring algorithms, determining the best running time (base of exponent) is open. Reductions among NP-hard problems and the ETH hypothesis tie between this question and similar questions for other NP-hard problems. 4 Algorithms for k-coloring 4.1 Dynamic programming Dynamic programming is an algorithmic technique with many applications. Here is a sketch of how it can be used in the context of k-coloring. Use exhaustive search to find and list all sets that are 1-colorable (independent sets). Now proceed in an inductive manner. Given all sets that are 1-colorable and all sets that are (j 1)- colorable, find all sets that are j-colorable. For each candidate set, try all ways of partitioning it in two and checking (using previously computed and stored steps) whether one part is 1-colorable and the other is (j 1)-colorable. Hence the total number of checks is S V 2 S = 3 n. (A ternary vector can represent a check. The 0 entries are those vertices not in S. the 1 entries are those vertices in the independent set. The 2 entries are those in the (j 1)-colorable set.) Running time O (3 n ). The space of this algorithm is also exponential, O (2 n ). Remark. By considering only maximal independent sets (similar to Section 3.4), the dynamic programming based algorithm can be modified to have an improved running time of O (2.45 n ) (see [4]). Take home message. Dynamic programming is a method that avoids redoing computations over and over again in exhaustive search. This leads to significant savings in running times, typically at the expense of requiring more space to store previously computed values. 4.2 Inclusion-exclusion Rather than find a k-coloring, let us consider the more difficult task of counting how many different k-colorings there are. Given the number of k-coloring, we can check if this number is at least 1, and by this solve the decision problem. As with essentially all NP-complete problems, the search problem of k-coloring is reducible to the decision problem. For example, try to add edges to G and check if it remains k-colorable. When no more edges can be added, a simple greedy algorithm that assigns to each vertex the least color not yet assigned to any of its neighbors will k-color the graph. 3

For the counting version, it would be convenient to think of k-colorings as coverings of V by k independent sets, without requiring that the independent sets are disjoint. In fact, independent sets in the cover are allowed to be identical to each other. Moreover, the k independent sets are assumed to be ordered, and k-coverings that differ from each other only in the order of (nonidentical) independent sets are considered as different coverings. Still, under these conventions, the number of k-covering is positive if and only if the number of k-colorings is positive, and this suffices for using the counting algorithm as a subroutine that k-colors the graph. Let c k (G) denote the number of coverings of V by k independent sets in G. The main idea to get a relatively efficient counting algorithm for c k (G) is to use the inclusion-exclusion formula. (A similar idea was used by Ryser to compute the permanent, which implies counting perfect matchings. See algorithms course from Spring 2010.) Given a set X V, let a(x) denote the number of independent sets in the subgraph induced on X. Proposition 1 With definitions as given above, c k (G) = X ( 1) n X (a(x)) k where X ranges over nonempty subsets of V (including V ). Proof. Observe that (a(x)) k counts the number of ordered k-tuples of independent sets in the subgraph induced on X. To prove the equality, consider any ordered collection of (possibly overlapping) independent sets I 1,..., I k. Denote their union by U. If U = V they should contribute 1 to the left hand side. Indeed, they contribute 1 to the right hand side (only the term X = V counts them, and with coefficient +1). If U V then they should not contribute to the left hand side. Indeed, their contribution to the left hand side is 0, as there are as many even sized sets X as odd sets X sandwiched between Y and V (including Y and V ). The expression for c k (G) in the proposition involves the terms a(x) for all X V (except for the empty set). We can compute all of them simultaneously in time O (2 n ) using dynamic programming. For the empty set we have a( ) = 0. Having computed and stored a(x) for all X with X s, we can compute a(x) for a set X with X = s + 1 by the following inductive approach. Let v be an arbitrary vertex in X, and let N X (v) be the set of neighbors of v that are contained in X. Then a(x) = 1 + a(x v) + a(x v N X (v)). (The first term is the independent set containing only v, the second counts independent sets not containing v, and the third counts independent sets containing v and at least one more vertex.) Having, computed and stored all a(x), using Proposition 1 one can compute c k (G) in time O (2 n ). The above algorithm is taken from [2], which proves additional results using similar techniques. Running time O (2 n ). The algorithm also uses space O (2 n ). Take home message. Counting problems are at least as difficult as the corresponding decision problems. Nevertheless, sometimes the fastest known algorithms for a decision problem go through its counting version. Typically, in these cases the counting algorithms use algebraic expressions that involve cancelation effects. 4.3 Open questions It is not known whether there is a k-coloring algorithm that runs in time O (b n ) with b < 2. Likewise, it is not known whether there is an O (2 n ) algorithm for k-coloring that only uses polynomial space, though polynomial space algorithms that use somewhat more time (say, O (2.3 n )) are known. 4

References [1] Richard Beigel, David Eppstein: 3-coloring in time O(1.3289 n ). J. Algorithms 54(2): 168 204 (2005). [2] Andreas Bjorklund, Thore Husfeldt, Mikko Koivisto: Set Partitioning via Inclusion-Exclusion. SIAM J. Comput. 39(2): 546 563 (2009). [3] Russell Impagliazzo, Ramamohan Paturi: On the Complexity of k-sat. J. Comput. Syst. Sci. (JCSS) 62(2):367 375 (2001). [4] Eugene L. Lawler: A Note on the Complexity of the Chromatic Number Problem. Inf. Process. Lett. (IPL) 5(3):66 67 (1976). [5] J. W. Moon, L. Moser: On cliques in graphs. Israel Journal of Mathematics 3: 23-28 (1965). 5