Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.

Slides:



Advertisements
Similar presentations
Reductions Complexity ©D.Moshkovitz.
Advertisements

Complexity ©D.Moshkovits 1 Where Can We Draw The Line? On the Hardness of Satisfiability Problems.
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Lecture 23. Subset Sum is NPC
NP-Completeness: Reductions
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
What is the first line of the proof? a). Assume G has an Eulerian circuit. b). Assume every vertex has even degree. c). Let v be any vertex in G. d). Let.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Analysis of Algorithms CS 477/677
Time Complexity.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 24 Instructor: Paul Beame.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Clique Cover Cook’s Theorem 3SAT and Independent Set
February 25, 2015CS21 Lecture 211 CS21 Decidability and Tractability Lecture 21 February 25, 2015.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
1 The TSP : NP-Completeness Approximation and Hardness of Approximation All exact science is dominated by the idea of approximation. -- Bertrand Russell.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
Lecture 22 More NPC problems
Theory of Computation, Feodor F. Dragan, Kent State University 1 NP-Completeness P: is the set of decision problems (or languages) that are solvable in.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Techniques for Proving NP-Completeness Show that a special case of the problem you are interested in is NP- complete. For example: The problem of finding.
Additional NP-complete problems
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CSC 413/513: Intro to Algorithms
Complexity ©D.Moshkovits 1 2-Satisfiability NOTE: These slides were created by Muli Safra, from OPICS/sat/)
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Prof. Busch - LSU1 Busch Complexity Lectures: More NP-complete Problems.
SUBSET-SUM Instance: A set of numbers denoted S and a target number t.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
Costas Busch - LSU 1 More NP-complete Problems. Costas Busch - LSU 2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible.
More NP-complete problems
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
More NP-complete Problems
Richard Anderson Lecture 26 NP-Completeness
(xy)(yz)(xz)(zy)
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
CS154, Lecture 16: More NP-Complete Problems; PCPs
Where Can We Draw The Line?
More NP-complete Problems
Additional NP-complete problems
More NP-Complete Problems
NP-Completeness Yin Tat Lee
CS154, Lecture 16: More NP-Complete Problems; PCPs
Reductions Complexity ©D.Moshkovitz.
Reductions Complexity ©D.Moshkovitz.
Instructor: Aaron Roth
Presentation transcript:

Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs

Complexity ©D.Moshkovitz 2 Introduction Objectives: –To introduce more graph theory problems. Overview: –Hamiltonian paths –Eulerian paths

Complexity ©D.Moshkovitz 3 Hamiltonian Path Instance: a directed graph G=(V,E) and two vertices s,t  V. Problem: To decide if there exists a path from s to t, which goes through each node once.

Complexity ©D.Moshkovitz 4 Can You Find One Here? st

Complexity ©D.Moshkovitz 5 HAMPATH is in NP Non-deterministically choose v 1,…,v n  V (n=|V|). For any 1  i,j  n, verify v i  v j. Verify s=v 1 and t=v n. For any 1  i  n, verify (v i,v i+1 )  E.

Complexity ©D.Moshkovitz 6 HAMPATH is NP-Complete Proof: We’ll show 3SAT  p HAMPATH. SIP s t... pp

Complexity ©D.Moshkovitz 7 Representing Variables For any variable x i, Diamond...

Complexity ©D.Moshkovitz 8 Representing Clauses For any clause c i,

Complexity ©D.Moshkovitz 9 High-Level Structure... x1x2...xlx1x2...xl c1c2c3...ckc1c2c3...ck s t

Complexity ©D.Moshkovitz 10 The Internal Structure of the Diamonds k pairs of internal nodes Diamond...

Complexity ©D.Moshkovitz 11 Connecting Clauses to Variables If the clause c j contains the literal x i, j’th pair xixi cjcj...

Complexity ©D.Moshkovitz 12 Connecting Clauses to Variables If the clause c j contains the literal  x i, j’th pair xixi cjcj...

Complexity ©D.Moshkovitz 13 Construction Completed This concludes the construction. Its size is polynomial in the size of the formula (Check!). We proceed to prove correctness.

Complexity ©D.Moshkovitz 14 Completeness Assume there exists a satisfying assignment for the 3CNF formula. Let us demonstrate a Hamiltonian tour on the graph.

Complexity ©D.Moshkovitz 15 Assignment  Path If the variable x i is assigned TRUE,...

Complexity ©D.Moshkovitz 16 Assignment  Path If the variable x i is assigned FALSE,...

