Approximation Algorithms Lecture 8 September 17, 2015 Sariel - - PowerPoint PPT Presentation

approximation algorithms
SMART_READER_LITE
LIVE PREVIEW

Approximation Algorithms Lecture 8 September 17, 2015 Sariel - - PowerPoint PPT Presentation

NEW CS 473: Theory II, Fall 2015 Approximation Algorithms Lecture 8 September 17, 2015 Sariel (UIUC) New CS473 1 Fall 2015 1 / 39 Todays Lecture Dont give up on NP-Hard problems: (A) Faster exponential time algorithms: n O ( n ) , 3 n


slide-1
SLIDE 1

NEW CS 473: Theory II, Fall 2015

Approximation Algorithms

Lecture 8

September 17, 2015

Sariel (UIUC) New CS473 1 Fall 2015 1 / 39

slide-2
SLIDE 2

Today’s Lecture

Don’t give up on NP-Hard problems: (A) Faster exponential time algorithms: nO(n), 3n, 2n, etc. (B) Fixed parameter tractable. (C) Find an approximate solution.

Sariel (UIUC) New CS473 2 Fall 2015 2 / 39

slide-3
SLIDE 3

8.1: Greedy algorithms and approximation algorithms – Vertex Cover

Sariel (UIUC) New CS473 3 Fall 2015 3 / 39

slide-4
SLIDE 4

Greedy algorithms

1

greedy algorithms: do locally the right thing...

2

...and they suck.

VertexCoverMin

Instance: A graph G. Question: Return the smallest subset S ⊆ V (G), s.t. S touches all the edges of G.

3

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

Sariel (UIUC) New CS473 4 Fall 2015 4 / 39

slide-5
SLIDE 5

Greedy algorithms

1

greedy algorithms: do locally the right thing...

2

...and they suck.

VertexCoverMin

Instance: A graph G. Question: Return the smallest subset S ⊆ V (G), s.t. S touches all the edges of G.

3

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

Sariel (UIUC) New CS473 4 Fall 2015 4 / 39

slide-6
SLIDE 6

Greedy algorithms

1

greedy algorithms: do locally the right thing...

2

...and they suck.

VertexCoverMin

Instance: A graph G. Question: Return the smallest subset S ⊆ V (G), s.t. S touches all the edges of G.

3

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

Sariel (UIUC) New CS473 4 Fall 2015 4 / 39

slide-7
SLIDE 7

Greedy algorithms

1

greedy algorithms: do locally the right thing...

2

...and they suck.

VertexCoverMin

Instance: A graph G. Question: Return the smallest subset S ⊆ V (G), s.t. S touches all the edges of G.

3

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

Sariel (UIUC) New CS473 4 Fall 2015 4 / 39

slide-8
SLIDE 8

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-9
SLIDE 9

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-10
SLIDE 10

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-11
SLIDE 11

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-12
SLIDE 12

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-13
SLIDE 13

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-14
SLIDE 14

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-15
SLIDE 15

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-16
SLIDE 16

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-17
SLIDE 17

Greedy algorithms

GreedyVertexCover in action...

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-18
SLIDE 18

Greedy algorithms

GreedyVertexCover in action...

Observation

GreedyVertexCover returns 4 vertices, but opt is 3 vertices.

Sariel (UIUC) New CS473 5 Fall 2015 5 / 39

slide-19
SLIDE 19

Good enough...

Definition

In a minimization optimization problem, one looks for a valid solution that minimizes a certain target function.

1

VertexCoverMin: Opt(G) = minS⊆V (G),S cover of G |S|.

2

VertexCover(G): set realizing sol.

3

Opt(G): value of the target function for the optimal solution.

Sariel (UIUC) New CS473 6 Fall 2015 6 / 39

slide-20
SLIDE 20

Good enough...

Definition

In a minimization optimization problem, one looks for a valid solution that minimizes a certain target function.

1

VertexCoverMin: Opt(G) = minS⊆V (G),S cover of G |S|.

2

VertexCover(G): set realizing sol.

3

Opt(G): value of the target function for the optimal solution.

Sariel (UIUC) New CS473 6 Fall 2015 6 / 39

slide-21
SLIDE 21

Good enough...

Definition

In a minimization optimization problem, one looks for a valid solution that minimizes a certain target function.

1

VertexCoverMin: Opt(G) = minS⊆V (G),S cover of G |S|.

2

VertexCover(G): set realizing sol.

3

Opt(G): value of the target function for the optimal solution.

Definition

Alg is α-approximation algorithm for problem Min, achieving an approximation α ≥ 1, if for all inputs G, we have: Alg(G) Opt(G) ≤ α.

Sariel (UIUC) New CS473 6 Fall 2015 6 / 39

slide-22
SLIDE 22

Back to GreedyVertexCover

1

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

2

Returns 4, but opt is 3!

3

Can not be better than a 4/3-approximation algorithm.

4

Actually it is much worse!

Sariel (UIUC) New CS473 7 Fall 2015 7 / 39

slide-23
SLIDE 23

Back to GreedyVertexCover

1

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

2

Returns 4, but opt is 3!

3

Can not be better than a 4/3-approximation algorithm.

4

Actually it is much worse!

Sariel (UIUC) New CS473 7 Fall 2015 7 / 39

slide-24
SLIDE 24

Back to GreedyVertexCover

1

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

2

Returns 4, but opt is 3!

3

Can not be better than a 4/3-approximation algorithm.

4

Actually it is much worse!

Sariel (UIUC) New CS473 7 Fall 2015 7 / 39

slide-25
SLIDE 25

Back to GreedyVertexCover

1

GreedyVertexCover: pick vertex with highest degree, remove, repeat.

2

Returns 4, but opt is 3!

3

Can not be better than a 4/3-approximation algorithm.

4

Actually it is much worse!

Sariel (UIUC) New CS473 7 Fall 2015 7 / 39

slide-26
SLIDE 26

How bad is GreedyVertexCover?

Build a bipartite graph. Let the top partite set be of size n.

Sariel (UIUC) New CS473 8 Fall 2015 8 / 39

slide-27
SLIDE 27

How bad is GreedyVertexCover?

Build a bipartite graph. In the bottom set add ⌊n/2⌋ vertices of degree 2, such that each edge goes to a different vertex above.

Sariel (UIUC) New CS473 8 Fall 2015 8 / 39

