Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Similar documents
Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

NP-Complete Reductions 2

NP-complete Reductions

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

P and NP (Millenium problem)

P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ. Instructor: X. Zhang

NP-Completeness. Algorithms

P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Partha Sarathi Mandal

NP-Hard (A) (B) (C) (D) 3 n 2 n TSP-Min any Instance V, E Question: Hamiltonian Cycle TSP V, n 22 n E u, v V H

NP-Complete Problems

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms

Chapter 9 Graph Algorithms

Introduction to Algorithms

(p 300) Theorem 7.27 SAT is in P iff P=NP

Module 6 NP-Complete Problems and Heuristics

CMPSCI611: The SUBSET-SUM Problem Lecture 18

COMP 355 Advanced Algorithms Approximation Algorithms: VC and TSP Chapter 11 (KT) Section (CLRS)

Some Hardness Proofs

Reference Sheet for CO142.2 Discrete Mathematics II

Lecture 7: Counting classes

W4231: Analysis of Algorithms

8.1 Polynomial-Time Reductions

1 Introduction. 1. Prove the problem lies in the class NP. 2. Find an NP-complete problem that reduces to it.

8 NP-complete problem Hard problems: demo

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

Chapter 8. NP-complete problems

CS 4407 Algorithms. Lecture 8: Circumventing Intractability, using Approximation and other Techniques

Computability Theory

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not.

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

Complexity Classes and Polynomial-time Reductions

Lecture 8: The Traveling Salesman Problem

1 Definition of Reduction

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

More NP-complete Problems. CS255 Chris Pollett May 3, 2006.

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

Introduction to Algorithms. Lecture 24. Prof. Patrick Jaillet

8.1 Polynomial-Time Reductions

NP and computational intractability. Kleinberg and Tardos, chapter 8

Theorem 2.9: nearest addition algorithm

Matching 4/21/2016. Bipartite Matching. 3330: Algorithms. First Try. Maximum Matching. Key Questions. Existence of Perfect Matching

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

Lecture 24: More Reductions (1997) Steven Skiena. skiena

APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

Module 6 NP-Complete Problems and Heuristics

Reductions and Satisfiability

Module 6 NP-Complete Problems and Heuristics

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example

6.2. Paths and Cycles

Prove, where is known to be NP-complete. The following problems are NP-Complete:

1 The Traveling Salesperson Problem (TSP)

Coping with NP-Completeness

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS

CS 580: Algorithm Design and Analysis

3/7/2018. CS 580: Algorithm Design and Analysis. 8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Examples of P vs NP: More Problems

Homework 4 Solutions

Basic Approximation algorithms

CSE 417 Branch & Bound (pt 4) Branch & Bound

Lecture 20: Satisfiability Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

Hardness of Approximation for the TSP. Michael Lampis LAMSADE Université Paris Dauphine

Notes for Lecture 24

Lecture 21: Other Reductions Steven Skiena

NP-Complete Problems

Approximation Algorithms

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

Slides on Approximation algorithms, part 2: Basic approximation algorithms

Paths. Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph.

1 Minimum Spanning Trees (MST) b 2 3 a. 10 e h. j m

Chapter 8. NP-complete problems. Search problems. cient algorithms. Exponential search space

Traveling Salesperson Problem (TSP)

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

Institute of Operating Systems and Computer Networks Algorithms Group. Network Algorithms. Tutorial 4: Matching and other stuff

Chapter 8. NP-complete problems

W[1]-hardness. Dániel Marx. Recent Advances in Parameterized Complexity Tel Aviv, Israel, December 3, 2017

Copyright 2000, Kevin Wayne 1

Lecture 21: Other Reductions Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

Introduction to Graph Theory

P vs. NP. Simpsons: Treehouse of Horror VI

Approximation Algorithms

Algorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95

Algorithms. Graphs. Algorithms

The k-center problem Approximation Algorithms 2009 Petros Potikas

Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, Approximation Algorithms

Chapter 10 Part 1: Reduction

