Английская Википедия:Gomory–Hu tree

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description

In combinatorial optimization, the Gomory–Hu tree[1] of an undirected graph with capacities is a weighted tree that represents the minimum s-t cuts for all s-t pairs in the graph. The Gomory–Hu tree can be constructed in Шаблон:Math maximum flow computations. It is named for Ralph E. Gomory and T. C. Hu.

Definition

Let <math>G = (V_G, E_G, c)</math> be an undirected graph with <math>c(u,v)</math> being the capacity of the edge <math>(u,v)</math> respectively.

Denote the minimum capacity of an Шаблон:Mvar-Шаблон:Mvar cut by <math>\lambda_{st}</math> for each <math> s, t \in V_G </math>.
Let <math> T = (V_G, E_T) </math> be a tree, and denote the set of edges in an Шаблон:Mvar-Шаблон:Mvar path by <math>P_{st}</math> for each <math>s,t \in V_G</math>.

Then Шаблон:Mvar is said to be a Gomory–Hu tree of Шаблон:Mvar, if for each <math>s, t \in V_G</math>

<math style="display">\lambda_{st} = \min_{e\in P_{st}} c(S_e, T_e),</math>

where

  1. <math>S_e, T_e \subseteq V_G</math> are the two connected components of <math>T \setminus \{e\}</math>, and thus <math>(S_e, T_e)</math> forms an Шаблон:Mvar-Шаблон:Mvar cut in Шаблон:Mvar.
  2. <math>c(S_e, T_e)</math> is the capacity of the <math>(S_e,T_e)</math> cut in Шаблон:Mvar.

Algorithm

Gomory–Hu Algorithm

Input: A weighted undirected graph <math>G = ((V_G,E_G), c)</math>
Output: A Gomory–Hu Tree <math>T = (V_T, E_T).</math>
  1. Set <math>V_T = \{V_G\}, \ E_T = \empty.</math>
  2. Choose some <math>X \in V_T</math> with Шаблон:Math if such Шаблон:Mvar exists. Otherwise, go to step 6.
  3. For each connected component <math>C = (V_C,E_C) \in T \setminus X,</math> let <math display=inline>S_C = \bigcup_{v_T \in V_C} v_T.</math>
    Let <math>

S = \{ S_C \mid C \text{ is a connected component in } T \setminus X \}. </math>

  1. Contract the components to form <math>G' = ((V_{G'}, E_{G'}), c'),</math> where:<math display=block>

