algorithmic graph theory part v - approximation algorithms for

79
Algorithmic Graph Theory Part V - Approximation Algorithms for Graph Problems Martin Milaniˇ c [email protected] University of Primorska, Koper, Slovenia Dipartimento di Informatica Universit` a degli Studi di Verona, March 2013 1 / 26

Upload: others

Post on 03-Feb-2022

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithmic Graph Theory Part V - Approximation Algorithms for

Algorithmic Graph TheoryPart V - Approximation Algorithms

for Graph Problems

Martin [email protected]

University of Primorska, Koper, Slovenia

Dipartimento di InformaticaUniversita degli Studi di Verona, March 2013

1 / 26

Page 2: Algorithmic Graph Theory Part V - Approximation Algorithms for

Coping with NP -hardness

There are several approaches on how to deal with (theintractability of) NP -hard problems:

polynomial algorithms for particular input instances

approximation algorithms

heuristics, local optimization

“efficient” exponential algorithms

randomized algorithms

parameterized complexity(fixed-parameter tractable (FPT) algorithms)

2 / 26

Page 3: Algorithmic Graph Theory Part V - Approximation Algorithms for

What we’ll do

1 Basic Definitions.2 2-Approximation Algorithm for Vertex Cover.3 Approximation Algorithms for the Metric TSP.

2 / 26

Page 4: Algorithmic Graph Theory Part V - Approximation Algorithms for

BASICS OF APPROXIMATION ALGORITHMS.

2 / 26

Page 5: Algorithmic Graph Theory Part V - Approximation Algorithms for

Coping with NP -hardness

Heuristics:

intuitive algorithms;

3 / 26

Page 6: Algorithmic Graph Theory Part V - Approximation Algorithms for

Coping with NP -hardness

Heuristics:

intuitive algorithms;

guaranteed to run in polynomial time;

3 / 26

Page 7: Algorithmic Graph Theory Part V - Approximation Algorithms for

Coping with NP -hardness

Heuristics:

intuitive algorithms;

guaranteed to run in polynomial time;

no guarantee on quality of solution.

3 / 26

Page 8: Algorithmic Graph Theory Part V - Approximation Algorithms for

Coping with NP -hardness

Heuristics:

intuitive algorithms;

guaranteed to run in polynomial time;

no guarantee on quality of solution.

Approximation algorithms:

guaranteed to run in polynomial time;

3 / 26

Page 9: Algorithmic Graph Theory Part V - Approximation Algorithms for

Coping with NP -hardness

Heuristics:

intuitive algorithms;

guaranteed to run in polynomial time;

no guarantee on quality of solution.

Approximation algorithms:

guaranteed to run in polynomial time;

guaranteed to find “high quality” solution, say within 1% ofoptimum;

3 / 26

Page 10: Algorithmic Graph Theory Part V - Approximation Algorithms for

Coping with NP -hardness

Heuristics:

intuitive algorithms;

guaranteed to run in polynomial time;

no guarantee on quality of solution.

Approximation algorithms:

guaranteed to run in polynomial time;

guaranteed to find “high quality” solution, say within 1% ofoptimum;

Obstacle:need to prove a solution’s value is close to optimum,without even knowing what the optimum value is!

3 / 26

Page 11: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approximation Algorithms and Schemes

ρ-approximation algorithm :

An algorithm A for an optimization problem Π that runs inpolynomial time.

4 / 26

Page 12: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approximation Algorithms and Schemes

ρ-approximation algorithm :

An algorithm A for an optimization problem Π that runs inpolynomial time.

For every instance of Π, A outputs a feasible solution withobjective function value within ratio ρ of true optimum forthat instance.

4 / 26

Page 13: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approximation Algorithms and Schemes

ρ-approximation algorithm :

An algorithm A for an optimization problem Π that runs inpolynomial time.

For every instance of Π, A outputs a feasible solution withobjective function value within ratio ρ of true optimum forthat instance.

More specifically:

for minimization problems:for every instance I, we have fA(I) ≤ ρ · OPT(I) , where

4 / 26

Page 14: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approximation Algorithms and Schemes

ρ-approximation algorithm :

An algorithm A for an optimization problem Π that runs inpolynomial time.

For every instance of Π, A outputs a feasible solution withobjective function value within ratio ρ of true optimum forthat instance.

More specifically:

for minimization problems:for every instance I, we have fA(I) ≤ ρ · OPT(I) , wherefA(I) is the value of the solution returned by the algorithm,and

4 / 26

Page 15: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approximation Algorithms and Schemes

ρ-approximation algorithm :

An algorithm A for an optimization problem Π that runs inpolynomial time.

For every instance of Π, A outputs a feasible solution withobjective function value within ratio ρ of true optimum forthat instance.

More specifically:

for minimization problems:for every instance I, we have fA(I) ≤ ρ · OPT(I) , wherefA(I) is the value of the solution returned by the algorithm,andOPT(I) is the optimal solution value.

for maximization problems: fA(I) ≥ OPT(I)/ρ .

4 / 26

Page 16: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approaches to the Design of ApproximationAlgorithms

There exist several approaches to the design of approximationalgorithms:

combinatorial algorithms,

5 / 26

Page 17: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approaches to the Design of ApproximationAlgorithms

There exist several approaches to the design of approximationalgorithms:

combinatorial algorithms,

algorithms based on linear programming,

5 / 26

Page 18: Algorithmic Graph Theory Part V - Approximation Algorithms for

Approaches to the Design of ApproximationAlgorithms

There exist several approaches to the design of approximationalgorithms:

combinatorial algorithms,

algorithms based on linear programming,

randomized algorithms,

etc.

5 / 26

Page 19: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-APPROXIMATION ALGORITHMFOR THE VERTEX COVER PROBLEM

5 / 26

Page 20: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Vertex Cover Problem

Recall:vertex cover in a graph G = (V ,E):a subset C ⊆ V such that for all e ∈ E , e ∩C 6= ∅

tocka v pokritju

G

6 / 26

Page 21: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Vertex Cover Problem

Recall:vertex cover in a graph G = (V ,E):a subset C ⊆ V such that for all e ∈ E , e ∩C 6= ∅

a vertex in the cover

G

6 / 26

Page 22: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Vertex Cover Problem

Consider the optimization version of the VERTEX COVER

problem:

MINIMUM VERTEX COVER

Input: Graph G = (V ,E).Task: Find a minimum vertex cover in G.

7 / 26

Page 23: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Vertex Cover Problem

Consider the optimization version of the VERTEX COVER

problem:

MINIMUM VERTEX COVER

Input: Graph G = (V ,E).Task: Find a minimum vertex cover in G.

In bipartite graphs, the problem can be solved optimally inpolynomial time.

7 / 26

Page 24: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Vertex Cover Problem

Consider the optimization version of the VERTEX COVER

problem:

MINIMUM VERTEX COVER

Input: Graph G = (V ,E).Task: Find a minimum vertex cover in G.

In bipartite graphs, the problem can be solved optimally inpolynomial time.For general graphs, the problem is NP-hard.

7 / 26

Page 25: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

Approx-Cover :

8 / 26

Page 26: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

Approx-Cover :C := ∅;

8 / 26

Page 27: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

Approx-Cover :C := ∅;while (∃e = uv ∈ E)(u, v ∈ V \C) do

8 / 26

Page 28: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

Approx-Cover :C := ∅;while (∃e = uv ∈ E)(u, v ∈ V \C) do

C := C ∪ {u, v}

8 / 26

Page 29: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

Approx-Cover :C := ∅;while (∃e = uv ∈ E)(u, v ∈ V \C) do

C := C ∪ {u, v}end while

8 / 26

Page 30: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

Approx-Cover :C := ∅;while (∃e = uv ∈ E)(u, v ∈ V \C) do

C := C ∪ {u, v}end whilereturn C.

The algorithm computes an inclusion-wise maximal matchingM and returns the union of all edges in the matching.

8 / 26

Page 31: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

9 / 26

Page 32: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

Proof:

9 / 26

Page 33: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

Proof:The stopping criterion of the while loop guarantees that C is acover.

9 / 26

Page 34: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

Proof:The stopping criterion of the while loop guarantees that C is acover.Clearly, the algorithm can be implemented to run in polynomialtime.

9 / 26

Page 35: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

Proof:The stopping criterion of the while loop guarantees that C is acover.Clearly, the algorithm can be implemented to run in polynomialtime.Let M be the maximal matching consisting of all edges chosenby the algorithm.

9 / 26

Page 36: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

Proof:The stopping criterion of the while loop guarantees that C is acover.Clearly, the algorithm can be implemented to run in polynomialtime.Let M be the maximal matching consisting of all edges chosenby the algorithm.Every vertex cover must contain at least one vertex of eachedge of M,

9 / 26

Page 37: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

Proof:The stopping criterion of the while loop guarantees that C is acover.Clearly, the algorithm can be implemented to run in polynomialtime.Let M be the maximal matching consisting of all edges chosenby the algorithm.Every vertex cover must contain at least one vertex of eachedge of M,hence OPT ≥ |M|

9 / 26

Page 38: Algorithmic Graph Theory Part V - Approximation Algorithms for

2-Approximation Algorithm for Vertex Cover

ClaimApprox-Cover is a 2-approximation algorithm for the MINIMUM

VERTEX COVER problem.

Proof:The stopping criterion of the while loop guarantees that C is acover.Clearly, the algorithm can be implemented to run in polynomialtime.Let M be the maximal matching consisting of all edges chosenby the algorithm.Every vertex cover must contain at least one vertex of eachedge of M,hence OPT ≥ |M|and consequently

|C| = 2|M| ≤ 2 · OPT .

9 / 26

Page 39: Algorithmic Graph Theory Part V - Approximation Algorithms for

Other (In)approximability issues

The factor of 2 in the analysis cannot be improved:

10 / 26

Page 40: Algorithmic Graph Theory Part V - Approximation Algorithms for

Other (In)approximability issues

The factor of 2 in the analysis cannot be improved:If G = Kn,n, then the algorithm returns C = V (Kn,n), whilean optimal solution is of size n (either part of thebipartition).

10 / 26

Page 41: Algorithmic Graph Theory Part V - Approximation Algorithms for

Other (In)approximability issues

The factor of 2 in the analysis cannot be improved:If G = Kn,n, then the algorithm returns C = V (Kn,n), whilean optimal solution is of size n (either part of thebipartition).

Remark:It can be shown that a natural greedy algorithm is not aρ-approximation, for any ρ.

10 / 26

Page 42: Algorithmic Graph Theory Part V - Approximation Algorithms for

Other (In)approximability issues

The factor of 2 in the analysis cannot be improved:If G = Kn,n, then the algorithm returns C = V (Kn,n), whilean optimal solution is of size n (either part of thebipartition).

Remark:It can be shown that a natural greedy algorithm is not aρ-approximation, for any ρ.[Greedy: start with C = ∅. Until C is not a vertex cover,peel off and add to C a vertex of maximum degree in thecurrent graph.]

10 / 26

Page 43: Algorithmic Graph Theory Part V - Approximation Algorithms for

Other (In)approximability issues

The factor of 2 in the analysis cannot be improved:If G = Kn,n, then the algorithm returns C = V (Kn,n), whilean optimal solution is of size n (either part of thebipartition).

Remark:It can be shown that a natural greedy algorithm is not aρ-approximation, for any ρ.[Greedy: start with C = ∅. Until C is not a vertex cover,peel off and add to C a vertex of maximum degree in thecurrent graph.]

Inapproximability of vertex cover:If there exists a polynomial 1.36-approximation algorithmfor MINIMUM VERTEX COVER, then P = NP (Dinur-Safra 2005).

10 / 26

Page 44: Algorithmic Graph Theory Part V - Approximation Algorithms for

Other (In)approximability issues

The factor of 2 in the analysis cannot be improved:If G = Kn,n, then the algorithm returns C = V (Kn,n), whilean optimal solution is of size n (either part of thebipartition).

Remark:It can be shown that a natural greedy algorithm is not aρ-approximation, for any ρ.[Greedy: start with C = ∅. Until C is not a vertex cover,peel off and add to C a vertex of maximum degree in thecurrent graph.]

Inapproximability of vertex cover:If there exists a polynomial 1.36-approximation algorithmfor MINIMUM VERTEX COVER, then P = NP (Dinur-Safra 2005).No ρ-approximation algorithm for MINIMUM VERTEX

COVER is known with ρ < 2.10 / 26

Page 45: Algorithmic Graph Theory Part V - Approximation Algorithms for

APPROXIMATION ALGORITHMSFOR THE TRAVELING SALESMAN PROBLEM

10 / 26

Page 46: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

TRAVELING SALESMAN (TSP)

Input: Graph G = (V ,E), a cost function c : E → R+.Task: Find a Hamiltonian cycle in G of smallest total cost.

11 / 26

Page 47: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

12 / 26

Page 48: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.

12 / 26

Page 49: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).

12 / 26

Page 50: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).HAMILTONIAN CYCLE: determine whether a given graph contains a cyclegoing through every vertex exactly once.

12 / 26

Page 51: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).HAMILTONIAN CYCLE: determine whether a given graph contains a cyclegoing through every vertex exactly once.I = instance for HAMILTONIAN CYCLE: a graph G = (V ,E).

12 / 26

Page 52: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).HAMILTONIAN CYCLE: determine whether a given graph contains a cyclegoing through every vertex exactly once.I = instance for HAMILTONIAN CYCLE: a graph G = (V ,E).Let G′ = KV (complete graph), c :

(V2

)

→ R+, where

c(e) ={

1, if e ∈ E ;ρ|V |+ 1, otherwise.

12 / 26

Page 53: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).HAMILTONIAN CYCLE: determine whether a given graph contains a cyclegoing through every vertex exactly once.I = instance for HAMILTONIAN CYCLE: a graph G = (V ,E).Let G′ = KV (complete graph), c :

(V2

)

→ R+, where

c(e) ={

1, if e ∈ E ;ρ|V |+ 1, otherwise.

Notice: G is Hamiltonian if and only if G′ has a Hamiltonian cycle of total cost|V |.

12 / 26

Page 54: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).HAMILTONIAN CYCLE: determine whether a given graph contains a cyclegoing through every vertex exactly once.I = instance for HAMILTONIAN CYCLE: a graph G = (V ,E).Let G′ = KV (complete graph), c :

(V2

)

→ R+, where

c(e) ={

1, if e ∈ E ;ρ|V |+ 1, otherwise.

Notice: G is Hamiltonian if and only if G′ has a Hamiltonian cycle of total cost|V |.Let Γ be the solution to the TSP given (KV , c), computed by our algorithm A.

12 / 26

Page 55: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).HAMILTONIAN CYCLE: determine whether a given graph contains a cyclegoing through every vertex exactly once.I = instance for HAMILTONIAN CYCLE: a graph G = (V ,E).Let G′ = KV (complete graph), c :

(V2

)

→ R+, where

c(e) ={

1, if e ∈ E ;ρ|V |+ 1, otherwise.

Notice: G is Hamiltonian if and only if G′ has a Hamiltonian cycle of total cost|V |.Let Γ be the solution to the TSP given (KV , c), computed by our algorithm A.

(a) If c(Γ) ≤ ρ|V |, then Γ ⊆ E , hence G is Hamiltonian.

12 / 26

Page 56: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Traveling Salesman Problem

Proposition

If there exists a ρ-approximation algorithm for TSP for someρ ≥ 1, then P = NP.

Proof:Suppose that A is a ρ-approximation algorithm for TSP.We will show how to decide in polynomial time, using A, whether a givengraph G is Hamiltonian (which is an NP-complete problem).HAMILTONIAN CYCLE: determine whether a given graph contains a cyclegoing through every vertex exactly once.I = instance for HAMILTONIAN CYCLE: a graph G = (V ,E).Let G′ = KV (complete graph), c :

(V2

)

→ R+, where

c(e) ={

1, if e ∈ E ;ρ|V |+ 1, otherwise.

Notice: G is Hamiltonian if and only if G′ has a Hamiltonian cycle of total cost|V |.Let Γ be the solution to the TSP given (KV , c), computed by our algorithm A.

(a) If c(Γ) ≤ ρ|V |, then Γ ⊆ E , hence G is Hamiltonian.

(b) If c(Γ) > ρ|V |, then OPT > |V |, hence G is not Hamiltonian.12 / 26

Page 57: Algorithmic Graph Theory Part V - Approximation Algorithms for

A Heuristic for TSP

Approx-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).

13 / 26

Page 58: Algorithmic Graph Theory Part V - Approximation Algorithms for

A Heuristic for TSP

Approx-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).

1

2

3 4 5

6 7

8 9

1

2

3 4 5

6 7

8 9

input instance

(The cost of an egde connecting two vertices is equal to the Euclidean distance between them.)

minimum spanning tree T

13 / 26

Page 59: Algorithmic Graph Theory Part V - Approximation Algorithms for

A Heuristic for TSP

Approx-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).

W ← walk in which each edge appears exactly twice(obtained for example with depth-first search)

14 / 26

Page 60: Algorithmic Graph Theory Part V - Approximation Algorithms for

A Heuristic for TSP

Approx-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).

W ← walk in which each edge appears exactly twice(obtained for example with depth-first search)

H ← cycle that visits vertices in the order as they appear inW for the first time

14 / 26

Page 61: Algorithmic Graph Theory Part V - Approximation Algorithms for

A Heuristic for TSP

Approx-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).

W ← walk in which each edge appears exactly twice(obtained for example with depth-first search)

H ← cycle that visits vertices in the order as they appear inW for the first time

1

2

3 4 5

6 7

8 9

1

2

3 4 5

6

7

8 9

walk W traveling salesman tour determined by W

(obtained with DFS)

14 / 26

Page 62: Algorithmic Graph Theory Part V - Approximation Algorithms for

A Heuristic for TSP

Approx-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).

W ← walk in which each edge appears exactly twice(obtained for example with depth-first search)

H ← cycle that visits vertices in the order as they appear inW for the first time

1

2

3 4 5

6

7

8 9

1

2

3 4 5

6

7

8 9

optimal solution traveling salesman tour determined by W

cost ≈ 15, 72cost ≈ 13, 95

15 / 26

Page 63: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP

METRIC TSP: TSP in which the cost function obeys the triangleinequality:For all u, v ,w ∈ V :

c(uw) ≤ c(uv) + c(vw) .

16 / 26

Page 64: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP

METRIC TSP: TSP in which the cost function obeys the triangleinequality:For all u, v ,w ∈ V :

c(uw) ≤ c(uv) + c(vw) .

A reduction from the HAMILTONIAN CYCLE problem shows:

Proposition

METRIC TSP is NP-hard.

16 / 26

Page 65: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: a 2-approximation

Proposition

APPROX-TSP is a 2-approximation algorithm for the METRIC

TSP problem.

17 / 26

Page 66: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: a 2-approximation

Proposition

APPROX-TSP is a 2-approximation algorithm for the METRIC

TSP problem.

Proof:Let H∗ be an optimal tour. We need to show: c(H) ≤ 2 · c(H∗).

17 / 26

Page 67: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: a 2-approximation

Proposition

APPROX-TSP is a 2-approximation algorithm for the METRIC

TSP problem.

Proof:Let H∗ be an optimal tour. We need to show: c(H) ≤ 2 · c(H∗).

c(T ) ≤ c(H∗), since removing any edge of H∗ results in aspanning tree.

1

2

3 4 5

6 7

8 9

1

2

3 4 5

6

7

8 9

optimal solution H∗ minus one edge

minimum spanning tree T17 / 26

Page 68: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: a 2-approximation

Proposition

APPROX-TSP is a 2-approximation algorithm for the METRIC

TSP problem.

Proof:c(T ) ≤ c(H∗), since removing any edge of H∗ results in aspanning tree.c(W ) = 2 · c(T ), since every edge is visited exactly twice.

1

2

3 4 5

6 7

8 9

walk W

1

2

3 4 5

6 7

8 9

minimum spanning tree T

18 / 26

Page 69: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: a 2-approximation

Proposition

APPROX-TSP is a 2-approximation algorithm for the METRIC

TSP problem.

Proof:c(T ) ≤ c(H∗), since removing any edge of H∗ results in aspanning tree.c(W ) = 2 · c(T ), since every edge is visited exactly twice.c(H) ≤ ·c(W ), due to the triangle inequality.

1

2

3 4 5

6 7

8 9

1

2

3 4 5

6

7

8 9

walk W traveling salesman tour determined by W 19 / 26

Page 70: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: Christofides’ Algorithm

Theorem (Christofides, 1976)

There exists a 1.5-approximation algorithm for the METRIC

TSP problem.

20 / 26

Page 71: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: Christofides’ Algorithm

Theorem (Christofides, 1976)

There exists a 1.5-approximation algorithm for the METRIC

TSP problem.

Christofides-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).Find a minimum cost perfect matching M connectingvertices of odd degree in T .

1

2

3 4 5

6 7

8 9

1

67

9

matching Mminimum spanning tree T

vertices of odd degree are red

20 / 26

Page 72: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: Christofides’ Algorithm

Theorem (Christofides, 1976)

There exists a 1.5-approximation algorithm for the METRIC

TSP problem.

Christofides-TSP (G, c)

Find a minimum spanning tree T = (V ,ET ) for (G, c).Find a minimum cost perfect matching M connectingvertices of odd degree in T .G′ ← T ∪ME ← Euler tour in G′ (graph G′ is Eulerian, since it is connected

and has all vertices of even degree).1

2

3 4 5

67

8 9

G′

1

2

3 4 5

67

8 9

E = Euler tour in G′

21 / 26

Page 73: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: Christofides’ Algorithm

Proof:Let H∗ be an optimal tour. We need to show: c(H) ≤ 1.5 ·c(H∗).

22 / 26

Page 74: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: Christofides’ Algorithm

Proof:Let H∗ be an optimal tour. We need to show: c(H) ≤ 1.5 ·c(H∗).

c(T ) ≤ c(H∗), as before

22 / 26

Page 75: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: Christofides’ Algorithm

Proof:Let H∗ be an optimal tour. We need to show: c(H) ≤ 1.5 ·c(H∗).

c(T ) ≤ c(H∗), as beforec(M) ≤ (1/2) · c(Γ∗) ≤ (1/2) · c(H∗), where Γ∗ is anoptimal cycle on the odd vertices of T .

The first inequality follows since Γ∗ is the union of twoperfect matchings.The second inequality follows from the triangle inequality.

1

67

9

matching M

1

67

9

cycle Γ∗

22 / 26

Page 76: Algorithmic Graph Theory Part V - Approximation Algorithms for

The Metric TSP: Christofides’ Algorithm

Proof:

c(T ) ≤ c(H∗), as before

c(M) ≤ (1/2) · c(Γ∗) ≤ (1/2) · c(H∗), where Γ∗ is anoptimal cycle on the odd vertices of T .

Due to the triangle inquality:c(H) ≤ c(M) + c(T ) ≤ (3/2) · c(H∗).

1

2

3 4 5

67

8 9

G′

1

2

3 4 5

6

7

8 9

H = traveling salesman tour

23 / 26

Page 77: Algorithmic Graph Theory Part V - Approximation Algorithms for

What we did – Week 1

1 Tue March 5: Review of basic notions in graph theory,algorithms and complexity X

2 Wed March 6: Graph colorings X

3 Thu March 7: Perfect graphs and their subclasses, part 1 X

4 Fri March 8: Perfect graphs and their subclasses, part 2 X

24 / 26

Page 78: Algorithmic Graph Theory Part V - Approximation Algorithms for

What we’ll do – Week 2

1 Tue March 19: Further examples of tractable problems,part 1 X

2 Wed March 20:Further examples of tractable problems, part 2 X

Approximation algorithms for graph problems X

3 Thu March 21: Lectio Magistralis lecture, “Graph classes:interrelations, structure, and algorithmic issues”

25 / 26

Page 79: Algorithmic Graph Theory Part V - Approximation Algorithms for

Questions?

Thank you for your attention!

[email protected]

26 / 26