• Keine Ergebnisse gefunden

Constructing an Exact Cut by Successively Removing Separators

2.4 Algorithms

3.1.1 Constructing an Exact Cut by Successively Removing Separators

The first aim of this section is to present an algorithm that computes anm-cut in a graph Gunder the assumption that there is some method to compute separators in the graphGand all its subgraphs, that is, a method to find a small subset of the vertices whose removal decomposes the graph into several not so big components. More precisely, consider a graphG= (V, E) onnvertices and fix a constant 0< c <1.

Then, a subset S (V is called a c-separator in G if every component of GS contains at most cn vertices. For technical reasons, the setS =V is also considered to be ac-separator inG. Sometimes, when the specific value of cis not relevant, we refer to such a set simply as aseparator. For example, the Planar Separator Theorem says that every planar graph onnvertices has a 23-separatorSwith|S| ≤√

8n, see Theorem3.4or [LT79]. The idea to construct anm-cut (B, W) in a graphGis the following. The algorithm starts with two empty setsB andW, and decomposes Ginto smaller parts by removing a separator. Then, it greedily puts as many parts as possible into the set B such that |B| ≤ m is still satisfied. All remaining parts, except the first one, that did not fit intoB, are put in the setW. Then, the algorithm goes on recursively in the part that was neither put in the setBnor the setW. This is repeated until the remaining graph contains at most one vertex. Then, all vertices not yet assigned to the setB orW, which are the vertices in the remaining graph and all vertices that belong to some separator that was removed, are distributed to the sets B andW. This procedure is stated formally in Algorithm3.1, where the set W is kept implicit. The next lemma presents some invariants of Algorithm3.1, before the width of the cut produced by Algorithm3.1and its running time are analyzed.

Lemma 3.1.

Consider an application of Algorithm 3.1 to a graph G0 = (V0, E0) on n0 vertices with size-parame-ter m∈[n0]. The following invariants hold after each execution of the while loop, where V =V(G),B, andS are the sets used in Algorithm3.1:

(i) the sets V,B, andS are pairwise disjoint,

(ii) eG0S(B, W, V) = 0for W =V0\(B∪VS), or equivalently,G0S decomposes into the disjoint parts G[B],G[W], andG[V], as well as

(iii) |B| ≤m≤ |B|+|S|+|V|.

Proof. As in the statement, letG0= (V0, E0) be a graph to which Algorithm3.1is applied and denote bymthe size-parameter used in that application. Clearly,(i),(ii), and(iii)hold before the first execution of the while loop. Now, suppose that(i)-(iii)hold at the beginning of thesth execution of the while loop for somes∈N, i. e., they hold after the (s−1)st execution of the while loop ifs≥2 or before the first execution ifs= 1. We will prove that(i)-(iii)hold at the end of thesth execution of the while loop. To do so, fixS, B, andGto the state of the corresponding variable before the sth execution of the while loop and denote byS0,B0, andG0 the state of the same variable after thesth execution of the while loop, respectively. Let ˜S be the separator chosen in Line 3and letk, U1, . . . , Uk, and `be as determined in Lines4-5during the sth execution of the while loop. Furthermore, defineV :=V(G) and V0:=V(G0), W :=V0\(B∪SV) andW0:=V0\(B0S0V0), as well as ˜B=B0\Band ˜W =W0\W. Lines3-4 imply that{S, U˜ 1, . . . , Uk}is a partition of V. Then, Lines5-6 distribute some of these sets toB andS, and Line7sets G0 to be either one of the components in the partition{S, U˜ 1, . . . , Uk}or the empty set.

All remaining components form the set ˜W by construction, see Figure 3.1. Therefore, ( ˜S,B, V˜ 0,W˜) is a cut inGand, by construction, cuts only edges incident to ˜S, or equivalently

eGS˜( ˜B,W , V˜ 0) = 0. (3.1)

Algorithm 3.1:Computes anm-cut based on a method to find a separator in the input graph and its subgraphs.

Input: a graphGonnvertices and an integer m∈[n].

Output: anm-cut (B, W) inG.

1 G0G, B← ∅, S← ∅, n← |V(G)|;

2 While n >1 do

3 Find a separator ˜S inG;

4 Letkbe the number of components ofGS˜ and ifk≥1, let (U1, E1), . . . ,(Uk, Ek) be the components of GS;˜

5 If k= 0then`←0 elseLet`∈[k] be the largest integer with|B|+P`

h=1|Uh| ≤m;

6 BB∪S

h∈[`]Uh

, SSS;˜

7 If `+ 1≤k thenG←(U`+1, E`+1), n← |U`+1|else G←(∅,∅), n←0;

8 Endw

9 SSV(G), G←(∅,∅);

10 LetSBS be an arbitrary subset with|SB|=m− |B|;

11 BBSB;

12 Return(B, V(G0)\B);

This also implies that ˜S, ˜B, andV0 are pairwise disjoint subsets ofV. Using thatB0=BB,˜ S0 =SS,˜ and that(i)was satisfied before thesth execution of the while loop, it follows that (i)is satisfied after thesthexecution. Furthermore, instead of removing all vertices in S0 at once, removing the vertices inS fromG0 first and then the vertices in ˜S fromGgives

eG0S0(B0, W0, V0) ≤ eG0S0(B,B, W,˜ W , V˜ 0) ≤ eG0S(B, W, V) +eGS˜( ˜B,W , V˜ 0).

As (ii)is satisfied before the sth execution of the while loop, (3.1) implies thateG0S0(B0, W0, V0) = 0,

B S W

V

U1 . . . U`

S˜

U`+1

=V0

U`+2 . . . Uk

B0 S0 W0

B˜ W˜

Figure 3.1:Notation used in the proof of Lemma3.1.

i. e.,(ii)is satisfied after thesth execution of the while loop. To show that(iii) is satisfied, consider the following cases.

Case 1: k= 0. Then, ˜S=V,B0 =B,S0=SV, andV0=∅. Using that(iii)is satisfied before the sth execution of the while loop, it follows that

|B0| = |B| ≤ m ≤ |B|+|S|+|V| = |B0|+|S0|+|V0|, asV andS are disjoint by(i).

Case 2: k≥1. Then, the choice of`in Line5implies that|B0| ≤m.

Case 2a: `=k. Then,B0 =B∪(V \S),˜ S0=SS, and˜ V0=∅. Using that(iii)is satisfied before the sth execution of the while loop, it follows thatm≤ |B|+|S|+|V|=|B0|+|S0|+|V0|.

Case 2b: ` < k. Then,V0=U`+1. Furthermore,BUhBV =∅for all h∈[k] as(i) is satisfied before thesth execution of the while loop. Now, due to the choice of`in Line5, it follows that

|B0|+|S0|+|V0| ≥ |B0|+|U`+1|> m.

All in all,(iii)is satisfied after thesth execution of the while loop. 2

Lemma 3.2.

Consider an application of Algorithm 3.1 to a graph G0 = (V0, E0) on n0 vertices with size-parame-term∈[n0]. Algorithm3.1terminates and returns an m-cut(B, W)inG0, that satisfies

eG0(B, W)≤∆(G0)· |S|,

where S denotes the set of all removed vertices. More precisely, S = Ss

s=1Ss, where Ss denotes the separator S˜ used in the sth execution of the while loop and s denotes the number of executions of the while loop.

Proof. Denote by G0 = (V0, E0) an arbitrary graph onn0vertices, fix an integer m∈[n0], and apply Algorithm 3.1. The number of vertices of the graphGin the algorithm, which is tracked by n, decreases by at least one in each execution of the while loop. Indeed, consider the separator ˜S used in Line3. Then, each component ofGS˜must have strictly less vertices thanG, even if ˜S is empty, which might only happen in the first iteration if the input graph is not connected. Hence, there are at mostn0 executions of the while loop. Denote bysthe number of executions of the while loop and, fors∈[s], denote bySs

the separator ˜S used in Line3 of thesth execution of the while loop. As in the statement of the lemma, letS=Ss

s=1Ss. Invariants(i)and(iii)in Lemma3.1imply that|B| ≤m≤ |B∪˙ S|after Line9has been executed. Therefore, Line10 is feasible and Algorithm3.1always returns anm-cut in the input graph.

Furthermore, invariant(ii)in Lemma3.1implies thateG0S(B, W, V) = 0 holds forW =V0\(B∪VS) after the last execution of the while loop. If V is not empty at this point, then V contains only one vertexv andeG0S(B∪ {v}, W) = 0 as well aseG0S(B, W ∪ {v}) = 0. Consequently, all cut edges of the returnedm-cut must be incident to a vertex inS, which gives the desired bound on the width of the

computedm-cut. 2

Lemma 3.3.

Consider an application of Algorithm3.1 to a graph G0= (V0, E0) withV0= [n0] for some integern0

and with size-parameterm∈[n0]. Furthermore, denote byfsep(G) the time needed to find a separator in the graphGin Line3. Algorithm3.1 computes anm-cut inG0 in time proportional to

s

X

s=1

(fsep(Gs−1) +kGs−1k),

whereGs denotes the graphGin Algorithm3.1 after thesth execution of the while loop. In the implemen-tation, bijections are set up, such that for the functionfsep(G)one may assume thatV(G) = [n] for some integern.

Proof. Consider a graph G0 = (V0, E0) with V0 = [n0] for some integer n0 and fix an arbitrary integerm∈[n0]. Lemma3.2states that Algorithm3.1computes anm-cut inG0 when applied toG0with size-parameterm. To implement Algorithm3.1, all sets are stored as unordered lists and all graphs are stored by their adjacency lists. Furthermore, the algorithm keeps track of the size of each set and the size of the vertex set of each graph. Before executing Line1 the algorithm sets up a bijection betweenV(G0) and [n0], for example the identity, and stores it in two arrays as in Lemma 2.21a), which takesO(n0) time. Then, Line1takes O(kG0k) time. Furthermore, Line 9takes time proportional to |V|, as each vertex name needs to be converted back to its original name inG0, which takes constant time for one vertex by Lemma2.21b). As the setSB can be constructed greedily, Lines10-11takeO(m) =O(n0) time.

