Presentation is loading. Please wait.

Presentation is loading. Please wait.

Instructor: Aaron Roth

Similar presentations


Presentation on theme: "Instructor: Aaron Roth"— Presentation transcript:

1 Instructor: Aaron Roth aaroth@cis.upenn.edu
CIS 262 Automata, Computability, and Complexity Spring Instructor: Aaron Roth Lecture: April 22, 2019

2 Vertex Cover A vertex cover of a graph G is a subset of vertices S such that every edge in G is adjacent to a vertex in S.

3 Vertex Cover A vertex cover of a graph G is a subset of vertices S such that every edge in G is adjacent to a vertex in S. VERTEX-COVER = {<G,k> | G is a graph with a vertex cover of size k}

4 Vertex Cover Theorem: VERTEX-COVER is NP-Complete. Proof:
VERTEX-COVER is clearly in NP: The cover itself is the certificate. 3SAT ≤ 𝑃 VERTEX-COVER.

5 Vertex Cover Theorem: VERTEX-COVER is NP-Complete. Proof:
Given: A formula 𝜙 with L variables and m clauses. Construct: A graph G and a cover-size k. For each variable 𝑥 𝑖 , create two “variable” vertices and connected by an edge. One of these will need to be chosen in any vertex cover: will correspond to truth value for 𝑥 𝑖 . For each clause ( 𝑎 1 ∨ 𝑎 2 ∨ 𝑎 3 ), create three vertices all connected to one another, and to the variable vertices with the same label. At least two of these will need to be chosen in any vertex cover – three if no edge to a variable vertex is already covered. Set k = L + 2m. 𝑥 𝑖 𝑥 𝑖 𝑎 1 𝑎 2 𝑎 3

6 Vertex Cover Theorem: VERTEX-COVER is NP-Complete. Proof:
Example Construction 𝜙= 𝑥 1 ∨ 𝑥 1 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 (L = 2, m = 3) k = 2 + 2x3 = 8 𝑥 1 𝑥 1 𝑥 2 𝑥 2 𝑥 1 𝑥 1 𝑥 1 𝑥 2 𝑥 1 𝑥 2 𝑥 2 𝑥 2 𝑥 2

7 Vertex Cover Theorem: VERTEX-COVER is NP-Complete. Proof:
𝜙= 𝑥 1 ∨ 𝑥 1 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 Observation: Any vertex cover needs to choose one variable vertex for each variable, and at least two clause vertices for each clause. So: VC ≥ L + 2m = k. To show: there is a VC of size k iff 𝜙 is satisfiable. 𝑥 1 𝑥 1 𝑥 2 𝑥 2

8 Vertex Cover Theorem: VERTEX-COVER is NP-Complete. Proof:
𝜙= 𝑥 1 ∨ 𝑥 1 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 ⇒: Suppose 𝜙 is satisfiable. Let 𝜌 be a satisfying assignment. Add 𝐿 variable vertices to the cover, corresponding to true literals in 𝜌 Choose a true literal in each clause. Add the other two clause vertices. Every edge in variable gadget covered. Every edge in clause gadget covered. Every edge between variable and clause gadgets covered since clause vertices are chosen when corresponding variable vertices are not. 𝑥 1 𝑥 1 𝑥 2 𝑥 2 𝑥 1 𝑥 1 𝑥 1 𝑥 2 𝑥 1 𝑥 2 𝑥 2 𝑥 2 𝑥 2

9 Vertex Cover Theorem: VERTEX-COVER is NP-Complete. Proof:
𝜙= 𝑥 1 ∨ 𝑥 1 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 ∧ 𝑥 1 ∨ 𝑥 2 ∨ 𝑥 2 ⇐: Suppose there is a vertex cover of size 𝑘=𝐿+2𝑚. It must include exactly one vertex from each variable gadget, and two vertices for each clause gadget. Let 𝜌 be the truth assignment corresponding to the literals chosen in the variable gadgets. 𝜌 is a satisfying assignment. Every edge between clause and variable gadgets is covered, but only two are covered by clause vertices. So every clause contains a true literal. 𝑥 1 𝑥 1 𝑥 2 𝑥 2 𝑥 1 𝑥 1 𝑥 1 𝑥 2 𝑥 1 𝑥 2 𝑥 2 𝑥 2 𝑥 2

10 The optimization version:
Vertex Cover Theorem: VERTEX-COVER is NP-Complete. The optimization version: MIN-VC: Given a graph G, find the smallest vertex cover S. MIN-VC is not a decision problem, so not in NP. But… If we can solve MIN-VC in polynomial time, we can solve VERTEX-COVER (and vice versa) Why? So, MIN-VC is NP-hard.

