5

Hello everyone I am studying for an exam on logic and computability, I am trying to tackle a specific problem so any help would be greatly appreciated:

Let $G = (V,E)$ be an undirected graph with vertex set $V$ and edge set $E$. A 3-coloring of $G$ is a map $\chi:V\to \{R,G,Y\}$ such that if $\{x,y\}\in E$ then $\chi(x)\neq \chi(y)$. (Let $R,G,Y$ stand for red, blue, and yellow respectively).

<p>Suppose $n &gt; 1$ and let $V_n = \{0,1,\cdots,n-1\}$ and let $G_n = (V_n,E_n)$ be an undirected graph with vertex set $V_n$. For each $i$, $0 \leq i &lt; n$ let $R_i,B_i,Y_i$ be propositional variables. We can think of $i$ being a node so $R_i$ says node $i$ has a color of red.  </p>

<p>Give a propositional formula $A_n$ using the variables $\{R_i,B_i,Y_i | 0 \leq i &lt; n\}$ such that $A_n$ is satisfiable iff $G_n$ has a 3-coloring. Do this in such a way that $A_n$ can be computed efficiently from $G_n$ (e.g. don't define $A_n$ to be $R_1$ if $G_n$ has a three coloring and ($R_1 \wedge \neg R_1$) otherwise).</p>

My inclination for a question like this is to set up some sort of CNF formula, that is come up with a set of clauses that set out to take care of different properties. For instance I believe for something like this I need a clause that deals with the case that every node has a color, maybe one that deals with every node cannot have more than one color, and that every node cannot be the same color as an adjacent node? I am not really sure how to illustrate that last one or if there are cases that I am missing. Thank you for any help!

$\textbf{NOTE}$ I put this under the label homework since it is homework in the sense that I do need to learn it for my exam but it won't be marked.

InsigMath
  • 2,073
  • 2
  • 18
  • 27
  • 1
    Your plan is good. For dealing with adjacent nodes: what you'll do is loop through the edges of the graph, adding some clauses to your formula for each edge. (This is the kind of thing they have in mind when they say "$A_n$ can be computed [...] from $G_n$".) –  Apr 23 '14 at 00:14

1 Answers1

3

The formula can be something like $$ \bigwedge_{i} \Big( (R_i\vee G_i\vee Y_i) \wedge (\neg R_i\vee \neg G_i) \wedge (\neg R_i\vee \neg Y_i) \wedge (\neg G_i\vee \neg Y_i)\Big) \wedge \\ \bigwedge_{(i,j)\in E} \Big( (\neg R_i\vee \neg R_j) \wedge (\neg G_i\vee \neg G_j) \wedge (\neg Y_i\vee \neg Y_j) \Big) $$ The first part states that every vertex has a colour but only one. The second part says that the neighbouring vertices have different colours.

G.Kós
  • 14,297
  • Nice answer :) ... yeah I had something like that in mind but I often have difficulty really putting it down properly! – InsigMath Apr 30 '14 at 15:57