300 likes | 312 Views
This article discusses the NP-completeness of the Vertex Cover and Clique problems, and provides a proof for each. It also explores the relationship between Vertex Cover and Hamiltonian Circuit.
E N D
NP-completeness NP-complete problems
Homework Vertex Cover • Instance.A graph G and an integer k. • Question.Is there a vertex cover of cardinality k? Clique • Instance.A graph G and an integer k. • Question.Has G a clique of cardinality k? Prove NP-completeness of Vertex cover and Clique.
Vertex cover, stable set, clique,…(2) Proposition 2.2. Let G be a graph and X⊆V(G). Then the following three statements are equivalent: • X is a vertex cover in G, • V(G)\X is a stable set in G, • V(G)\X is a clique in the complement of G.
NP-completeness of Vertex Cover • Transform Stable Set to Vertex Cover. • Let G = (V, E) and k constitute any instance of Stable Set. • The corresponding instance of Vertex Cover is provided simply by the graph G′ = G and the integer k′ =n − k, where |V |= n.
Hamiltonian Circuit • Instance:A graph G. • Question:Is there a Hamiltonian circuit?
Hamiltonian Circuit Theorem11.1(Karp 1972) Hamiltonian Circuit is NP-complete.
Sketch of Proof • «Vertex Cover» → «Hamiltonian Circuit» • «Vertex Cover»:G = (V,E),an integer k ≥ 0. • We must construct a graph G′ = (V′,E′) such thatG′has a Hamiltonian circuitifand only if Ghas a vertex cover Hof sizekor less. • Let|E| = m.
Construction of G′ • |V′| = 12m+k • For each edge (vi, vj) ∊E, G′ contains a “cover-testing” component that will be used to ensure that at least one endpoint of that edges is among the selected k vertices. • The componenthas 12 verticesuij1, uij2, uij3, uij4, uij5, uij6, uji1, uji2, uji3, uji4, uji5, uji6 and 14 edges. • AdditionallyG′ has k “selector” vertices a1, a2,…, ak, which will be used to select k vertices from the vertex set V for G.
Component(vi, vj) In the completed construction, the only vertices from this component that will be involved in any additional edges are uij1, uji1,uij6, uji6. This implies that any Hamiltonian circuit of G′ has to pass through these vertices by the exactly one of the three following ways. uij1 uji1 uij2 uji2 uij3 uji3 uij4 uji4 uij5 uji5 uij6 uji6
Component(vi, vj) uij1 uji1 uij2 uji2 uij3 uji3 uij4 uji4 uij5 uji5 uij6 uji6 vi ∊H, vj∉H vi ∉H, vj∊H vi ∊H, vj∊H
Componentvi • Additional edges in our construction will serve to join pairs of cover-testing components or to join a cover testing component to a selector vertex. • For each vertexvi let rdenote a degree of vi in G. Arbitrarily order the edges incident onvi as(vi, vj1), (vi, vj2),…, (vi, vjr). • All the cover testing components corresponding to these edges are joined together by the following connecting edges:
Vertex Component uijr1 uij11 uij21 uij31 uij16 uijr6 uij26 uij36
Construction of G′ • |V′| = 12m+k • For each edge (vi, vj) ∊E, G′ contains a “cover-testing” component that will be used to ensure that at least one endpoint of that edges is among the selected k vertices. • The componenthas 12 verticesuij1, uij2, uij3, uij4, uij5, uij6, uji1, uji2, uji3, uji4, uji5, uji6 and 14 edges. • AdditionallyG′ has k “selector” vertices a1, a2,…, ak, which will be used to select kvertices from the vertex set V for G.
Selector vertices • Each selector vertex al join with the first and last vertices of every componentvi. • It is easy to see that G′ can be constructed from G in polynomial time.
Component of G′ uijr1 uij11 uij21 uij31 uij16 uijr6 uij26 uij36
Proof (1) • We claim that G′ has a Hamiltonian circuit if and only if G has a vertex cover of size k or less. • Suppose there is a Hamiltonian circuit for G′. Consider any portion of this circuit that begins at a selector vertex, ends at another selector vertex and that encounters no such vertex internally.
Component of G′ uijr1 uij11 uij21 uij31 uij16 uijr6 uij26 uij36
Proof (2) • We claim that G′ has a Hamiltonian circuit if and only if G has a vertex cover of size k or less. • Suppose there is a Hamiltonian circuit for G′. Consider any portion of this circuit that begins at a selector vertex, ends at another selector vertex and that encounters no such vertex internally. • This portion of the circuit must pass through a set of cover-testing components corresponding to exactly those edge from E that are incident on some one particular vertex vi ∊V.
Proof(3) • Each of the cover-testing components is traversed in one of the three modes, and no vertex from any other cover-testing component is encountered.
Proof(4) • So the k selector vertices divide the Hamiltonian circuit into k paths, each path corresponding to a distinct vertex vi ∊V. • Since the Hamiltonian circuit must include all vertices from every one of the cover-testing components, and since vertices from the cover-testing component for edge e∊E can be traversed only by a path corresponding to an endpoint of e, every edge in E must have at least one endpoint among those k selected vertices. • Therefore, this set of k vertices forms the desired vertex cover for G.
Proof(5) • Suppose V* is a vertex cover for G with |V*| ≤ k. • Let us suppose that |V*| = k. • Denote the elements of V* by v1, v2,…, vk. • Choose the edges in the cover-testing component representing each edge e = {vi, vj} depending on whether {vi, vj} ∩ V* equals, respectively, {vi}, {vj}, or {vi, vj}.
Component(vi, vj) uij1 uji1 uij2 uji2 uij3 uji3 uij4 uji4 uij5 uji5 uij6 uji6 vi ∊H, vj∉H vi ∉H, vj∊H vi ∊H, vj∊H
Optimization problem Definition 11.2. • A (discrete) optimization problem is a quadruple Π= (X, (Sx) x∈X, c, goal), where • X is a language over {0, 1} decidable in polynomial time; • Sxis a subset of {0,1}∗ for each x ∈ X; there exists a polynomial p with size(y) ≤ p(size(x)) for all y ∈ Sxand all x ∈ X, and the languages {(x, y) : x ∈ X, y ∈ Sx} and {x∈X: Sx=∅}are decidable in polynomial time; • c:{(x,y): x ∈ X, y ∈ Sx} → Q is a function computable in polynomial time; and • goal ∈ {max, min}.
Optimization problem • The elements of X are called instances of Π. • For each instance x, the elements of Sxare called feasible solutions of x. • We write OPT(x) := goal{c(x, y) : y ∈ Sx}. • An optimum solution of x is a feasible solution y of x with c(x, y) = OPT(x).
Algorithm • An algorithm for an optimization problem (X, (Sx) x∈X, c, goal) is an algorithm A which computes for each input x ∈ X with non-empty Sxa feasible solution y ∈ Sx. • We sometimes write A(x) := c(x, y). • If A(x) = OPT(x) for all x ∈ X with non-empty S, then A is an exact algorithm.
Polynomial reduction • The concept of polynomial reductions easily extends to optimization problems: a problem polynomially reduces to an optimization problem Π= (X, (Sx)x∈X, c, goal) if it has an exact polynomial-time oracle algorithm using any function f with f(x)∈{y∈Sx:c(x,y) = OPT(x)} for all x∈Xwith non-empty Sx.
NP-hardness • Definition 11.3. • An optimization problem or decision problem Πis called NP - hard if all problems in NP polynomially reduce to Π.
Exercise 11.1 Traveling Salesman Problem (TSP) • Instance: A complete graph Kn(n ≥ 3) and weights c : E(Kn) → Q+. • Task: Find a Hamiltonian circuit T whose weight is minimum. Prove that the TSP is NP-hard.
Exercise 11.2 Zero Quadratic Assignment Problem (QAP0) Given two n × nsymmetric 0/1 matrices A= (aij) and B = (bij). Computea permutation π of V= {1, . . . , n} so that Prove that the QAP0 is NP-hard.
Homework • The decision problem Clique is NP-complete. Is it still NP-complete if restricted to • bipartite graphs, • planar graphs. • Prove that the following problems are NP-complete: • Hamiltonian Path • Given a graph G, does G contain a Hamiltonian path? • Shortest Path • Given a graph G, weights c : E(G) → Z, two vertices s,t∈ V(G), and an integer k. Is there an s-t-path of weight at most k?