104
Announcements Announcements Assignment 4: Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible for understanding all 4 problems (related material may be on final exam). Tutorial: Tutorial: Fri, Apr 2 A. Kolokolova 16:00-17:30 PSE 321 Special office hours Special office hours (week prior to exam): (week prior to exam): MWF 2-3 MWF 2-3

Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Embed Size (px)

Citation preview

Page 1: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

AnnouncementsAnnouncements

Assignment 4:Assignment 4:

• Due Monday, April 5 at Midnight (due to university regulations).

• Submit solutions to any 2 of the 4 problems.

• Responsible for understanding all 4 problems (related material may be on final exam).

Tutorial:Tutorial:

• Fri, Apr 2 A. Kolokolova 16:00-17:30 PSE 321

Special office hoursSpecial office hours (week prior to exam): MWF (week prior to exam): MWF 2-32-3

Page 2: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

The Maximum The Maximum Network Flow Network Flow

ProblemProblem

Page 3: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExample

Flow(1)

Residual(1)

Flow(2)

Residual(2)

No more augmenting paths max flow attained.

Page 4: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

The Basic Ford-Fulkerson The Basic Ford-Fulkerson Algorithm Algorithm

Page 5: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Multiple Sources NetworkMultiple Sources Network

•We have several sources and several targets. We have several sources and several targets. •Want to maximize the total flow from all sources to all targets. Want to maximize the total flow from all sources to all targets. •Reduce to max-flow by creating a supersource and a supersink:Reduce to max-flow by creating a supersource and a supersink:

Page 6: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Maximum Bipartite MatchingMaximum Bipartite Matching

A bipartite graph is a graph G=(V,E) in which V can be divided into two parts L and R such that every edge in E is between a vertex in L and a vertex in R.

e.g. vertices in L represent skilled workers and vertices in R represent jobs. An edge connects workers to jobs they can perform.

Page 7: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

A matching in a graph is a subset M of E, such that for all vertices v in V, at most one edge of M is incident on v.

Page 8: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

A A maximummaximum matchingmatching is a matching of maximum is a matching of maximum cardinality. cardinality.

not maximum maximum

Page 9: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

A Maximum MatchingA Maximum Matching

No matching of No matching of cardinality 4, cardinality 4, because only one of because only one of v and u can be v and u can be matched. matched.

In the workers-jobs In the workers-jobs example a max-example a max-matching provides matching provides work for as many work for as many people as possible. people as possible.

v

u

Page 10: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Solving the Maximum Solving the Maximum Bipartite Matching ProblemBipartite Matching Problem

•Reduce an instance of the maximum Reduce an instance of the maximum bipartite matching problem on graph G to bipartite matching problem on graph G to an instance of the max-flow problem on a an instance of the max-flow problem on a corresponding flow networkcorresponding flow network G’. G’.

•Solve using Ford-Fulkerson method.Solve using Ford-Fulkerson method.

Page 11: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Corresponding Flow NetworkCorresponding Flow Network

•To form the corresponding flow network To form the corresponding flow network G' of the bipartite graph G:G' of the bipartite graph G:• Add a source vertex s and edges from s to L.• Direct the edges in E from L to R. • Add a target vertex t and edges from R to t. • Assign a capacity of 1 to all edges.

•ClaimClaim: max-flow in G’ corresponds to a : max-flow in G’ corresponds to a max-bipartite-matching on G.max-bipartite-matching on G.

Page 12: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExample

min cut

|M| = 3 max flow = 3

Page 13: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Lemma (CLRS 26.10)Lemma (CLRS 26.10)

( , ) be a bipartite graph with vertex partition Let .G V E V L R

( , ) be its corresponding fl ow netwLet ork. G V E

is a matching in ,I f M G

there is an integer-valued fl ow in with value | |then | | .f G f M

, is an integer-valued fConvers low in ife y ,l f G

there is a matching in with cardinality | |t .n |e |h M G M f

Page 14: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Why can’t we just say max |f| = Why can’t we just say max |f| = max |M|?max |M|?

Problem:Problem: we haven’t shown that f(u,v) is necessarily we haven’t shown that f(u,v) is necessarily integer-valued for all (u,v) when f is a max flow. integer-valued for all (u,v) when f is a max flow.

It follows from the lemma that It follows from the lemma that

max |M| = max [ integral flow], max |M| = max [ integral flow],

but we also need but we also need

max [integral flow] = max |f|max [integral flow] = max |f|

Page 15: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Integrality Theorem (CLRS Integrality Theorem (CLRS 26.11)26.11)

