Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 60Slide 61Slide 62Circuit-SAT / 3-ColorabilitySlide 64Slide 65Slide 66Slide 67Slide 68Great Theoretical Ideas In Computer ScienceAnupam GuptaCS 15-251 Fall 2006Lecture 28 Dec 5th, 2006 Carnegie Mellon UniversityComplexity Theory: A graph called “Gadget”A Graph Named “Gadget”K-ColoringWe define a k-coloring of a graph:Each node gets colored with one colorAt most k different colors are usedIf two nodes have an edge between them they must have different colorsA graph is called k-colorable if and only if it has a k-coloringA 2-CRAYOLA Question!Is Gadget 2-colorable?No, it contains a triangleA 2-CRAYOLA Question!Given a graph G, how can we decide if it is 2-colorable?Answer: Enumerate all 2n possible colorings to look for a valid 2-colorHow can we efficiently decide if G is 2-colorable?Proposition: If G contains an odd cycle, G is not 2-colorableElse, output an odd cycleAlternate coloring algorithm:To 2-color a connected graph G, pick an arbitrary node v, and color it whiteColor all v’s neighbors blackColor all their uncolored neighbors white, and so onIf the algorithm terminates without a color conflict, output the 2-coloringElse, output an odd cycleTo 2-color a connected graph G, pick an arbitrary node v, and color it whiteColor all v’s neighbors blackColor all their uncolored neighbors white, and so onIf the algorithm terminates without a color conflict, output the 2-coloringElse, output an odd cycleTo 2-color a connected graph G, pick an arbitrary node v, and color it whiteColor all v’s neighbors blackColor all their uncolored neighbors white, and so onIf the algorithm terminates without a color conflict, output the 2-coloringA 2-CRAYOLA Question!TheoremTheorem: : G contains an odd cycle G contains an odd cycle if and only if if and only if G is not 2-colorableG is not 2-colorableA 3-CRAYOLA Question!Is Gadget 3-colorable?Yes!A 3-CRAYOLA Question!3-Coloring Is Decidable by Brute ForceTry out all 3n colorings until you determine if G has a 3-coloring3-Colorability Oracle YES/NOYES/NOA 3-CRAYOLA Oracle3-Colorability Search Oracle NO, orYES, here is how: gives 3-coloring of the nodesBetter 3-CRAYOLA Oracle3-Colorability Decision Oracle 3-Colorability Search OracleGIVEN: 3-Colorability Decision Oracle BUT I WANTED a SEARCH oracle for Christmas I am really bummed outChristmas PresentHow do I turn a How do I turn a mere decision mere decision oracle into a oracle into a search oracle?search oracle?GIVEN: 3-Colorability Decision Oracle Christmas PresentBeanie’s Flawed IdeaWhat if I gave the oracle partial colorings of G? For each partial coloring of G, I could pick an uncolored node and try different colors on it until the oracle says “YES”Turning a decision oracle into a search oracleBeanie’s Flawed IdeaRats, the decision Rats, the decision oracle does not take oracle does not take partial colorings….partial colorings….The FixBeanie’s FixGIVEN: 3-Colorability Decision Oracle3-Colorability Decision Oracle 3-Colorability Search OracleLet’s now look at two other problems:1. K-Clique2. K-Independent SetK-CliquesA A K-cliqueK-clique is a set of K nodes with all is a set of K nodes with all K(K-1)/2 possible edges between K(K-1)/2 possible edges between themthemThis graph contains a 4-cliqueA Graph Named “Gadget”Given: (G, k)Question: Does G contain a k-clique?BRUTE FORCE: Try out all {n choose k} BRUTE FORCE: Try out all {n choose k} possible locations for the k cliquepossible locations for the k cliqueThis graph contains an independent set of size 3Independent SetAn An independent setindependent set is a set of nodes with is a set of nodes with no edges between themno edges between themA Graph Named “Gadget”Given: (G, k)Question: Does G contain an independent set of size k?BRUTE FORCE: Try out all n choose k possible locations for the k independent setClique / Independent SetTwo problems that are Two problems that are cosmetically different, but cosmetically different, but substantially the samesubstantially the sameComplement of GGiven a graph G, let G*, the complement of G, be the graph such that two nodes are connected in G* if and only if the corresponding nodes are not connected in G GG*G has a k-cliqueG* has an independent set of size kLet G be an n-node graphGIVEN: Clique Oracle BUILD:Independent Set Oracle(G,k)(G*, k)Let G be an n-node graphGIVEN: Independent Set Oracle BUILD:Clique Oracle(G,k)(G*, k)Clique / Independent SetTwo problems that are Two problems that are cosmetically different, but cosmetically different, but substantially the samesubstantially the sameThus, we can quickly reduce a clique problem to an independent set problem and vice versa There is a fast algorithm to solve one if and only if there is a fast algorithm for the otherLet’s now look at two other problems:1. Circuit Satisfiability2. Graph 3-ColorabilityCombinatorial CircuitsAND, OR, NOT, 0, 1 gates wired AND, OR, NOT, 0, 1 gates wired together with no feedback together with no feedback allowedallowedx3x2x1ANDANDORORORANDANDNOT0111Yes, this circuit is satisfiable: 110Circuit-SatisfiabilityGiven a circuit with n-inputs and one output, is there a way to assign 0-1 values to the input wires so that the output value is 1 (true)?BRUTE FORCE: Try out all 2n assignmentsCircuit-SatisfiabilityGiven: A circuit with n-inputs and one Given: A circuit with n-inputs and one output, is there a way to assign 0-1 values output, is there a way to assign 0-1 values to the input wires so that the output value to the input wires so that the output value is 1 (true)?is 1 (true)?3-ColorabilityCircuit SatisfiabilityANDANDNOTTFXYTFXYTFXYX YF F FF T TT F TT T TORTFXNOT gate!ORORNOTx y zxyzORORNOTx y zxyzORORNOTx y zxyzORORNOTx y zxyzORORNOTx y zxyzHow do we force the graph to be 3 colorable exactly when the circuit is satifiable?Let C be an n-input circuitGIVEN: 3-colorOracle BUILD:SATOracleGraph composed of gadgets that mimic the gates in C CYou can quickly transform a method to decide 3-coloring
View Full Document