slide-28
SLIDE 28

How bad is GreedyVertexCover?

Build a bipartite graph. Repeatedly add ⌊n/i⌋ bottom vertices echo of degree i, for i = 2, . . . , n.

Sariel (UIUC) New CS473 8 Fall 2015 8 / 39

slide-29
SLIDE 29

How bad is GreedyVertexCover?

Build a bipartite graph. Repeatedly add ⌊n/i⌋ bottom vertices of degree i, for i = 2, . . . , n.

Sariel (UIUC) New CS473 8 Fall 2015 8 / 39

slide-30
SLIDE 30

How bad is GreedyVertexCover?

Build a bipartite graph. Repeatedly add ⌊n/i⌋ bottom vertices of degree i, for i = 2, . . . , n.

Sariel (UIUC) New CS473 8 Fall 2015 8 / 39

slide-31
SLIDE 31

How bad is GreedyVertexCover?

Build a bipartite graph. Repeatedly add ⌊n/i⌋ bottom vertices of degree i, for i = 2, . . . , n.

Sariel (UIUC) New CS473 8 Fall 2015 8 / 39

slide-32
SLIDE 32

How bad is GreedyVertexCover?

Build a bipartite graph. Bottom row has n

i=2⌊n/i⌋ = Θ(n log n) vertices.

Sariel (UIUC) New CS473 8 Fall 2015 8 / 39

slide-33
SLIDE 33

How bad is GreedyVertexCover?

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-34
SLIDE 34

How bad is GreedyVertexCover?

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-35
SLIDE 35

How bad is GreedyVertexCover?

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-36
SLIDE 36

How bad is GreedyVertexCover?

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-37
SLIDE 37

How bad is GreedyVertexCover?

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-38
SLIDE 38

How bad is GreedyVertexCover?

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-39
SLIDE 39

How bad is GreedyVertexCover?

1

Bottom row taken by Greedy.

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-40
SLIDE 40

How bad is GreedyVertexCover?

1

Bottom row taken by Greedy.

2

Top row was a smaller solution.

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-41
SLIDE 41

How bad is GreedyVertexCover?

1

Bottom row taken by Greedy.

2

Top row was a smaller solution.

Lemma

The algorithm GreedyVertexCover is Ω(log n) approximation to the optimal solution to VertexCoverMin. See notes for details!

Sariel (UIUC) New CS473 9 Fall 2015 9 / 39

slide-42
SLIDE 42

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-43
SLIDE 43

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-44
SLIDE 44

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-45
SLIDE 45

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-46
SLIDE 46

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-47
SLIDE 47

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-48
SLIDE 48

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-49
SLIDE 49

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-50
SLIDE 50

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-51
SLIDE 51

How bad is GreedyVertexCover?

Understanding the graph...

1

Top row has n vertices.

2

Bottom row has

1

Upper bound: α = n

i=2 ⌊n/i⌋ ≤ n i=1 n/i ≤ nHn = O(n log n).

2

Lower bound: α = n

i=2 ⌊n/i⌋ ≥

n

i=1 n/i − (n − 1) − n ≥ n(Hn − 2) ≥ n(ln n − 2).

3

Bottom row has Θ(n log n) vertices.

3

Greedy algorithm returns bottom row Θ(n log n) vertices.

4

Optimal solution is top row: n vertices.

5

Greedy algorithm is O(log n) approximation in this case.

Sariel (UIUC) New CS473 10 Fall 2015 10 / 39

slide-52
SLIDE 52

Some math required

Hn =

n

  • i=1

1 i ≤ 1 + n

x=1

1 xdx

  • 1/(i+1)≤

i+1

x=i (1/x)dx

= 1 + ln n − ln 1 = 1 + ln n. Hn =

n

  • i=1

1 i ≥ n+1

x=1

1 xdx

  • 1

i ≥

i+1

x=i 1 x dx

