-The same graph G=(V,E)Proof of the reduction:
-the integer |V|-k
Finding the Maximum matching:The entire algorithm is polynomial. The Ford-Fulkerson algorithm is polynomial. After that, finding the vertex cover is polynomial, since all we are doing is tracing alternating paths. Finally, taking the opposite vertices to get the independent set is also polynomial.
- Convert the Bipartite graph into a network flow
- Use Ford-Fulkerson to find the maximum flow.
- Each edge in the graph which has a positive flow, is now an edge in the maximum matching of G. This was actually done on your assignment 3 and is shown in the text book.
- Let the set of edges in this matching be called M.
Finding the Minimum Vertex CoverFinding the maximum independent set:
- Suppose that M is a perfect matching, (ie: no vertices are missing). If the graph partition is (A,B), then the vertex cover is simply the vertices on side of the partition, which ever is smallest. In other words, the cover is the min of A or B.
- Otherwise, M is not a perfect matching. An example is shown below where the matched edges are in red.
Let A be one side of the partition that has some vertices which are unmatched. Let the unmatched vertices in A be labelled S. Let U be the set of vertices in A which are reachable from S by alternating paths. And let T be the neighbours of U along edges in M. (See the figure below).
![]()
- The vertex cover is now (A-S-U)union(T). The size of this vertex cover is exactly the size of M. This is because for each edge in the matching which touches a T vertex, we have exactly one vertex in the cover. Also, for each each in the matching which does NOT touch a T vertex, we have exactly one vertex in the cover in the set (A-S-U). The vertex cover is shown by the yellow vertices in the figure below:
![]()
- This is easy, just take the vertices which are NOT in the vertex cover. This set is shown in green below. Notice that none of the green vertices are neighbours.
First we show that PARTITION is in NP. Our certificate will be a subset S of A. We can verify in polynomial time whether S and (A-S) have equal sums (simply by taking the sum of the elements in S and in (A-S)). If these sets have equal sums, then we accept.
Now we show that Partition is NP-complete via a reduction from SUBSET-SUM (defined as: is there a subset of sum k in A?). Let (A,k) be an arbitrary instantance of SUBSET-SUM. We transform this into an instance A' of the PARTITION problem in this way:
A' can be constructed easily in polynomial time.
I claim that A' is a true instance of PARTITION iff (A,k) is a true instance of SUBSET-SUM. Assume (A,k) is a true instance of SUBSET-SUM. Then there is a subset S of A such that S has size k. Then ((A-S) union {an+1}, S union {an+2}) is a PARTITION of A'. Now assume that A' is a true instance of PARTITION. Then there exists an equal-weight partition (S1, S2) of A'. Notice that the sum of all the elements in A' is 6m. So both an+1 and an+2 cannot appear in the same subset. Without loss of generality, we say that an+1 is in S1 and an+2 is in S2. Then by construction S2 - {an+2} has sum k (since S2 has weight 3m). It follows that there is a subset of weight k in A. Therefore, The given reduction reduces SUBSET-SUM to PARTITION, and since SUBSET-SUM is NP-complete, it follows that PARTITION is NP-hard. We have shown that PARTITION is in NP, so PARTITION is NP-complete.
4-SAT is similar to 3-SAT, except that each clause contains exactly 4 distinct literals. Show that 4-SAT is NP-Complete.
First we show that 4-SAT is in NP. 4-SAT is just a special case of SAT (i.e. we can use the same certificate for 4-SAT as for SAT), and SAT is in NP, thus 4-SAT is in NP.
Next we show that 4-SAT is NP-complete, by reducing 3-SAT to 4-SAT. Let phi = {C1, C2, ..., Cn}} be an arbitrary instance of 3-SAT. Our reduction will go like this. The set of variables in the new instance will be the set of variables in phi, plus one new variable x. To each Ci we add a new literal x. We also add a new clause Cn+1 = {not x, not x, not x, not x}. Call this new instance phi'. This construction can be easily computed in polynomial time.
We claim that phi' is in 4-SAT iff phi is in 3-SAT. Assume phi' is in 4-SAT. Then Cn+1 must be satisfied. Therefore x must be assigned to false, therefore the fourth literal of each clause in phi' must be false. Therefore there must be an assignment to the remaining variables such that for each clause Ci, at least one of the first three literals is satisfied. It is easy to see that this is only possible if the original 3-SAT instance phi' is satisfiable. Now assume that the 3-SAT instance phi is satisfiable by some assignment. Then we can satisfify phi' by using the satisfying assignment to phi and by setting x to false. Thus phi' is in 4-SAT iff phi is in 3-SAT, and the claim is proven.
Yummy | Juicy | Supply | |
---|---|---|---|
fat | 1kg | 2kg | 60kg |
sawdust | 2kg | 1kg | 48kg |
Profits | $3 | $2 |   |
  | x+2y<=60 |
  | 2x+y<=48 |
  | x>=0, y>=0 |
  | u+2v>=3 |
  | 2u+v>=2 |
  | u>=0, v>=0 |