If the capacity function c takes on only integral If the capacity function c takes on only integral values, then:values, then:

1. The maximum flow f produced by the Ford-Fulkerson method has the property that |f| is integer-valued.

2. For all vertices u and v the value f(u,v) of the flow is an integer.

So So |M| = max [integral flow] = max |f||M| = max [integral flow] = max |f|

Page 16: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Conclusion Conclusion

Network flow algorithms allow us to Network flow algorithms allow us to find the maximum bipartite find the maximum bipartite matching fairly easily.matching fairly easily.

Similar techniques are applicable in Similar techniques are applicable in other combinatorial design other combinatorial design problems. problems.

Page 17: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExample

In a department there are n courses and In a department there are n courses and m instructors.m instructors.Every instructor has a list of courses he or Every instructor has a list of courses he or she can teach. she can teach. Every instructor can teach at most 3 Every instructor can teach at most 3 courses during a year. courses during a year.

The goal: find an allocation of courses to The goal: find an allocation of courses to the instructors subject to these the instructors subject to these constraints.constraints.

Page 18: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Two solutions using network Two solutions using network flowsflows

Solution 1: convert the problem into Solution 1: convert the problem into a bipartite matching problem.a bipartite matching problem.

Solution 2: convert the problem into Solution 2: convert the problem into a flow problem directly. a flow problem directly.

Page 19: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

A more complicated problemA more complicated problem

•There are m student groups on campus.There are m student groups on campus.•We would like to form a committee with a president, We would like to form a committee with a president, 3 vice-pres, and 10 members at large.3 vice-pres, and 10 members at large.•The committee is formed by representatives of the The committee is formed by representatives of the groups. groups.

•Can add conditions:Can add conditions:• The first group can be represented by at most 2 members,

any other group can be represented by at most one. • The representative of the third group cannot be the

president.

•Reduce to network flows!Reduce to network flows!

Page 20: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Reducibility and Reducibility and NP-CompletenessNP-Completeness

Page 21: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Computational Complexity Computational Complexity TheoryTheory

Computational Complexity Theory Computational Complexity Theory is is the study of how much of a given the study of how much of a given resource (such as time, space, resource (such as time, space, parallelism, randomness, algebraic parallelism, randomness, algebraic operations, communication, or quantum operations, communication, or quantum steps) is required to solve important steps) is required to solve important problems.problems.

Page 22: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

WORST-CASE TIMEWORST-CASE TIME

We say that a program takes We say that a program takes worst-case time T(n), if some worst-case time T(n), if some input of size n takes T(n) steps, input of size n takes T(n) steps, and no input of size n takes and no input of size n takes longer.longer.

The input size is measured in The input size is measured in bits, unless stated otherwise. bits, unless stated otherwise.

Page 23: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Some ExamplesSome Examples

Page 24: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

A Graph Named “Gadget”A Graph Named “Gadget”

Page 25: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

K-COLORINGK-COLORING

A A k-coloringk-coloring of a graph is an of a graph is an assignment of one color to each vertex assignment of one color to each vertex such that:such that:• No more than k colors are used• No two adjacent vertices receive the

same color

A graph is called A graph is called k-colorablek-colorable iff it has a iff it has a k-coloringk-coloring

Page 26: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

A A CCRRAAYYOOLLAA Question! Question!Is Gadget 2-colorable?Is Gadget 2-colorable?

No: it contains a triangle!

Page 27: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Is Gadget 3-colorable?Is Gadget 3-colorable?

A A CCRRAAYYOOLLAA Question! Question!

Yes!

Page 28: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given a graph G, what is Given a graph G, what is a fast algorithm to decide a fast algorithm to decide

if it can be 2-colored?if it can be 2-colored?

2 2 CCRRAAYYOOLLAASS

PERSPIRATION; BRUTE FORCE: Try out all 2n ways of 2 coloring G.

Page 29: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 30: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 31: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 32: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given a graph G, what is Given a graph G, what is a fast algorithm to decide a fast algorithm to decide

if it can be 3-colored?if it can be 3-colored?

3 3 CCRRAAYYOOLLAASS

? ? ? ? ? ? ? ?

Page 33: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Let’s consider a completely Let’s consider a completely different problem.different problem.

Page 34: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

K-CLIQUESK-CLIQUES

A K-clique is a set of K nodes with all A K-clique is a set of K nodes with all k(K-1)/2 possible edges between k(K-1)/2 possible edges between them.them.

Page 35: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

This graph contains a 4-This graph contains a 4-cliqueclique

