Download presentation
Presentation is loading. Please wait.
Published byAgatha Kelly Modified over 9 years ago
1
NP-completeness NP-complete problems
2
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.
3
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: (a) X is a vertex cover in G, (b) V(G)\X is a stable set in G, (c) V(G)\X is a clique in the complement of G.
4
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.
5
Hamiltonian Circuit Instance: A graph G. Question: Is there a Hamiltonian circuit?
6
Hamiltonian Circuit Theorem 11.1 (Karp 1972) Hamiltonian Circuit is NP-complete.
7
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 that G′ has a Hamiltonian circuit if and only if G has a vertex cover H of size k or less. Let |E| = m.
8
Construction of G′ |V′| = 12m+k For each edge (v i, v j ) ∊ 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 component has 12 vertices u ij1, u ij2, u ij3, u ij4, u ij5, u ij6, u ji1, u ji2, u ji3, u ji4, u ji5, u ji6 and 14 edges. Additionally G′ has k “selector” vertices a 1, a 2,…, a k, which will be used to select k vertices from the vertex set V for G.
9
Component (v i, v j ) u ij1 u ij2 u ij3 u ij4 u ij5 u ij6 u ji1 u ji2 u ji3 u ji4 u ji5 u ji6 In the completed construction, the only vertices from this component that will be involved in any additional edges are u ij1, u ji1, u ij6, u ji6. This implies that any Hamiltonian circuit of G′ has to pass through these vertices by the exactly one of the three following ways.
10
Component (v i, v j ) u ij1 u ij2 u ij3 u ij4 u ij5 u ij6 u ji1 u ji2 u ji3 u ji4 u ji5 u ji6 v i ∊ H, v j ∉ H v i ∉ H, v j ∊ H v i ∊ H, v j ∊ H
11
Component v i 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 vertex v i let r denote a degree of v i in G. Arbitrarily order the edges incident on v i as (v i, v j 1 ), (v i, v j 2 ),…, (v i, v j r ). All the cover testing components corresponding to these edges are joined together by the following connecting edges:
12
Vertex Component u ij 1 1 u ij 1 6 u ij 2 1 u ij 2 6 u ij r 1 u ij r 6 u ij 3 1 u ij 3 6
13
Construction of G′ |V′| = 12m+k For each edge (v i, v j ) ∊ 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 component has 12 vertices u ij1, u ij2, u ij3, u ij4, u ij5, u ij6, u ji1, u ji2, u ji3, u ji4, u ji5, u ji6 and 14 edges. Additionally G′ has k “selector” vertices a 1, a 2,…, a k, which will be used to select k vertices from the vertex set V for G.
14
Selector vertices Each selector vertex a l join with the first and last vertices of every component v i. It is easy to see that G′ can be constructed from G in polynomial time.
15
Component of G′ u ij 1 1 u ij 1 6 u ij 2 1 u ij 2 6 u ij r 1 u ij r 6 u ij 3 1 u ij 3 6
16
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.
17
Component of G′ u ij 1 1 u ij 1 6 u ij 2 1 u ij 2 6 u ij r 1 u ij r 6 u ij 3 1 u ij 3 6
18
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 v i ∊ V.
19
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.
20
Proof(4) So the k selector vertices divide the Hamiltonian circuit into k paths, each path corresponding to a distinct vertex v i ∊ 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.
21
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 v 1, v 2,…, v k. Choose the edges in the cover-testing component representing each edge e = {v i, v j } depending on whether {v i, v j } ∩ V* equals, respectively, {v i }, {v j }, or {v i, v j }.
22
Component (v i, v j ) u ij1 u ij2 u ij3 u ij4 u ij5 u ij6 u ji1 u ji2 u ji3 u ji4 u ji5 u ji6 v i ∊ H, v j ∉ H v i ∉ H, v j ∊ H v i ∊ H, v j ∊ H
23
Optimization problem Definition 11.2. A (discrete) optimization problem is a quadruple Π = (X, (S x ) x ∈ X, c, goal), where – X is a language over {0, 1} decidable in polynomial time; –S x is a subset of {0,1} ∗ for each x ∈ X; there exists a polynomial p with size(y) ≤ p(size(x)) for all y ∈ S x and all x ∈ X, and the languages {(x, y) : x ∈ X, y ∈ S x } and {x ∈ X: S x = ∅ }are decidable in polynomial time; –c:{(x,y): x ∈ X, y ∈ S x } → Q is a function computable in polynomial time; and –goal ∈ {max, min}.
24
Optimization problem The elements of X are called instances of Π. For each instance x, the elements of S x are 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).
25
Algorithm An algorithm for an optimization problem (X, (S x ) x ∈ X, c, goal) is an algorithm A which computes for each input x ∈ X with non- empty S x a feasible solution y ∈ S x. 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.
26
Polynomial reduction The concept of polynomial reductions easily extends to optimization problems: a problem polynomially reduces to an optimization problem Π = (X, (S x )x ∈ X, c, goal) if it has an exact polynomial-time oracle algorithm using any function f with f(x) ∈ {y ∈ S x :c(x,y) = OPT(x)} for all x ∈ X with non-empty S x.
27
NP-hardness Definition 11.3. An optimization problem or decision problem Π is called NP - hard if all problems in NP polynomially reduce to Π.
28
Exercise 11.1 Traveling Salesman Problem (TSP) Instance: A complete graph K n (n ≥ 3) and weights c : E(K n ) → Q +. Task: Find a Hamiltonian circuit T whose weight is minimum. Prove that the TSP is NP-hard.
29
Exercise 11.2 Zero Quadratic Assignment Problem (QAP 0 ) Given two n × n symmetric 0/1 matrices A = (a ij ) and B = (b ij ). Compute a permutation π of V = {1,..., n} so that Prove that the QAP 0 is NP-hard.
30
Homework The decision problem Clique is NP-complete. Is it still NP- complete if restricted to a) bipartite graphs, b) planar graphs. Prove that the following problems are NP-complete: a) Hamiltonian Path –Given a graph G, does G contain a Hamiltonian path? b) 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?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.