World's most popular travel blog for travel bloggers.

Proving NP-completeness of a graph coloring problem

, , No Comments
Problem Detail: 

Given a graph $G=(V,E)$ and a set of colors $k<V$. Find a assignment of colors to vertices that minimizes the number of adjacent vertices in conflict. (Two adjacent vertices are in conflict if they have the same color.)

I want to prove the above problem is NP-complete. Call the above problem P1.

Answer: I am trying to reduce the k-coloring problem.

P2: Given a graph $G=(V,E)$ and set of colors $k<V$ is the graph k-colorable (zero conflicts)?

P2 is feasible iff P1 has optimal value is exactly $0$. Therefore if P1 is solved we know solution to P2.

Is this solution correct? Is it what is suggested by the first comment of user G.Bach in A variation of the graph coloring problem ?

Asked By : Mat

Answered By : Yuval Filmus

First of all, you haven't formulated your problem as a decision problem (a problem that has a YES/NO answer). The decision problem corresponding to your optimization problem is: Given a graph $G$, an integer $k$ and another integer $\ell$, is there a $k$-coloring of $G$ with at most $\ell$ monochromatic edges?

In order to show NP-completeness of a problem $P$, you need to do two things:

  1. Show that $P$ is in NP. This is usually easy. It just means that a putative solution can be verified.
  2. Show that $P$ is NP-hard. In practice, this is (almost) always done by showing that some other NP-hard problem $Q$ is many-one reducible to $P$. This implies that $P$ itself is NP-hard.

A many-one reduction from $Q$ to $P$ is a function $f$, computable in polynomial time, which maps an instance $x$ of $Q$ to an instance $f(x)$ of $P$ such that $x \in Q$ iff $f(x) \in P$.

In your case, it is easy to see that your problem (let's call it MIN-MONOCHROMATIC) is in NP: the NP machine guesses a $k$-coloring of $G$, and verifies (in polynomial time) that there are at most $\ell$ monochromatic edges. In order to show that it is NP-hard, we come up with a many-one reduction $f$ from the NP-hard problem K-COLORING to MIN-MONOCHROMATIC. The reduction $f$ takes a graph $G$ and an integer $k$, forming an instance of K-COLORING, to the instance $(G,k,0)$ of MIN-MONOCHROMATIC (i.e., with $\ell=0$). The definition of coloring implies that $(G,K)$ is in K-COLORING iff $(G,k,0)$ is in MIN-MONOCHROMATIC. Also, clearly $f$ can be computed in polynomial time. So $f$ is a polytime many-one reduction from an NP-hard problem K-COLORING to MIN-MONOCHROMATIC, so we conclude that the latter is NP-hard. Since it is also in NP, it is NP-complete.

As you see, this is the same proof as yours, only with a lot of fluff. At this stage of your education, this fluff is important, since you need to makes sure that you understand the definitions not only intuitively but also formally (both are important). Once you're past this stage, all the details you really need are the ones explained in your current proof.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/22246

0 comments:

Post a Comment

Let us know your responses and feedback