Page 36: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given an n-node graph G Given an n-node graph G and a number k, how can and a number k, how can

you decide if G contains a k-you decide if G contains a k-clique? clique?

PERSPIRATION: Try out all n choose PERSPIRATION: Try out all n choose k possible locations for the k cliquek possible locations for the k clique

INSPIRATION: INSPIRATION:

? ? ? ? ? ? ? ?

Page 37: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

OK, how about a slightly OK, how about a slightly different problem?different problem?

Page 38: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

INDEPENDENT SETINDEPENDENT SET

An An independent setindependent set is a set of is a set of vertices with no edges between vertices with no edges between them.them.

This graph contains an independent set of size

3.

Page 39: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given an n-node graph G Given an n-node graph G and a number k, how can and a number k, how can

you decide if G contains an you decide if G contains an independent set of size k?independent set of size k?

PERSPIRATION: Try out all n-choose-PERSPIRATION: Try out all n-choose-k possible locations for independent k possible locations for independent setset

INSPIRATION: INSPIRATION: ? ? ? ? ? ? ? ?

Page 40: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

One more completely One more completely different problemdifferent problem

Page 41: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Combinational CircuitsCombinational Circuits

AND, OR, NOT, gates wired together AND, OR, NOT, gates wired together with no feedback allowed (acyclic).with no feedback allowed (acyclic).

Page 42: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Logic GatesLogic Gates

Not And Or

Page 43: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Example CircuitExample Circuit

Page 44: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

CIRCUIT-SATISFIABILITYCIRCUIT-SATISFIABILITY(decision version)(decision version)

Given a circuit with n-inputs Given a circuit with n-inputs and one output, is there a and one output, is there a way to assign 0-1 values to way to assign 0-1 values to the input wires so that the the input wires so that the output value is 1 (true)?output value is 1 (true)?

Page 45: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

CIRCUIT-SATISFIABILITYCIRCUIT-SATISFIABILITY(search version)(search version)

Given a circuit with n-inputs Given a circuit with n-inputs and one output, find an and one output, find an assignment of 0-1 values to assignment of 0-1 values to the input wires so that the the input wires so that the output value is 1 (true), or output value is 1 (true), or determine that no such determine that no such assignment exists.assignment exists.

Page 46: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Satisfiable Circuit ExampleSatisfiable Circuit Example

Page 47: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Satisfiable?Satisfiable?

No!

Page 48: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given a circuit, is it Given a circuit, is it satisfiable?satisfiable?

PERSPIRATION: Try out all 2PERSPIRATION: Try out all 2nn assignmentsassignments

INSPIRATION: INSPIRATION:

? ? ? ? ? ? ? ?

Page 49: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

We have seen 4 problems: coloring, clique,

independent set, and circuit SAT.

They all have a common story: A large space of possibilities only a tiny fraction of which satisfy the constraints. Brute

force takes too long, and no feasible algorithm is

known.

Page 50: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

CLIQUE / INDEPENDENT SETCLIQUE / INDEPENDENT SET

Two problems that Two problems that are cosmetically are cosmetically different, but different, but substantially the substantially the samesame

Page 51: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Complement Of GComplement Of G

Given a graph G, let GGiven a graph G, let G**, the , the complementcomplement of G, be the of G, be the graph obtained by the rule graph obtained by the rule that two nodes in Gthat two nodes in G** are are connected if and only if the connected if and only if the corresponding nodes of G are corresponding nodes of G are not connected not connected

Page 52: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ReductionReduction

• Suppose you have a method for solving the k-clique problem.

• How could it be used to solve the independent set problem?

Page 53: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Or what if you have an Or what if you have an Oracle?Oracle?

or·a·cleor·a·cle

Pronunciation:Pronunciation: 'or-&-k&l, 'är- 'or-&-k&l, 'är-

Function:Function: noun noun

Etymology:Etymology: Middle English, from Middle French, from Latin Middle English, from Middle French, from Latin oraculum, from orare to speakoraculum, from orare to speak

1 a : a person (as a priestess of ancient Greece) through 1 a : a person (as a priestess of ancient Greece) through whom a deity is believed to speak whom a deity is believed to speak

2 a : a person giving wise or authoritative decisions or 2 a : a person giving wise or authoritative decisions or opinionsopinions

Page 54: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Let G be an n-node graph.

GIVEN:Clique Oracle

<G,k>

BUILD:Indep.

SetOracle

<G*, k>

Page 55: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Let G be an n-node graph.

GIVEN: Indep.

Set Oracle

<G,k>

BUILD: Clique

