#  3 5,7,0308

## Full text

(1)

### min cut and max cut

• A cut in an undirected graph G = (V, E) is a partition of the nodes into two nonempty sets S and V − S.

• The size of a cut (S, V − S) is the number of edges between S and V − S.

• min cut ∈ P by the maxﬂow algorithm.a

• max cut asks if there is a cut of size at least K.

– K is part of the input.

(2)

(3)

### min cut and max cut (concluded)

• max cut has applications in circuit layout.

– The minimum area of a VLSI layout of a graph is not less than the square of its maximum cut size.a

aRaspaud, S´ykora, and Vrˇto (1995); Mak and Wong (2000).

(4)

### max cut Is NP-Complete

a

• We will reduce naesat to max cut.

• Given a 3sat formula φ with m clauses, we shall construct a graph G = (V, E) and a goal K.

• Furthermore, there is a cut of size at least K if and only if φ is nae-satisﬁable.

• Our graph will have multiple edges between two nodes.

– Each such edge contributes one to the cut if its nodes are separated.

aKarp (1972); Garey, Johnson, and Stockmeyer (1976).

(5)

### The Proof

• Suppose φ’s m clauses are C1, C2, . . . , Cm.

• The boolean variables are x1, x2, . . . , xn.

• G has 2n nodes: x1, x2, . . . , xn, ¬x1, ¬x2, . . . , ¬xn.

• Each clause with 3 distinct literals makes a triangle in G.

• For each clause with two identical literals, there are two parallel edges between the two distinct literals.

(6)

### The Proof (continued)

• No need to consider clauses with one literal (why?).

• No need to consider clauses containing two opposite literals xi and ¬xi (why?).

• For each variable xi, add ni copies of edge [xi, ¬xi],

where ni is the number of occurrences of xi and ¬xi in φ.

• Note that

n i=1

ni = 3m.

– The summation is simply the total number of literals.

(7)

M

L

L

L

L

M

## » [

N

(8)

### The Proof (continued)

• Set K = 5m.

• Suppose there is a cut (S, V − S) of size 5m or more.

• A clause (a triangle or two parallel edges) contributes at most 2 to a cut no matter how you split it.

• Suppose some xi and ¬xi are on the same side of the cut.

• They together contribute (at most) 2ni edges to the cut.

– They appear in (at most) ni diﬀerent clauses.

– A clause contributes at most 2 to a cut.

(9)