Complexity ©D.Moshkovitz 17 Covering the Clauses If the clause c j is satisfied due to the literal x i, xixi cjcj... j’th pair

Complexity ©D.Moshkovitz Covering the Clauses If the clause c j is satisfied due to the literal  x i, xixi cjcj j’th pair

Complexity ©D.Moshkovitz 19 Soundness Assume there exists a Hamiltonian tour on the graph, Let us construct a satisfying assignment for the 3CNF formula.

Complexity ©D.Moshkovitz 20 Observation Every Hamiltonian path must contain either the entire right path or the entire left path of each diamond....

Complexity ©D.Moshkovitz 21 Path  Assignment For each variable, decide on its truth value, According to the direction of the path in its diamond....

Complexity ©D.Moshkovitz 22 x1x2...xlx1x2...xl... s t Observation cjcj A Hamiltonian path cannot jump from inside one diamond to another Proof Idea: Assume it can and observe this node

Complexity ©D.Moshkovitz 23 Satisfaction Note that because of the observationthe observation And the fact the path goes through all clause nodes, All clauses are satisfied

Complexity ©D.Moshkovitz 24 The Punch Line HAMPATH is NP-Complete.

Complexity ©D.Moshkovitz 25 Food for Thought… Is HAMCYCLE (Whether there exists a simple cycle which goes through all nodes) NP-Complete?

Complexity ©D.Moshkovitz 26 Food for Thought… What about finding Hamiltonian paths in undirected graphs?

Complexity ©D.Moshkovitz 27 Similar Problem Children usually like this riddle: Can you draw the following shape in one line?

Complexity ©D.Moshkovitz 28 Eulerian Path Instance: an undirected graph G=(V,E) and two vertices s  t  V. Problem: To decide if there exists a path from s to t, which goes through each edge exactly once.

Complexity ©D.Moshkovitz 29 Can You Find One Here? st

Complexity ©D.Moshkovitz 30 Eulerian Paths Vs. Hamiltonian Paths What do you make of this problem? Is it reducible to HAMPATH? Or vice-versa? ?

Complexity ©D.Moshkovitz 31

Complexity ©D.Moshkovitz 32 The Euler Theorem Theorem: A connected graph has an Eulerian path from s to t iff 1.s and t’s degrees are odd. 2.the degree of all other vertices is even.

Complexity ©D.Moshkovitz 33 First Direction Assume there is an Eulerian path from s to t in the graph. Let us prove all degrees, but s and t’s, are odd.

Complexity ©D.Moshkovitz 34 Analyzing Degrees Observe the path. It passes through all edges. For internal vertices, it gets out every time it gets in, thus adding 2 to the degree each time. Except it first gets out of s and finally gets in to t.

Complexity ©D.Moshkovitz 35 Second Direction Assume all degrees, but s and t’s, are even. Let us describe an algorithm which finds an Eulerian path from s to t.

Complexity ©D.Moshkovitz 36 Walks Start at s, While there are new edges –Arbitrarily choose such, –And walk on it.

Complexity ©D.Moshkovitz 37 Observation Claim: Such a walk must get stuck at t. Proof: After leaving s, t is the only vertex whose degree is odd. Thus we can get out of every other vertex we visit.

Complexity ©D.Moshkovitz 38 Were All Edges Visited? Not necessarily! Check out this example: st

Complexity ©D.Moshkovitz 39 Observation Claim: If there are edges not visited, than there exists such edge which “hits” a visited vertex. Proof: By graph connectivity. st

Complexity ©D.Moshkovitz 40 Observation Claim: A walk that starts at the visited vertex must get stuck at that vertex itself. Proof: After leaving the visited vertex it remains the only vertex the number of new edges hitting it is odd.

Complexity ©D.Moshkovitz 41 Putting the Pieces Together We can add the new walk to the old one and so cover at least one more edge. Now repeat this process if there are more uncovered edges. … s t ……

Complexity ©D.Moshkovitz 42 The Punch Line There is a polynomial time algorithm for the Eulerian path problem.

Complexity ©D.Moshkovitz 43 Food for Thought… How would you efficiently implement the Euler algorithm?

Complexity ©D.Moshkovitz 44 Summary NP P NPC EULERPATH HAMPATH

Complexity ©D.Moshkovitz 45 Summary In this lecture we’ve examined few problems related to paths in graphs. We’ve shown that finding a path which visits all vertices (Hamiltonian) is NP-Hard. While we can efficiently find paths which visit all edges (Eulerian). 