\begin{align}

 V_{G'} &= X \cup S \\[2pt]
 E_{G'} &= E_G|_{X \times X} \cup \{(u, S_C) \in X \times S \mid (u,v) \in E_G \text{ for some } v \in S_C \} \\[2pt]
 & \qquad \qquad \quad\! \cup \{(S_{C1}, S_{C2}) \in S \times S \mid (u,v) \in E_G \text{ for some } u \in S_{C1} \text{ and } v \in S_{C2} \} 

\end{align}</math>

  1. <math>c':V_{G'} \times V_{G'} \to R^+</math> is the capacity function, defined as:<math display=block>

\begin{align}

 &\text{if }\ (u,S_C) \in E_G|_{X \times S}: &&c'(u,S_C) = \!\!\! \sum_{\begin{smallmatrix} v \in S_C : \\ (u,v) \in E_G \end{smallmatrix}} \!\!\! c(u,v) \\[4pt]
 &\text{if }\ (S_{C1},S_{C2}) \in E_G|_{S \times S}: &&c'(S_{C1},S_{C2}) = \!\!\!\!\!\!\! \sum_{\begin{smallmatrix} (u,v) \in E_G : \\ u \in S_{C1} \, \land \, v \in S_{C2} \end{smallmatrix}} \!\!\!\!\! c(u,v) \\[4pt]
 &\text{otherwise}: &&c'(u,v) = c(u,v)

\end{align}</math>

  1. Choose two vertices Шаблон:Math and find a minimum Шаблон:Math cut Шаблон:Math in Шаблон:Mvar.
    Set <math>A = \Biggl(\bigcup_{S_C \in A' \cap S} \!\!\! S_C \! \Biggr) \cup (A' \cap X),\ </math><math>B = \Biggl(\bigcup_{S_C \in B' \cap S} \!\!\! S_C \! \Biggr) \cup (B' \cap X).</math>
  2. Set <math>V_T = (V_T \setminus X) \cup \{A \cap X, B \cap X \}.

</math>

  1. For each <math>e = (X, Y) \in E_T</math> do:
    1. Set <math> e' = (A \cap X,Y)</math> if <math> Y \subset A, </math> otherwise set <math>e' = (B \cap X,Y).</math>
    2. Set <math>E_T = (E_T \setminus \{e\}) \cup \{e'\}.</math>
    3. Set <math>w(e') = w(e).</math>
    Set <math>E_T = E_T \cup \{(A \cap X,\ B \cap X) \}.</math>
    Set <math>w((A \cap X, B \cap X)) = c'(A', B').</math>
    Go to step 2.
  2. Replace each <math>\{v\} \in V_T</math> by Шаблон:Mvar and each <math>(\{u\},\{v\}) \in E_T</math> by Шаблон:Math. Output Шаблон:Mvar.

Analysis

Using the submodular property of the capacity function Шаблон:Mvar, one has <math display=block>c(X) + c(Y) \ge c(X \cap Y) + c(X \cup Y).</math> Then it can be shown that the minimum Шаблон:Math cut in Шаблон:Mvar is also a minimum Шаблон:Math cut in Шаблон:Mvar for any Шаблон:Math.

To show that for all <math>(P,Q) \in E_T,</math> <math>w(P,Q) = \lambda_{pq}</math> for some Шаблон:Math, Шаблон:Math throughout the algorithm, one makes use of the following Lemma,

For any Шаблон:Mvar in Шаблон:Mvar, <math>\lambda_{ik} \ge \min(\lambda_{ij}, \lambda_{jk}).</math>

The Lemma can be used again repeatedly to show that the output Шаблон:Mvar satisfies the properties of a Gomory–Hu Tree.

Example

The following is a simulation of the Gomory–Hu's algorithm, where

  1. green circles are vertices of T.
  2. red and blue circles are the vertices in G'.
  3. grey vertices are the chosen s and t.
  4. red and blue coloring represents the s-t cut.
  5. dashed edges are the s-t cut-set.
  6. A is the set of vertices circled in red and B is the set of vertices circled in blue.
G' T
Файл:Gomory–Hu G.svg Файл:Gomory–Hu T.svg
1. Set VT = {VG} = { {0, 1, 2, 3, 4, 5} } and ET = ∅.
2. Since VT has only one vertex, choose X = VG = {0, 1, 2, 3, 4, 5}. Note that | X | = 6 ≥ 2.
1. Файл:Gomory–Hu Gp1.svg Файл:Gomory–Hu T1.svg
3. Since T\X = ∅, there is no contraction and therefore G' = G.
4. Choose s = 1 and t = 5. The minimum s-t cut (A', B') is ({0, 1, 2, 4}, {3, 5}) with c'(A', B') = 6.
    Set A = {0, 1, 2, 4} and B = {3, 5}.
5. Set VT = (VT\X) ∪ {AX, BX} = { {0, 1, 2, 4}, {3, 5} }.
    Set ET = { ({0, 1, 2, 4}, {3, 5}) }.
    Set w( ({0, 1, 2, 4}, {3, 5}) ) = c'(A', B') = 6.
    Go to step 2.
2. Choose X = {3, 5}. Note that | X | = 2 ≥ 2.
2. Файл:Gomory–Hu Gp2.svg Файл:Gomory–Hu T2.svg
3. {0, 1, 2, 4} is the connected component in T\X and thus S = { {0, 1, 2, 4} }.
    Contract {0, 1, 2, 4} to form G', where
c'( (3, {0, 1, 2 ,4}) ) = c( (3, 1) ) + c( (3, 4) ) = 4.
c'( (5, {0, 1, 2, 4}) ) = c( (5, 4) ) = 2.
c'( (3, 5)) = c( (3, 5) ) = 6.
4. Choose s = 3, t = 5. The minimum s-t cut (A', B') in G' is ( {{0, 1, 2, 4}, 3}, {5} ) with c'(A', B') = 8.
    Set A = {0, 1, 2, 3, 4} and B = {5}.
5. Set VT = (VT\X) ∪ {AX, BX} = { {0, 1, 2, 4}, {3}, {5} }.
    Since (X, {0, 1, 2, 4}) ∈ ET and {0, 1, 2, 4} ⊂ A, replace it with (AX, Y) = ({3}, {0, 1, 2 ,4}).
    Set ET = { ({3}, {0, 1, 2 ,4}), ({3}, {5}) } with
w(({3}, {0, 1, 2 ,4})) = w((X, {0, 1, 2, 4})) = 6.
w(({3}, {5})) = c'(A', B') = 8.
    Go to step 2.
2. Choose X = {0, 1, 2, 4}. Note that | X | = 4 ≥ 2.
3. Файл:Gomory–Hu Gp3.svg Файл:Gomory–Hu T3.svg
3. { {3}, {5} } is the connected component in T\X and thus S = { {3, 5} }.
    Contract {3, 5} to form G', where
c'( (1, {3, 5}) ) = c( (1, 3) ) = 3.
c'( (4, {3, 5}) ) = c( (4, 3) ) + c( (4, 5) ) = 3.
c'(u,v) = c(u,v) for all u,vX.
4. Choose s = 1, t = 2. The minimum s-t cut (A', B') in G' is ( {1, {3, 5}, 4}, {0, 2} ) with c'(A', B') = 6.
    Set A = {1, 3, 4, 5} and B = {0, 2}.
5. Set VT = (VT\X) ∪ {AX, BX} = { {3}, {5}, {1, 4}, {0, 2} }.
    Since (X, {3}) ∈ ET and {3} ⊂ A, replace it with (AX, Y) = ({1, 4}, {3}).
    Set ET = { ({1, 4}, {3}), ({3}, {5}), ({0, 2}, {1, 4}) } with
w(({1, 4}, {3})) = w((X, {3})) = 6.
w(({0, 2}, {1, 4})) = c'(A', B') = 6.
    Go to step 2.
2. Choose X = {1, 4}. Note that | X | = 2 ≥ 2.
4. Файл:Gomory–Hu Gp4.svg Файл:Gomory–Hu T4.svg
3. { {3}, {5} }, { {0, 2} } are the connected components in T\X and thus S = { {0, 2}, {3, 5} }
    Contract {0, 2} and {3, 5} to form G', where
c'( (1, {3, 5}) ) = c( (1, 3) ) = 3.
c'( (4, {3, 5}) ) = c( (4, 3) ) + c( (4, 5) ) = 3.
c'( (1, {0, 2}) ) = c( (1, 0) ) + c( (1, 2) ) = 2.
c'( (4, {0, 2}) ) = c( (4, 2) ) = 4.
c'(u,v) = c(u,v) for all u,vX.
4. Choose s = 1, t = 4. The minimum s-t cut (A', B') in G' is ( {1, {3, 5}}, {{0, 2}, 4} ) with c'(A', B') = 7.
    Set A = {1, 3, 5} and B = {0, 2, 4}.
5. Set VT = (VT\X) ∪ {AX, BX} = { {3}, {5}, {0, 2}, {1}, {4} }.
    Since (X, {3}) ∈ ET and {3} ⊂ A, replace it with (AX, Y) = ({1}, {3}).
    Since (X, {0, 2}) ∈ ET and {0, 2} ⊂ B, replace it with (BX, Y) = ({4}, {0, 2}).
    Set ET = { ({1}, {3}), ({3}, {5}), ({4}, {0, 2}), ({1}, {4}) } with
w(({1}, {3})) = w((X, {3})) = 6.
w(({4}, {0, 2})) = w((X, {0, 2})) = 6.
w(({1}, {4})) = c'(A', B') = 7.
    Go to step 2.
2. Choose X = {0, 2}. Note that | X | = 2 ≥ 2.
5. Файл:Gomory–Hu Gp5.svg Файл:Gomory–Hu T5.svg
3. { {1}, {3}, {4}, {5} } is the connected component in T\X and thus S = { {1, 3, 4, 5} }.
    Contract {1, 3, 4, 5} to form G', where
c'( (0, {1, 3, 4, 5}) ) = c( (0, 1) ) = 1.
c'( (2, {1, 3, 4, 5}) ) = c( (2, 1) ) + c( (2, 4) ) = 5.
c'( (0, 2) ) = c( (0, 2) ) = 7.
4. Choose s = 0, t = 2. The minimum s-t cut (A', B') in G' is ( {0}, {2, {1, 3, 4, 5}} ) with c'(A', B') = 8.
    Set A = {0} and B = {1, 2, 3 ,4 ,5}.
5. Set VT = (VT\X) ∪ {AX, BX} = { {3}, {5}, {1}, {4}, {0}, {2} }.
    Since (X, {4}) ∈ ET and {4} ⊂ B, replace it with (BX, Y) = ({2}, {4}).
    Set ET = { ({1}, {3}), ({3}, {5}), ({2}, {4}), ({1}, {4}), ({0}, {2}) } with
w(({2}, {4})) = w((X, {4})) = 6.
w(({0}, {2})) = c'(A', B') = 8.
    Go to step 2.
2. There does not exist XVT with | X | ≥ 2. Hence, go to step 6.
6.

Файл:Gomory–Hu output.svg

6. Replace VT = { {3}, {5}, {1}, {4}, {0}, {2} } by {3, 5, 1, 4, 0, 2}.
    Replace ET = { ({1}, {3}), ({3}, {5}), ({2}, {4}), ({1}, {4}), ({0}, {2}) } by { (1, 3), (3, 5), (2, 4), (1, 4), (0, 2) }.
    Output T. Note that exactly | V | − 1 = 6 − 1 = 5 times min-cut computation is performed.

Implementations: Sequential and Parallel

Gusfield's algorithm can be used to find a Gomory–Hu tree without any vertex contraction in the same running time-complexity, which simplifies the implementation of constructing a Gomory–Hu Tree.[2]

Andrew V. Goldberg and K. Tsioutsiouliklis implemented the Gomory-Hu algorithm and Gusfield algorithm, and performed an experimental evaluation and comparison.[3]

Cohen et al. report results on two parallel implementations of Gusfield's algorithm using OpenMP and MPI, respectively.[4]

Related concepts

In planar graphs, the Gomory–Hu tree is dual to the minimum weight cycle basis, in the sense that the cuts of the Gomory–Hu tree are dual to a collection of cycles in the dual graph that form a minimum-weight cycle basis.[5]

See also

References

Шаблон:Reflist