Final. Name: TA: Section Time: Course Login: Person on Left: Person on Right: U.C. Berkeley CS170 : Algorithms, Fall 2013

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 25: Review and Open Problems

Transcription:

Hard Problems Euler-Tour Problem Undirected graph G=(V,E) An Euler Tour is a path where every edge appears exactly once. The Euler-Tour Problem: does graph G have an Euler Path? Answerable in O(E) time. Tour exists if each vertex has even degree. Merge edge-disjoint cycles.

Hamiltonian-Cycle Problem Undirected graph G=(V,E) A Hamiltonian cycle is a simple cycle that contains each vertex in V. The Hamiltonian-Cycle Problem: does graph G have a Hamiltonian cycle? Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Problems with polynomial-time solutions are tractable. low-order poly time is fast invariant under many models of computation (RAM, TM, parallel) invariant under +, *, and composition

Problems that require more than polynomial time are intractable. Some problems seem to have no polytime solutions. They may be NP-complete problems NP-complete problems are probably intractable and are candidates for approximation

Deciding NP-Completeness theory uses decision problems. A decision problem is a problem with a yes or no answer.

Ordinary Problem SHORTEST-PATH finds a shortest path between two given vertices in an unweighted, undirected graph G = (V, E). An instance is a triple consisting of a graph and two vertices. A solution is a sequence of vertices in the graph, with the empty sequence denoting no path.

Decision Problem Given two vertices in an unweighted, undirected graph G = (V, E) and a non-negative integer k, is there a path of length at most k? An instance is a quadruple consisting of a graph, two vertices, and a non-negative integer. A solution is either 0 (no) or 1(yes)

Complexity class P is the set of decision problems that can be solved in polynomial time.

Verifying A proposed solution, or certificate, is verified by checking that it is correct. The complexity class NP is the set of decision problems that can be verified by a poly-time algorithm.

Deciding if a graph is Hamiltonian no known poly-time algorithm (in fact, the problem is NP-complete) naive algorithm: test each permutation of vertices to see if it is a simple cycle. complexity: poly-time. Ω(m!), which is not

Verifying that a graph is Hamiltonian given a certificate, or list of vertices to check if the list is a Ham-cycle check that the list is a permutation of the graph vertices, then check that consecutive vertices in the list are connected by graph edges. algorithm verifies ham-cycle in poly time.

More Examples Is positive integer n composite? A certificate for n could be a list of its factors. (graph coloring) Can the vertices of graph G be colored with k colors so that no two adjacent vertices have the same color? A certificate could be a list of the colors associated with each vertex.

(satisfiability) Can the variables in a Boolean expression be assigned values true or false so the expression is true? A certificate could be a list of truth values associated with each variable.

Reducibility: Transforming one problem to another Problem A is polynomial-time reducible to problem B if there is a poly-time algorithm that converts an instance of A to an instance of B so that they have the same (yes or no) answers.

Example: Squaring and Multiplying x 2 = x x x y = ((x + y) 2 (x y) 2 )/4 If B has a fast solution, so does A.

Example The Hamiltonian cycle problem is poly-time reducible to the Travelling Salesperson Problem. Traveling Salesperson Problem (TSP) Optimization problem: given a weighted graph, find a minimumweight Hamiltonian cycle Decision problem: given a weighted graph and integer k, is there a Hamiltonian circuit of total weight at most k?

Idea: convert an instance of the ham-cycle problem to an equivalent instance of TSP.

Transformation Let G=(V,E) be a graph with n nodes (ham-cycle problem). Construct an instance of TSP as follows: Let H=(V,VxV) be a complete graph on the vertices of G. The edge weights c(u,v) are 1 if the edge (u,v) is in E and 2 otherwise. The bound k is n. A transformation is f(g)=(h,c,n).

Equivalence A Hamiltonian cycle in G is a tour in H with cost n. If there are no Hamiltonian cycles in G, any tour in H must cost at least n+1. So G has a Hamiltonian cycle if and only if H has a Traveling Salesperson Tour of weight n.

NP-Complete A decision problem A is NP-complete if A is in NP, and Every problem B in NP is polytime reducible to A. Transform old to the new.

