NP-completeness
NP-complete problems
Homework
Vertex Cover
Instance. A graph and an integer k.
Question. Is there a vertex cover of cardinality k?
Clique
Instance. A graph 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 XV(G). Then thefollowing 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.
NP-completeness of Vertex Cover
Transform Stable Set to Vertex Cover.
Let G = (VE) and constitute any instance ofStable Set.
The corresponding instance of Vertex Cover isprovided simply by the graph G′ = G and theinteger k′ = n  k, where ||= n.
Hamiltonian Circuit
Instance: A graph G.
Question: Is there a Hamiltonian circuit?
Hamiltonian Circuit
Theorem 11.1 (Karp 1972)
     Hamiltonian Circuit is NP-complete.
Sketch of Proof
«Vertex Cover» → «Hamiltonian Circuit»
«Vertex Cover»: G = (V,E),  an integer ≥ 0.
We must construct a graph G′ (V,E) such that Ghas a Hamiltonian circuit if and only if G has a vertexcover H of size k or less.
Let |E| = m.
Construction of G
|V| = 12m+k
For each edge (vivj)  E, G′ contains a “cover-testing”component that will be used to ensure that at least oneendpoint of that edges is among the selected k vertices.
The component has 12 vertices uij1uij2uij3uij4uij5,uij6uji1uji2uji3uji4uji5uji6 and 14 edges.
Additionally G′ has k  “selector” vertices a1a2,…, ak,which will be used to select k vertices from the vertexset V for G.
Component (vivj)
uij1
uij2
uij3
uij4
uij5
uij6
uji1
uji2
uji3
uji4
uji5
uji6
In the completed construction, the onlyvertices from this component that willbe involved in any additional edges are
uij1, uji1, uij6, uji6.
This implies that any Hamiltoniancircuit of G′ has to pass through thesevertices by the exactly one of the threefollowing ways.
Component (vivj)
uij1
uij2
uij3
uij4
uij5
uij6
uji1
uji2
uji3
uji4
uji5
uji6
v H,
v H
v H,
v H
v H,
v H
Component vi
Additional edges in our construction will serve to joinpairs of cover-testing components or to join a covertesting component to a selector vertex.
For each vertex vi let r denote a degree of vi in G.Arbitrarily order the edges incident on vi as(vivj1)(vivj2),…, (vivjr).
All the cover testing components corresponding tothese edges are joined together by the followingconnecting edges:
Vertex Component
uij11
uij16
uij21
uij26
uijr1
uijr6
uij31
uij36
Construction of G
|V| = 12m+k
For each edge (vivj)  E, G′ contains a “cover-testing”component that will be used to ensure that at least oneendpoint of that edges is among the selected k vertices.
The component has 12 vertices uij1uij2uij3uij4uij5,uij6uji1uji2uji3uji4uji5uji6 and 14 edges.
Additionally G′ has k  “selector” vertices a1a2,…, ak,which will be used to select k vertices from the vertexset V for G.
Selector vertices
Each selector vertex al  join with the first and lastvertices of every component vi.
It is easy to see that G′ can be constructed from G inpolynomial time.
Component of G
uij11
uij16
uij21
uij26
uijr1
uijr6
uij31
uij36
Proof (1)
We claim that G′ has a Hamiltonian circuit if andonly 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 aselector vertex, ends at another selector vertex andthat encounters no such vertex internally.
Component of G
uij11
uij16
uij21
uij26
uijr1
uijr6
uij31
uij36
Proof (2)
We claim that G′ has a Hamiltonian circuit if andonly 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 aselector vertex, ends at another selector vertex andthat encounters no such vertex internally.
This portion of the circuit must pass through a set ofcover-testing components corresponding to exactlythose edge from E that are incident on some oneparticular vertex v V.
Proof(3)
Each of the cover-testing components istraversed in one of the three modes, and novertex from any other cover-testing componentis encountered.
Proof(4)
So the k selector vertices divide the Hamiltonian circuit into kpaths, each path corresponding to a distinct vertex v V.
Since the Hamiltonian circuit must include all vertices fromevery one of the cover-testing components, and since verticesfrom the cover-testing component for edge e  E can betraversed only by a path corresponding to an endpoint of e,every edge in E must have at least one endpoint among those kselected vertices.
Therefore, this set of k vertices forms the desired vertex coverfor 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 v1v2,…, vk.
Choose the edges in the cover-testing componentrepresenting each edge e = {vivj} depending onwhether {vivj} ∩ V* equals, respectively, {vi}, {vj},or {vivj}.
Component (vivj)
uij1
uij2
uij3
uij4
uij5
uij6
uji1
uji2
uji3
uji4
uji5
uji6
v H,
v H
v H,
v H
v H,
v H
Optimization problem
Definition 11.2.
A (discrete) optimization problem is a quadrupleΠ = (X, (Sxxc, goal), where
 is a language over {0, 1} decidable in polynomial time;
Sx is a subset of {0,1} for each  X; there exists a polynomial withsize(y) ≤ p(size(x)) for all  Sx and all  X, and the languages{(xy) :  X Sx} and {xXSx =}are decidable in polynomialtime;
c:{(x,y):  X Sx} → Q is a function computable in polynomialtime; and
goal  {max, min}.
Optimization problem
The elements of are called instances of Π.
For each instance x, the elements of Sx are called feasiblesolutions of x.
We write OPT(x) := goal{c(xy) :  Sx }.
An optimum solution of is a feasible solution of withc(xy) = OPT(x).
Algorithm
An algorithm for an optimization problem(X, (Sx xc, goal) is an algorithm whichcomputes for each input  with       non-empty Sx  a feasible solution  Sx.
We sometimes write A(x) := c(xy).
If A(x) = OPT(x) for all  with non-emptyS, then is an exact algorithm.
Polynomial reduction
The concept of polynomial reductions easilyextends to optimization problems: a problempolynomially reduces to an optimization problemΠ = (X, (Sx )xc, goal) if it has an exactpolynomial-time oracle algorithm using anyfunction with f(x){ySx :c(x,y) = OPT(x)}for all xX  with non-empty S.
NP-hardness
Definition 11.3.
An optimization problem or decisionproblem Π is called NP - hard if allproblems in NP polynomially reduce to Π.
Exercise 11.1
Traveling Salesman Problem (TSP)
Instance: A complete graph Kn (≥ 3) and weights   cE(Kn) → Q+.
Task: Find a Hamiltonian circuit whose weight
                                   is minimum.
Prove that the TSP is NP-hard.
Exercise 11.2
Zero Quadratic Assignment Problem (QAP0)
Given
two n × n symmetric 0/1 matrices A = (aij) and B = (bij).
Compute a permutation π of V = {1, . . . , n} so that
Prove that the QAPis NP-hard.
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 contain a Hamiltonian path?
b) Shortest Path
Given a graph G, weights E(G) → Z, two verticess, V(G), and an integer k. Is there an s-t-path of weight atmost k?