Journal of Algorithms 32, 167᎐194 Ž1999. Article ID jagm.1999.1011, available online at http:rrwww.idealibrary.com on
Graphs with Branchwidth at Most ThreeU Hans L. Bodlaender Department of Computer Science, Utrecht Uni¨ ersity, P.O. Box 80.089, 3508 TB Utrecht, the Netherlands E-mail:
[email protected]
and Dimitrios M. Thilikos† Department of Computer Science DC 2117, Uni¨ ersity of Waterloo, 200 Uni¨ ersity A¨ enue West, Waterloo, Ontario N2L 32G1, Canada E-mail:
[email protected] Received December 20, 1997; revised December 28, 1998; accepted February 9, 1999
In this paper we investigate both the structure of graphs with branchwidth at most three, as well as algorithms to recognise such graphs. We show that a graph has branchwidth at most three if and only if it has treewidth at most three and does not contain the three-dimensional binary cube graph as a minor. A set of four graphs is shown to be the obstruction set for the class of graphs with branchwidth at most three. Moreover, we give a safe and complete set of reduction rules for the graphs with branchwidth at most three. Using this set, a linear time algorithm is given that verifies if a given graph has branchwidth at most three, and, if so, outputs a minimum width branch decomposition. 䊚 1999 Academic Press Key Words: graph algorithms; branchwidth; obstruction set; graph minors; reduction rule.
* This paper is the full version of part of the paper titled ‘‘Constructive Linear Time Algorithms for Branchwidth’’ which appeared in the ‘‘Proceedings of ICALP’97’’ Žsee w7x.. The research was partially supported by ESPRIT Long Term Research Project 20244 ŽProject ALCOM IT: Algorithms and Complexity in Information Technology .. † This research has been done while the second author was working at the Department of Computer Science of Utrecht University, Netherlands, supported by the Training and Mobility of Researchers ŽTMR. Program, ŽEU Contract ERBFMBICT950198.. 167 0196-6774r99 $30.00 Copyright 䊚 1999 by Academic Press All rights of reproduction in any form reserved.
168
BODLAENDER AND THILIKOS
1. INTRODUCTION This paper studies the graphs with branchwidth at most three. The notion of branchwidth has a close relationship to the more well-known notion of treewidth, a notion that has come to play a large role in many recent investigations in algorithmic graph theory. ŽSee Section 2 for definitions of treewidth and branchwidth.. One reason for the interest in this notion is that many graph problems can be solved by linear time algorithms, when the inputs are restricted to graphs with some uniform upper bound on their treewidth. Most of these algorithms first try to find a tree decomposition of small width and then utilise the advantages of the tree structure of the decomposition. The branchwidth of a graph differs from its treewidth by at most a multiplicative constant factor Žsee Theorem 1.b. As branchwidth also reflects some optimal tree structure arrangement, it is possible to have algorithmic applications analogous to those of treewidth. Hence, instead of using tree decompositions, one also can use branch decompositions as the starting point for linear time algorithms for problems restricted to graphs with bounded treewidth Žand, hence, also bounded branchwidth.. In fact, in some cases, it appears that branchwidth is more convenient to use and seems to give better constant factors in the implementation of the algorithms; for instance, Cook used branch decompositions as an important ingredient in a practical approximation algorithm for the Travelling Salesman Problem w10x and remarked that branchwidth was the more natural notion Žinstead of treewidth. to use for that problem w9x; where tree decompositions primarily are concerned with vertices, branch decompositions deal more with edges Žin a loose sense.. We also mention that the branchwidth of planar graphs can be computed in polynomial time Žsee w19x.. As both treewidth and branchwidth are NP-complete parameters Žsee w1, 19x., it appears an interesting task to find algorithms solving the following problems Ž k is assumed to be a fixed constant.: Treewidth: Given a graph G, check if G has treewidth at most k. Branchwidth: Given a graph G, check if G has branchwidth at most k. The constructive version of Treewidth ŽBranchwidth. is, given a graph with treewidth Žbranchwidth. at most k, output a minimum width tree Žbranch. decomposition. According to the results of Robertson and Seymour w15, 16x for any class of graphs that is closed under taking of minors there exists a finite set of graphs, its obstruction set, such that a graph G belongs to the class iff no
GRAPHS WITH BRANCHWIDTH AT MOST THREE
169
element of the obstruction set is a minor of G. It is also known that, for any k, the class of graphs, where treewidth Žor branchwidth. is bounded by a fixed k, is closed under taking of minors Žsee also Theorem 1.a.. An immediate consequence of this fact Žusing results of Robertson and Seymour and the algorithm from w5x. is the existence of a linear time algorithm solving Treewidth or Branchwidth. Unfortunately, in this way, we only get a nonconstructive proof of the existence of such an algorithm; but in order to construct the algorithm, we must know the corresponding obstruction set. Additionally, we would like to have an algorithm that not only decides the branchwidth, but which also constructs the corresponding branch decomposition. Much research has been done towards the construction of linear time algorithms solving Treewidth, Branchwidth, and their constructive versions. In w5x, a linear time algorithm for treewidth was constructed. As this algorithm appears to be heavily exponential on k Žand thus impractical, at least without considerable optimisations in the implementation., practical ‘‘tailor-made’’ algorithms have been presented for small values of k Žtreewidths 1 and 2 w14, 21x, treewidth 3 w3, 12, 14x, treewidth 4 w17x.. Also, the obstruction sets for the class of graphs with treewidths 1, 2, and 3 are known w4, 18, 21x. Recently, a linear time algorithm solving Branchwidth and its constructive version was given in w7x. Unfortunately, the algorithms in w7x appear to be impractical, similarly to the case of treewidth. In this paper, we provide special ‘‘tailor made’’ results for the cases where k F 3. As the cases where k F 2 are trivial we focus our attention on the case k s 3. More specifically, for the class of graphs with branchwidth at most three, we identify the obstruction set and we give a set of safe and complete reduction rules enabling the construction of a practical linear time algorithm that checks if a graph has branchwidth at most three and, if so, outputs a minimum width branch decomposition. The obstruction set consists of the four graphs K 5 , M6 , M8 , Q3 depicted in Fig. 2 and the proof of its correctness is based on a structural lemma asserting that the graphs of branchwidth at most three are exactly the graphs that have treewidth at most three and that do not contain the three-dimensional binary cube graph Ži.e. graph Q3 of Fig. 2. as a minor. The paper is organized as follows. In Section 2, the basic definition and preliminary results are presented. In Section 3, we give the main routine of our algorithm, along with several graph theoretic results concerning the obstruction set for the class of graphs with branchwidth at most three. In Section 4, we identify a complete and safe set of reduction rules leading to the construction of a practical linear time algorithm solving Branchwidth and its constructive version when k F 3. Finally, an overall description of the algorithm is given in Section 5.
170
BODLAENDER AND THILIKOS
2. DEFINITIONS AND PRELIMINARY RESULTS We consider undirected graphs without parallel edges or self-loops. ŽIt is easy to extend the results to graphs with parallel edges andror self-loops.. Given a graph G s Ž V, E . we denote its vertex set V and edge set E with V Ž G . and EŽ G ., respectively. A triangle t s ¨ 1 , ¨ 2 , ¨ 34 of G is a triple of vertices in V Ž G . such that ¨ 1 , ¨ 2 4 , ¨ 2 , ¨ 3 4 , ¨ 1 , ¨ 344 : EŽ G .. For any vertex ¨ g V Ž G ., we define the neighborhood of ¨ , NG Ž ¨ ., as the set of vertices in V Ž G . adjacent to ¨ . Given a set S : V Ž G . we denote the graph induced by S. We also denote the complete graph with r vertices by K r and by Pr we denote the graph consisting of a path on r vertices. An r-clique of G is a subgraph of G isomorphic to K r . Let T be a tree and let Si : V ŽT ., i s 1, 2, be two subsets of V ŽT . such that Gw S i x, i s 1, 2, are connected and < V1 l V2 < F 1. We define the path connecting S1 and S2 as the shortest path connecting some of the vertices of S1 with some of the vertices in S2 Žnotice that such a path is uniquely defined.. Finally, we will assume that all the graphs we deal with are connected, as this does not influence the generality of our results. ŽThe branchwidth of a graph equals the maximum branchwidth of its connected components.. Given two graphs G, H, we say that H is a minor of G Ždenoted by H U G . if H can be obtained by a series of the following operations: vertex deletions, edge deletions, and edge contractions Ža contraction of an edge u, ¨ 4 in G is the operation that replaces u and ¨ by a new vertex whose neighbours are the vertices that were adjacent to u andror ¨ .. Let G be a class of graphs. We say that G is closed under taking of minors when all the minors of any graph in G belong also to G . Given a graph class G that is closed under taking of minors, we define the obstruction set for G as the set of minor minimal graphs that do not belong to G . Robertson and Seymour proved Žsee, e.g., w15x. that any class of graphs G contains a finite set of minor minimal elements. According to this result, any graph class that is closed under taking of minors has a finite obstruction set. It follows that if G is closed under taking of minors, then, for any graph G, G g G iff there is no graph in H in the obstruction set for G such that H U G. We give now the formal definitions of treewidth and branchwidth. A tree decomposition of a graph G is a pair Ž X i < i g I 4 , T s Ž I, F .., where X i < i g I 4 is a collection of subsets of V and T is a tree, such that 䢇 䢇
Di g I X i s V Ž G ., for each edge ¨ , w4 g EŽ G ., there is an i g I such that ¨ , w g X i ,
and 䢇
for each ¨ g V the set of nodes i < ¨ g X i 4 induces a subtree of T.
GRAPHS WITH BRANCHWIDTH AT MOST THREE
171
The width of a tree decomposition Ž X i < i g I 4 , T s Ž I, F .. equals max i g I < X i < y 14 . The treewidth of a graph G is the minimum width over all tree decompositions of G. A branch decomposition of a graph G is a pair ŽT, ., where T is a tree with vertices of degree 1 or 3, and is a bijection from the set of leaves of T to EŽ G .. The order of an edge e in T is the number of vertices ¨ g V Ž G . such that there are leaves t 1 , t 2 in T in different components of T Ž V ŽT ., EŽT . y e . with Ž t 1 . and Ž t 2 . both containing ¨ as an endpoint. The width of ŽT, . is the maximum order over all edges of T, and the branchwidth of G is the minimum width over all branch decompositions of G Žin the case where < EŽ G .< F 1, we define the branchwidth to be 0; if < EŽ G .< s 0, then G has no branch decomposition; if < EŽ G .< s 1, then G has a branch decomposition consisting of a tree with one vertexᎏthe width of this branch decomposition is considered to be 0.. Instead of bijections, we can use different types of functions . If is a surjective function that maps every leaf of T to an edge e g EŽ G ., then we have an amplified branch decomposition: for each edge e g EŽ G . there exists at least one leaf ¨ or T with Ž ¨ . s e. LEMMA 1. decomposition decomposition time.
Ži. One can construct an algorithm that, gi¨ en a branch ŽT, . of a graph G with width at most k, outputs a branch of any subgraph GX of G with width at most k in O Ž< V ŽT .<.
Žii. One can construct an algorithm that, gi¨ en an amplified branch decomposition ŽT, . of a graph G with width at most k, outputs a branch decomposition of G with width at most k, in O Ž< V ŽT .<. time. Proof. Ži. The algorithm is as follows: Start with the branch decomposition ŽT, .. Let W be the set of leaves that are mapped to edges in EŽ GX .. Now, repeat the following steps until none is possible: Ži. remove a leaf not in W, and Žii. remove a vertex of degree two and connects its neighbours. One easily sees that a branch decomposition of GX results of width not larger than the width of ŽT, .. Žii. Similar. Now, for each edge e g EŽ G ., choose an arbitrary leaf
¨ e that is mapped to that edge by , and let W be the collection of those
leaves. Then apply the procedure given above with this set W. Also, one easily sees the time needed for the procedure is O Ž< V ŽT .<.. For an example of the second statement of Lemma 1 see Figs. 11Žiii., Živ.. The grey vertices are those that will be removed during step Ži. and the white vertices are those that will be removed during step Žii..
172
BODLAENDER AND THILIKOS
In what follows we denote as Bk Ž Tk . the obstruction set for the graphs with branchwidth Žtreewidth. at most k. THEOREM 1 w16x. The following statements hold: a. The class of graphs with bounded branchwidth is closed under taking of minors. b.
branchwidthŽ G . F treewidthŽ G . q 1 F ? 32 branchwidthŽ G .@.
c. A graph G has branchwidth at most 0 Ž at most 1., if and only if each connected component of G contains at most one edge Ž at most one ¨ ertex of degree at least 2.. d.
B0 s P34 , B1 s K 3 , P4 4 , and B2 s K 4 4 .
A reduction rule R is a triple Ž H, S, f ., where H is a graph, S : V Ž H ., S / ⭋, and f : V Ž H . ª q 1 is a labelling of vertices in H by ordinals Žfinite ones and ., such that ᭙ ¨ g S: f Ž ¨ . s 0. We say that a reduction rule R s Ž H, S, f . occurs in G if H is a subgraph of G and for any ¨ g V Ž H . the degree of ¨ in GwŽ V Ž G . y V Ž H .. j ¨ 4x is at most f Ž ¨ .. The result of applying R on G is the graph arising from G if we remove the vertices in S and connect as a clique in G all vertices in V Ž H . y S Ži.e., add the minimum number of edges so that V Ž H . y S will induce an r-clique in the resulting graph, r s < V Ž H . y S <.. Given a graph class G , we say that a set R of reduction rules is safe if, for any R g R and for any G such that R occurs in G, the result of applying R on G is a graph in G if and only if G g G . R is called complete for G , if for every nonempty graph G g G , there is a reduction rule in R occurring in G. Clearly, if a set R of reduction rules is safe and complete for a graph class G , then, for any graph G, it holds that G g R if and only if there exists a sequence of reduction rules in R that, when successively applied, can reduce G to the empty graph. These reduction rules are in fact a special case of a more general form of reduction rules as studied amongst others in w2x where subgraphs can be rewritten to general graphs, different from a clique. We denote as Rt F 3 the set of reduction rules t.i, t.ii, t.iii, t.i¨ , t.¨ , t.¨ i4 , shown in Fig. 1. For any R s Ž H, S, f . g Rt F 3 , S is represented by the white cycles; when f Ž ¨ . - , f Ž ¨ . is shown. THEOREM 2 w3, 12, 14x. Rt F 3 is a safe and complete set of reduction rules for the class of graphs with treewidth F 3. Also, if we replace rule t.i¨ in Rt F 3 by t.i¨ X the resulting set of rules is also safe and complete for the class of graphs with treewidth F 3.
GRAPHS WITH BRANCHWIDTH AT MOST THREE
173
FIG. 1. The reduction rules for the class of graphs with treewidth F 3.
We define below the notions of k-tree, k-perfect elimination ordering, minimal separator, and minimal triangulation. We call a graph G chordal when it does not contain any induced cycle of length at least four. We call a vertex ¨ g V Ž G . simplicial if Gw NG Ž ¨ .x is an r-clique of G, where r s < NG Ž ¨ .<. Let k be a positive integer. An ordering Ž ¨ 1 , . . . , ¨
174
BODLAENDER AND THILIKOS
FIG. 2. The graphs K 5 , M6 , M8 , M10 , and Q3 .
LEMMA 2. The following three statements hold: a. There are no graphs in B3 with treewidth at most 2. b. Q3 g B3 and treewidthŽ Q3 . s 3. c. The set K 5 , M6 , M8 4 contains all the graphs of B3 that ha¨ e treewidth at least 4. Proof. a. From the first inequality of Theorem 1.b, we have that there are no graphs with treewidth at most 2 and branchwidth at least 4. b. One can easily verify that treewidthŽ Q3 . s branchwidthŽ Q3 . y 1 s 3. Also, any graph obtained by Q3 by a vertexredge deletion or edge contraction has a branch decomposition of width at most 3. c. We will first prove that K 5 , M6 , M8 4 : B3 . From Theorem 4, S s K 5 , M6 , M8 4 : T3 and thus ᭙G g S : treewidthŽ G . s 4. From the second inequality of Theorem 1.b, we obtain that ᭙G g S : branchwidthŽ G . G 4. It is now enough to check, by inspection, that if we apply to any element of S a vertexredge deletion or edge contraction the resulting graph has a branch decomposition of width F 3. Suppose now that there exists a graph G in B3 y K 5 , M6 , M8 4 that has treewidth G 4. From Theorem 4, G should contain one of the graphs in T3 as a minor and thus one of the graphs in K 5 , M6 , M8 , Q34 : B3 which is a contradiction Žobserve that Q3 U M10 and Q3 g B3 .. Let G be a graph and S : V Ž G ., < S < s 4. We call S s ¨ 1 , ¨ 2 , ¨ 3 , ¨ 4 4 a cross if each of the sets Si s S y ¨ i 4 , 1 F i F 4, is a minimal separator of G Žfor an example, see Fig. 3.. If a graph does not contain any cross then we call it crossless. LEMMA 3. Let G be a crossless graph of treewidth at most 3 and let GX be a minimal triangulation of G. Then, GX is a crossless chordal graph with maximum clique size at most 4. Proof. It is known that if GX is a minimal triangulation of a partial k-tree, then GX has maximum clique size at most k q 1 Žsee, e.g., Chapter 2 of w13x.. What remains to prove is that GX is crossless. Suppose that GX
GRAPHS WITH BRANCHWIDTH AT MOST THREE
175
FIG. 3. A graph G containing a cross S s ¨ 1 , ¨ 2 , ¨ 3 , ¨ 4 4 Žnotice that S remains a cross even if we remove from G any set of dashed edges..
contain a cross S. Then all the triples of S are minimal separators and, by Theorem 3, they are also minimal separators of G. We have a contradiction as G is crossless. We now introduce the notion of a clique tree of a 3-tree. ŽWe mention that it is possible to extend the definition belowᎏas well as the algorithm following itᎏfor any integer k / 3. ŽFor other representations of chordal graphs in tree structures see w11, 23x.. Let G be a 3-tree G. A tree TG is a clique tree of G if Ži. each vertex in V ŽTG . is a subset of V Ž G . inducing a 4-clique in G and Žii. if two vertices v s ¨ 1 , ¨ 2 , ¨ 3 , ¨ 4 4 , u s u1 , u 2 , u 3 , u 4 4 g V ŽTG . are connected by an edge e s v, u4 in TG then
176
BODLAENDER AND THILIKOS
FIG. 4. A 3-tree and two clique trees of it. For any edge e, the set sepŽe. is depicted.
LEMMA 4. Let e 1 , e 2 be two edges of TG and ¨ g V Ž G . such that ¨ g sepŽe 1 . l sepŽe 2 .. Then, for any edge e 3 of T2 with both endpoints in the path connecting e 1 and e 2 in TG , we ha¨ e that ¨ g sepŽ e3 . as well. We now give an algorithm constructing a clique tree of a 3-tree in linear time. ALGORITHM. Clique-Tree. input: A 3-tree G. output: A clique tree TG of G. 1. Find a 3-perfect elimination ordering Ž ¨ 1 , ¨ 2 , . . . , ¨ n . of G Ž n s < V Ž G .<.; 2. let a ny 3 s ¨ ny3 , ¨ ny2 , ¨ ny1 , ¨ n4 ; 3. 4. 5. 6. 7. 8. 9. 10. 11. 4-clique 12. 13. 14. 15.
for i s 1 to n y 4 do let simŽ ¨ i . s NGwV ŽG.y¨ 1 , . . . , ¨ iy 14xŽ ¨ i .; for i s n y 3 to n do let simŽ ¨ i . s a ny3 y ¨ i 4 ; let V ŽTG . s a ny34 , EŽTG . s ⭋; for i [ n y 4 downto 1 do begin set Ci s D¨ g simŽ ¨ i . simŽ ¨ .; find a vertex ¨ iX g Ci such that a iX s simŽ ¨ i . j ¨ iX 4 induces a in Gi ; let a i s simŽ ¨ i . j ¨ i 4 ; let V ŽTG . s V ŽTG . j a i 4 , EŽTG . s EŽTG . j a iX , a i 44 ; end end
LEMMA 5. Gi¨ en a 3-tree in G, algorithms Clique-Tree constructs the clique tree of G in O Ž< V Ž G .<. time.
GRAPHS WITH BRANCHWIDTH AT MOST THREE
177
Proof. We will first prove that a vertex as required in Step 11 always exists. Let simŽ ¨ i . s ¨ j , ¨ jX , ¨ jY 4 . W.l.o.g. we assume that j - jX , j - jY . We set ¨ iX 4 s simŽ ¨ j . y ¨ jX , ¨ jY 4 and it is enough to notice that ¨ iX g C j and Gw ¨ iX , ¨ j , ¨ jX , ¨ jY 4x is a 4-clique of Gi . Moreover, as ᭙iF iF n
Clearly, the above preprocessing can be done in O Ž< V Ž G .<. time and outputs a crossless chordal graph G with maximum clique size at most 4 and with no articulation points. It is easy to see that, using a 3-perfect elimination ordering, we can compute, in linear time, two functions f H , g H such that, for any 3-tree H, f H takes as input a triangle t of H and outputs a boolean value indicating whether t is a minimal separator of H or not and g H takes as input an edge e of H and outputs a 4-clique of H containing it. Using the algorithm of Lemma 6, we compute, in linear time, all the triconnected components of G. We also compute for each triconnected component Gi that is a Žcrossless. 3-tree the corresponding functions fG i and g G i . Suppose now that Gi and Gj are two triconnected components of G. It is enough to show that in constant time, we can Ži. add an edge in Gw V Ž Gi . j V Ž Gj .x so that the resulting graph Gi j is a crossless 3-tree and
178
BODLAENDER AND THILIKOS
Žii. compute the functions fG and g G using fG , fG and g G , g G . As G ij ij i j i j does not contain any articulation points we may assume that V Ž Gi . l V Ž Gj . s a, b4 . We distinguish the following three cases Žsee also Fig. 5.. Case Ži.. Gi and Gj are both crossless 3-trees. Let g G iŽ a, b4. s a, b, c, d4 and g G jŽ a, b4. s a, b, f, e4 . If fG iŽ a, b, c4. s 0 then set ¨ s d; otherwise set ¨ s c. Also, if fG jŽ a, b, e4. s 0 then set u s f ; otherwise set u s e. Now, construct Gi j by adding the edge ¨ , u4 in Gw V Ž Gi . j V Ž Gj .x. One can now easily verify that Gi j is a crossless 3-tree. We set fG i jŽ a, ¨ , u4. s fG i jŽ b, ¨ , u4. s 0, fG i jŽ a, b, ¨ 4. s fG i jŽ a, b, u4. s 1, and g G i jŽ ¨ , u4. s a, b, ¨ , u4 . Case Žii.. Gi is a crossless 3-tree and V Ž Gj . s a, b, e4 . Let g G iŽ a, b4. s a, b, c, d4 . If fG iŽ a, b, c4. s 0 then set ¨ s d; otherwise set ¨ s c. Now, construct Gi j by adding the edge ¨ , e4 in Gw V Ž Gi . j V Ž Gj .x. One can now easy verify that Gi j is a crossless 3-tree. We set fG i jŽ a, ¨ , e4. s f G i jŽ b, ¨ , e4. s f G i jŽ a, b, e4. s 0, f G i jŽ a, b, ¨ 4. s 1, g G i jŽ a, e4. s g G i jŽ b, e4. s g G i jŽ ¨ , e4. s a, b, ¨ , u4 . Case Žiii.. V Ž Gi . s a, b, ¨ 4 , V Ž Gj . s a, b, u4 . In this case we construct Gi j by adding ¨ , u4 in Gw V Ž Gi . j V Ž Gj .x. Clearly, Gi j is a crossless 3-tree. Finally, for any triple t of a, b, ¨ , u4 we set fG i jŽ t . s 0 and for any edge e : a, b, ¨ , u4 we set g G i jŽ e . s a, b, ¨ , u4 .
FIG. 5. Examples for cases Ži., Žii., and Žiii. of the proof of Lemma 7.
GRAPHS WITH BRANCHWIDTH AT MOST THREE
179
3. OBSTRUCTIONS FOR GRAPHS WITH BRANCHWIDTH AT MOST 3 In this section we will identify the obstruction set for the class of graphs with branchwidth at most three. Unless stated otherwise, we consider a clique tree TG of a crossless 3-tree G. Given a k-tree, a clique tree TG of G, and a vertex v g V ŽTG ., we define Ev s e g EŽTG .: v belongs to e4 . The following lemma defines the notion of the 3-labelled clique tree of a crossless 3-tree. LEMMA 8. Let G be a crossless 3-tree G and TG a clique tree of G. Then, there exist a function l: EŽTG . ª 1, 2, 34 such that ᭙v g V ŽTG .: ᭙e 1 , e 2 g Ev : ŽsepŽe 1 . s sepŽe 2 . iff l Že 1 . s l Že 2 ..; i.e., edges in Ev with the same separation set ha¨ e the same label. Moreo¨ er, one can construct an algorithm that, gi¨ en TG , computes such a function l in O Ž< V Ž G .<. time. Proof. Since G is crossless, we have that, for any 4-clique of G, at most three of its triples are minimal separators and therefore ᭙v g V ŽTG .: < sepŽe.
180
BODLAENDER AND THILIKOS
FIG. 6. A 3-tree and two 3-labelled clique trees of it.
3-tree G, outputs an amplified branch decomposition ŽT, . of G that has width 3. We will first construct T. Let v be a vertex of TG with span-degree d. Using function l we can assume that Ev s Ev1 j ⭈⭈⭈ j Evd, where Evi s e 1i , . . . , e ir 4 , i s 1, . . . , d, and ᭙ i, 1 F i F d: ᭙ j, 1 F j F ri : l Ž e ji . s i; i.e., we i partition Ev into a minimum number of sets each containing edges with the same label. Notice that to find such a partition for all the vertices of TG costs O Ž< V ŽTG .<. time. For any vertex v g V ŽTG ., we construct the tree Tv s Ž V ŽTv1 . j V ŽTv2 . j V ŽTv3 .., EŽTv1 . j EŽTv2 . j EŽTv3 .. where, for i s 1, 2, 3; 䢇
In case i F d and ri G 2, then we set
Tvi s ¨ 0 4 j ¨ 1i , . . . , ¨ riiy1 4
ž
D V Ž Tvi , j . 4 ,
1FjFr i
½ ¨
i 0 , ¨1
4 , ¨ 1i , ¨ 2i 4 , . . . , ¨ ri y2 , ¨ ri y1 4 5 D E Ž Tvi , j . 4 i
i
1FjFr i
/
,
where for j s 1, . . . , ri y 1, Tvi , j s
ž ¨ , ¨ i j
i i i i i i j, 1 , ¨ j, 2 , ¨ j, 3 , ¨ j, 4 , ¨ j, 5 , ¨ j, 6
½ ¨ , ¨ 4 , ¨ i j
i j, 1
i i j, 1 , ¨ j, 2
4,
4 , ¨ j,i 2 , ¨ j,i 3 4 , ¨ j,i 1 , ¨ j,i 4 4 , ¨ j,i 2 , ¨ j,i 5 4 , ¨ j,i 3 , ¨ j,i 6 4 5 / and
Tvi , r i s
ž ¨
i i i i i i i r iy1 , ¨ r i , 1 , ¨ r i , 2 , ¨ r i , 3 , ¨ r i , 4 , ¨ r i , 5 , ¨ r i , 6
½ ¨
i i r iy1 , ¨ r i , 1
4,
4 , ¨ ri , 1 , ¨ ri , 2 4 , ¨ ri , 2 , ¨ ri , 3 4 , ¨ ri , 1 , ¨ ri , 4 4 , i
i
i
i
i
i
¨ ri , 2 , ¨ ri , 5 4 , ¨ ri , 3 , ¨ ri , 6 4 5 / . i
i
i
i
GRAPHS WITH BRANCHWIDTH AT MOST THREE
181
The tree Tv is illustrated in Fig. 7. We call the path Ž ¨ 0 , ¨ 1i , . . . , ¨ riiy1 . the trunk and the vertices in ¨ 1i , . . . , ¨ riiy1 4 the body of the trunk. In case i F d and ri s 1 we define T¨i by applying the construction given above for ri s 1 with the difference that, where in that construction ¨ riiy1 is used, now ¨ 0 is used. ŽClearly, in such a case, the trunk of Tvi contains only ¨ 0 .. 䢇
䢇
In case i ) d, we set
Tvi s Ž ¨ 0 , ¨ 1i , ¨ 2i , ¨ 3i , ¨ 4i , ¨ 5i 4 , ¨ 0 , ¨ 1i 4 , ¨ 1i , ¨ 2i 4 , ¨ 2i , ¨ 3i 4 , ¨ 1i , ¨ 4i 4 , ¨ 2i , ¨ 5i 4 4 . . If i ) d, we call the subtree Tvi constructed above external; otherwise, if i F d, we call the subtrees Tvi, 1 , . . . , Tvi, r i internal subtrees of Tv . We also call vertex ¨ 0 the kernel. Observe now that each of the internal subtrees of Tv that comprise Tvi corresponds to one of the edges in Ev with label i; i.e., edge e ij corresponds to the tree Tvi, j for 1 F j F ri , 1 F i F d. For an example illustrating the three cases above see Fig. 8. In the clique tree of Fig. 8 vertex v has span-degree 2 and belongs to edges e11, e21 , e31 , e41 , e12 , where l Ž e 1j . s 1, 1 F j F 4, and l Ž e12 . s 2. Clearly, Tv1 consists of a trunk ¨ 0 , ¨ 11 , ¨ 21 , ¨ 31 4 and four internal subtrees, Tv1, 1, Tv1, 2 , Tv1, 3, and Tv1, 4 of Tv , each corresponding to one of the edges of Ev labelled with 1. As the unique edge labelled with 2 is e12 , the subtree corresponding to it is Tv2 s Tv2, 1 which is an internal subtree of Tv . Finally, the fact that there are no edges labelled with 3 implies the existence of subtree Tv3 in Tv . Clearly, Tv3 is an external subtree. The construction of the tree T of the amplified branch decomposition is now completed by applying, for any edge e of TG , the following operation: Suppose that e s v, u4 . Let also Tv and Tu be the subtrees corresponding to v and u, according to the construction described above. We denote as Tvi v , j v the internal subtree of Tv corresponding to edge e and as Tui u , j u the internal subtree of Tu corresponding to edge e. The construction proceeds by identifying the pairs of vertices Ž ¨ jivv, 1 , u ij uu , 3 ., Ž ¨ jivv, 2 , u ij uu , 2 ., Ž ¨ jivv, 3 , u ij uu , 1 ., Ž ¨ ji v, 4 , u ij u , 6 ., Ž ¨ ji v, 5 , u ij u , 5 ., Ž ¨ ji v, 6 , u ij u , 4 . and eliminating the double edges that v u v u v u
FIG. 7. The tree Tvi.
182
BODLAENDER AND THILIKOS
FIG. 8. A vertex v in a clique tree, and the corresponding tree T¨ .
appear Žsee also Fig. 9.. We call the above operation the merging operation and notice that it is applied always to internal subtrees. Notice now that, applying the merging operation for any edge of TG , we construct a tree with vertices of degree 1 or 3. Moreover, such a construction can be done in O Ž V ŽTG .. time. Notice that each vertex v g V ŽTG .
FIG. 9. Identifying vertices of Tvi v , j v and Tui u , j u towards constructing Te .
GRAPHS WITH BRANCHWIDTH AT MOST THREE
183
corresponds to exactly one kernel, say ¨ 0v , in V ŽT .. Moreover, each edge e s v, u4 g EŽTG ., corresponds to exactly one subtree of T that is the result of merging two internal subtrees Tvi v , j v , Tui u , j u of Tv and Tu , respectively. We call the product of this merging the merged subtree of T and we denote it as Te . We also call the nonleaf vertices of a merged subtree central vertices. Given a trunk L of T we call an L-merged subtree any merged subtree sharing a common vertex with the body of L. We say that two merged subtrees Te i , i s 1, 2, of T are touching if the path connecting their vertex sets contains only vertices of trunks of T. According to the construction above, two edges e 1 , e 2 of EŽTG . have a common vertex in TG iff Te 1 and Te 2 are touching. A direct consequence of that is the following fact. Fact A. Let e i g EŽTG ., i s 1, 2, 3. Then, both endpoints of e3 belong to the path that connects e 1 and e 2 in TG iff the central vertices of Te 3 belong to the path that connect the vertex sets of Te 1 and Te 2 . What now remains is to define the function : leaves of T ª EŽ G .. We distinguish two kinds of leaves in T : those that are leaves of merged subtrees and those that belong to external subtrees. In the first case we have to define for leaves appearing in triples of the form ¨ j,i 4 , ¨ j,i 5 , ¨ j,i 6 . Recall that each such triple corresponds to some edge e of the clique tree of G. Let sepŽe. s w 1 , w 2 , w 3 4 . We define Ž ¨ j,i 4 . s w 1 , w 2 4 , Ž ¨ j,i 5 . s w 2 , w 34 , and Ž ¨ j,i 6 . s w 1 , w 34 Žsee Fig. 9.. Now, we can observe the following fact. Fact B. If p1 , p 2 , p 3 are the leaves of a merged subtree Te of T then Ž pi . ; sepŽe., i s 1, . . . , 3. We claim that, for any edge e that is a subset of a minimal separator S of G, there is a leaf ¨ in T where Ž ¨ . s e. Indeed, ¨ should be one of the leaves of Te where e is the edge of TG for which sepŽe. s S. The only leaves of T, where is still undefined, are the leaves of the external subtrees of T. Let Tvi be such an external subtree and let ¨ 3i , ¨ 4i , ¨ 5i be its leaves. Let d be the span-degree of v. We distinguish the cases Žsee also Fig. 10.: Case Ži.. d s 2: w 1 , w 2 , w 3 , w4 4 contains exactly two triples, say t 1 s w 1 , w 2 , w4 4 , t 2 s w 2 , w 3 , w4 4 that are minimal separators of G. Clearly, i s d q 1 s 3 and we set Ž ¨ 33 . s w 1 , w 3 4 , Ž ¨ 43 . s w 1 , w 3 4 , and Ž ¨ 53 . s w 2 , w 34 . Case Žii.. d s 1: w 1 , w 2 , w 3 , w4 4 contains only one triple, say t 1 s w 2 , w 3 , w4 4 , that is a minimal separator of G. Clearly, i s 2 or 3. W.l.o.g. we assume that i s 2 and observe that Tv contains another external subtree Tv3. Let ¨ 33 , ¨ 43, ¨ 534 be the leaves of Tv3. We set Ž ¨ 32 . s w 1 , w 34 ,
184
BODLAENDER AND THILIKOS
FIG. 10. An illustration of the two cases in the proof of Lemma 9.
Ž ¨ 42 . s w 1 , w 2 4 , Ž ¨ 52 . s w 2 , w 34 , Ž ¨ 33 . s w 1 , w4 4 , Ž ¨ 43 . s w 1 , w 34 , and Ž ¨ 53 . s w 3 , w4 4 . We now claim that if an edge e of G does not belong to any minimal separator there will be an external subtree Tvi containing a leaf ¨ , where Ž ¨ . s e. Using Lemma 4 one can see that e will be the subset of exactly one vertex v of TG . Let ¨ 0v be the kernel of T corresponding to v. Notice that ¨ 0v is a vertex of at most two external subtrees of T and, according to the definition of in Cases Ži. and Žii. above, ¨ will be one of their leaves. We now have that any edge in G is an image of some leaf of T and thus ŽT, . is an amplified branch decomposition of G. Moreover, the construction of G can be done in O Ž< V Ž G .<. time. What now remains is to prove that the width of ŽT, . is 3. Let e be an edge of T. If e belongs to an external subtree of T, it is trivial that it has order F 3. Therefore, we can assume that either e is an edge of a merged subtree of T or that it belongs to a trunk of T. Let pi , i s 1, 2, be two leaves of T each belonging to a different connected component of Ž V ŽT ., EŽT . y e4.. Let also ¨ g Ž p1 . l Ž p 2 .. If e belongs to a merged subtree of T, we denote it as Te , where e is the corresponding edge of TG . We define as Pi the path connecting e with pi in T for i s 1, 2. In case e belongs to a trunk L of T, we define Te as the L-merged subtree of T that has at least one of its central vertices, either in P1 or in P2 Žit is easy to check that such an L-merged subtree always exists.. Clearly, as
GRAPHS WITH BRANCHWIDTH AT MOST THREE
185
We examine first the nontrivial case, where both T1 , T2 are merged subtrees, and we denote them as Te 1 and Te 2 , respectively. Notice that all the central vertices of Te belong to P1 or P2 and, thus, in the path of T that connects p1 with p 2 . Applying Fact A, we have that both endpoints of e belong to the path connecting e 1 and e 2 in TG . From Lemma 4 we have that sepŽe 1 . l sepŽe 2 . : sepŽe.. Using now Fact B, we have that ¨ g Ž pi . ; sepŽe i ., i s 1, 2, and thus ¨ g sepŽe.. We now assume that one, say T1 , of T1 , T2 is an external tree. Notice that, according to the definition of for the leaves of the external subtrees, at least one, say T1X , of the merged subtrees that touch Ti should have a leaf pX1 such that ¨ g Ž pX1 .. If pX1 is a leaf of Te then the required follows from Fact B; otherwise, it is enough to apply the nontrivial case for pX1 and p 2 . The case where both T1 , T2 are external trees is very similar. For an example of the construction presented in the proof of Lemma 9, see Figs. 11Ži. ᎐ Žiii.. We have now the following. THEOREM 5. The following propositions are equi¨ alent: a.
A graph G has branchwidth at most 3.
b. G has treewidth at most 3 and Q3 g G. c. G has treewidth at most 3 and G is crossless. Proof. Ža « b. Suppose that branchwidthŽ G . F 3. Then, from the second inequality of Theorem 1.b, we get that treewidthŽ G . F 3. We also have the Q3 g G because, otherwise from Theorem 1.a we have that branchwidthŽ G . G branchwidthŽ Q3 . s 4, a contradiction. Žb « c. It is sufficient to prove that if a graph G has a cross, then it contains Q3 as a minor. Let S s ¨ 1 , ¨ 2 , ¨ 3 , ¨ 4 4 be a cross in G. It is now enough to see that if we contract all edges of G, except those that have at least one endpoint in S, we obtain Q3 . Žc « a. From Lemmata 3 and 7, we have that G is a subgraph of a crossless 3-tree G. Applying now Lemmata 9 and 1, we have the required. THEOREM 6. The obstruction set for the class of graphs with branchwidth at most three, B3 , equals K 5 , M6 , M8 , Q34 . Proof. By Lemma 2, it is sufficient to prove that Q3 is the only element of B3 with treewidth equal to 3. That statement holds because, according to Theorem 5, any graph treewidth at most 3 that does not contain Q3 as a minor, has branchwidth at most 3.
186
BODLAENDER AND THILIKOS
FIG. 11. Ži. A crossless 3-tree G, Žii. its 3-labelled clique tree ŽTG , l ., Žiii. an amplified branch decomposition ŽT, . as it is constructed by the algorithm of Lemma 9, and Živ. the branch decomposition constructed by ŽT, ., using the algorithm of Lemma 1.
4. REDUCTION RULES FOR GRAPHS WITH BRANCHWIDTH AT MOST 3 In this section we give a safe and complete set of reduction rules for the graphs with branchwidth at most three. ŽThe same conventions are used as in Fig. 1.. We denote as Rb F 3 the set of reduction rules shown in Fig. 12.
GRAPHS WITH BRANCHWIDTH AT MOST THREE
187
FIG. 12. The reduction rules for the class of graphs with branchwidth F 3.
LEMMA 10. Let G be a graph with branchwidth at most 3. Suppose also that rule b.¨ or rule b.¨ i occurs in G. Then, if we apply b.¨ or b.¨ i on G the resulting graph has also branchwidth at most 3. Proof. We will examine together the two cases where we apply b.¨ or b.¨ i. Suppose that for some graph G, where branchwidthŽ G . F 3, the application of rule R, that is either b.¨ or b.¨ i, on G results in a graph GX with branchwidthŽ GX . ) 3. From the second inequality of Theorem 1.b we have that treewidthŽ G . F 3. Let a, b, c, d4 be the vertices of the resulting 4-clique of GX . W.l.o.g. we can assume that NGX Ž a. s b, c, d4 . Observe that H s GX w V Ž GX . y a4x has treewidth at most 3, since treewidthŽ G . F 3 and H is the result of a single application of rule t.¨ , in case R is b.¨ , or of three successive applications of rule t.i¨ X , in case R is b.¨ i, on G. Moreover, GX has also treewidth at most 3, as b, c, d4 induces a 3-clique in H Že.g., see w8x or w13x.. Now, from Theorem 5, we have that GX contains a cross S. By the definition of the cross we have that for any vertex ¨ g S there must exist three vertices in NGX Ž ¨ . forming an independent set of GX . Therefore a f S. We also claim that < b, c, d4 l S < F 1. Suppose to the contrary that w.l.o.g. b, c4 : S. Then, S would be a cross also in GY s GX w V Ž GX ., EŽ GX . y b, c44x and this is a contradiction as GY U G. We can now assume w.l.o.g. that b, c4 l S s ⭋. Therefore, a, b, c4 belongs to the vertex set of one of the connected components of GX w V Ž GX . y S x. The same connected component remains connected even if we remove b, c4 from GX as a is adjacent to both b, c. Therefore, graph GY s GX w V Ž GX ., EŽ GX . y b, c44x contains a cross which is a contradiction as GY U G. LEMMA 11. Rb F 3 is a safe set of reduction rules for the class of graphs with branchwidth bounded by 3. Proof. We have to prove that the application of any reduction rule from Rb F 3 to a graph preserves both its membership and nonmembership. Membership for b.¨ and b.¨ i holds immediately from Lemma 10. For the rest of the rules in Rb F 3 membership is easy because of Theorem 1.a,
188
BODLAENDER AND THILIKOS
as the application of any of them on a graph G with branchwidth F 3 results a graph H, where H U G. Suppose now to the contrary that there exists a graph G with branchwidth G 4 and a reduction rule R g Rb F 3 occurring in G, such that if GX is the result of applying R on G, then GX has branchwidth F 3. Notice that, according to Theorem 5, GX is crossless and has treewidth F 3. We also have from the same theorem that either G has treewidth G 4 or it contains a cross. Suppose that G has treewidth G 4. Notice that, as Rt F 3 is safe, there are no rules in Rt F 3 occurring in G. Clearly R cannot be b.i Žor b.ii, or b.iii, or b.i¨ .; otherwise rule t.i Ž t.ii, or t.iii., or t.i¨ . would occur in G .. Moreover, it is not hard to see that if R is b.¨ Ž b.¨ i ., then also t.¨ Ž t.i¨ . occurs in G, a contradiction. So, G has treewidth at most 3 and, therefore, contains a cross. Recall that GX has also treewidth at most 3 and is crossless. Let S s a, b, c, d4 be a cross in G but not in GX . Notice that GX cannot result after the application of rules b.i, b.ii, b.iii, or b.¨ on G, as those applications cannot harm the status of S as a cross. Thus, R is either b.i¨ or b.¨ i. In the first case G contains one vertex more than GX which is adjacent to the vertices of a triple, say b, c, d4 of S. This case leads to a contradiction because b, c, and d are all adjacent to more than one vertex in V Ž GX w V Ž GX . y b, d, c4x. and rule b.i¨ cannot be applied. In the second case G should contain two vertices more than GX , each one adjacent to different triples in a, b, c, d4 . In this case we have again a contradiction because a, b, c, d are all adjacent to more than zero vertices in GX w V Ž GX . y a, b, c, d4x and rule b.¨ i cannot be applied. We call a leaf u of TG that is adjacent to a vertex v simple if all the edges of TG connecting v with leaves of TG have pairwise different labels. For example, notice that in the first 3-labelled clique tree of Fig. 6 leaves d, f, g, h4 and b, c, d, g 4 are simple. Moreover, in the second 3-labelled clique tree of Fig. 6 all the leaves are simple. LEMMA 12. Let ŽTG , l . be a 3-labelled clique tree containing at least one edge. Then, one of the following holds: Ži. There exists at least one nonsimple leaf. Žii. There exists a simple leaf u in TG adjacent to a ¨ ertex v of span-degree 1. Žiii. There exists a simple leaf u in TG adjacent to a ¨ ertex v of span-degree 2. Živ. There exist two simple lea¨ es u 1 and u 2 in TG adjacent to a ¨ ertex v of span-degree 3. Proof. Let L0 be the set of leaves of TG . Let also L1 s Dv g L 0 NT GŽv.. Suppose now that L1 / ⭋; otherwise, Žii. trivially holds. Moreover, we
GRAPHS WITH BRANCHWIDTH AT MOST THREE
189
assume that all the leaves in TG are simple; otherwise Ži. holds. As TG w V ŽTG . y L0 x is a nonempty tree, L1 must contain at least one leaf v. Clearly, v is adjacent to at most d, 2 F d F 4, vertices in TG and only one of them is not a leaf. It is now easy to verify that if the span-degree of v is 1, 2, or 3; then Žii., Žiii., Živ. respectively holds Žsee also Fig. 13.. LEMMA 13. Let G be a crossless 3-tree. Then, there exists one reduction rule in Rb F 3 occurring in G. Proof. Let ŽTG , l . be a 3-labelled clique tree of G. As the lemma is obvious for the case where G is isomorphic to K 4 , we may assume that EŽTG . ) 0. Using Lemma 12, we distinguish the cases Žsee also Fig. 13.: Case i. TG contains a leaf u 1 adjacent to a vertex v that is also adjacent to a vertex u 2 and such that l Ž v, u 1 4. s l Ž v, u 2 4.. In this case we can easily see that the two vertices in the set u 1 j u 2 y sepŽ v, u 1 4. are adjacent only to the three vertices in sepŽ v, u 1 4. s sepŽ v, u 2 4 and, thus, rule b.¨ can be applied. Case ii. TG contains a simple leaf u adjacent to a vertex v with span-degree 1. The case where u is the only vertex of TG adjacent to v is trivial as both rules b.i¨ , b.¨ can be applied. If now there exists a vertex uX / u adjacent to v and v, u4 and v, uX 4 have the same label, it is clear that the only triple of v that is a minimal separator of G is S s sepŽ v, u4.. Notice now that the unique vertices in v y S and u y S are adjacent only to the vertices of S in G and, therefore, rule b.¨ can be applied.
FIG. 13. Examples of the cases of Lemmata 12 and 13.
190
BODLAENDER AND THILIKOS
Case iii. TG contains a simple leaf u adjacent to a vertex v with span-degree 2. We observe that v contains exactly two triples S1 , S2 that are minimal separators and one of them, say S1 , contains vertices that are all adjacent to the single vertex in u y v. Observe that, as u is simple, the single vertex in v y S2 is adjacent to exactly one vertex not in u and thus rule b.i¨ can be applied. Case iv. There exist two simple leaves u 1 , u 2 in T connected with the same vertex v that has span-degree 3. In this case, v contains exactly 3 triples S1 , S2 , S3 that are minimal separators and two of them, denote them S1 , S2 , contain vertices that are all adjacent to the single vertex in u 1 y v and to the single vertex u 2 y v, respectively. It is easy to see that, as u is simple, the single vertex in v y S3 is adjacent only to the vertices in v j u 1 j u 2 and thus rule b.¨ i can be applied. LEMMA 14. If there exists some reduction rule in Rb F 3 occurring in a graph G, then, for any subgraph GX of G such that V Ž GX . s V Ž G ., there exists some rule in Rb F 3 occurring in GX as well. Proof. It is sufficient to prove that if some reduction rule R occurs in a graph G then for any e g EŽ G . there exists some rule in Rb F 3 occurring in GX s Ž V Ž G ., EŽ G . y e4.. If the removal of e does not harm the occurrence of R, then R occurs in GX as well. If this is not the case we claim that, whatever the rule R is, the removal of e implies the occurrence of another rule RX g Rb F 3 in GX . Indeed, it is not difficult to check that any removal of an edge in rule b.ii, b.iii, b.i¨ , b.¨ , produces rule b.i, b.ii, b.iii, b.iii, respectively and any removal of an edge in rule b.¨ i, produces either rule b.iii or rule b.i¨ . LEMMA 15. Rb F 3 is a complete set of reduction rules for the class of graphs with branchwidth F 3. Proof. Let G be a nonempty graph with branchwidth F 3. We will prove that there is a reduction rule in Rb F 3 occurring in G. From Theorem 5, G has treewidth bounded by 3 and is crossless. Let GX be a minimal triangulation of G. According to Lemma 3, GX is also crossless. From Lemma 7, we have that G is a subgraph of a crossless 3-tree GY such that V Ž GY . s V Ž G .. Applying now Lemma 13 we know that there exists a reduction rule in Rb F 3 occurring in GY . The result now follows immediately from Lemma 14. Now, from Lemma 11 and 15 we have the following. THEOREM 7. Rb F 3 is a safe and complete set of rules for rewriting graphs of branchwidth at most 3.
GRAPHS WITH BRANCHWIDTH AT MOST THREE
191
5. THE ALGORITHM The results of the previous sections lead to the construction of a linear time algorithm testing whether a graph has branchwidth at most 3 and, if so, computes a branch decomposition of minimum width. In this section we present this algorithm. LEMMA 16. Let G be a graph with branchwidth at most 3. Let also Ž R1 , . . . , R r . be a sequence of reduction rules in Rb F 3 that reduces G to the empty graph. Then, one can construct an algorithm that, gi¨ en G and Ž R1 , . . . , R r ., outputs in O Ž< V Ž G .<. time a crossless chordal graph GX with maximum clique size at most 4, such that G is a subgraph of GX and V Ž GX . s V Ž G .. Proof. Let G1 , . . . , Grq1 be a sequence of graphs such that G s G1 , Grq1 is the empty graph, and Giq1 occurs after the application of R i to Gi for i s 1, . . . , r. Clearly, we can compute, in O Ž< V Ž G .<. time the set Eqs Dis1, . . . , r EŽ Gi .. It is now easy to see that GX s Ž V Ž G ., Eq . is the required crossless chordal graph and such a graph can be constructed in O Ž< V Ž G .<. time. LEMMA 17. One can construct a linear time algorithm that, gi¨ en a graph G, checks whether branchwidthŽ G . F 3 and, if so, outputs, in O Ž< V Ž G .<. time, a sequence Ž R1 , . . . , R r . of reduction rules in Rb F 3 that can reduce a graph G to the empty graph. Proof. According to Theorem 7, a graph has branchwidth at most 3 iff we can find a sequence of reduction rules in Rb F 3 that, when successively applied, reduce G to the empty graph. Clearly, it is enough to prove that there exists a way to check, in constant time, whether a reduction rule in Rt F 3 occurs in a graph G or not. Indeed, it is enough to observe that, given a reduction rule Ž H, S, f . g Rb F 3 , every edge of H contains a vertex of degree F 5 and then to use the same approach as the one used in w14x by Matousek ˇ and Thomas Žtheir algorithm is based on the same observation about the set Rt F 3 .. ŽSee, however, the note added in proof.. We are now in position to present the main algorithm of this paper. ALGORITHM. Branchwidth-3. input: A graph G. output: A branch decomposition of G with width F 3 or a report that branchwidthŽ G . ) 3. 1. Use G and the algorithm of Lemma 17 and create sequence Ž R1 , . . . , R r .. If such a sequence does not exist then report that branchwidthŽ G . ) 3 and stop.
192
BODLAENDER AND THILIKOS
2. Use G, ŽT1 , . . . , R r ., and the algorithm of Lemma 16 to construct a crossless chordal graph GX with maximum clique at most 4 that contains G as a subgraph. 3. Use GX and the algorithm of Lemma 7 and construct a crossless k-tree GY that contains GX Žand therefore G . as a subgraph. TGY
4. Use GY and algorithm Clique-Tree to construct a 3-clique tree of GY .
5. Use TGY and the algorithm of Lemma 8 to construct a labelled 3-tree clique ŽTGY , l . of GY . 6. Use ŽTGY , l ., and the algorithm of Lemma 9 to construct an amplified branch decomposition BU of GY with width 3. 7. Use BU and the algorithm of the second statement of Lemma 1 to construct a branch decomposition BY of GY with width at most 3. 8. Use BY and the algorithm of the first statement of Lemma 1 to construct a branch decomposition B of G with width at most 3. 9. Output B. 10. end Notice that each of the nine steps of algorithm Branchwidth-3 can be done in O Ž< V Ž G .<. time. Notice also that, according to Theorem 1.d, one can check, in linear time, if a graph has branchwidth at most 2 or not. Moreover, from Theorem 1.c, it is trivial to check, in linear time, if G has branchwidth at most 1 or not. Therefore, it is easy to know if G has branchwidth 2. In this special case, the corresponding branch decomposition can be computed using a straightforward modification of our algorithm. Finally, if branchwidthŽ G . s 1 then, using Theorem 1.c, it is trivial to construct the minimal branch decomposition. Concluding, we sum up the results of this paper as follows. THEOREM 8. The following three statements hold: a. A graph has branchwidth at most 3 if and only if it does not contain any of the graphs in the set B3 s K 5 , M6 , M8 , Q34 as a minor. b. A graph has branchwidth at most 3 if and only if there exists a sequence of reduction rules in Rb F 3 that can reduce G to the empty graph. c. One can construct an algorithm that tests if a gi¨ en graph G has branchwidth at most 3 and, if so, outputs a branch decomposition of minimum width in O Ž< V Ž G .< time.
GRAPHS WITH BRANCHWIDTH AT MOST THREE
193
6. OPEN PROBLEMS We believe that the methodology applied in this paper may be useful in identifying obstruction sets andror reduction rules for other problems as well. In this direction, the study of the graphs with branchwidth at most four appears to be an interesting problem.
ACKNOWLEDGMENT We thank Kouichi Yamazaki for discussions on this research. Note Added in Proof. Upon recent inspection of w14x, we became uncertain whether the technique used to find occurrences of the rule t.v s b.v Ži.e., find pairs of vertices of degree 3 with the same neighbors in a dynamically changing graph. works as required. Using a more than linear space, similarly to techniques used in w2x, can in any case resolve the problem, assuming the RAM with uniform cost measure computation model. Thus, while the time needed for the algorithm is linear, the space used is O Ž n3 .. Techniques such as that described in T. Hagerup, On Saving Space in Parallel Computation, Inform. Process. Lett. 29 Ž1988., 327᎐329, could help to bring the space requirements down, e.g., to O Ž n1q ⑀ .. It is also not difficult to see that an implementation exists that uses O Ž n log n. time and O Ž n. space.
REFERENCES 1. S. Arnborg, D. G. Corneil, and A. Proskurowski, Complexity of finding embeddings in a k-tree, SIAM J. Alg. Discrete Methods 8 Ž1987., 277᎐284. 2. S. Arnborg, B. Courcelle, A. Proskurowski, and D. Seese, An algebraic theory of graph reduction, J. Assoc. Comput. Mach. 40 Ž1993., 1134᎐1164. 3. S. Arnborg and A. Proskurowski, Characterization and recognition of partial 3-trees, SIAM J. Alg. Disc. Meth. 7 Ž1986., 305᎐314. 4. S. Arnborg, A. Proskurowski, and D. G. Corneil, Forbidden minors characterization of partial 3-trees, Discrete Math. 80 Ž1990., 1᎐19. 5. H. L. Bodlaender, ‘‘A Partial k-Arboretum of Graphs with Bounded Treewidth,’’ Theor. Comp. Sc. 209 Ž1998., 1᎐45. 6. H. L. Bodlaender, T. Kloks, and D. Kratsch, Treewidth and pathwidth of permutation graphs, SIAM J. Disc. Meth. 8, No. 4 Ž1995., 606᎐616. 7. H. L. Bodlaender and D. M. Thilikos, Constructive linear-time algorithms for branchwidth, in ‘‘Proceedings 24th International Colloquium on Automata, Languages, and Programming’’ ŽP. Degano, R. Gorrieri, and A. Marchetti-Spaccamela, Eds.., Lecture Notes in Computer Science, Vol. 1256, pp. 627᎐637, Springer-Verlag, New YorkrBerlin, 1997. 8. H. L. Bodlaender, J. van Leeuwen, R. Tan, and D. Thilikos, On interval routing schemes and treewidth, Inform. and Comput. 139, No. 1 Ž1997., 92᎐109. 9. W. Cook, 1996. Personal communication. 10. W. Cook and P. D. Seymour, An algorithm for the ring-routing problem, Bellcore technical memorandum, Bellcore, 1993. 11. F. Gavril, The intersection graphs of subtrees in trees are exactly the chordal graphs, J. Combin. Theory Ser. B 16 Ž1974., 47᎐56.
194
BODLAENDER AND THILIKOS
12. Y. Kajitani, A. Ishizuka, and S. Ueno, A characterization of the partial k-tree in terms of certain substructures, Graphs Combin. 2 Ž1986., 233᎐246. 13. T. Kloks, ‘‘Treewidth. Computations and Approximations,’’ Lecture Notes in Computer Science, Vol. 842, Springer-Verlag, Berlin, 1994. 14. J. Matousek ˇ and R. Thomas, Algorithms finding tree-decompositions of graphs, J. Algorithms 12 Ž1991., 1᎐22. 15. N. Robertson and P. D. Seymour, Graph minorsᎏA survey in ‘‘Surveys in Combinatorics’’ ŽI. Anderson, Ed.., pp. 153᎐171, Cambridge Univ. Press, Cambridge, 1985. 16. N. Robertson and P. D. Seymour, Graph minors. X. Obstructions to tree-decomposition, J. Comb. Theory Series B, 52 Ž1991., 153᎐190. 17. D. P. Sanders, On linear recognition of tree-width at most four, SIAM J. Disc. Meth., 9, No. 1 Ž1996., 101᎐117. 18. A. Satyanarayana and L. Tung, A characterization of partial 3-trees, Networks 20 Ž1990., 299᎐322. 19. P. D. Seymour and R. Thomas, Call routing and the ratcatcher, Combinatorica 14, No. 2 Ž1994., 217᎐241. 20. J. van Leeuwen, Graph algorithms, in Handbook of Theoretical Computer Science, A: Algorithms and Complexity Theory, pp. 527᎐631, North Holland, Amsterdam, 1990. 21. J. A. Wald and C. J. Colburn, Steiner trees, partial 2-trees, and minimum IFI networks, Networks 13 Ž1983., 159᎐167. 22. M. Yannakakis, Computing the minimum fill-in is NP-complete, SIAM J. Alg. Disc. Meth. 2 Ž1981., 950᎐988. 23. M. Yannakakis and F. Gavril, The maximum k-colorable subgraph problem for chordal graphs, Inform. Proc. Lett. 24 Ž1987., 133᎐137.