• Keine Ergebnisse gefunden

Finding k-blocks in polynomial time

II. Essential parts

2.5 k-Blocks: a connectivity invariant for graphs

2.5.7 Finding k-blocks in polynomial time

We consider graphsG= (V, E), withnvertices and medges, say, and positive integers k < n.We shall present a simple algorithm that finds all the k-blocks ofGin time polynomial inn,mandk. We start our algorithm with the following step, which we callpre-processing.

For two verticesx, yofGletκ(x, y) denote the smallest size of a set of other vertices that separates x from y in G. We construct a graph Hk from G by adding, for every pair of non-adjacent verticesx, y, the edgexy ifκ(x, y)≥k, that is, ifxandycannot be separated by fewer thankother vertices. Moreover, we label every non-edgexyofHk by some separation of orderκ(x, y)< kthat separatesxfromy in G. This completes the pre-processing.

Note that all separations of order< kofGare still separations ofHk,and that thek-blocks ofGare the vertex sets of the maximal cliques of order≥kinHk. Lemma 2.5.27. The pre-processing has running timeO(min{k,√n} ·m·n2).

Proof. We turn the problem of finding a minimal vertex separator between two vertices into one of finding a minimal edge cut between them. This is done in the usual way (see e.g. Even [62]) by constructing a unit-capacity networkG0 fromGwithn0= 2˜nvertices andm0= 2m+ ˜ndirected edges, where ˜n=O(m) is the number of non-isolated vertices ofG.

For every non-edgexyofGwe start Dinitz’s algorithm (DA) onG0, which is designed to find anx–yseparation of orderκ(x, y). If DA completeskiterations of its ‘inner loop’ (finding an augmenting path), thenκ(x, y)≥k; we then stop DA and letxybe an edge ofHk. Otherwise DA returns a separation (A, B) of order< k; we then keepxy as a non-edge of Hk and label it by (A, B). Since the inner loop has time complexityO(m0) =O(m) and DA has an overall time complexity ofO(√

n0·m0) =O(√n·m) (see e.g. [80]), this establishes the desired bound.

Now we describe themain part of the algorithm. We shall construct a rooted treeT, inductively by adding children to leaves of the tree constructed so far.

We maintain two lists: a listL of some of the leaves of the current tree, and a listBof subsets of V. We shall changeL by either deleting its last element or replacing it with two new elements that will be its children in our tree. When-ever we add an elementt to L in this way, we assign it a set Xt ⊆V. Think of the current list L as containing those t whose Xt we still plan to scan for k-blocks ofG, and ofBas the set of k-blocks found so far.

We start with a singleton listL= (r) andB=∅, puttingXr=V.

At a given step, stop with outputBifLis empty; otherwise consider the last elementtofL. If|Xt|< k, deletetfromL and do nothing further at this step.

Assume now that|Xt| ≥k. IfXtinduces a complete subgraph in Hk, add Xtto B, deletetfrom L, and do nothing further at this step.

If not, find verticesx, y∈Xtthat are not adjacent inHk. At pre-processing, we labeled the non-edgexywith a separation (A, B) of order< kthat separates x from y in G (and in Hk). Replace t in L by two new elements t0 and t00, making them children oftin the tree under construction, and letXt0 =Xt∩A and Xt00 =Xt∩B. If |Xt|> k, do nothing further at this step. If|Xt| =k, then bothXt0 andXt00 have size< k; we deletet0 andt00again from Land do nothing further in this step.

This completes the description of the main part of the algorithm. LetT be the tree with rootrthat the algorithm constructed: its nodes are thoset that were inLat some point, and its edges were defined as nodes were added toL. Proposition 2.5.28. The main part of the algorithm stops with output B the set ofk-blocks ofG.

Proof. The algorithm clearly stops withBthe set of vertex sets of the maximal cliques of Hk that have order ≥k. These are the k-blocks of G, by definition ofHk.

