Cuts All-Pair Min-Cuts in undirected graphs R. Inkulu http://www.iitg

Cuts
All-Pair Min-Cuts in undirected graphs
R. Inkulu
http://www.iitg.ac.in/rinkulu/
(Gomory-Hu tree)
1 / 16
Problem description
Given an undirected graph G(V, E), preprocess G to find all-pair min-cuts and
their values to facilitate in answering any pair min-cut queries efficiently.
• if done in naive way, takes O(n2 ) min-cut computations
• can we do better?
(Gomory-Hu tree)
2 / 16
Preprocessing to obtain Gomory-Hu (cut-)tree
(1) for any x, y ∈ V, find a x-y min-cut X-Y in G
(2) introduce two pseudonodes tx , ty in T; set edge (tx , ty ) with X-Y cut
capacity as its weight; associate nodes in X (resp. Y) with tx (resp. ty )
(3) while ∃ a pseudonode tv in T that is associated with at least two nodes
(a) S
for every component Ci of T − tv , contract all the vertices of G in
0
j∈Ci (vertices associated with tj ) into one vertex; let G be the resultant
graph
(b) for any x, y ∈ tv , find a x-y min-cut X-Y in G0 ; introduce two pseudonodes tx ,
ty in T; introduce edge (tx , ty ) with weight X-Y cut capacity; for every node
v00 ∈ tv , if v00 ∈ X (resp. v00 ∈ Y), associate it with tx (resp. ty )
(c) for every component Ci of T − tv with ti ∈ Ci and edge ei (ti , tv ) ∈ T, if the
corresponding contracted node of Ci belongs to X (resp. Y), then add an
edge between tx and tv (resp. ty and tv ) while setting the weight of this new
edge equal to the weight of ei
(d) delete tv from T
(Gomory-Hu tree)
3 / 16
Query algorithm
output a vi -vk min-cut and its capacity:
(1) e(vj , vj+1 ) ← an edge with least cut capacity along the unique path from
vi to vk in Gomory-Hu tree T
(2) for the
S component C containing vi in T − e, return X-Y min-cut where
X = j∈C (vertices associated with tj ), and Y = V − X wherein x ∈ X;
also, weight of the edge e in T is the X-Y cut capacity
(Gomory-Hu tree)
4 / 16
Algorithm in Execution
4
b
10
2
3
a
c
2
5
4
d
2
7
8
a,b,f
e
f
13
f−e
c,d,e
3
f−e min−cut
b
10
6
3
a
8
c,d,e
a
18
b,f
a−b
13
f−e
c,d,e
7
f
a−b min−cut
(Gomory-Hu tree)
5 / 16
Algorithm in Execution (cont)
c
6
a, b,f
5
e−c min−cut
d
2
4
5
10
a
e
a
7
b b−f min−cut
6
3
8
f
(Gomory-Hu tree)
a
18
b,f
a−b
18
b
a−b
17
b−f
13
f−e d,e
f
15
e−c c
15 c
13
d,e
e−c
f−e
c,d,e
7
6 / 16
Algorithm in Execution (cont)
6
a,b,f
c
5
5
4
e
2
d
7
a
18
b
a−b
17
b−f
f
15 c
13
e
e−c
f−e
14 e−d
d
e−d min−cut
(Gomory-Hu tree)
7 / 16
Analysis
Preprocessing:
O(n3 + time to do (n − 1)s-t min-cut computations)
Query:
O(n) time
(Gomory-Hu tree)
8 / 16
Relation between multiple pair min-cuts
• for any arbitrary vertices i, j, k ∈ V, λik ≥ min{λij , λjk }
• further, for any arbitrary vertices i, . . . , k ∈ V,
λik ≥ min{λii+1 , . . . , λk−1k }
(Gomory-Hu tree)
9 / 16
Submodularity of cut capacity function
t’
s’−t’ min−cut (A’,V−A’)
s
s’
s−t min−cut (A,V−A)
u(δ(A)) + u(δ(A0 )) ≥ u(δ(A ∩ A0 )) + u(δ(A ∪ A0 ))
* hence, u is said to be a submodular function
(Gomory-Hu tree)
10 / 16
Contracting in 3(a) of algo does not affect
t’
s’−t’ min−cut (A’,V−A’)
s
s’
s−t min−cut (A,V−A)
Let δ(A) be a s-t min-cut; for s0 , t0 ∈ V − A, there exists a s0 -t0 min-cut δ(A0 )
such that either A0 or V − A0 contains A.
* in u(δ(A)) + u(δ(A0 )) ≥ u(δ(A ∩ A0 )) + u(δ(A ∪ A0 )), since u(δ(A ∩ A0 )) ≥ λst = δ(A),
u(δ(A ∪ A0 )) ≤ u(δ(A0 )) = λs0 t0
hence, u(δ(A ∪ A0 )) = λs0 t0
(Gomory-Hu tree)
11 / 16
Contracting in 3(a) of algo does not affect (cont)
The correctness does not get affected even when there are more than one
component gets contracted in 3(a) of the algorithm.
* induction on number of contracted components: contract one component after the other in
succession
(Gomory-Hu tree)
12 / 16
Each edge in tree represents a specific pair min-cut
At any stage of the algorithm (or when it ends), weight of edge e(ti , tj ) in T
corresponds to s-t min-cut capacity in G such that s ∈ ti and t ∈ tj .
s
s
q
q
p
s
q
p
t
t
t
p
case (i)
case (ii): λsq = λpq
for the case (ii) * λsq ≥ min{λst , λtp , λpq };
as any large capacity edge between t and p does not change λsq , λsq ≥ min{λst , λpq }
since λst ≥ λpq , λsq ≥ λpq
* from the leftmost diagram, λsq ≤ λpq
(Gomory-Hu tree)
13 / 16
Each edge e in tree represents a min-cut in G between
two components of T − e
Moreover, at any stage of the algorithm (or when it ends) and for any edge
e(ti , tj ) ∈ T, for two connected components Ci , Cj ∈ T − e, weight of e in T is
equal to the value of min-cut in G between vertices associated with Ci and the
vertices associated with Cj .
* induction on number of iterations
(Gomory-Hu tree)
14 / 16
Correctness of query algorithm
letting (Ce , V − Ce ) be the s-t cut induced in G by any edge e in T,
* λst ≤ mine∈E(Pst ) u(δ(Ce ))
* from the relation between multiple pair min-cuts, λst ≥ min(v,w)∈E(Pst ) λvw
since each edge along Pst represents a cut capacity, λst ≥ mine∈E(Pst ) u(δ(Ce ))
(Gomory-Hu tree)
15 / 16
Corollary
There are at most n − 1 distinct pair min-cuts in G.
(Gomory-Hu tree)
16 / 16