So, except for the time consumed by the executions of the while loop,O(kG0k+n0) =O(kG0k) time is needed.

Now, consider one execution of the while loop and fixG= (V, E) to be the state of the corresponding variable before this execution of the while loop. Assume thatV = [n] forn:=|V| and that there is a bijection that converts the integers in [n] back to the original vertex names of the graphG0. We need to argue that the considered execution of the while loop takesO(fsep(G) +kGk) time including the time needed to adjust the bijection when the graphGis reset. Line3 takes time proportional tofsep(G) and Line4takesO(n+|E|) by Corollary2.24and Lemma2.25, including to determine lists of the vertices for each component (Ui, Ei) of GS. Then, Line˜ 5takes time proportional to max{k,1} ≤n. In Line 6, the vertex names need to be converted back to the vertex names of the graphG0, which takes constant time for each vertex by Lemma 2.21b). As in total at mostn vertices are added to the setB andS together, Line 6takes at most O(n) time. If`+ 1 > k, then Line7takes constant time. Otherwise, letn0:=|U`+1|, which satisfiesn0 < n. Then, Line 7takesO(n0) time including the modification of the bijection by Corollary2.23and Lemma2.21d), as (U`+1, E`+1) =G[U`+1] and a list of the vertices inU`+1 has already been computed. All in all, the considered execution of the while loop takesO(fsep(G) +kGk) time. Summing up gives the desired bound on the total running time. 2 Before applying Algorithm3.1in Section3.1.2-3.1.4, we briefly present a very easy application, which is discussed in detail in Chapter 7.2 in [Sch13], where also an example of an application of Algorithm3.1 can be found. It is widely known and also not hard to show, that every treeT on nvertices contains aseparating vertex, i. e., a vertex v such that each component of Tv contains at most 12n vertices.

Therefore, every tree T has a 12-separator S with |S| = 1. When applying Algorithm 3.1 with these separators to a treeT0 onn0 vertices, then in each round of the while loop, the considered graph is a tree and its number of vertices decreases by at least a factor of 12 in each round. So after sexecutions of the while loop, the considered tree has at most 21sn0 vertices. Consequently, the while loop is executed at most log2(n0) times and the computed cut has width at most ∆(T0) log2(n0) by Lemma3.2.