To analyse running time, we shall need a lemma that is easily proved by in-duction. Aleaf in a rooted tree is a node that has no children, and abranching node is one that has at least two children.

Lemma 2.5.29. Every rooted tree has more leaves than branching nodes.

Lemma 2.5.30. The main part of the algorithm stops after at most 4(n−k) steps. Its total running time isO(min{m, n} ·n2).

Proof. Each step takesO(n2) time, the main task being to check whetherHk[Xt] is complete.It thus suffices to show that there are no more than 4(n−k) steps as long asn≤2m, which can be achieved by deleting isolated vertices.

At every step except the last (whenL=∅) we considered the last elementt of L, which was subsequently deleted or replaced and thus never considered again. Every sucht is a node of the treeT0 obtained from T by deleting the children of nodestwith|Xt|=k. (Recall that such childrent0, t00 were deleted again immediately after they were created, so they do not give rise to a step of the algorithm.) Our aim, therefore, is to show that|T0| ≤4(n−k)−1.

By Lemma 2.5.29 it suffices to show thatT0 has at most 2(n−k) leaves. As n≥k+1, this is the case ifT0consists only of its rootr. If not, thenris a branch-ing node ofT0. It thus suffices to show that below every branching nodetofT0 there are at most 2(|Xt| −k) leaves; fort=r this will yield the desired result.

By definition of T0, branching nodes t of T0 satisfy |Xt| ≥ k+ 1. So our assertion holds if the two children oftare leaves. Assuming inductively that the childrent0 andt00oftsatisfy the assertion (unless they are leaves), we find that, withXt0 =Xt∩AandXt00=Xt∩B for some (< k)-separation (A, B) ofGas in the description of the algorithm, the number of leaves belowtis at most

2(|Xt∩A| −k) + 2(|Xt∩B| −k)≤2(|Xt|+ (k−1)−2k)≤2(|Xt| −k) if neithert0 nort00is a leaf, and at most

1 + 2(|Xt∩B| −k)≤2(|Xt| −k)

ift0 is a leaf butt00 is not (say), sinceXt\B6=∅ by the choice of (A, B).

Putting Lemmas 2.5.27 and 2.5.30 together, we obtain the following:

Theorem 2.5.31. There is anO(min{k,√n}·m·n2)-time algorithm that finds, for any graphGwithnvertices andmedges and any fixedk < n, all thek-blocks inG.

Our algorithm can easily be adapted to find thek-blocks of Gfor all values ofk at once. To do this, we run our pre-processing just once to construct the graphHn, all whose non-edgesxyare labeled by anx–yseparation of minimum order and its valueκ(x, y). We can then use this information at the start of the proof of Lemma 2.5.30, when we check whetherHk[Xt] is complete, leaving the running time of the main part of the algorithm atO(n3) as in Lemma 2.5.30.

Running it separately once for eachk < n, we obtain with Lemma 2.5.27:

Theorem 2.5.32. There is anO(max{m√n n2, n4})algorithm that finds, for any graphGwith nvertices andmedges, all the k-blocks of G(for all k).

Perhaps this running time can be improved if the trees Tk exhibiting the k-blocks are constructed simultaneously, e.g. by using separations of order` for allTk with ` < k.

The mere decision problem of whether Ghas a k-block does not need our pre-processing, which makes the algorithm faster:

Theorem 2.5.33. For fixed k, deciding whether a graph with n vertices and medges has a k-block has time complexityO(mn+n2).

Proof. Given k and a graph G, we shall find either a (< k)-inseparable set of vertices in G (which we know extends to a k-block) or a set S of at most 2(n−k)−1 separations of order< ksuch that among anykvertices inGsome two are separated by a separation inS (in which caseGhas nok-block).

Starting with X =V(G), we pick ak-set of vertices in X and test whether any two vertices in this set are separated by a (< k)-separation (A, B) in G.

If not, we have found a (< k)-inseparable set of vertices and stop with a yes-answer. Otherwise we iterate withX =AandX =B.