» [L [L

QLØWULDQJOHVÙ 3 L

(10)

### The Proof (continued)

• Either xi or ¬xi contributes at most ni to the cut by the pigeonhole principle.

• Changing the side of that literal does not decrease the size of the cut.

• Hence we assume variables are separated from their negations.

• The total number of edges in the cut that join opposite literals xi and ¬xi is n

i=1 ni.

• But n

i=1 ni = 3m.

(11)

### The Proof (concluded)

• The remaining K − 3m ≥ 2m edges in the cut must come from the m triangles or parallel edges that correspond to the clauses.

• Each can contribute at most 2 to the cut.a

• So all are split.

• A split clause means at least one of its literals is true and at least one false.

• The other direction is left as an exercise.

(12)

### This Cut Does Not Meet the Goal K = 5 × 3 = 15

» [

» [

» [ [

[

[

• (x1 ∨ x2 ∨ x2) ∧ (x1 ∨ ¬x3 ∨ ¬x3) ∧ (¬x1 ∨ ¬x2 ∨ x3).

• The cut size is 13 < 15.

(13)

» [

» [

» [ [

[

[ WUXH

IDOVH

(14)

### Remarks

• We had proved that max cut is NP-complete for multigraphs.

• How about proving the same thing for simple graphs?a

• How to modify the proof to reduce 4sat to max cut?b

• All NP-complete problems are mutually reducible by deﬁnition.c

– So they are equally hard in this sense.d

aContributed by Mr. Tai-Dai Chou (J93922005) on June 2, 2005.

bContributed by Mr. Chien-Lin Chen (J94922015) on June 8, 2006.

cContributed by Mr. Ren-Shuo Liu (D98922016) on October 27, 2009.

dContributed by Mr. Ren-Shuo Liu (D98922016) on October 27, 2009.

(15)

### max bisection

• max cut becomes max bisection if we require that

| S | = | V − S |.

• It has many applications, especially in VLSI layout.

(16)

### max bisection Is NP-Complete

• We shall reduce the more general max cut to max bisection.

• Add |V | = n isolated nodes to G to yield G.

• G has 2n nodes.

• G’s goal K is identical to G’s

– As the new nodes have no edges, they contribute 0 to the cut.

• This completes the reduction.

(17)

### The Proof (concluded)

• Every cut (S, V − S) of G = (V, E) can be made into a bisection by appropriately allocating the new nodes between S and V − S.

• Hence each cut of G can be made a cut of G of the same size, and vice versa.

(18)

### bisection width

• bisection width is like max bisection except that it asks if there is a bisection of size at most K (sort of min bisection).

• Unlike min cut, bisection width is NP-complete.

• We reduce max bisection to bisection width.

• Given a graph G = (V, E), where | V | is even, we generate the complement of G.

• Given a goal of K, we generate a goal of n2 − K.a

a| V | = 2n.

(19)

### The Proof (concluded)

• To show the reduction works, simply notice the following easily veriﬁable claims.

– A graph G = (V, E), where |V | = 2n, has a bisection of size K if and only if the complementa of G has a bisection of size n2 − K.

– So G has a bisection of size ≥ K if and only if its complement has a bisection of size ≤ n2 − K.

aRecall p. 374.

(20)

### hamiltonian path Is NP-Complete

a

Theorem 45 Given an undirected graph, the question whether it has a Hamiltonian path is NP-complete.

aKarp (1972).

(21)

(22)

### tsp (d) Is NP-Complete

Corollary 46 tsp (d) is NP-complete.

• Consider a graph G with n nodes.

• Create a weighted complete graph G with the same nodes as G.

• Set dij = 1 on G if [ i, j ] ∈ G and dij = 2 on G if [ i, j ] ∈ G.

– Note that G is a complete graph.

• Set the budget B = n + 1.

• This completes the reduction.

(23)

### tsp (d) Is NP-Complete (continued)

• Suppose G has a tour of distance at most n + 1.a

• Then that tour on G must contain at most one edge with weight 2.

• If a tour on G contains one edge with weight 2, remove that edge to arrive at a Hamiltonian path for G.

• Suppose a tour on G contains no edge with weight 2.

• Remove any edge to arrive at a Hamiltonian path for G.

(24)
(25)

### tsp (d) Is NP-Complete (concluded)

• On the other hand, suppose G has a Hamiltonian path.

• There is a tour on G containing at most one edge with weight 2.

– Start with a Hamiltonian path and then close the loop.

• The total cost is then at most (n − 1) + 2 = n + 1 = B.

• We conclude that there is a tour of length B or less on G if and only if G has a Hamiltonian path.

(26)

### Random tsp

• Suppose each distance dij is picked uniformly and independently from the interval [ 0, 1 ].

• It is known that the total distance of the shortest tour has a mean value of β√

n for some positive β.

• In fact, the total distance of the shortest tour deviates from the mean by more than t with probability at most e−t2/(4n)!a

aDubhashi and Panconesi (2012).

(27)

### Graph Coloring

• k-coloring: Can the nodes of a graph be colored with

≤ k colors such that no two adjacent nodes have the same color?a

• 2-coloring is in P (why?).

• But 3-coloring is NP-complete (see next page).

• k-coloring is NP-complete for k ≥ 3 (why?).

• exact-k-coloring asks if the nodes of a graph can be colored using exactly k colors.

• It remains NP-complete for k ≥ 3 (why?).

(28)

### 3-coloring Is NP-Complete

a

• We will reduce naesat to 3-coloring.

• We are given a set of clauses C1, C2, . . . , Cm each with 3 literals.

• The boolean variables are x1, x2, . . . , xn.

• We shall construct a graph G that can be colored with colors { 0, 1, 2 } if and only if all the clauses can be

nae-satisﬁed.

aKarp (1972).

(29)

### The Proof (continued)

• Every variable xi is involved in a triangle [ a, xi, ¬xi ] with a common node a.

• Each clause Ci = (ci1 ∨ ci2 ∨ ci3) is also represented by a triangle

[ ci1, ci2, ci3 ].

– Node cij and a node in an a-triangle [ a, xk, ¬xk ] with the same label represent distinct nodes.

• There is an edge between cij and the node that represents the jth literal of Ci.a

¬c

(30)

1

2

3













(31)

### The Proof (continued)

Suppose the graph is 3-colorable.

• Assume without loss of generality that node a takes the color 2.

• A triangle must use up all 3 colors.

• As a result, one of xi and ¬xi must take the color 0 and the other 1.

(32)

### The Proof (continued)

• Treat 1 as true and 0 as false.a

– We are dealing with the a-triangles here, not the clause triangles yet.

• The resulting truth assignment is clearly contradiction free.

• As each clause triangle contains one color 1 and one color 0, the clauses are nae-satisﬁed.

aThe opposite also works.

(33)

### The Proof (continued)

Suppose the clauses are nae-satisﬁable.

• Color node a with color 2.

• Color the nodes representing literals by their truth values (color 0 for false and color 1 for true).

– We are dealing with the a-triangles here, not the clause triangles.

(34)

### The Proof (continued)

• For each clause triangle:

– Pick any two literals with opposite truth values.a – Color the corresponding nodes with 0 if the literal is

true and 1 if it is false.

– Color the remaining node with color 2.

aBreak ties arbitrarily.

(35)

### The Proof (concluded)

• The coloring is legitimate.

– If literal w of a clause triangle has color 2, then its color will never be an issue.

– If literal w of a clause triangle has color 1, then it must be connected up to literal w with color 0.

– If literal w of a clause triangle has color 0, then it must be connected up to literal w with color 1.

(36)

### Algorithms for 3-coloring and the Chromatic Number χ(G)

• Assume G is 3-colorable.

• There is a classic algorithm that ﬁnds a 3-coloring in time O(3n/3) = 1.4422n.a

• It can be improved to O(1.3289n).b

aLawler (1976).

bBeigel and Eppstein (2000).

(37)

### Algorithms for 3-coloring and the Chromatic Number χ(G) (concluded)

• The chromatic number χ(G) is the smallest number of colors needed to color a graph G.

• There is an algorithm to ﬁnd χ(G) in time O((4/3)n/3) = 2.4422n.a

• It can be improved to O((4/3 + 34/3/4)n) = O(2.4150n)b and 2nnO(1).c

• Computing χ(G) cannot be easier than 3-coloring.d

aLawler (1976).

(38)

### tripartite matching

• We are given three sets B, G, and H, each containing n elements.

• Let T ⊆ B × G × H be a ternary relation.

• tripartite matching asks if there is a set of n triples in T , none of which has a component in common.

– Each element in B is matched to a diﬀerent element in G and diﬀerent element in H.

Theorem 47 (Karp (1972)) tripartite matching is NP-complete.

(39)

### Related Problems

• We are given a family F = {S1, S2, . . . , Sn} of subsets of a ﬁnite set U and a budget B.

• set covering asks if there exists a set of B sets in F whose union is U .

• set packing asks if there are B disjoint sets in F .

• Assume |U| = 3m for some m ∈ N and |Si| = 3 for all i.

• exact cover by 3-sets asks if there are m sets in F

(40)

SET COVERING SET PACKING

(41)

### Related Problems (concluded)

Corollary 48 (Karp (1972)) set covering, set packing, and exact cover by 3-sets are all

NP-complete.

• set covering is used to prove that the inﬂuence maximization problem in social networks is

NP-complete.a

aKempe, Kleinberg, and Tardos (2003).

(42)

### knapsack

• There is a set of n items.

• Item i has value vi ∈ Z+ and weight wi ∈ Z+.

• We are given K ∈ Z+ and W ∈ Z+.

• knapsack asks if there exists a subset I ⊆ {1, 2, . . . , n}

such that 

i∈I wi ≤ W and 

i∈I vi ≥ K.

– We want to achieve the maximum satisfaction within the budget.

(43)

### knapsack Is NP-Complete

a

• knapsack ∈ NP: Guess an I and check the constraints.

• We shall reduce exact cover by 3-sets to knapsack, in which vi = wi for all i and K = W .

• The simpliﬁed knapsack now asks if a subset of v1, v2, . . . , vn adds up to exactly K.b

– Picture yourself as a radio DJ.

aKarp (1972).

bThis problem is called subset sum.

(44)

### The Proof (continued)

• The primary diﬀerences between the two problems are:a – Sets vs. numbers.

– Union vs. addition.

• We are given a family F = {S1, S2, . . . , Sn} of size-3 subsets of U = {1, 2, . . . , 3m}.

• exact cover by 3-sets asks if there are m disjoint sets in F that cover the set U .

aThanks to a lively class discussion on November 16, 2010.

(45)

### The Proof (continued)

• Think of a set as a bit vector in {0, 1}3m. – Assume m = 3.

– 110010000 means the set {1, 2, 5}.

– 001100010 means the set {3, 4, 8}.

• Assume there are n = 5 size-3 subsets in F .

• Our goal is

  3m

1 1 · · · 1 .

(46)

### The Proof (continued)

• A bit vector can also be seen as a binary number.

• Set union resembles addition:

001100010 + 110010000 111110010

which denotes the set {1, 2, 3, 4, 5, 8}, as desired.

(47)

### The Proof (continued)

• Trouble occurs when there is carry:

010000000 + 010000000 100000000

which denotes the wrong set {1}, not the correct {2}.

(48)

### The Proof (continued)

• Or consider

001100010 + 001110000 011010010

which denotes the set {2, 3, 5, 8}, not the correct {3, 4, 5, 8}.a

aCorrected by Mr. Chihwei Lin (D97922003) on January 21, 2010.

(49)

### The Proof (continued)

• Carry may also lead to a situation where we obtain our solution 1 1 · · · 1 with more than m sets in F .

• For example,

000100010 001110000 101100000 + 000001101 111111111

(50)

### The Proof (continued)

• And it uses 4 sets instead of the required m = 3.a

• To ﬁx this problem, we enlarge the base just enough so that there are no carries.b

• Because there are n vectors in total, we change the base from 2 to n + 1.

aThanks to a lively class discussion on November 20, 2002.

bYou cannot map ∪ to ∨ because knapsack requires + not ∨!

(51)

### The Proof (continued)

• Set vi to be the integer corresponding to the bit vector encoding Si in base n + 1:

vi = 

j∈Si

1 × (n + 1)3m−j (3)

• Set

K =

3m−1

j=0

1 × (n + 1)j =

  3m

1 1 · · · 1 (base n + 1).

• Now in base n + 1, if there is a set S such that

   3m

(52)

### The Proof (continued)

• For example, the case on p. 423 becomes 000100010

001110000 101100000 + 000001101 102311111 in base n + 1 = 6.

• As desired, it no longer meets the goal.

(53)

### The Proof (continued)

• Suppose F admits an exact cover, say {S1, S2, . . . , Sm}.

• Then picking I = {1, 2, . . . , m} clearly results in

v1 + v2 + · · · + vm =

  3m

1 1· · · 1 .

• It is important to note that the meaning of addition (+) is independent of the base.a

– It is just regular addition.

– But an Si may give rise to diﬀerent integers vi in Eq.

(3) on p. 425 under diﬀerent bases.

(54)

### The Proof (concluded)

• On the other hand, suppose there exists an I such that



i∈I

vi =

  3m

1 1 · · · 1 in base n + 1.

• The no-carry property implies that | I | = m and {Si : i ∈ I}

is an exact cover.

(55)

### An Example

• Let m = 3, U = {1, 2, 3, 4, 5, 6, 7, 8, 9}, and S1 = {1, 3, 4},

S2 = {2, 3, 4}, S3 = {2, 5, 6}, S4 = {6, 7, 8}, S5 = {7, 8, 9}.

• Note that n = 5, as there are 5 Si’s.

(56)

### An Example (continued)

• Our reduction produces

K =

3×3−1

j=0

6j =

  3×3

1 1· · · 16 = 201553910, v1 = 101100000 = 1734048,

v2 = 011100000 = 334368, v3 = 010011000 = 281448, v4 = 000001110 = 258, v5 = 000000111 = 43.

(57)

### An Example (concluded)

• Note v1 + v3 + v5 = K because

101100000 010011000 + 000000111 111111111

• Indeed,

S1 ∪ S3 ∪ S5 = {1, 2, 3, 4, 5, 6, 7, 8, 9},

(58)

### bin packing

• We are given N positive integers a1, a2, . . . , aN, an

integer C (the capacity), and an integer B (the number of bins).

• bin packing asks if these numbers can be partitioned into B subsets, each of which has total sum at most C.

• Think of packing bags at the check-out counter.

Theorem 49 bin packing is NP-complete.

(59)

### bin packing (concluded)

• But suppose a1, a2, . . . , aN are randomly distributed between 0 and 1.

• Let B be the smallest number of unit-capacity bins capable of holding them.

• Then B can deviate from its average by more than t with probability at most 2e−2t2/N.a

aDubhashi and Panconesi (2012).

Updating...

## References

Related subjects :