Oracle

<G*, k>

Page 56: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Thus, we can quickly reduce clique problem to an independent set

problem and vice versa.

There is a fast method for one if and only if

there is a fast method for the other.

Page 57: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given an oracle for circuit SAT, how can you quickly

solve 3-colorability?

Page 58: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

VVnn(X,Y)(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 Y of colors to graph X and an assignment Y of colors to these nodes, and these nodes, and verifiesverifies that Y is a valid that Y is a valid 3-colouring of X. i.e., V3-colouring of X. i.e., Vnn(X,Y)=1 iff Y is a 3-(X,Y)=1 iff Y is a 3-colouring of X.colouring 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 sequence. sequence.

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

Page 59: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Let G be an n-node graph.

GIVEN:SAT

Oracle

G

BUILD:3-

colorOracle

Vn(G,Y)

Page 60: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given an oracle for circuit SAT, how can you quickly

solve k-clique?

Page 61: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

VVn,kn,k(X,Y)(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 a subset of nodes Y, and graph X and a subset of nodes Y, and verifiesverifies that Y is a k-clique X. I.e., that Y is a k-clique X. I.e., VVnn(X,Y)=1 iff Y is a k-clique of X.(X,Y)=1 iff Y is a k-clique 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 an n bit sequence. Y is expressed as an n bit sequence. sequence.

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

Page 62: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Let G be an n-node graph.

GIVEN:SAT

Oracle

<G,k>

BUILD:CliqueOracle

Vn,k(G,Y)

Page 63: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Given an oracle for 3-colorability, how

can you quickly solve

circuit SAT?

Page 64: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Reducing Circuit-SAT to 3-Reducing Circuit-SAT to 3-ColouringColouring

Goal: map circuit to graph that is 3-Goal: map circuit to graph that is 3-colourable only if circuit is colourable only if circuit is satisfiable.satisfiable.

How do we represent a logic gate as How do we represent a logic gate as a 3-colouring problem?a 3-colouring problem?

Page 65: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

X Y

Output

ExampleExample

X and Y and Output are boolean variables in circuit.

Without loss of generality, map truth values to colours, e.g.

0 red

1 green

Add base colour for encoding purposes, e.g. yellow.

Page 66: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

X Y

Output

ExampleExample

Note that in a valid 3-colouring, this node cannot have the same colour as X, Y or Output.

Thus, without loss of generality, we can assign it the base colour, yellow.

Page 67: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

X Y

Output

ExampleExample

Now suppose we fix this node to represent false.

Page 68: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

X Y

Output

ExampleExampleF

Now suppose we fix this node to represent false.

Page 69: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

Page 70: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

Page 71: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

Page 72: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

Page 73: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Thus (X,Y)=0Output=0

Page 74: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Conversely, what if Output=0?

Page 75: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Conversely, what if Output=0?

Page 76: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Conversely, what if Output=0?

Page 77: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Conversely, what if Output=0?

Page 78: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

Thus Output=0X=Y=0.

Page 79: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

ExampleExampleT F

X Y

Output

XX YY OutpOutputut

FF FF FF

FF TT TT

TT FF TT

TT TT TT

What type of gate is this?

An OR gate!

Page 80: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

T F

X What type of gate is this?

A NOT gate!

Output

Page 81: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

OR

OR

NOT

x y z

xy

z

Page 82: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

OR

OR

NOT

x y z

xy

z

Satisfiability of this circuit = 3-colorability of this graph

Page 83: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Let C be an n-input circuit.

GIVEN:3-colorOracle

C

BUILD:SAT

Oracle

Graph composed of gadgets that mimic

the gates in C

Page 84: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

Formal StatementFormal Statement

There is a polynomial-time function f There is a polynomial-time function f such that:such that:

C is satisfiable <-> f(C) is 3 C is satisfiable <-> f(C) is 3 colorablecolorable

Page 85: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

4 Problems All Equivalent4 Problems All Equivalent

If you can solve one quickly then you If you can solve one quickly then you can solve them all quickly:can solve them all quickly:

Circuit-SATCircuit-SAT

CliqueClique

Independent SetIndependent Set

3 Colorability3 Colorability

Page 86: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 87: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 88: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 89: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 90: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 91: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 92: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 93: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 94: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 95: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 96: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 97: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 98: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 99: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 100: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 101: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 102: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 103: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible
Page 104: Announcements Assignment 4: Due Monday, April 5 at Midnight (due to university regulations). Submit solutions to any 2 of the 4 problems. Responsible

That’s All, Folks!That’s All, Folks!