Every separation found by the algorithm corresponds to a branching node ofT. All these are nodes ofT0, of which there are at most 4(n−k)−1 (see the proof of Lemma 2.5.30). Testing whether a given pair of vertices is separated by some (< k)-separation ofGtakes at mostkruns of the inner loop of Dinitz’s algorithm (which takesO(m+n) time), and we test at most k2

pairs of vertices inX.

Let us say that a setS of (< k)-separations inGwitnessesthatGhas no k-block if among everykvertices ofGsome two are separated by a separation inS.

Trivially, ifGhas nok-block then this is witnessed by someO(n2) separations.

The proof of Theorem 2.5.33 shows that this bound can be made linear:

Corollary 2.5.34. Whenever a graph of ordern has nok-block, there is a set of at most4(n−k)−1 separations witnessing this.

Let us call any treeT as in our main algorithm (at any stage), with each of its branching nodestlabelled by a separation (A, B)tofGthat separates some two vertices ofXt, ablock-decomposition ofG. The setsXtwithta leaf will be called itsleaf sets.

The adhesion of a block-decomposition is the maximum order of the sep-arations (A, B)t. A block-decomposition is k-complete if it has adhesion < k and every leaf set is (< k)-inseparable or has size< k. Thewidth of a block-decomposition is the maximum order of a leaf setXt. The block-width bw(G) ofGis the leastksuch thatGhas a block-decomposition of adhesion and width both at mostk.

Having block-width< kcan be viewed as dual to containing ak-block, much as having tree-width< k−1 is dual to containing a haven or bramble of orderk, and having branch-width< kis dual to containing a tangle of orderk. Indeed, we have shown the following:

Theorem 2.5.35. Let D = (T; (A, B)t, t ∈T) be a block-decomposition of a graphG, and letk∈N.

(i) Every edge ofGhas both ends in some leaf set of T.

(ii) IfDhas adhesion< k, then anyk-block ofGis contained in a leaf set ofT. (iii) If Disk-complete, then everyk-block ofGis a leaf set, and all other leaf

sets have size < k.

Theorem 2.5.35 implies thatG has a block-decomposition of adhesion and width both at mostk if and only if Ghas no (k+ 1)-block. The least suchk clearly equals the greatestksuch thatGhas ak-block, itsblock number β(G):

Corollary 2.5.36. Every finite graphGsatisfiesβ(G) = bw(G).

By Theorem 2.5.33 and its proof, we obtain the following complexity bound:

Corollary 2.5.37. Deciding whether a graph with nvertices and m edges has block-width< k, for k fixed, has time complexityO(mn+n2).

Forkvariable, the proof of Theorem 2.5.33 yields a complexity ofO(k3(m+ n)(n−k)). Alternatively, we can use pre-processing to obtain O(min{k,√

n} · m·n2) by Theorem 2.5.31.

The above duality between the block number and the block-width of a graph is formally reminiscent of the various known dualites for other width parameters, such as the tree-width, branch-width, path-width, rank-width, carving-width or clique-width of a graph. The ‘width’ to which these parameters refer, however, is usually that of a tree-like decomposition of the graph itself, which exhibits that it structurally resembles that tree. In our block-decompositions, on the other hand, the tree T merely indicates a recursion by which the graph can be decomposed into small sets: the separations used to achieve this, though of small order, will not in general be nested, and the structure ofGwill not in any intuitive sense be similar to that ofT.

In [58], Diestel and Oum give a structural duality theorem fork-blocks in the sense of those traditional width parameters. The graph structure that is shown to witness the absence of a k-block is not a tree-structure, but one modelled on more general (though still tree-like) graphs. Whether or not a structural duality between k-blocks and tree-like decompositions exists remains an open

problem. It has been formalized, and stated explicitly [58], with reference to a fundamental structural duality theorem between tangle-like ‘dense objects’ and tree-like decompositions, which implies all the traditional duality theorems for width parameters [57] but does not yield a duality theorem fork-blocks.