CS 374: Algorithms & Models of Computation, Spring 2017 Polynomial Time Reductions Lecture 22 April 18, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 1
Part I (Polynomial Time) Reductions Chandra Chekuri (UIUC) CS374 2 Spring 2017 2 / 1
Reductions A reduction from Problem X to Problem Y means (informally) that if we have an algorithm for Problem Y , we can use it to find an algorithm for Problem X . Chandra Chekuri (UIUC) CS374 3 Spring 2017 3 / 1
Reductions A reduction from Problem X to Problem Y means (informally) that if we have an algorithm for Problem Y , we can use it to find an algorithm for Problem X . Using Reductions We use reductions to find algorithms to solve problems. 1 Chandra Chekuri (UIUC) CS374 3 Spring 2017 3 / 1
Reductions A reduction from Problem X to Problem Y means (informally) that if we have an algorithm for Problem Y , we can use it to find an algorithm for Problem X . Using Reductions We use reductions to find algorithms to solve problems. 1 We also use reductions to show that we can’t find algorithms for 2 some problems. (We say that these problems are hard.) Chandra Chekuri (UIUC) CS374 3 Spring 2017 3 / 1
Reductions for decision problems/languages For languages L X , L Y , a reduction from L X to L Y is: An algorithm . . . 1 Input: w ∈ Σ ∗ 2 Output: w ′ ∈ Σ ∗ 3 Such that: 4 w ′ ∈ L X w ∈ L Y ⇐ ⇒ Chandra Chekuri (UIUC) CS374 4 Spring 2017 4 / 1
Reductions for decision problems/languages For languages L X , L Y , a reduction from L X to L Y is: An algorithm . . . 1 Input: w ∈ Σ ∗ 2 Output: w ′ ∈ Σ ∗ 3 Such that: 4 w ′ ∈ L X w ∈ L Y ⇐ ⇒ (Actually, this is only one type of reduction, but this is the one we’ll use most often.) There are other kinds of reductions. Chandra Chekuri (UIUC) CS374 4 Spring 2017 4 / 1
Reductions for decision problems/languages For decision problems X , Y , a reduction from X to Y is: An algorithm . . . 1 Input: I X , an instance of X . 2 Output: I Y an instance of Y . 3 Such that: 4 I Y is YES instance of Y ⇐ ⇒ I X is YES instance of X Chandra Chekuri (UIUC) CS374 5 Spring 2017 5 / 1
Using reductions to solve problems R : Reduction X → Y 1 A Y : algorithm for Y : 2 Chandra Chekuri (UIUC) CS374 6 Spring 2017 6 / 1
Using reductions to solve problems R : Reduction X → Y 1 A Y : algorithm for Y : 2 = ⇒ New algorithm for X : 3 A X ( I X ) : // I X : instance of X . I Y ⇐ R ( I X ) return A Y ( I Y ) Chandra Chekuri (UIUC) CS374 6 Spring 2017 6 / 1
Using reductions to solve problems R : Reduction X → Y 1 A Y : algorithm for Y : 2 = ⇒ New algorithm for X : 3 A X ( I X ) : // I X : instance of X . I Y ⇐ R ( I X ) return A Y ( I Y ) YES I X I Y R A Y NO A X If R and A Y polynomial-time = ⇒ A X polynomial-time. Chandra Chekuri (UIUC) CS374 6 Spring 2017 6 / 1
Comparing Problems “Problem X is no harder to solve than Problem Y ”. 1 If Problem X reduces to Problem Y (we write X ≤ Y ), then 2 X cannot be harder to solve than Y . X ≤ Y : 3 X is no harder than Y , or 1 Y is at least as hard as X . 2 Chandra Chekuri (UIUC) CS374 7 Spring 2017 7 / 1
Part II Examples of Reductions Chandra Chekuri (UIUC) CS374 8 Spring 2017 8 / 1
Independent Sets and Cliques Given a graph G , a set of vertices V ′ is: Chandra Chekuri (UIUC) CS374 9 Spring 2017 9 / 1
Independent Sets and Cliques Given a graph G , a set of vertices V ′ is: independent set : no two vertices of V ′ connected by an edge. 1 Chandra Chekuri (UIUC) CS374 9 Spring 2017 9 / 1
Independent Sets and Cliques Given a graph G , a set of vertices V ′ is: independent set : no two vertices of V ′ connected by an edge. 1 clique : every pair of vertices in V ′ is connected by an edge of 2 G . Chandra Chekuri (UIUC) CS374 9 Spring 2017 9 / 1
Independent Sets and Cliques Given a graph G , a set of vertices V ′ is: independent set : no two vertices of V ′ connected by an edge. 1 clique : every pair of vertices in V ′ is connected by an edge of 2 G . Chandra Chekuri (UIUC) CS374 9 Spring 2017 9 / 1
Independent Sets and Cliques Given a graph G , a set of vertices V ′ is: independent set : no two vertices of V ′ connected by an edge. 1 clique : every pair of vertices in V ′ is connected by an edge of 2 G . Chandra Chekuri (UIUC) CS374 9 Spring 2017 9 / 1
Independent Sets and Cliques Given a graph G , a set of vertices V ′ is: independent set : no two vertices of V ′ connected by an edge. 1 clique : every pair of vertices in V ′ is connected by an edge of 2 G . Chandra Chekuri (UIUC) CS374 9 Spring 2017 9 / 1
The Independent Set and Clique Problems Problem: Independent Set Instance: A graph G and an integer k . Question: Does G has an independent set of size ≥ k ? Chandra Chekuri (UIUC) CS374 10 Spring 2017 10 / 1
The Independent Set and Clique Problems Problem: Independent Set Instance: A graph G and an integer k . Question: Does G has an independent set of size ≥ k ? Problem: Clique Instance: A graph G and an integer k . Question: Does G has a clique of size ≥ k ? Chandra Chekuri (UIUC) CS374 10 Spring 2017 10 / 1
Recall For decision problems X , Y , a reduction from X to Y is: An algorithm . . . 1 that takes I X , an instance of X as input . . . 2 and returns I Y , an instance of Y as output . . . 3 such that the solution (YES/NO) to I Y is the same as the 4 solution to I X . Chandra Chekuri (UIUC) CS374 11 Spring 2017 11 / 1
Reducing Independent Set to Clique An instance of Independent Set is a graph G and an integer k . Chandra Chekuri (UIUC) CS374 12 Spring 2017 12 / 1
Reducing Independent Set to Clique An instance of Independent Set is a graph G and an integer k . Chandra Chekuri (UIUC) CS374 12 Spring 2017 12 / 1
Reducing Independent Set to Clique An instance of Independent Set is a graph G and an integer k . Reduction given < G , k > outputs < G , k > where G is the complement of G . G has an edge ( u , v ) if and only if ( u , v ) is not an edge of G . Chandra Chekuri (UIUC) CS374 12 Spring 2017 12 / 1
Reducing Independent Set to Clique An instance of Independent Set is a graph G and an integer k . Reduction given < G , k > outputs < G , k > where G is the complement of G . G has an edge ( u , v ) if and only if ( u , v ) is not an edge of G . Chandra Chekuri (UIUC) CS374 12 Spring 2017 12 / 1
Reducing Independent Set to Clique An instance of Independent Set is a graph G and an integer k . Reduction given < G , k > outputs < G , k > where G is the complement of G . G has an edge ( u , v ) if and only if ( u , v ) is not an edge of G . Chandra Chekuri (UIUC) CS374 12 Spring 2017 12 / 1
Reducing Independent Set to Clique An instance of Independent Set is a graph G and an integer k . Reduction given < G , k > outputs < G , k > where G is the complement of G . G has an edge ( u , v ) if and only if ( u , v ) is not an edge of G . Chandra Chekuri (UIUC) CS374 12 Spring 2017 12 / 1
Correctness of reduction Lemma G has an independent set of size k if and only if G has a clique of size k . Proof. Need to prove two facts: G has independent set of size at least k implies that G has a clique of size at least k . G has a clique of size at least k implies that G has an independent set of size at least k . Easy to see both from the fact that S ⊆ V is an independent set in G if and only if S is a clique in G . Chandra Chekuri (UIUC) CS374 13 Spring 2017 13 / 1
Independent Set and Clique Independent Set ≤ Clique . 1 Chandra Chekuri (UIUC) CS374 14 Spring 2017 14 / 1
Independent Set and Clique Independent Set ≤ Clique . 1 What does this mean? If have an algorithm for Clique , then we have an algorithm for 2 Independent Set . Chandra Chekuri (UIUC) CS374 14 Spring 2017 14 / 1
Independent Set and Clique Independent Set ≤ Clique . 1 What does this mean? If have an algorithm for Clique , then we have an algorithm for 2 Independent Set . Clique is at least as hard as Independent Set . 3 Chandra Chekuri (UIUC) CS374 14 Spring 2017 14 / 1
Independent Set and Clique Independent Set ≤ Clique . 1 What does this mean? If have an algorithm for Clique , then we have an algorithm for 2 Independent Set . Clique is at least as hard as Independent Set . 3 Also... Clique ≤ Independent Set . Why? Thus Clique and 4 Independent Set are polnomial-time equivalent. Chandra Chekuri (UIUC) CS374 14 Spring 2017 14 / 1
Independent Set and Clique Assume you can solve the Clique problem in T ( n ) time. Then you can solve the Independent Set problem in (A) O ( T ( n )) time. (B) O ( n log n + T ( n )) time. (C) O ( n 2 T ( n 2 )) time. (D) O ( n 4 T ( n 4 )) time. (E) O ( n 2 + T ( n 2 )) time. (F) Does not matter - all these are polynomial if T ( n ) is polynomial, which is good enough for our purposes. Chandra Chekuri (UIUC) CS374 15 Spring 2017 15 / 1
DFA Universality A DFA M is universal if it accepts every string. That is, L ( M ) = Σ ∗ , the set of all strings. Chandra Chekuri (UIUC) CS374 16 Spring 2017 16 / 1
Recommend
More recommend