# hw10sol - CS 473 Homework 10 Solutions Spring 2010 1 Show...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 473 Homework 10 Solutions Spring 2010 1. Show that 2SAT is NP-hard, or describe a polynomial-time algorithm to solve it. Solution: We describe a polynomial-time algorithm to solve 2SAT. Given a 2CNF boolean formula φ , the implication graph G φ is defined as follows. For each variable x i in φ , the graph contains two vertices x i and x i . For each clause ( u ∨ v ) in φ , the graph contains two edges u → v and u → v . (Here, x i = x i .) The disjunction ( u ∨ v ) is logically equivalent to the implications u ⇒ v and v ⇒ u . Thus, the graph G φ is a direct encoding of φ with edges representing implications. w x y z w x y z The implication graph for the formula ( x ∨ y ) ∧ ( y ∨ z ) ∧ ( x ∨ z ) ∧ ( w ∨ y ) ∧ ( y ∨ z ) We say that two vertices are strongly connected if there is a directed cycle in G φ that passes through both of them. Strong connectivity is clearly an equivalence relation; the equivalence classes are called the strong components of G φ . y x z x z y w w 1 2 3 4 Strong components of the implication graph shown above. We claim that φ is satisfiable if and only if every variable x i is in a different strong component than its negation x i . = ⇒ Because implication is transitive, any path from a node x to another node z indicates the implication x ⇒ z . Thus, if G φ contains a path from a variable x i to its negation x i , then x i must be F ALSE in every satisfying assignment. Symmetrically, if there is a path from x i to x i in G φ , then x i must be T RUE in every satisfying assignment. Suppose G φ contains a cycle through both x i and x i . That cycle can be decomposed into a directed path from x i to x i and a path from x i to x i . The first path implies that x i must be T RUE in every satisfying assignment, and the second implies that x i must be F ALSE. We conclude that φ is not satisfiable....
View Full Document

## This note was uploaded on 04/18/2011 for the course CS 473 taught by Professor Chekuri,c during the Spring '08 term at University of Illinois, Urbana Champaign.

### Page1 / 4

hw10sol - CS 473 Homework 10 Solutions Spring 2010 1 Show...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online