= ln(n + 1 − ln 1 = ln(n + 1) ≥ ln n.

Lemma

For Hn = n

i=1 1/i we have that ln n ≤ Hn ≤ 1 + ln n.

Sariel (UIUC) New CS473 11 Fall 2015 11 / 39

slide-53
SLIDE 53

Some math required

Hn =

n

  • i=1

1 i ≤ 1 + n

x=1

1 xdx

  • 1/(i+1)≤

i+1

x=i (1/x)dx

= 1 + ln n − ln 1 = 1 + ln n. Hn =

n

  • i=1

1 i ≥ n+1

x=1

1 xdx

  • 1

i ≥

i+1

x=i 1 x dx

= ln(n + 1 − ln 1 = ln(n + 1) ≥ ln n.

Lemma

For Hn = n

i=1 1/i we have that ln n ≤ Hn ≤ 1 + ln n.

Sariel (UIUC) New CS473 11 Fall 2015 11 / 39

slide-54
SLIDE 54

Some math required

Hn =

n

  • i=1

1 i ≤ 1 + n

x=1

1 xdx

  • 1/(i+1)≤

i+1

x=i (1/x)dx

= 1 + ln n − ln 1 = 1 + ln n. Hn =

n

  • i=1

1 i ≥ n+1

x=1

1 xdx

  • 1

i ≥

i+1

x=i 1 x dx

= ln(n + 1 − ln 1 = ln(n + 1) ≥ ln n.

Lemma

For Hn = n

i=1 1/i we have that ln n ≤ Hn ≤ 1 + ln n.

Sariel (UIUC) New CS473 11 Fall 2015 11 / 39

slide-55
SLIDE 55

Some math required

Hn =

n

  • i=1

1 i ≤ 1 + n

x=1

1 xdx

  • 1/(i+1)≤

i+1

x=i (1/x)dx

= 1 + ln n − ln 1 = 1 + ln n. Hn =

n

  • i=1

1 i ≥ n+1

x=1

1 xdx

  • 1

i ≥

i+1

x=i 1 x dx

= ln(n + 1 − ln 1 = ln(n + 1) ≥ ln n.

Lemma

For Hn = n

i=1 1/i we have that ln n ≤ Hn ≤ 1 + ln n.

Sariel (UIUC) New CS473 11 Fall 2015 11 / 39

slide-56
SLIDE 56

Some math required

Hn =

n

  • i=1

1 i ≤ 1 + n

x=1

1 xdx

  • 1/(i+1)≤

i+1

x=i (1/x)dx

= 1 + ln n − ln 1 = 1 + ln n. Hn =

n

  • i=1

1 i ≥ n+1

x=1

1 xdx

  • 1

i ≥

i+1

x=i 1 x dx

= ln(n + 1 − ln 1 = ln(n + 1) ≥ ln n.

Lemma

For Hn = n

i=1 1/i we have that ln n ≤ Hn ≤ 1 + ln n.

Sariel (UIUC) New CS473 11 Fall 2015 11 / 39

slide-57
SLIDE 57

Some math required

Hn =

n

  • i=1

1 i ≤ 1 + n

x=1

1 xdx

  • 1/(i+1)≤

i+1

x=i (1/x)dx

= 1 + ln n − ln 1 = 1 + ln n. Hn =

n

  • i=1

1 i ≥ n+1

x=1

1 xdx

  • 1

i ≥

i+1

x=i 1 x dx

= ln(n + 1 − ln 1 = ln(n + 1) ≥ ln n.

Lemma

For Hn = n

i=1 1/i we have that ln n ≤ Hn ≤ 1 + ln n.

Sariel (UIUC) New CS473 11 Fall 2015 11 / 39

slide-58
SLIDE 58

Greedy Vertex Cover

Theorem

The greedy algorithm for VertexCover achieves Θ(log n) approximation, where n (resp. m) is the number of vertices (resp., edges) in the graph. Running time is O(mn2).

Proof

Lower bound follows from lemma. Upper bound follows from analysis of greedy algorithm for Set Cover, which will be done shortly. As for the running time, each iteration of the algorithm takes O(mn) time, and there are at most n iterations.

Sariel (UIUC) New CS473 12 Fall 2015 12 / 39

slide-59
SLIDE 59

8.1.1: A better greedy algorithm: Two for the price

  • f one

Sariel (UIUC) New CS473 13 Fall 2015 13 / 39

slide-60
SLIDE 60

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-61
SLIDE 61

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-62
SLIDE 62

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-63
SLIDE 63

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-64
SLIDE 64

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-65
SLIDE 65

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-66
SLIDE 66

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-67
SLIDE 67

Two for the price of one - example

Sariel (UIUC) New CS473 14 Fall 2015 14 / 39

slide-68
SLIDE 68

Two for the price of one

ApproxVertexCover(G): S ← ∅

while E(G) = ∅ do

uv ← any edge of G S ← S ∪ {u, v} Remove u, v from V(G) Remove all edges involving u or v from E(G)

return S

Theorem

ApproxVertexCover is a 2-approximation algorithm for VertexCoverMin that runs in O(n2) time. Proof...

Sariel (UIUC) New CS473 15 Fall 2015 15 / 39

slide-69
SLIDE 69

8.2: Fixed parameter tractability, approximation, and fast exponential time algorithms (to say nothing of the dog)

Sariel (UIUC) New CS473 16 Fall 2015 16 / 39

slide-70
SLIDE 70

8.2.1: A silly brute force algorithm for vertex cover

Sariel (UIUC) New CS473 17 Fall 2015 17 / 39

slide-71
SLIDE 71

What if the vertex cover is small?

1

G = (V, E) with n vertices

2

K ← Approximate VertexCoverMin up to a factor of two.

3

Any vertex cover of G is of size ≥ K/2.

4

Naively compute optimal in O

  • nK+2

time.

Sariel (UIUC) New CS473 18 Fall 2015 18 / 39

slide-72
SLIDE 72

Neighborhood of a vertex

Definition

NG(v): Neighborhood of v – set of vertices of G adjacent to v.

v

NG(v)

Sariel (UIUC) New CS473 19 Fall 2015 19 / 39

slide-73
SLIDE 73

Induced subgraph

Definition

Let G = (V, E) be a graph. For a subset S ⊆ V, let GS be the induced subgraph over S.

Sariel (UIUC) New CS473 20 Fall 2015 20 / 39

slide-74
SLIDE 74

Induced subgraph

Definition

Let G = (V, E) be a graph. For a subset S ⊆ V, let GS be the induced subgraph over S.

Sariel (UIUC) New CS473 20 Fall 2015 20 / 39

slide-75
SLIDE 75

Induced subgraph

Definition

Let G = (V, E) be a graph. For a subset S ⊆ V, let GS be the induced subgraph over S.

Sariel (UIUC) New CS473 20 Fall 2015 20 / 39

slide-76
SLIDE 76

Induced subgraph

Definition

Let G = (V, E) be a graph. For a subset S ⊆ V, let GS be the induced subgraph over S.

Sariel (UIUC) New CS473 20 Fall 2015 20 / 39

slide-77
SLIDE 77

8.2.2: Fixed parameter algorithm

Sariel (UIUC) New CS473 21 Fall 2015 21 / 39

slide-78
SLIDE 78

Exact algorithm for Set Cover

1

G: Input graph.

2

Opt = min size vertex cover for G. opt = |Opt|.

3

Compute a set S ⊆ V(G) s.t. |S| ≤ 2opt. Takes: O(n + m) time.

4

Enumerate over all possible X ⊆ S:

1

Check if X is vertex cover in G. Takes O(n + m) time.

5

Return smallest VC encountered.

6

Running time: O(22opt(n + m) + n + m) = O(22optm).

Sariel (UIUC) New CS473 22 Fall 2015 22 / 39

slide-79
SLIDE 79

Exact algorithm for Set Cover

1

G: Input graph.

2

Opt = min size vertex cover for G. opt = |Opt|.

3

Compute a set S ⊆ V(G) s.t. |S| ≤ 2opt. Takes: O(n + m) time.

4

Enumerate over all possible X ⊆ S:

1

Check if X is vertex cover in G. Takes O(n + m) time.

5

Return smallest VC encountered.

6

Running time: O(22opt(n + m) + n + m) = O(22optm).

Sariel (UIUC) New CS473 22 Fall 2015 22 / 39

slide-80
SLIDE 80

Exact algorithm for Set Cover

1

G: Input graph.

2

Opt = min size vertex cover for G. opt = |Opt|.

3

Compute a set S ⊆ V(G) s.t. |S| ≤ 2opt. Takes: O(n + m) time.

4

Enumerate over all possible X ⊆ S:

1

Check if X is vertex cover in G. Takes O(n + m) time.

5

Return smallest VC encountered.

6

Running time: O(22opt(n + m) + n + m) = O(22optm).

Sariel (UIUC) New CS473 22 Fall 2015 22 / 39

slide-81
SLIDE 81

Exact algorithm for Set Cover

1

G: Input graph.

2

Opt = min size vertex cover for G. opt = |Opt|.

3

Compute a set S ⊆ V(G) s.t. |S| ≤ 2opt. Takes: O(n + m) time.

4

Enumerate over all possible X ⊆ S:

1

Check if X is vertex cover in G. Takes O(n + m) time.

5

Return smallest VC encountered.

6

Running time: O(22opt(n + m) + n + m) = O(22optm).

Sariel (UIUC) New CS473 22 Fall 2015 22 / 39

slide-82
SLIDE 82

Exact algorithm for Set Cover

1

G: Input graph.

2

Opt = min size vertex cover for G. opt = |Opt|.

3

Compute a set S ⊆ V(G) s.t. |S| ≤ 2opt. Takes: O(n + m) time.

4

Enumerate over all possible X ⊆ S:

1

Check if X is vertex cover in G. Takes O(n + m) time.

5

Return smallest VC encountered.

6

Running time: O(22opt(n + m) + n + m) = O(22optm).

Sariel (UIUC) New CS473 22 Fall 2015 22 / 39

slide-83
SLIDE 83

Exact algorithm for Set Cover

1

G: Input graph.

2

Opt = min size vertex cover for G. opt = |Opt|.

3

Compute a set S ⊆ V(G) s.t. |S| ≤ 2opt. Takes: O(n + m) time.

4

Enumerate over all possible X ⊆ S:

1

Check if X is vertex cover in G. Takes O(n + m) time.

5

Return smallest VC encountered.

6

Running time: O(22opt(n + m) + n + m) = O(22optm).

Sariel (UIUC) New CS473 22 Fall 2015 22 / 39

slide-84
SLIDE 84

Exact algorithm for Set Cover

1

G: Input graph.

2

Opt = min size vertex cover for G. opt = |Opt|.

3

Compute a set S ⊆ V(G) s.t. |S| ≤ 2opt. Takes: O(n + m) time.

4

Enumerate over all possible X ⊆ S:

1

Check if X is vertex cover in G. Takes O(n + m) time.

5

Return smallest VC encountered.

6

Running time: O(22opt(n + m) + n + m) = O(22optm).

Sariel (UIUC) New CS473 22 Fall 2015 22 / 39

slide-85
SLIDE 85

Summary of result

Theorem

Given a graph G with n vertices and m (≥ n) edges, and with a vertex cover of size k. Then, one can compute the optimal vertex cover in G in O(22km) time. Note, that running time is Fixed Parameter Tractable.

Sariel (UIUC) New CS473 23 Fall 2015 23 / 39

slide-86
SLIDE 86

8.3: Traveling Salesperson Problem

Sariel (UIUC) New CS473 24 Fall 2015 24 / 39

slide-87
SLIDE 87

TSP

TSP-Min

Instance: G = (V, E) a complete graph, and ω(e) a cost function on edges of G. Question: The cheapest tour that visits all the vertices of G exactly once. Solved exactly naively in ≈ n! time. Using DP, solvable in O(n22n) time.

Sariel (UIUC) New CS473 25 Fall 2015 25 / 39

slide-88
SLIDE 88

TSP

TSP-Min

Instance: G = (V, E) a complete graph, and ω(e) a cost function on edges of G. Question: The cheapest tour that visits all the vertices of G exactly once. Solved exactly naively in ≈ n! time. Using DP, solvable in O(n22n) time.

Sariel (UIUC) New CS473 25 Fall 2015 25 / 39

slide-89
SLIDE 89

TSP Hardness

Theorem

TSP-Min can not be approximated within any factor unless

NP = P. Proof.

1

Reduction from Hamiltonian Cycle into TSP.

2

G = (V, E): instance of Hamiltonian cycle.

3

J: Complete graph over V. ∀u, v ∈ V wJ(uv) =

  • 1

uv ∈ E 2

  • therwise.

4

∃ tour of price n in J ⇐ ⇒ ∃ Hamiltonian cycle in G.

5

No Hamiltonian cycle = ⇒ TSP price at least n + 1.

6

But... replace 2 by cn, for c an arbitrary number

Sariel (UIUC) New CS473 26 Fall 2015 26 / 39

slide-90
SLIDE 90

TSP Hardness

Theorem

TSP-Min can not be approximated within any factor unless

NP = P. Proof.

1

Reduction from Hamiltonian Cycle into TSP.

2

G = (V, E): instance of Hamiltonian cycle.

3

J: Complete graph over V. ∀u, v ∈ V wJ(uv) =

  • 1

uv ∈ E 2

  • therwise.

4

∃ tour of price n in J ⇐ ⇒ ∃ Hamiltonian cycle in G.

5

No Hamiltonian cycle = ⇒ TSP price at least n + 1.

6

But... replace 2 by cn, for c an arbitrary number

Sariel (UIUC) New CS473 26 Fall 2015 26 / 39

slide-91
SLIDE 91

TSP Hardness

Theorem

TSP-Min can not be approximated within any factor unless

NP = P. Proof.

1

Reduction from Hamiltonian Cycle into TSP.

2

G = (V, E): instance of Hamiltonian cycle.

3

J: Complete graph over V. ∀u, v ∈ V wJ(uv) =

  • 1

uv ∈ E 2

  • therwise.

4

∃ tour of price n in J ⇐ ⇒ ∃ Hamiltonian cycle in G.

5

No Hamiltonian cycle = ⇒ TSP price at least n + 1.

6

But... replace 2 by cn, for c an arbitrary number

Sariel (UIUC) New CS473 26 Fall 2015 26 / 39

slide-92
SLIDE 92

TSP Hardness

Theorem

TSP-Min can not be approximated within any factor unless

NP = P. Proof.

1

Reduction from Hamiltonian Cycle into TSP.

2

G = (V, E): instance of Hamiltonian cycle.

3

J: Complete graph over V. ∀u, v ∈ V wJ(uv) =

  • 1

uv ∈ E 2

  • therwise.

4

∃ tour of price n in J ⇐ ⇒ ∃ Hamiltonian cycle in G.

5

No Hamiltonian cycle = ⇒ TSP price at least n + 1.

6

But... replace 2 by cn, for c an arbitrary number

Sariel (UIUC) New CS473 26 Fall 2015 26 / 39

slide-93
SLIDE 93

TSP Hardness - proof continued

Proof.

1

Price of all tours are either: (i) n (only if ∃ Hamiltonian cycle in G), (ii) larger than cn + 1 (actually, ≥ cn + (n − 1)).

2

Suppose you had a poly time c-approximation to TSP-Min.

3

Run it on J: (i) If returned value ≥ cn + 1 = ⇒ no Ham Cycle since (cn + 1)/c > n (ii) If returned value ≤ cn = ⇒ Ham Cycle since OP T ≤ cn < cn + 1

4

c-approximation algorithm to TSP = ⇒ poly-time algorithm for NP-Complete problem. Possible only if P = NP.

Sariel (UIUC) New CS473 27 Fall 2015 27 / 39

slide-94
SLIDE 94

TSP Hardness - proof continued

Proof.

1

Price of all tours are either: (i) n (only if ∃ Hamiltonian cycle in G), (ii) larger than cn + 1 (actually, ≥ cn + (n − 1)).

2

Suppose you had a poly time c-approximation to TSP-Min.

3

Run it on J: (i) If returned value ≥ cn + 1 = ⇒ no Ham Cycle since (cn + 1)/c > n (ii) If returned value ≤ cn = ⇒ Ham Cycle since OP T ≤ cn < cn + 1

4

c-approximation algorithm to TSP = ⇒ poly-time algorithm for NP-Complete problem. Possible only if P = NP.

Sariel (UIUC) New CS473 27 Fall 2015 27 / 39

slide-95
SLIDE 95

TSP Hardness - proof continued

Proof.

1

Price of all tours are either: (i) n (only if ∃ Hamiltonian cycle in G), (ii) larger than cn + 1 (actually, ≥ cn + (n − 1)).

2

Suppose you had a poly time c-approximation to TSP-Min.

3

Run it on J: (i) If returned value ≥ cn + 1 = ⇒ no Ham Cycle since (cn + 1)/c > n (ii) If returned value ≤ cn = ⇒ Ham Cycle since OP T ≤ cn < cn + 1

4

c-approximation algorithm to TSP = ⇒ poly-time algorithm for NP-Complete problem. Possible only if P = NP.

Sariel (UIUC) New CS473 27 Fall 2015 27 / 39

slide-96
SLIDE 96

TSP Hardness - proof continued

Proof.

1

Price of all tours are either: (i) n (only if ∃ Hamiltonian cycle in G), (ii) larger than cn + 1 (actually, ≥ cn + (n − 1)).

2

Suppose you had a poly time c-approximation to TSP-Min.

3

Run it on J: (i) If returned value ≥ cn + 1 = ⇒ no Ham Cycle since (cn + 1)/c > n (ii) If returned value ≤ cn = ⇒ Ham Cycle since OP T ≤ cn < cn + 1

4

c-approximation algorithm to TSP = ⇒ poly-time algorithm for NP-Complete problem. Possible only if P = NP.

Sariel (UIUC) New CS473 27 Fall 2015 27 / 39

slide-97
SLIDE 97

TSP with the triangle inequality

Because it is not that bad after all.

TSP△=-Min

Instance: G = (V, E) is a complete graph. There is also a cost function ω(·) defined over the edges of G, that complies with the triangle inequality. Question: The cheapest tour that visits all the vertices of G exactly once. triangle inequality: ω(·) if ∀u, v, w ∈ V(G), ω(u, v) ≤ ω(u, w) + ω(w, v).

Shortcutting

σ: a path from s to t in G = ⇒ ω(st) ≤ ω(σ).

Sariel (UIUC) New CS473 28 Fall 2015 28 / 39

slide-98
SLIDE 98

TSP with the triangle inequality

Because it is not that bad after all.

TSP△=-Min

Instance: G = (V, E) is a complete graph. There is also a cost function ω(·) defined over the edges of G, that complies with the triangle inequality. Question: The cheapest tour that visits all the vertices of G exactly once. triangle inequality: ω(·) if ∀u, v, w ∈ V(G), ω(u, v) ≤ ω(u, w) + ω(w, v).

Shortcutting

σ: a path from s to t in G = ⇒ ω(st) ≤ ω(σ).

Sariel (UIUC) New CS473 28 Fall 2015 28 / 39

slide-99
SLIDE 99

TSP with the triangle inequality

Because it is not that bad after all.

TSP△=-Min

Instance: G = (V, E) is a complete graph. There is also a cost function ω(·) defined over the edges of G, that complies with the triangle inequality. Question: The cheapest tour that visits all the vertices of G exactly once. triangle inequality: ω(·) if ∀u, v, w ∈ V(G), ω(u, v) ≤ ω(u, w) + ω(w, v).

Shortcutting

σ: a path from s to t in G = ⇒ ω(st) ≤ ω(σ).

Sariel (UIUC) New CS473 28 Fall 2015 28 / 39

slide-100
SLIDE 100

TSP with the triangle inequality

Continued...

Definition

Cycle in G is Eulerian if it visits every edge of G exactly once. Assume you already seen the following:

Lemma

A graph G has a cycle that visits every edge of G exactly once (i.e., an Eulerian cycle) if and only if G is connected, and all the vertices have even degree. Such a cycle can be computed in O(n + m) time, where n and m are the number of vertices and edges of G, respectively.

Sariel (UIUC) New CS473 29 Fall 2015 29 / 39

slide-101
SLIDE 101

TSP with the triangle inequality

Continued...

1

Copt optimal TSP tour in G.

2

Observation: ω(Copt) ≥ weight

  • cheapest spanning graph of G
  • .

3

MST: cheapest spanning graph of G. ω(Copt) ≥ ω(MST(G))

4

O(n log n + m) = O(n2): time to compute MST. n = |V(G)|, m = n

2

  • .

Sariel (UIUC) New CS473 30 Fall 2015 30 / 39

slide-102
SLIDE 102

TSP with the triangle inequality

Continued...

1

Copt optimal TSP tour in G.

2

Observation: ω(Copt) ≥ weight

  • cheapest spanning graph of G
  • .

3

MST: cheapest spanning graph of G. ω(Copt) ≥ ω(MST(G))

4

O(n log n + m) = O(n2): time to compute MST. n = |V(G)|, m = n

2

  • .

Sariel (UIUC) New CS473 30 Fall 2015 30 / 39

slide-103
SLIDE 103

TSP with the triangle inequality

Continued...

1

Copt optimal TSP tour in G.

2

Observation: ω(Copt) ≥ weight

  • cheapest spanning graph of G
  • .

3

MST: cheapest spanning graph of G. ω(Copt) ≥ ω(MST(G))

4

O(n log n + m) = O(n2): time to compute MST. n = |V(G)|, m = n

2

  • .

Sariel (UIUC) New CS473 30 Fall 2015 30 / 39

slide-104
SLIDE 104

TSP with the triangle inequality

Continued...

1

Copt optimal TSP tour in G.

2

Observation: ω(Copt) ≥ weight

  • cheapest spanning graph of G
  • .

3

MST: cheapest spanning graph of G. ω(Copt) ≥ ω(MST(G))

4

O(n log n + m) = O(n2): time to compute MST. n = |V(G)|, m = n

2

  • .

Sariel (UIUC) New CS473 30 Fall 2015 30 / 39

slide-105
SLIDE 105

TSP with the triangle inequality

2-approximation

1

T ← MST(G)

2

J ← duplicate very edge of T .

3

H has an Eulerian tour.

4

C: Eulerian cycle in H.

5

ω(C) = ω(H) = 2ω(T ) = 2ω(MST (G)) ≤ 2ω(Copt).

6

π: Shortcut C so visit every vertex once.

7

ω(π) ≤ ω(C)

Sariel (UIUC) New CS473 31 Fall 2015 31 / 39

slide-106
SLIDE 106

TSP with the triangle inequality

2-approximation

1

T ← MST(G)

2

J ← duplicate very edge of T .

3

H has an Eulerian tour.

4

C: Eulerian cycle in H.

5

ω(C) = ω(H) = 2ω(T ) = 2ω(MST (G)) ≤ 2ω(Copt).

6

π: Shortcut C so visit every vertex once.

7

ω(π) ≤ ω(C)

Sariel (UIUC) New CS473 31 Fall 2015 31 / 39

slide-107
SLIDE 107

TSP with the triangle inequality

2-approximation

1

T ← MST(G)

2

J ← duplicate very edge of T .

3

H has an Eulerian tour.

4

C: Eulerian cycle in H.

5

ω(C) = ω(H) = 2ω(T ) = 2ω(MST (G)) ≤ 2ω(Copt).

6

π: Shortcut C so visit every vertex once.

7

ω(π) ≤ ω(C)

Sariel (UIUC) New CS473 31 Fall 2015 31 / 39

slide-108
SLIDE 108

TSP with the triangle inequality

2-approximation

1

T ← MST(G)

2

J ← duplicate very edge of T .

3

H has an Eulerian tour.

4

C: Eulerian cycle in H.

5

ω(C) = ω(H) = 2ω(T ) = 2ω(MST (G)) ≤ 2ω(Copt).

6

π: Shortcut C so visit every vertex once.

7

ω(π) ≤ ω(C)

Sariel (UIUC) New CS473 31 Fall 2015 31 / 39

slide-109
SLIDE 109

TSP with the triangle inequality

2-approximation

1

T ← MST(G)

2

J ← duplicate very edge of T .

3

H has an Eulerian tour.

4

C: Eulerian cycle in H.

5

ω(C) = ω(H) = 2ω(T ) = 2ω(MST (G)) ≤ 2ω(Copt).

6

π: Shortcut C so visit every vertex once.

7

ω(π) ≤ ω(C)

Sariel (UIUC) New CS473 31 Fall 2015 31 / 39

slide-110
SLIDE 110

TSP with the triangle inequality

2-approximation

1

T ← MST(G)

2

J ← duplicate very edge of T .

3

H has an Eulerian tour.

4

C: Eulerian cycle in H.

5

ω(C) = ω(H) = 2ω(T ) = 2ω(MST (G)) ≤ 2ω(Copt).

6

π: Shortcut C so visit every vertex once.

7

ω(π) ≤ ω(C)

Sariel (UIUC) New CS473 31 Fall 2015 31 / 39

slide-111
SLIDE 111

TSP with the triangle inequality

2-approximation

1

T ← MST(G)

2

J ← duplicate very edge of T .

3

H has an Eulerian tour.

4

C: Eulerian cycle in H.

5

ω(C) = ω(H) = 2ω(T ) = 2ω(MST (G)) ≤ 2ω(Copt).

6

π: Shortcut C so visit every vertex once.

7

ω(π) ≤ ω(C)

Sariel (UIUC) New CS473 31 Fall 2015 31 / 39

slide-112
SLIDE 112

TSP with the triangle inequality

2-approximation algorithm in figures

(a) (b) (c) (d)

Sariel (UIUC) New CS473 32 Fall 2015 32 / 39

slide-113
SLIDE 113

TSP with the triangle inequality

2-approximation algorithm in figures

(a) (b) (c) (d)

Sariel (UIUC) New CS473 32 Fall 2015 32 / 39

slide-114
SLIDE 114

TSP with the triangle inequality

2-approximation algorithm in figures

s w u v C

(a) (b) (c) (d)

Sariel (UIUC) New CS473 32 Fall 2015 32 / 39

slide-115
SLIDE 115

TSP with the triangle inequality

2-approximation algorithm in figures

s w u v C

s w u v C D

(a) (b) (c) (d) Euler Tour: vuvwvsv First occurrences: vuvwvsv Shortcut String: vuwsv

Sariel (UIUC) New CS473 32 Fall 2015 32 / 39

slide-116
SLIDE 116

TSP with the triangle inequality

2-approximation - result

Theorem

G: Instance of TSP△=-Min. Copt: min cost TSP tour of G. = ⇒ Compute a tour of G of length ≤ 2ω(Copt). Running time of the algorithm is O(n2). G: n vertices, cost function ω(·) on the edges that comply with the triangle inequality.

Sariel (UIUC) New CS473 33 Fall 2015 33 / 39

slide-117
SLIDE 117

TSP with the triangle inequality

2-approximation - result

Theorem

G: Instance of TSP△=-Min. Copt: min cost TSP tour of G. = ⇒ Compute a tour of G of length ≤ 2ω(Copt). Running time of the algorithm is O(n2). G: n vertices, cost function ω(·) on the edges that comply with the triangle inequality.

Sariel (UIUC) New CS473 33 Fall 2015 33 / 39

slide-118
SLIDE 118

TSP with the triangle inequality

2-approximation - result

Theorem

G: Instance of TSP△=-Min. Copt: min cost TSP tour of G. = ⇒ Compute a tour of G of length ≤ 2ω(Copt). Running time of the algorithm is O(n2). G: n vertices, cost function ω(·) on the edges that comply with the triangle inequality.

Sariel (UIUC) New CS473 33 Fall 2015 33 / 39

slide-119
SLIDE 119

TSP with the triangle inequality

2-approximation - result

Theorem

G: Instance of TSP△=-Min. Copt: min cost TSP tour of G. = ⇒ Compute a tour of G of length ≤ 2ω(Copt). Running time of the algorithm is O(n2). G: n vertices, cost function ω(·) on the edges that comply with the triangle inequality.

Sariel (UIUC) New CS473 33 Fall 2015 33 / 39

slide-120
SLIDE 120

TSP with the triangle inequality

3/2-approximation

Definition

G = (V, E), a subset M ⊆ E is a matching if no pair of edges of M share endpoints. A perfect matching is a matching that covers all the vertices of G. w: weight function on the edges. Min-weight perfect matching, is the minimum weight matching among all perfect matching, where ω(M) =

  • e∈M

ω(e).

Sariel (UIUC) New CS473 34 Fall 2015 34 / 39

slide-121
SLIDE 121

TSP with the triangle inequality

3/2-approximation

The following is known:

Theorem

Given a graph G and weights on the edges, one can compute the min-weight perfect matching of G in polynomial time.

Sariel (UIUC) New CS473 35 Fall 2015 35 / 39

slide-122
SLIDE 122

Min weight perfect matching vs. TSP

Lemma

G = (V, E): complete graph. S ⊆ V: even size. ω(·): a weight function over E. = ⇒ min-weight perfect matching in GS is ≤ ω(TSP(G))/2.

Sariel (UIUC) New CS473 36 Fall 2015 36 / 39

slide-123
SLIDE 123

Min weight perfect matching vs. TSP

Lemma

G = (V, E): complete graph. S ⊆ V: even size. ω(·): a weight function over E. = ⇒ min-weight perfect matching in GS is ≤ ω(TSP(G))/2.

π

S

Sariel (UIUC) New CS473 36 Fall 2015 36 / 39

slide-124
SLIDE 124

Min weight perfect matching vs. TSP

Lemma

G = (V, E): complete graph. S ⊆ V: even size. ω(·): a weight function over E. = ⇒ min-weight perfect matching in GS is ≤ ω(TSP(G))/2.

σ π

S

Sariel (UIUC) New CS473 36 Fall 2015 36 / 39

slide-125
SLIDE 125

Min weight perfect matching vs. TSP

Lemma

G = (V, E): complete graph. S ⊆ V: even size. ω(·): a weight function over E. = ⇒ min-weight perfect matching in GS is ≤ ω(TSP(G))/2.

σ π

S

Sariel (UIUC) New CS473 36 Fall 2015 36 / 39

slide-126
SLIDE 126

A more perfect tree?

1

How to make the tree Eulerian?

4

1 3 5 6 7 2

2

Pesky odd degree vertices must die!

3

Number of odd degree vertices in a graph is even!

4

Compute min-weight matching on odd vertices, and add to MST.

5

J = MST + (min-weight-matching) is Eulerian.

6

Weight of resulting cycle in J ≤ (3/2)ω(TSP).

Sariel (UIUC) New CS473 37 Fall 2015 37 / 39

slide-127
SLIDE 127

A more perfect tree?

1

How to make the tree Eulerian?

4

1 3 5 6 7 2

2

Pesky odd degree vertices must die!

3

Number of odd degree vertices in a graph is even!

4

Compute min-weight matching on odd vertices, and add to MST.

5

J = MST + (min-weight-matching) is Eulerian.

6

Weight of resulting cycle in J ≤ (3/2)ω(TSP).

Sariel (UIUC) New CS473 37 Fall 2015 37 / 39

slide-128
SLIDE 128

A more perfect tree?

1

How to make the tree Eulerian?

4

1 3 5 6 7 2

2

Pesky odd degree vertices must die!

3

Number of odd degree vertices in a graph is even!

4

Compute min-weight matching on odd vertices, and add to MST.

5

J = MST + (min-weight-matching) is Eulerian.

6

Weight of resulting cycle in J ≤ (3/2)ω(TSP).

Sariel (UIUC) New CS473 37 Fall 2015 37 / 39

slide-129
SLIDE 129

A more perfect tree?

1

How to make the tree Eulerian?

4

1 3 5 6 7 2

2

Pesky odd degree vertices must die!

3

Number of odd degree vertices in a graph is even!

4

Compute min-weight matching on odd vertices, and add to MST.

5

J = MST + (min-weight-matching) is Eulerian.

6

Weight of resulting cycle in J ≤ (3/2)ω(TSP).

Sariel (UIUC) New CS473 37 Fall 2015 37 / 39

slide-130
SLIDE 130

A more perfect tree?

1

How to make the tree Eulerian?

4

1 3 5 6 7 2

2

Pesky odd degree vertices must die!

3

Number of odd degree vertices in a graph is even!

4

Compute min-weight matching on odd vertices, and add to MST.

5

J = MST + (min-weight-matching) is Eulerian.

6

Weight of resulting cycle in J ≤ (3/2)ω(TSP).

Sariel (UIUC) New CS473 37 Fall 2015 37 / 39

slide-131
SLIDE 131

A more perfect tree?

1

How to make the tree Eulerian?

4

1 3 5 6 7 2

2

Pesky odd degree vertices must die!

3

Number of odd degree vertices in a graph is even!

4

Compute min-weight matching on odd vertices, and add to MST.

5

J = MST + (min-weight-matching) is Eulerian.

6

Weight of resulting cycle in J ≤ (3/2)ω(TSP).

Sariel (UIUC) New CS473 37 Fall 2015 37 / 39

slide-132
SLIDE 132

Even number of odd degree vertices

Lemma

The number of odd degree vertices in any graph G′ is even.

Proof.

µ =

v∈V (G′) d(v) = 2|E(G′)| and thus even.

U =

v∈V (G′),d(v) is even d(v) even too.

Thus, α =

  • v∈V,d(v) is odd

d(v) = µ − U = even number, since µ and U are both even. Number of elements in sum of all odd numbers must be even, since the total sum is even.

Sariel (UIUC) New CS473 38 Fall 2015 38 / 39

slide-133
SLIDE 133

Even number of odd degree vertices

Lemma

The number of odd degree vertices in any graph G′ is even.

Proof.

µ =

v∈V (G′) d(v) = 2|E(G′)| and thus even.

U =

v∈V (G′),d(v) is even d(v) even too.

Thus, α =

  • v∈V,d(v) is odd

d(v) = µ − U = even number, since µ and U are both even. Number of elements in sum of all odd numbers must be even, since the total sum is even.

Sariel (UIUC) New CS473 38 Fall 2015 38 / 39

slide-134
SLIDE 134

Even number of odd degree vertices

Lemma

The number of odd degree vertices in any graph G′ is even.

Proof.

µ =

v∈V (G′) d(v) = 2|E(G′)| and thus even.

U =

v∈V (G′),d(v) is even d(v) even too.

Thus, α =

  • v∈V,d(v) is odd

d(v) = µ − U = even number, since µ and U are both even. Number of elements in sum of all odd numbers must be even, since the total sum is even.

Sariel (UIUC) New CS473 38 Fall 2015 38 / 39

slide-135
SLIDE 135

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-136
SLIDE 136

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-137
SLIDE 137

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-138
SLIDE 138

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-139
SLIDE 139

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-140
SLIDE 140

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-141
SLIDE 141

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-142
SLIDE 142

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-143
SLIDE 143

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-144
SLIDE 144

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-145
SLIDE 145

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-146
SLIDE 146

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-147
SLIDE 147

3/2-approximation algorithm for TSP

Animated!

Sariel (UIUC) New CS473 39 Fall 2015 39 / 39

slide-148
SLIDE 148

3/2-approximation algorithm for TSP

The result

Theorem

Given an instance of TSP with the triangle inequality, one can compute in polynomial time, a (3/2)-approximation to the optimal TSP.

Sariel (UIUC) New CS473 40 Fall 2015 40 / 39

slide-149
SLIDE 149

Biographical Notes

The 3/2-approximation for TSP with the triangle inequality is due to Christofides [1976].

Sariel (UIUC) New CS473 41 Fall 2015 41 / 39

slide-150
SLIDE 150

8.4: Alternative FPT algorithm for Vertex Cover (not for lecture)

Sariel (UIUC) New CS473 42 Fall 2015 42 / 39

slide-151
SLIDE 151

Exact fixed parameter tractable algorithm

Fixed parameter tractable algorithm for VertexCoverMin.

Computes minimum vertex cover for the induced graph GX: fpVCI (X, β) // β: size of VC computed so far.

if X = ∅ or GX has no edges then return β

e ← any edge uv of GX. β1 = fpVCI

  • X \ {u, v} , β + 2
  • β2 = fpVCI
  • X \
  • {u} ∪ NGX(v)
  • , β + |NGX(v)|
  • β3 = fpVCI
  • X \
  • {v} ∪ NGX(u)
  • , β + |NGX(u)|
  • return min(β1, β2, β3).

algFPVertexCover (G = (V, E))

return fpVCI(V, 0)

Sariel (UIUC) New CS473 43 Fall 2015 43 / 39

slide-152
SLIDE 152

Depth of recursion

Lemma

The algorithm algFPVertexCover returns the optimal solution to the given instance of VertexCoverMin. Proof...

u v

Sariel (UIUC) New CS473 44 Fall 2015 44 / 39

slide-153
SLIDE 153

Depth of recursion II

Lemma

The depth of the recursion of algFPVertexCover(G) is at most α, where α is the minimum size vertex cover in G.

Proof.

1

When the algorithm takes both u and v - one of them in opt. Can happen at most α times.

2

Algorithm picks NGX(v) (i.e., β2). Conceptually add v to the vertex cover being computed.

3

Do the same thing for the case of β3.

4

Every such call add one element of the opt to conceptual set

  • cover. Depth of recursion is ≤ α.

Sariel (UIUC) New CS473 45 Fall 2015 45 / 39

slide-154
SLIDE 154

Vertex Cover

Exact fixed parameter tractable algorithm

Theorem

G: graph with n vertices. Min vertex cover of size α. Then, algFPVertexCover returns opt. vertex cover. Running time is O(3αn2).

Proof:

1

By lemma, recursion tree has depth α.

2

Rec-tree contains ≤ 2 · 3α nodes.

3

Each node requires O(n2) work. Algorithms with running time O(ncf(α)), where α is some parameter that depends on the problem are fixed parameter tractable.

Sariel (UIUC) New CS473 46 Fall 2015 46 / 39

slide-155
SLIDE 155

Vertex Cover

Exact fixed parameter tractable algorithm

Theorem

G: graph with n vertices. Min vertex cover of size α. Then, algFPVertexCover returns opt. vertex cover. Running time is O(3αn2).

Proof:

1

By lemma, recursion tree has depth α.

2

Rec-tree contains ≤ 2 · 3α nodes.

3

Each node requires O(n2) work. Algorithms with running time O(ncf(α)), where α is some parameter that depends on the problem are fixed parameter tractable.

Sariel (UIUC) New CS473 46 Fall 2015 46 / 39

slide-156
SLIDE 156

Notes

Sariel (UIUC) New CS473 47 Fall 2015 47 / 39

slide-157
SLIDE 157

Notes

Sariel (UIUC) New CS473 48 Fall 2015 48 / 39

slide-158
SLIDE 158

Notes

Sariel (UIUC) New CS473 49 Fall 2015 49 / 39

slide-159
SLIDE 159

Notes

Sariel (UIUC) New CS473 50 Fall 2015 50 / 39

slide-160
SLIDE 160
  • N. Christofides. Worst-case analysis of a new heuristic for the

travelling salesman problem. Technical Report Report 388, Graduate School of Industrial Administration, Carnegie Mellon University, 1976.

Sariel (UIUC) New CS473 50 Fall 2015 50 / 39