Metric k-Center and Feedback Vertex Set Outline Warehouse

Warehouse location
Metric k-Center and Feedback Vertex Set
Given a set of cities, pick k cities for locating warehouses such that
the maximum distance from each city to its closest warehouse is
minimized.
November 21, 2005
Outline
Formal definition
Input:
Metric k-Center
2-approximation using parametric pruning
Factor 2 is the best we can do
Weighted metric k-center
Feedback Vertex Set
Cyclomatic weight function
Generalization using layering
I
A complete undirected graph G = (V , E ).
I
Edge costs c(e) for all e ∈ E .
I
A positive integer k.
Find a set S ⊆ V , with |S| = k, minimizing the maximum distance
from any vertex v ∈ V to the set S, or
argminS⊆V ,|S|=k max{min c(u, v )}.
v ∈V
u∈S
Parametric pruning
Dominating set
Definition
Use some parameter t (which is based on some guess on the cost
of an optimal solution) to prune the problem instance I i.e.
removing parts which are not needed if t is a correct guess.
I
Step 1: Generate a family of instances I (t) and use them to
compute a lower bound on OPT (some t 0 ).
I
Step 2: Find a solution in I (α · t 0 ) for some suitable choice of
α.
Given an undirected graph H = (U, F ) a dominating set is a subset
S ⊆ U such that every vertex in the complementary set U − S is
adjacent to a vertex in S. Let dom(H) denote the size of a smallest
dominating set.
Computing dom(H) is NP-hard.
The ratio between the lower bound and the solution is our final
approximation factor.
Minimal dominating set
Dominating set
Definition
Given an undirected graph H = (U, F ) a dominating set is a subset
S ⊆ U such that every vertex in the complementary set U − S is
adjacent to a vertex in S. Let dom(H) denote the size of a smallest
dominating set.
Computing dom(H) is NP-hard.
Minimal dominating set
Minimum dominating set
Restatement of the problem
Sort the edges of G such that c(e1 ) ≤ c(e2 ) ≤ . . . ≤ c(em ) and let
Gi = (V , Ei ), Ei = {e1 , ..., ei }.
Restatement of the problem
Sort the edges of G such that c(e1 ) ≤ c(e2 ) ≤ . . . ≤ c(em ) and let
Gi = (V , Ei ), Ei = {e1 , ..., ei }.
G
Sort the edges of G such that c(e1 ) ≤ c(e2 ) ≤ . . . ≤ c(em ) and let
Gi = (V , Ei ), Ei = {e1 , ..., ei }.
G
Restatement of the problem
Sort the edges of G such that c(e1 ) ≤ c(e2 ) ≤ . . . ≤ c(em ) and let
Gi = (V , Ei ), Ei = {e1 , ..., ei }.
G
Restatement of the problem
G1
G1
G2
Restatement of the problem
Sort the edges of G such that c(e1 ) ≤ c(e2 ) ≤ . . . ≤ c(em ) and let
Gi = (V , Ei ), Ei = {e1 , ..., ei }.
G
G1
G2
G3
G4
G8
G11
Gm
Restatement of the problem
Square of a graph
Sort the edges of G such that c(e1 ) ≤ c(e2 ) ≤ . . . ≤ c(em ) and let
Gi = (V , Ei ), Ei = {e1 , ..., ei }.
Definition
The square of a graph H = (U, F ) is a graph, denoted H 2 , with
the same vertex set U and an edge (u, v ) for each pair of vertices
in U for which a path of length at most 2 exists in H.
G
G1
G2
G3
G4
G8
G11
Gm
H
H2
Restatement: Find the smallest index i such that Gi has a
dominating set of size at most k. If this is i ∗ then c(i ∗ ) is the cost
of an optimal k-center (OPT).
Square of a graph
Independent set
Definition
Definition
The square of a graph H = (U, F ) is a graph, denoted H 2 , with
the same vertex set U and an edge (u, v ) for each pair of vertices
in U for which a path of length at most 2 exists in H.
H
An independent set of vertices in a graph H is a set from which no
pair of vertices represent an edge in H. A maximal independent set
is an independent set which cannot be extended.
Independent set
Note: A maximal independent set is also a dominating set.
Bounding the size of an independent set in H 2
Independent set
Definition
An independent set of vertices in a graph H is a set from which no
pair of vertices represent an edge in H. A maximal independent set
is an independent set which cannot be extended.
Independent set
Lemma (5.2)
Given a graph H and an independent set I in H 2 , then
|I | ≤ dom(H).
Stars based on dom(H) spans V .
Maximal independent set
Note: A maximal independent set is also a dominating set.
Bounding the size of an independent set in H 2
Bounding the size of an independent set in H 2
Lemma (5.2)
Lemma (5.2)
Given a graph H and an independent set I in
|I | ≤ dom(H).
H 2,
Minimum dominating set in H
then
Given a graph H and an independent set I in H 2 , then
|I | ≤ dom(H).
Stars become cliques in H 2
Algorithm: Metric k-center
1. Construct G12 , . . . , Gm2 .
2. Compute maximal independent set Mi in each graph.
3. Find the smallest i such that |Mi | ≤ k, say j.
4. Return Mj .
2-approximation
Theorem (5.5)
The algorithm is a 2-approximation for the metric k-center
problem.
Proof.
Need to show that Mj is a solution of cost at most 2c(ej ):
I
Stars centered on vertices in Mj cover all vertices in Gi2
(a maximal independent set is also a dominating set).
I
Each edge in these stars has cost at most 2c(ej )
(triangle inequality).
Combined with Lemma 5.4: c(ej ) ≤ OPT ≤ 2c(ej ).
Algorithm: Metric k-center
Tight example
1. Construct G12 , . . . , Gm2 .
2. Compute maximal independent set Mi in each graph.
3. Find the smallest i such that |Mi | ≤ k, say j.
4. Return Mj .
Lemma (5.4)
c(ej ) ≤ OPT
Proof.
We show that j ≤ i ∗ .
For any i < j: |Mi | > k ⇒ dom(Gi ) > k ⇒ i < i ∗ .
Complete graph with |V | = n + 1. Consider k = 1.
Tight example
Factor 2 is the best we can do (if NP6=P)
Proof.
Assume a (2 − )-approximation algorithm exists. This can solve
the dominating set problem (which is NP-hard)!
Gn is the graph found by the algorithm (j = n).
Tight example
Factor 2 is the best we can do (if NP6=P)
Proof.
Assume a (2 − )-approximation algorithm exists. This can solve
the dominating set problem (which is NP-hard)!
Given an instance G = (V , E ), k, we want to know if dom(G ) ≤ k.
Return value Mn is found in Gn2 .
Factor 2 is the best we can do (if NP6=P)
Proof.
Assume a (2 − )-approximation algorithm exists. This can solve
the dominating set problem (which is NP-hard)!
Given an instance G = (V , E ), k, we want to know if dom(G ) ≤ k.
Construct complete graph G 0 = (V , E 0 ) with edge costs,
1, (u, v ) ∈ E
c(u, v ) =
2, (u, v ) ∈
/E
Weighted metric k-center
Given a weight function for the vertices, w : V → R+ , and a
bound W , we now want to solve:
argminS⊆V ,w (S)≤W max{min c(u, v )}
v ∈V
u∈S
.
3
1
3
3
2
2
2
Denote the weight of a minimum weight dominating set wdom(G ).
Factor 2 is the best we can do (if NP6=P)
Proof.
Assume a (2 − )-approximation algorithm exists. This can solve
the dominating set problem (which is NP-hard)!
Given an instance G = (V , E ), k, we want to know if dom(G ) ≤ k.
Construct complete graph G 0 = (V , E 0 ) with edge costs,
1, (u, v ) ∈ E
c(u, v ) =
2, (u, v ) ∈
/E
Now,
I
dom(G ) ≤ k ⇒ cost of k-center is 1 in G 0
I
dom(G ) > k ⇒ optimum cost of k-center is 2 in G 0 .
Based on this the algorithm can answer dom(G ) ≤ k.
Weighted metric k-center
Given a weight function for the vertices, w : V → R+ , and a
bound W , we now want to solve:
argminS⊆V ,w (S)≤W max{min c(u, v )}
v ∈V
u∈S
.
3
1
3
3
2
2
2
Denote the weight of a minimum weight dominating set wdom(G ).
Restatement: Find the smallest index i such that wdom(Gi ) ≤ W .
If this is i ∗ then c(i ∗ ) is the cost of an optimal weighted metric
k-center (OPT).
Lower bound
Algorithm: Weighted metric k-center
Definition
Given a graph H = (U, F ) with vertex weights, the lightest
neighbor of a vertex u ∈ H, denoted s(u), is a neighbor in H with
smallest vertex weight (u is also considered a neighbor of itself).
1. Construct G12 , . . . , Gm2 .
2. Compute maximal independent set Mi in each graph.
3. Compute Si = {si (u)|u ∈ Mi }.
4. Find the smallest i such that w (Si ) ≤ W , say j.
Lemma (5.9)
Given a graph H = (U, F ) and an independent set I in H 2 , let
S = {s(u)|u ∈ I } (neighbors from H), then
w (S) ≤ wdom(H).
5. Return Mj .
Lemma
c(ej ) ≤ OPT (c(ej ) is a lowerbound)
How does the extra step affect our approximation guarantee?
Lower bound - proof
Algorithm is a factor 3 approximation
Lemma: w (S) ≤ wdom(H).
Proof.
Let D be a minimum weight dominating set in H.
I
Consider stars in H centered on D covering V .
I
Stars are cliques in H 2 .
I
The set I can contain at most one vertex from each star.
I
All centers are available when creating S.
≤ 2cost(ej )
u
≤ cost(ej )
Thus, w (S) ≤ w (D) = wdom(H).
Stars in Gj2 based on Mj cover V .
Algorithm is a factor 3 approximation
Feedback Vertex Set
Input:
I
An undirected graph G = (V , E ).
I
A weight function w for which w (v ) ≥ 0 for all v ∈ V .
≤ 2cost(ej )
u
Find a minimum weight subset F of V such that removing F from
G leaves an acyclic graph (a forest).
≤ cost(ej )
≤ 3cost(ej )
Approximation method: Layering.
sj (u)
Moving to a light neighbor has a cost.
Tight example
Example graph
1
∞
2
1
∞
1+
1
4
1+
∞
1+
1+
∞
a
1
1
b
2
1
c
2
1
d
2
1
2
G = (V , E ), |V | = 7, |E | = 9
Example graph
Cyclomatic number
Definition
1
2
1
Given a graph G = (V , E ), the cyclomatic number (circuit rank),
cyc(G ), is the smallest number of graph edges which must be
removed to get rid of all cycles.
Let comps(G ) denote the number of connected components in G .
1
4
Theorem
cyc(G ) = |E | − |V | + comps(G )
1
2
Feedback vertex set of weight 4
Example graph
Cyclomatic number
Definition
1
2
1
Given a graph G = (V , E ), the cyclomatic number (circuit rank),
cyc(G ), is the smallest number of graph edges which must be
removed to get rid of all cycles.
Let comps(G ) denote the number of connected components in G .
1
4
Theorem
cyc(G ) = |E | − |V | + comps(G )
1
2
Proof.
Optimal feedback vertex set
Consider a connected component G 0 = (V 0 , E 0 ) in G .
A tree has |V 0 | − 1 edges, thus,
cyc(G 0 ) = |E 0 | − (|V 0 | − 1) = |E 0 | − |V 0 | + 1.
We cannot do better than a tree.
Decreasing the cyclomatic number
Lemmas (1)
Definition
Denote by δG (v ) the decrease in the cyclomatic number when
removing the vertex v .
Given a feedback vertex set F = {v1 , . . . , vf } then
cyc(G ) =
f
X
δGi−1 (vi ),
i=1
where G0 = G and Gi = G − {v1 , . . . , vi } for i > 0.
Decreasing the cyclomatic number
Lemma (Claim 2.3)
Given a connected graph G , δG (v ) = degG (v ) − comps(G − v ).
Proof.
δG (v )
=
=
=
=
cyc(G ) − cyc(G 0 )
|E | − |V | + comps(G ) − (|E | − deg(v ) − (|V | − 1) + comps(G 0 ))
deg(v ) − 1 + comps(G ) − comps(G 0 )
deg(v ) − 1 + 1 − comps(G 0 ) = deg(v ) − comps(G 0 )
Lemmas (2)
Lemma (6.4)
Definition
Denote by δG (v ) the decrease in the cyclomatic number when
removing the vertex v .
Given a feedback vertex set F = {v1 , . . . , vf } then
cyc(G ) =
f
X
δGi−1 (vi ),
i=1
where G0 = G and Gi = G − {v1 , . . . , vi } for i > 0.
Goal: Given a cyclomatic weight function, show that any minimal
feedback vertex set is a 2-approximation of the optimal feedback
vertex set.
Let H be a subgraph of G then δH (v ) ≤ δG (v ).
Cyclomatic weight function: Example
Lemmas (2)
2
Lemma (6.4)
2
Let H be a subgraph of G then δH (v ) ≤ δG (v ).
0
Proof.
1
I
Assume G and H are connected components.
I
Need to show
1
degH (v ) − comps(H − v ) ≤ degG (v ) − comps(G − v )
I
3
1
For each edge e in G − H.
I
I
e is not incident to v : Can decrease the number of
components in G − v compared to H − v .
e is incident to v : Can increase the number of components in
G − v compared to H − v by 1, but this also increases degG (v ).
Cyclomatic weight function and a lower bound
Given a feedback
Pvertex set F = {v1 , . . . , vf } we previously stated
that cyc(G ) = fi=1 δGi−1 (vi ). Using lemma 6.4 we get:
cyc(G ) ≤
X
δG (v ).
v ∈F
Definition
A weight function w is cyclomatic if there is a constant c > 0 such
that w (v ) = c · δG (v ) for all v ∈ V .
Given a cyclomatic weight function w and assuming that F is
optimal, we get
X
c · cyc(G ) ≤ c ·
δG (v ) = w (F ) = OPT.
v ∈F
Cyclomatic weight function (c = 1)
I
How does this affect optimal solutions?
I
What is the importance of the value c?
Cyclomatic number as an upper bound
Lemma (6.5)
If
PF is a minimal feedback vertex set then
v ∈F δG (v ) ≤ 2 · cyc(G ).
(Proof postponed). Assuming vertex weights are assigned by a
cyclomatic weight function w with constant c > 0 then:
X
c·
δG (v ) ≤ c · 2 · cyc(G ).
v ∈F
From the previous slide we have c · cyc(G ) ≤ OPT.
Cyclomatic number as an upper bound
Proof for Lemma 6.5 - 1
Lemma (6.5)
For a minimal feedback vertex set F ,
Lemma (6.5)
If
PF is a minimal feedback vertex set then
v ∈F δG (v ) ≤ 2 · cyc(G ).
(Proof postponed). Assuming vertex weights are assigned by a
cyclomatic weight function w with constant c > 0 then:
X
c·
δG (v ) ≤ c · 2 · cyc(G ).
P
v ∈F
δG (v ) ≤ 2 · cyc(G ).
Let k be the number of connected components in G − F . Two
types of components:
I Those connected to only one vertex in F (t).
I Those connected to more than one vertex in F (k − t).
v ∈F
From the previous slide we have c · cyc(G ) ≤ OPT.
Theorem (Corollary 6.6)
A minimal feedback vertex set in G is a 2-approximation.
Proof for Lemma 6.5 - 1
Proof for Lemma 6.5 - 1
Lemma (6.5)
For a minimal feedback vertex set F ,
Lemma (6.5)
P
v ∈F
δG (v ) ≤ 2 · cyc(G ).
For a minimal feedback vertex set F ,
P
v ∈F
δG (v ) ≤ 2 · cyc(G ).
Let k be the number of connected components in G − F . Two
types of components:
I Those connected to only one vertex in F (t).
I Those connected to more than one vertex in F (k − t).
We will show:
f
X
δG (vi ) =
i=1
f
X
(degG (vi ) − comps(G − vi )) ≤ 2(|E | − |V |)
i=1
or equivalently:
f
X
i=1
degG (vi ) ≤ 2(|E | − |V |) + f + t.
Proof for Lemma 6.5 - 2
Proof for Lemma 6.5 - 2
v1
v2
v3
comp. 1
comp. 2
comp. 3
vf
v1
v2
v3
comp. k
tree 1
tree 2
tree 3
...
...
Pf
i=1 degG (vi )
Goal:
f
X
Pf
= 2|E | − 2|comp.edges| − |(F , V − F )|
i=1 degG (vi )
Goal:
f
X
degG (vi ) ≤ 2(|E | − |V |) + f + t
≤ 2|E | − 2(|V | − f − k) − |f + 2k − t|
degG (vi ) ≤ 2(|E | − |V |) + f + t
Proof for Lemma 6.5 - 2
v1
v2
v3
tree 1
tree 2
tree 3
...
vf
v1
v2
v3
tree k
tree 1
tree 2
tree 3
...
i=1 degG (vi )
f
X
i=1
tree k
i=1
Proof for Lemma 6.5 - 2
Goal:
vf
...
i=1
Pf
...
vf
...
Pf
= 2|E | − 2(|V | − f − k) − |(F , V − F )|
i=1 degG (vi )
Goal:
degG (vi ) ≤ 2(|E | − |V |) + f + t
...
f
X
i=1
tree k
≤ 2|E | − 2(|V | − f − k) − |f + 2k − t|
degG (vi ) ≤ 2(|E | − |V |) + f + t
Layering technique
Decomposition: Example
2
4
2
I
I
2
Decomposition phase
Decompose the weight function into a set of cyclomatic
weight functions.
Use these functions to generate a sequence of subgraphs of G .
Extension phase
Go through these subgraphs augmenting a feedback vertex set
in each step.
2
8
4
G0 = G , w0 = w
2
2
1
0
3
1
1
t0 = 1 · δ G 0
Decomposition
Decomposition: Example
2
4
2
Given a graph G = (V , F ) and a non-negative weight function w ,
compute
w (v )
c = min
.
v ∈V
δG (v )
8
2
1
2
1
1
1
t0 = 1 · δ G 0
3
G1 , w1 = w0 − t0
0
3
2
5
1
G0 = G , w0 = w
2
0
2
4
Definition
The largest cyclomatic weight function is t(v ) = c · δG (v ). The
residual weight function is w 0 (v ) = w (v ) − t(v ).
2
1
1
0
1
1
0
t1 = 1 · δ G 1
Decomposition: Example
2
4
2
2
8
2
1
2
1
3
1
1
1
1
t0 = 1 · δ G 0
2
4
3
G2 , w2 = w1 − t1
0
1
1
0
0
G1 , w1 = w0 − t0
0
3
2
5
1
G0 = G , w0 = w
1
0
2
4
2
Algorithm
1
0
t1 = 1 · δ G 1
2
4
3
I
Decompose G as described creating graphs G0 , . . . , Gk .
I
Fk = ∅ is a minimal feedback vertex set for Gk .
I
For i = k, . . . , 1, extend Fi to Fi−1 by adding a minimal set of
vertices from Vi−1 − Vi .
I
Return F0 .
Theorem (6.9)
The algorithm above is a factor 2 approximation for the feedback
vertex set problem.
t2 = w 2
Extension (lemma)
2-approximation: Proof
Consider optimal feedback vertex set F ∗ . Clearly, F ∗ ∩ Vi must be
a feedback vertex set for Gi , thus
Lemma (6.7)
Given
I
a graph G = (V , E ),
I
a subgraph H induced by a vertex set V 0 ⊂ V ,
I
a minimal feedback vertex set F in H,
I
and a minimal set F 0 ⊆ V − V 0 such that F ∪ F 0 is a feedback
vertex set for G ,
then F ∪ F 0 is a minimal feedback vertex set for G .
Proof.
No vertex v ∈ F becomes redundant in G .
OPT = w (F ∗ ) =
k
X
i=0
ti (F ∗ ∩ Vi ) ≥
k
X
i=0
OPTi .
2-approximation: Proof
Summary
Consider optimal feedback vertex set F ∗ . Clearly, F ∗ ∩ Vi must be
a feedback vertex set for Gi , thus
OPT = w (F ∗ ) =
k
X
ti (F ∗ ∩ Vi ) ≥
i=0
k
X
OPTi .
Approximation techniques:
I Parametric pruning applied to (un)weighted k-center problem.
i=0
I
Pk
i=0 ti (F0
∩ Vi ) =
Pk
I
w (F0 ) =
i=0 ti (Fi )
I
Fi is a minimal feedback vertex set (extension lemma).
I
ti (Fi ) ≤ 2OPTi (2-approximation since ti is cyclomatic)
I
I
Factor 2 in the unweighted case (shown to be the best
possible).
Factor 3 in the weighted case.
Layering applied to the weighted feedback center problem.
I
I
Factor 2 with/without the restriction of cyclomatic weight
functions.
Tight example given for algorithm.
Exercises: 5.2 and 6.1.
2-approximation: Proof
Consider optimal feedback vertex set F ∗ . Clearly, F ∗ ∩ Vi must be
a feedback vertex set for Gi , thus
OPT = w (F ∗ ) =
k
X
ti (F ∗ ∩ Vi ) ≥
i=0
Pk
i=0 ti (F0
∩ Vi ) =
k
X
OPTi .
i=0
Pk
I
w (F0 ) =
i=0 ti (Fi )
I
Fi is a minimal feedback vertex set (extension lemma).
I
ti (Fi ) ≤ 2OPTi (2-approximation since ti is cyclomatic)
From the above we get,
w (F0 ) =
k
X
i=0
ti (Fi ) ≤ 2
k
X
i=0
OPTi ≤ 2 · OPT.