NP-Hard A problem A is NP-hard if every problem B in NP is poly-time reducible to A. NP-hard problems include nondecision problems and decision problems that are not poly-time verifiable.

If an NP-complete problem is polytime solvable, then P = NP. If any problem in NP is not poly-time solvable, then no NP-complete problem is poly-time solvable.

Proving the first problem NP-complete literally required showing any problem in NP could be transformed to it. Cook, 1971. Problem was Satisfiability, proof used Turing Machines. Now it suffices to transform one NPcomplete problem to the candidate.

NP-Complete Problems Boolean Satisfiability (SAT). First NP-complete problem. Circuit Satisfiabliity (CIRCUIT-SAT). Given a boolean combinational circuit composed of AND, OR, and NOT gates, is it satisfiable? 3CNF-SAT. A logic formula in 3- CNF is the AND of clauses, each of which is the OR of three distinct variables, for example, (a b c ) (d a c) Given a

formula in 3-CNF, is it satisfiable?

The Clique Problem. A clique in an undirected graph G=(V,E) is a subset V of vertices, each pair of which is connected by an edge in E. A clique is a complete subgraph. Optimization problem: Find a clique of maximum size. Decision problem: Is there a clique of size k in the graph?

The Vertex Cover Problem. A vertex cover of an undirected graph G=(V,E) is a subset V such that, if (u,v) is in E, the u is in V or v is in V (or both). The size of a vertex cover is the number of vertices in it. Optimization problem: find a vertex cover of minimum size. Decision problem: Is there a vertex cover of size k?

Showing NP-Completeness Show problem is in NP and that some NP-complete problem is transformable to it.

The Clique Problem is NP-complete. undirected graph G=(V,E) an k-clique of graph G is a complete subgraph of G with k vertices Clique problem: Does an undirected graph have a clique of size k?

in NP: guess clique, verify it in O(n 2 ) time by checking if every pair of vertices in the clique is in E. NP-complete: The 3-CNF-SAT problem is polynomially transformable to the Clique Problem.

create a vertex for each appearance of a variable. Connect vertices if they are in different clauses and not negatives of each other. Then the formula is satisfiable if and only if the graph has a clique of size k, where k is the number of clauses in the formula.

The Vertex-Cover Problem is NP-Complete undirected graph G=(V,E) A vertex cover of G is a subset S of V with the property that each edge of G is incident on some vertex in S. Vertex Cover Problem: Does an undirected graph have a vertex cover of size K?

in NP: guess vertex cover, test endpoints of each edge in E to see if at least one is in the vertex cover. NP-complete: transform Clique Problem to a Vertex Cover problem.

Idea: use graph complement. The complement of an undirected graph G has the same set of vertices as G and exactly the edges that are not in G. Given a graph G with n vertices for the clique problem, construct its complement. Then G has a clique of size k if and only if its complement has a vertex cover of size n-k.

Approximation Algorithms Poly-time algorithms with performance bounds

Bounds C is the cost of the approximate solution C* is the cost of an optimal solution ratio bound is ρ(n) if max( C C C, ) <= ρ(n). C relative error bound is ɛ(n) if C C <= ɛ(n). C

Vertex Cover can be approximated with a ratio bound of 2 If the weights in TSP obey the triangle inequality, TSP can be approximated with a ratio bound of 2 using Prim s MST algorithm.

Summary P is the set of decision problems that can be solved in polynomial time NP is the set of decision problems that can be verified in polynomial time P is in NP, but it is unknown if P=NP.

Problem A is polynomial-time reducible to problem B if there is a poly-time algorithm that converts an instance of A to an instance of B so that they have the same (yes or no) answers. a problem A is NP-complete if it is in NP and if every problem is NP can be poly-time reduced to A. (decision problems only)

a problem A is NP-hard if every problem is NP can be poly-time reduced to L. (optimization problems allowed) a problem A can be shown to be NP-hard by showing that one problem known to be NP-complete can be poly-time reduced to A. To show L is NP-complete, also show it is in NP. Solutions to NP-complete problems can be approximated.