This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS103 HO#52 SlidesMore on Complexity 5/23/11 1 The Language Class P P is closed under complement. PROOF: If L P, there is a deterministic Turing machine M that decides L in polynomial time. Construct a machine M' that is M with the accepting and rejecting states swapped. M' will halt in exactly the same number of steps that M would take and it would accept L. Is NOTCONNECTED the same as CONNECTED? CONNECTED = NOTCONNECTED {strings not of the form G } = { w  w is not an undirected graph or w = G for a graph G that is not connected } The question of whether a string is an encoded graph is decidable in polynomial time, so malformed cases don't affect the polynomial time decidability of CONNECTED. Thus it is reasonable to use NOTCONNECTED as a shorthand for CONNECTED. CONNECTED = { G  G is an undirected graph and G is connected } NOTCONNECTED = { G  G is an undirected graph and G is not connected } The Language Class P C A B D The Knigsberg Bridges An Eulerian path through a graph traverses each edge exactly once. An Eulerian circuit through a graph is an Eulerian path that starts and ends at the same node. (Note: a Hamiltonian circuit visits each vertex exactly once.) What is the complexity of deciding whether a graph has an Eulerian circuit? The Language Class P EC = { G  G is an undirected graph and G contains an Eulerian circuit. } Euler showed that a connected graph has an Eulerian path that is not a circuit if and only if it contains exactly 2 vertices of odd degree a connected graph has an Eulerian circuit if and only if all vertices have even degree. M = "On input G, a graph with vertices V and edges E: 1. If CONNECTED (G) rejects, reject . 2. For each vertex v in V: 3. Count the number of edges that have v as one endpoint but not both. 4. If the count is odd, exit the loop and reject . 5. If all counts are even, accept ." The Language Class P EC = { G  G is an undirected graph and G contains an Eulerian circuit. } M = "On input G, a graph with vertices V and edges E: 1. If CONNECTED (G) rejects, reject ....
View
Full
Document
This document was uploaded on 07/18/2011.
 Spring '09

Click to edit the document details