e4 1 graph problems
play

E4.1 Graph Problems P, NP Automata Theory Theory Polynomial - PowerPoint PPT Presentation

Theory of Computer Science May 18, 2020 E4. Some NP-Complete Problems, Part I Theory of Computer Science E4. Some NP-Complete Problems, Part I E4.1 Graph Problems Gabriele R oger E4.2 Routing Problems University of Basel May 18, 2020


  1. Theory of Computer Science May 18, 2020 — E4. Some NP-Complete Problems, Part I Theory of Computer Science E4. Some NP-Complete Problems, Part I E4.1 Graph Problems Gabriele R¨ oger E4.2 Routing Problems University of Basel May 18, 2020 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 1 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 2 / 38 E4. Some NP-Complete Problems, Part I Graph Problems Course Overview Background Nondeterminism Logic E4.1 Graph Problems P, NP Automata Theory Theory Polynomial Reductions Turing Computability Cook-Levin Theorem Complexity NP-complete Problems More Computability Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 3 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 4 / 38

  2. E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems 3SAT ≤ p Clique Clique SAT Definition ( Clique ) 3SAT The problem Clique is defined as follows: Given: undirected graph G = � V , E � , number K ∈ N 0 Question: Does G have a clique of size at least K , Clique DirHamiltonCycle SubsetSum i. e., a set of vertices C ⊆ V with | C | ≥ K and { u , v } ∈ E for all u , v ∈ C with u � = v ? IndSet HamiltonCycle Partition German: Clique VertexCover TSP BinPacking Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 5 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 6 / 38 E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems Clique is NP-Complete (1) Clique is NP-Complete (2) Proof. Clique ∈ NP: guess and check. Clique is NP-hard: We show 3SAT ≤ p Clique . ◮ We are given a 3-CNF formula ϕ , and we may assume Theorem ( Clique is NP-Complete) that each clause has exactly three literals. Clique is NP-complete. ◮ In polynomial time, we must construct a graph G = � V , E � and a number K such that: G has a clique of size at least K iff ϕ is satisfiable. � construction of V , E , K on the following slides. . . . Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 7 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 8 / 38

  3. E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems Clique is NP-Complete (3) Clique is NP-Complete (4) Proof (continued). Let m be the number of clauses in ϕ . Let ℓ ij the j -th literal in clause i . Proof (continued). ( ⇒ ): If ϕ is satisfiable, then � V , E � has clique of size at least K : Define V , E , K as follows: ◮ Given a satisfying variable assignment choose a vertex ◮ V = {� i , j � | 1 ≤ i ≤ m , 1 ≤ j ≤ 3 } corresponding to a satisfied literal in each clause. � a vertex for every literal of every clause ◮ E contains edge between � i , j � and � i ′ , j ′ � if and only if ◮ The chosen K vertices are all connected with each other ◮ i � = i ′ � belong to different clauses, and and hence form a clique of size K . ◮ ℓ ij and ℓ i ′ j ′ are not complementary literals . . . ◮ K = m � obviously polynomially computable to show: reduction property . . . Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 9 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 10 / 38 E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems Clique ≤ p IndSet Clique is NP-Complete (5) Proof (continued). SAT ( ⇐ ): If � V , E � has a clique of size at least K , then ϕ is satisfiable: ◮ Consider a given clique C of size at least K . ◮ The vertices in C must all correspond to different clauses 3SAT (vertices in the same clause are not connected by edges). � exactly one vertex per clause is included in C Clique DirHamiltonCycle SubsetSum ◮ Two vertices in C never correspond to complementary literals X and ¬ X (due to the way we defined the edges). ◮ If a vertex corresp. to X was chosen, map X to 1 (true). IndSet HamiltonCycle Partition ◮ If a vertex corresp. to ¬ X was chosen, map X to 0 (false). ◮ If neither was chosen, arbitrarily map X to 0 or 1. � satisfying assignment VertexCover TSP BinPacking Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 11 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 12 / 38

  4. E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems IndSet IndSet is NP-Complete (1) Definition ( IndSet ) The problem IndSet is defined as follows: Theorem ( IndSet is NP-Complete) Given: undirected graph G = � V , E � , number K ∈ N 0 IndSet is NP-complete. Question: Does G have an independent set of size at least K , i. e., a set of vertices I ⊆ V with | I | ≥ K and { u , v } / ∈ E for all u , v ∈ I with u � = v ? German: unabh¨ angige Menge Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 13 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 14 / 38 E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems IndSet is NP-Complete (2) IndSet is NP-Complete (3) Proof (continued). We have: Proof. IndSet ∈ NP: guess and check. �� V , E � , K � ∈ Clique IndSet is NP-hard: We show Clique ≤ p IndSet . there exists a set V ′ ⊆ V with | V ′ | ≥ K iff We describe a polynomial reduction f . and { u , v } ∈ E for all u , v ∈ V ′ with u � = v Let � G , K � with G = � V , E � be the given input for Clique . there exists a set V ′ ⊆ V with | V ′ | ≥ K iff Then f ( � G , K � ) is the IndSet instance � G , K � , where ∈ E for all u , v ∈ V ′ with u � = v and { u , v } / G := � V , E � and E := {{ u , v } ⊆ V | u � = v , { u , v } / ∈ E } . (This graph G is called the complement graph of G .) iff �� V , E � , K � ∈ IndSet Clearly f can be computed in polynomial time. . . . iff f ( �� V , E � , K � ) ∈ IndSet and hence f is a reduction. Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 15 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 16 / 38

  5. E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems IndSet ≤ p VertexCover VertexCover SAT Definition ( VertexCover ) 3SAT The problem VertexCover is defined as follows: Given: undirected graph G = � V , E � , number K ∈ N 0 Question: Does G have a vertex cover of size at most K , Clique DirHamiltonCycle SubsetSum i. e., a set of vertices C ⊆ V with | C | ≤ K and { u , v } ∩ C � = ∅ for all { u , v } ∈ E ? IndSet HamiltonCycle Partition German: Knoten¨ uberdeckung VertexCover TSP BinPacking Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 17 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 18 / 38 E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Graph Problems VertexCover is NP-Complete (1) VertexCover is NP-Complete (2) Proof. VertexCover ∈ NP: guess and check. VertexCover is NP-hard: Theorem ( VertexCover is NP-Complete) We show IndSet ≤ p VertexCover . VertexCover is NP-complete. We describe a polynomial reduction f . Let � G , K � with G = � V , E � be the given input for IndSet . Then f ( � G , K � ) := � G , | V | − K � . This can clearly be computed in polynomial time. . . . Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 19 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 20 / 38

  6. E4. Some NP-Complete Problems, Part I Graph Problems E4. Some NP-Complete Problems, Part I Routing Problems VertexCover is NP-Complete (3) Proof (continued). For vertex set V ′ ⊆ V , we write V ′ for its complement V \ V ′ . Observation: a set of vertices is a vertex cover iff its complement is an independent set. E4.2 Routing Problems We thus have: �� V , E � , K � ∈ IndSet iff � V , E � has an independent set I with | I | ≥ K iff � V , E � has a vertex cover C with | C | ≥ K iff � V , E � has a vertex cover C with | C | ≤ | V | − K �� V , E � , | V | − K � ∈ VertexCover iff iff f ( �� V , E � , K � ) ∈ VertexCover and hence f is a reduction. Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 21 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 22 / 38 E4. Some NP-Complete Problems, Part I Routing Problems E4. Some NP-Complete Problems, Part I Routing Problems 3SAT ≤ p DirHamiltonCycle DirHamiltonCycle is NP-Complete (1) SAT Definition (Reminder: DirHamiltonCycle ) 3SAT The problem DirHamiltonCycle is defined as follows: Given: directed graph G = � V , E � Question: Does G contain a Hamilton cycle? Clique DirHamiltonCycle SubsetSum Theorem DirHamiltonCycle is NP-complete. IndSet HamiltonCycle Partition VertexCover TSP BinPacking Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 23 / 38 Gabriele R¨ oger (University of Basel) Theory of Computer Science May 18, 2020 24 / 38

Recommend


More recommend