






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







A perfect matching of a graph is a matching in which every vertex is matched. Let G = (X ∪ Y, E) be a bipartite graph with |X| = |Y |. Prove, using the max-flow min-cut theorem, that G has a perfect matching if and only if |A| ≤ |N (A)| for every subset A ⊆ X, where N (A) denotes the set of all vertices adjacent to vertices in A.
Solution: It should be clear that if G(X ∪ Y, E) has a perfect matching then for all subsets A ⊆ X we must have |A| ≤ |N (A)|. Otherwise, if A′^ is such that A′^ ⊆ X with |A′| > |N (A′)|, since every node in A′^ is matched with some node N (A′) there must be some node in A′^ that remains unmatched. This proves necessity of the claim. Assume |A| ≤ |N (A)| for every subset A ⊆ X. To prove sufficiency of this condition we construct a flow network N from G in the following way: orient all edges so that they are directed from X to Y , add vertices s and t, with directed edges from s to every vertex in X and directed edges from each vertex in Y to t. We give all edges infinite capacity and give unit capacity to all vertices in X ∪ Y. Any valid integral flow in N must have edge flows values either 0 or 1. It’s clear that such a flow induces a matching on G where we take the edges in E that have flow value 1 to be in the matching. We show that the max-flow has value |X|. Equivalently, we show that the min-cut has size |X|. Suppose for contradiction that the min-cut is strictly smaller than |X|. Then let C = A ∪ B be a cut, where A ⊆ X and B ⊆ Y. By assumption |A| ∪ |B| < |X|. Since C is a cut, there can be no edge from X − A to Y − B. It follows that N (X − A) ⊂ B. Then we get
|N (X − A)| ≤ |B| < |X| − |A| = |X − A|
and so |X −A| > |N (X −A)| contradicting our assumption. Thus the size of the min-cut (and max-flow) is |X|. Since all the capacities are integral, we can find an integral max-flow. As described above this induces a matching on G of size |X| thus proving the theorem.
Prove that 2 - SAT ∈ P.
Solution: First note that a clause (α ∨ β) is logically equivalent to each of the expressions (α → β) and (β → α). Given 2-CNF formula ϕ, we construct a directed graph Gϕ as follows: The vertices are the literals of ϕ (i.e. the variables of ϕ and their negations). For each clause (α ∨ β) in ϕ, introduce two edges (α, β) and (β, α) corresponding to the two logical implications above. We note that Gϕ has the following interesting symmetry: for two vertices (i.e. literals) α, β, (α, β) is an edge if and only if (β, α) is an edge. In the following, for two vertices u, v of Gϕ (i.e. two literals u, v of ϕ), the notation u v shall mean that there is a path from vertex u to vertex v in Gϕ. We show that ϕ is satisfiable if and only if for each variable x, x 6 x or x 6 x. For each x, this condition can be tested in linear time by Depth First Search or Breadth First Search.
Suppose that for some variable x, both x x and x x. We show that ϕ is unsatisfiable. Assume by way of contradiction that some assignment A satisfies ϕ. WLOG assume that A(x) = 1 and thus A(x) = 0. (A similar argument works when A(x) = 0.) Since there is a path from x to x, and A(x) = 1 while A(x) = 0, along the path there must be an edge (α, β) such that A(α) = 1 and A(β) = 0. Since (α, β) is an edge of Gϕ, it follows that (α ∨ β) is a clause of ϕ. However this clause is not satisfied by A as A(α) = A(β) = 0, a contradiction.
Conversely, suppose that for each variable x, x 6 x or x 6 x. We show that ϕ is satisfiable by constructing an assignment A that satisfies ϕ. We note that an assignment satisfies ϕ if and only if under the assignment, no edge of Gϕ goes from 1 to 0. We repeat the following steps until all vertices have an assignment:
Note that these steps are well defined: If both α β and α β, then by the symmetry of Gϕ, β α, and thus α α, contradicting the hypothesis that α 6 α. Furthermore, if there were a path from α to a vertex β that
Conversely, if ϕ′^ has an NAE-assignment A, then we obtain a satisfying assignment to ϕ as follows: By Part (1) we assume that A(b) = 0 (otherwise negate the assignment). For each i, A cannot assign 0 to all of yi, 1 , yi, 2 , yi, 3 for doing so would force one of the two clauses of C i′ to have all 0’s. Hence, restricting this assignment to the variables of ϕ gives a satisfying assignment to ϕ. Therefore, NAE-SAT is NP-Hard as 3 - SAT is NP-Complete. We con- clude that NAE-SAT is NP-Complete as NAE-SAT ∈ NP.
A cut of an undirected graph G = (V, E) is a partition of the vertices V = A ∪ B (with A ∩ B = ∅). The size of a cut is defined as the number of edges crossing the cut. MAX-CUT is the following optimization problem: Given a graph G = (V, E), find a cut of G with the maximum size. By reduction from NAE-SAT, prove that unless P = NP, there is no polynomial- time algorithm for MAX-CUT.^1
Proof: For simplicity we may assume that for each variable x, no clause of ϕ contains both x and ¯x since such a clause is clearly satisfied by any assignment and thus can be removed. Let ϕ be a NAE-SAT instance with n variables and k clauses. Construct a graph Gϕ with 6nk vertices as follows: Each variable xi corresponds to 6k vertices – 3k labeled xi and 3k labeled ¯xi. For each i ∈ { 1 ,... , n}, connect each xi vertex with each ¯xi vertex (for a total of 9k^2 edges). For each clause in φ, select three vertices labeled by the literals in that clause and connect each pair of them by an edge. Avoid selecting the same vertex more than once. (This is possible as there are 3k vertices for each literal/label.) We show that ϕ ∈ NAE-SAT if and only if Gϕ has a cut of size at least 9 k^2 n + 2k. Suppose that ϕ has an NAE-assignment A. Then A yields a cut of size 9k^2 n+2k in Gϕ by placing all vertices corresponding to true variables on one side and all other variables on the other side. The the edges crossing the cut consisting of all 9kn^ edges between literals and their negations, and
(^1) Note that the MIN-CUT problem can be solved in polynomial time using MAX FLOW.
two edges for each clause as it contains at least one true and one false literal, yielding a total of 9k^2 n + 2k edges. Conversely, suppose that Gϕ has a cut of size at least 9k^2 n+2k. Observe that a cut can contain at most two edges for each clause, since at least two of the corresponding literals must be on the same side of the cut. Thus the clause edges can contribute at most 2k to the cut. Since Gϕ contains only 9 kn^ other edges, if Gϕ has a cut of size at least 9k^2 n + 2k, all of those edges appear in it and each clause contributes its maximum. Hence all vertices labeled by the same literal occur on the same side of the cut. By selecting either side of the cut and assigning 1 to its literals, we obtain an assignment to the variables of ϕ. Since each clause contributes two edges to the cut, it must have vertices appearing on both sides and so it has at least one true and one false literal. Hence ϕ has an NAE-assignment. Therefore, if there is a polynomial time algorithm for MAX-CUT, then NAE-SAT ∈ P: To decide NAE-SAT, on input an instance ϕ of NAE-SAT with n variables and k clauses, simply construct the graph Gϕ as above, find a maximum cut of Gϕ, and output 1 if and only if its size is at least 9 k^2 n + 2k. This would imply that P = NP as NAE-SAT is NP-Complete.
f (x 1 ,... , xn) =
( (^) n ∑
i=
aixi − t
∑^ n
i=
(x^2 i − xi).
It is clear that in f (x 1 ,... , xn) the degree of each variable is 2. If there is a subset {ai 1 ,... , aik } such that
∑k j=1 aij^ =^ t, then setting xij = 1 for each 1 ≤ j ≤ k and xℓ = 0 for all other ℓ gives an integral solution to the polynomial f (x 1 ,... , xn). On the other hand, suppose that the polynomial f (x 1 ,... , xn) has an integral root (α 1 ,... , αn). Note that for any integer values α 1 ,... , αn, both (
∑n i=1 aiαi^ −^ t)
(^2) and ∑n i=1(α 2 i −αi) are nonnegative. Thus f (α 1 ,... , αn) = 0 if and only if both (
∑n i=1 aiαi^ −^ t)
(^2) = 0 and ∑n i=1(α 2 i −^ αi) = 0. Note that^
∑n i=1(α 2 i −^ αi) = 0 if and only if^ αi^ = 0 or αi = 1 for each 1 ≤ i ≤ n, and that (
∑n i=1 aiαi^ −^ t)
(^2) = 0 if and only if
∑n i=1 aiαi^ =^ t. Define^ I^ =^ {i^ :^ αi^ = 1}. Then^
i∈I ai^ =^ t.^
Note: Recall that this is the famous Hilbert’s 10th Problem that is known to be undecidable (and thus not in NP).
Algorithm B: On input ϕ(x 1 ,... , xn):
(a) Run algorithm A on ϕ to decide whether ϕ is satisfiable. If not, then output NO and halt. If ϕ is satisfiable, then the rest of the algorithm finds a satisfying assignment in n iterations, as follows. (b) Define formulas ϕ 0 (x 2 ,... , xn) = ϕ(0, x 2 ,... , xn) and ϕ 1 (x 2 ,... , xn) = ϕ(1, x 2 ,... , xn). That is, ϕ 0 and ϕ 1 are the resulting formulas after x 1 is substituted by constants 0 and 1 respectively. If ϕ is satisfiable, then clearly at least one of ϕ 0 and ϕ 1 must be satisfi- able, as in any satisfying assignment x 1 is assigned either 0 or 1. Thus, in the first iteration, first run algorithm A on ϕ 0 to decide whether ϕ 0 is satisfiable, and if so, set a 1 = 0; else ϕ 1 must be satisfiable, and set a 1 = 1. Assign x 1 = a 1 , and repeat the above for ϕa 1 until all variables have been assigned. That is: (c) In general, in the i-th iteration, with a 1 ,... , ai− 1 already assigned to x 1 ,... , xi− 1 in the first i−1 iterations so that ϕa 1 ,...,ai− 1 (xi,... , xn) = ϕ(a 1 ,... , ai− 1 , xi,... , xn) is satisfiable, set
ϕa 1 ,...,ai− 1 , 0 (xi+1,... , xn) = ϕ(a 1 ,... , ai− 1 , 0 , xi+1,... , xn),
and
ϕa 1 ,...,ai− 1 , 1 (xi+1,... , xn) = ϕ(a 1 ,... , ai− 1 , 1 , xi+1,... , xn).
Then as above, at least one of ϕa 1 ,...,ai− 1 , 0 and ϕa 1 ,...,ai− 1 , 1 must be satisfiable. Thus, first run algorithm A on ϕa 1 ,...,ai− 1 , 0 to decide whether it is decidable, and if so, set ai = 0; else ϕa 1 ,...,ai− 1 , 1 must be satisfiable, and set ai = 1.
(d) Output x 1 = a 1 ,... , xn = an and halt.
It is not hard to see that algorithm D finds an assignment that satisfies the maximum number of clauses of a given formula ϕ, and it takes polynomial time provided that C runs in polynomial time.