Top Banner
Great Theoretical Ideas In Computer Science Anupam Gupta CS 15-251 Fall 2006 Lecture 28 Dec 5th, 2006 Carnegie Mellon University Complexity Theory: A graph called “Gadget”
67

Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Jan 17, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Great Theoretical Ideas In Computer Science

Anupam Gupta

CS 15-251 Fall 2006

Lecture 28 Dec 5th, 2006 Carnegie Mellon University

Complexity Theory: A graph called “Gadget”

Page 2: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A Graph Named “Gadget”

Page 3: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

K-Coloring

We define a k-coloring of a graph:

Each node gets colored with one color

At most k different colors are used

If two nodes have an edge between them they must have different colors

A graph is called k-colorable if and only if it has a k-coloring

Page 4: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A 2-CRAYOLA Question!

Is Gadget 2-colorable?

No, it contains a triangle

Page 5: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A 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-color

How can we efficiently decide if G is 2-colorable?

Page 6: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Proposition: If G contains an odd cycle, G is not 2-colorable

Else, output an odd cycle

Alternate coloring algorithm:

To 2-color a connected graph G, pick an arbitrary node v, and color it white

Color all v’s neighbors black

Color all their uncolored neighbors white, and so on

If the algorithm terminates without a color conflict, output the 2-coloring

Page 7: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Else, output an odd cycle

To 2-color a connected graph G, pick an arbitrary node v, and color it white

Color all v’s neighbors blackColor all their uncolored neighbors white, and so on

If the algorithm terminates without a color conflict, output the 2-coloring

Page 8: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Else, output an odd cycle

To 2-color a connected graph G, pick an arbitrary node v, and color it white

Color all v’s neighbors blackColor all their uncolored neighbors white, and so on

If the algorithm terminates without a color conflict, output the 2-coloring

Page 9: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A 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-colorable

Page 10: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A 3-CRAYOLA Question!

Is Gadget 3-colorable?

Yes!

Page 11: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.
Page 12: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A 3-CRAYOLA Question!

Page 13: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

3-Coloring Is Decidable by Brute Force

Try out all 3n colorings until you determine if G has a 3-coloring

Page 14: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

3-Colorability Oracle

YES/NOYES/NO

A 3-CRAYOLA Oracle

Page 15: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

3-Colorability Search Oracle

NO, or

YES, here is how: gives 3-coloring

of the nodes

Better 3-CRAYOLA Oracle

Page 16: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

3-Colorability Decision Oracle

3-Colorability Search Oracle

Page 17: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

GIVEN: 3-Colorability

Decision Oracle

BUT I WANTED a SEARCH oracle for Christmas

I am really bummed out

Christmas Present

Page 18: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

How 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 Present

Page 19: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Beanie’s Flawed Idea

What 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”

Page 20: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Turning a decision oracle into a search oracle

Page 21: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Beanie’s Flawed Idea

Rats, the decision Rats, the decision oracle does not take oracle does not take partial colorings….partial colorings….

Page 22: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

The Fix

Page 23: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Beanie’s Fix

GIVEN: 3-Colorability

Decision Oracle

Page 24: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

3-Colorability Decision Oracle

3-Colorability Search Oracle

Page 25: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Let’s now look at two other problems:

1. K-Clique2. K-Independent Set

Page 26: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

K-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 themthem

This graph contains a 4-clique

Page 27: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A Graph Named “Gadget”

Page 28: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

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 clique

Page 29: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

This graph contains an independent set of size

3

Independent Set

An An independent setindependent set is a set of nodes with is a set of nodes with no edges between themno edges between them

Page 30: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

A Graph Named “Gadget”

Page 31: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

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 set

Page 32: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Clique / Independent Set

Two problems that are Two problems that are cosmetically different, but cosmetically different, but

substantially the samesubstantially the same

Page 33: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Complement 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

G G*

Page 34: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

G has a k-cliqueG* has an

independent set of size k

Page 35: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Let G be an n-node graph

GIVEN: Clique Oracle

BUILD:Independent Set Oracle

(G,k)

(G*, k)

Page 36: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Let G be an n-node graph