11 But suppose we want to solve MIN-VC…
Vertex Cover But suppose we want to solve MIN-VC… What do we do? A couple of options: Try and solve it anyway. (e.g. encode vertex cover as a 3SAT instance, and run a commodity SAT solver.) Might work on your instance. Not guaranteed to work. Design an Approximation Algorithm A poly-time algorithm guaranteed to find a vertex cover quickly. But not necessarily the smallest vertex cover.

12 S is a vertex cover of G, and
Given a graph G, let OPT(G) denote the size of the smallest vertex cover of G. An algorithm A is a c-approximation algorithm for MIN-VC if, given any graph G as input, A outputs a subset of vertices S such that: S is a vertex cover of G, and |S| ≤ c⋅OPT(G) We want to find polynomial time approximation algorithms with small approximation factors c.

13 Lets try designing an approximation algorithm.
Vertex Cover Lets try designing an approximation algorithm. Greedy(G): Let 𝑆←∅, G’ ← G While G’ has any remaining edges: Find any un-covered edge (u,v). Choose any endpoint v. Add v to S, remove v from G’. Output S. S: 4 1 3 5 5 1 2 4

14 Lets try designing an approximation algorithm.
Vertex Cover Lets try designing an approximation algorithm. Is Greedy a good approximation algorithm? No: Greedy is not a c-approximation algorithm for any c. Consider a star graph G with c+1 vertices. Optimal cover has size OPT(G) = 1. But Greedy can pick a cover of size c.

15 Vertex Cover Another Attempt Greedy2(G): Let 𝑆←∅, G’ ← G
While G’ has any remaining edges: Find any un-covered edge (u,v). Add both u and v to S, remove u and v from G’. Output S. S: 4 1 3 2 5 3 1 2 4

16 Vertex Cover Another Attempt
Is Greedy2 a good approximation algorithm? Seems wasteful! Adds two vertices to cover a single edge! How does it do on the star example? Never finds OPT… But always finds a cover of size 2.

17 Vertex Cover Theorem: Greedy2 is a poly-time 2-approximation algorithm for MIN-VC. Proof: Clearly, Greedy2 runs in polynomial time. Greedy2 always outputs a vertex cover S since it continues to add vertices to S until all edges are covered. To show: For every graph G, |S| ≤ 2⋅OPT(G).

18 Vertex Cover Theorem: Greedy2 is a poly-time 2-approximation algorithm for MIN-VC. Proof: Let H denote the set of edges selected by the algorithm. By construction, |S| = 2⋅|H|. Observe that OPT(G) ≥ |H|: By construction, none of the edges in H share an endpoint (because we remove both endpoints from the graph before selecting the next edge). So every edge in H must be covered by a different vertex. So: |S| = 2⋅|H| ≤ 2⋅OPT(G).

19 Vertex Cover Theorem: Greedy2 is a poly-time 2-approximation algorithm for MIN-VC. No better algorithm is known. Finding a poly-time 1.99-approximation algorithm for MIN-VC would disprove the “Unique Games Conjecture”

20 Max-Cut A cut in a graph G is a partition of the vertices into two sets S, T. The size of the cut is the number of edges crossing the partition. S: T: MAX-CUT: Given G, find the largest cut. NP-hard (See book). 4 3 6 2 1 5

21 Max-Cut Can we give an approximation algorithm for MAX-CUT?
LocalSearch(G): Let S, T be an arbitrary partition of the vertices of G. Until there are no more changes: If one exists, find a vertex v such that moving it from S to T or from T to S increases the size of cut(T,S). Swap v to the other set in the partition.

22 Max-Cut LocalSearch Example: S: T: 4 3 6 2 1 5

23 Max-Cut LocalSearch Example: S: T: 4 3 6 2 1 5

24 Max-Cut LocalSearch Example: S: T: 4 3 6 2 1 5

25 Max-Cut Can we give an approximation algorithm for MAX-CUT?
Theorem: LocalSearch is a polynomial time 2-approximation algorithm for MAX-CUT. e.g. finds a cut of size at least half of the max-size cut.

26 Cut(S,T) ≥ |E|/2 ≥ OPT(G)/2
Max-Cut Can we give an approximation algorithm for MAX-CUT? Theorem: LocalSearch is a polynomial time 2-approximation algorithm for MAX-CUT. Proof: Polynomial time: By definition, each swap increases the cut size by at least 1. The cut can’t get larger than size |E| ≤ 𝑛 2 . So algorithm halts after at most 𝑛 2 rounds. Cut size: At final cut, #cut-edges adjacent to each vertex is ≥ #uncut-edges. (Otherwise we keep going). So more edges cut than uncut. So cut(S,T) ≥ |E|/2. But obviously, OPT(G) ≤ |E|. Therefore: Cut(S,T) ≥ |E|/2 ≥ OPT(G)/2


Download ppt "Instructor: Aaron Roth"

Similar presentations


Ads by Google