GIVEN: Independent Set Oracle

BUILD:Clique Oracle

(G,k)

(G*, k)

Page 37: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Clique / Independent Set

Two problems that are Two problems that are cosmetically different, but cosmetically different, but

substantially the samesubstantially the same

Page 38: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Thus, 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 other

Page 39: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Let’s now look at two other problems:

1. Circuit Satisfiability2. Graph 3-Colorability

Page 40: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Combinatorial CircuitsAND, OR, NOT, 0, 1 gates wired AND, OR, NOT, 0, 1 gates wired together with no feedback together with no feedback allowedallowed

x3x2x1

AND

AND

OR

OR

OR

Page 41: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

AND

AND

NOT

011

1

Yes, this circuit is satisfiable: 110

Circuit-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)?

Page 42: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

BRUTE FORCE: Try out all 2n assignments

Circuit-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)?

Page 43: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

3-ColorabilityCircuit

Satisfiability

AND

AND

NOT

Page 44: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.
Page 45: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

T F

XY

Page 46: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

T F

XY

Page 47: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

T F

XY

X Y

F F F

F T T

T F T

T T T

OR

Page 48: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

T F

X NOT gate!

Page 49: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

OR

OR

NOT

x y z

xy

z

Page 50: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

OR

OR

NOT

x y z

xy

z

Page 51: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

OR

OR

NOT

x y z

xy

z

Page 52: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

OR

OR

NOT

x y z

xy

z

Page 53: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

OR

OR

NOT

x y z

xy

z

How do we force the graph to be 3 colorable exactly when the circuit is satifiable?

Page 54: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Let C be an n-input circuit

GIVEN: 3-colorOracle

BUILD:SAT

Oracle

Graph composed of gadgets that

mimic the gates in C

C

Page 55: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

You can quickly transform a method to decide 3-coloring

into a method to decide circuit

satifiability!

Page 56: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Given an oracle for circuit SAT, how can you quickly solve

3-colorability?

Page 57: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Can you make a circuit that takes a description of a graph and a node coloring, and checks if it is a valid 3-coloring?

Page 58: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

X (n choose 2 bits) Y (2n bits)

Vn(X,Y)

eij ci cj

Page 59: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Vn(X,Y)Let VLet Vn n be a circuit that takes an n-node be a circuit that takes an n-node graph X and an assignment of colors to graph X and an assignment of colors to nodes Y, and nodes Y, and verifiesverifies that Y is a valid that Y is a valid 3 coloring of X. I.e., V3 coloring of X. I.e., Vnn(X,Y) = 1 iff Y is (X,Y) = 1 iff Y is a 3 coloring of Xa 3 coloring of X

X is expressed as an n choose 2 bit X is expressed as an n choose 2 bit sequence. Y is expressed as a 2n bit sequence. Y is expressed as a 2n bit sequencesequence

Given n, we can construct VGiven n, we can construct Vn n in time O(nin time O(n22))

Page 60: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Let G be an n-node graph

GIVEN: SAT

Oracle

BUILD:3-colorOracle

G

Vn(G,Y)

Page 61: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Circuit-SAT / 3-Colorability

Two problems that are Two problems that are cosmetically different, but cosmetically different, but

substantially the samesubstantially the same

Page 62: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Circuit-SAT / 3-Colorability

Clique / Independent Set

Page 63: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Given an oracle for circuit SAT, how can you

quickly solve k-clique?

Page 64: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Circuit-SAT / 3-Colorability

Clique / Independent Set

Page 65: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Four problems that are cosmetically different, but substantially the

same

Page 66: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

FACT:FACT: No one knows a No one knows a way to solve any of the way to solve any of the 4 problems that is fast 4 problems that is fast on all instanceson all instances

Page 67: Great Theoretical Ideas In Computer Science Anupam GuptaCS 15-251 Fall 2006 Lecture 28Dec 5th, 2006Carnegie Mellon University Complexity Theory: A graph.

Summary

Many problems that appear Many problems that appear different on the surface can be different on the surface can be

efficiently reduced to each other, efficiently reduced to each other, revealing a deeper similarityrevealing a deeper similarity