Size-Constrained Tree Decompositions
Bi Li, Fatima Zahra Moataz, Nicolas Nisse, Karol Suchan
To cite this version:
Bi Li, Fatima Zahra Moataz, Nicolas Nisse, Karol Suchan. Size-Constrained Tree
Decomposi-tions. [Research Report] INRIA Sophia-Antipolis. 2014.
<hal-01074177>
HAL Id: hal-01074177
https://hal.inria.fr/hal-01074177
Submitted on 13 Oct 2014
HAL
is a multi-disciplinary open access
archive for the deposit and dissemination of
sci-entific research documents, whether they are
pub-lished or not.
The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire
HAL
, est
destin´
ee au d´
epˆ
ot et `
a la diffusion de documents
scientifiques de niveau recherche, publi´
es ou non,
´
emanant des ´
etablissements d’enseignement et de
recherche fran¸
cais ou ´
etrangers, des laboratoires
publics ou priv´
es.
Size-Constrained Tree Decompositions
⋆Bi Li1,2,3, Fatima Zahra Moataz2,1, Nicolas Nisse1,2, and Karol Suchan4,5 1
Inria, France
2
Univ. Nice Sophia Antipolis, CNRS, I3S, UMR 7271, Sophia Antipolis, France
3
Institute of Applied Mathematics, Chinese Academy of Sciences, Beijing, China
4
FIC, Universidad Adolfo Ib´a˜nez, Santiago, Chile
5
WMS, AGH, University of Science and Technology, Krakow, Poland
Abstract. Tree-Decompositionsare the corner-stone of many dynamic programming algorithms for solving graph problems. Since the complexity of such algorithms generally depends exponentially on thewidth(size of thebags) of the decomposition, much work has been devoted to compute tree-decompositions with small width. However, practical algorithms computing tree-decompositions only exist for graphs withtreewidthless than4. In such graphs, the time-complexity of dynamic programming algorithms based on tree-decompositions is dominated by thesize
(number of bags) of the tree-decompositions. It is then interesting to minimize the size of the tree-decompositions. In this report, we consider the problem of computing a tree-decomposition of a graph with width at mostkand minimum size. More precisely, we focus on the following problem: given a fixedk ≥ 1, what is the complexity of computing a tree-decomposition of width at mostkwith minimum size in the class of graphs with treewidth at mostk? We prove that the problem is NP-complete for any fixedk≥4and polynomial fork≤2; fork= 3, we show that it is polynomial in the class of trees and 2-connected outerplanar graphs.
1
Introduction
Atree-decompositionof a graph [13] is a way to representGby a family of subsets of its vertex-set organized in a tree-like manner and satisfying some connectivity property. ThetreewidthofGmeasures the proximity ofGto a tree. More formally, a tree decomposition ofG= (V, E)is a pair(T,X)whereX ={Xt|t∈V(T)}is a family of subsets,
calledbags, ofV, andT is a tree, such that:
– St∈V(T)Xt=V;
– for any edgeuv∈E, there is a bagXt(for some nodet∈V(T)) containing bothuandv; – for any vertexv∈V, the set{t∈V(T)|v∈Xt}induces a subtree ofT.
Thewidthof a tree-decomposition(T,X)ismaxt∈V(T)|Xt| −1and itssizeis order|V(T)|ofT. The treewidth of
G, denoted bytw(G), is the minimum width over all possible tree-decompositions ofG.
If T is constrained to be a path,(T,X)is called apath-decompositionof G. The pathwidth ofG, denoted by
pw(G), is the minimum width over all possible path-decompositions ofG.
Tree-Decompositions are the corner-stone of many dynamic programming algorithms for solving graph problems. As an example, the famous Courcelle’s Theorem states that any problem expressible in MSOL can be solved in linear-time in the class of bounded treewidth graphs [6]. Another framework based on graph decompositions is the bi-dimensionality theorythat allowed the design of sub-exponential-time algorithms for many problems in the class of graphs excluding some fixed graph as a minor (e.g., [7]). Given a tree-decomposition with widthwand sizen, the time-complexity of most of such dynamic programming algorithms can be expressed asO(2wn)
(orO(2wlogwn)
in the case ofglobalproblems). Therefore, the problem of computing tree-decompositions with small width has drawn much attention in the last decades. It has been extensively studied and investigated from different angles: parametrized complexity, exact or approximation algorithms.
The above mentioned algorithms have mainly a theoretical interest because, on the one hand, their time-complexity exponential depends on the treewidth of graphs and, on the other hand, as far as we know, no practical algorithm ex-ists that computes a “good” tree-decomposition for graphs with treewidth at least5. However, in case of small (≤4) ⋆This work has been partially supported by European Project FP7 EULER, ANR project Stint (ANR-13-BS02-0007), the
treewidth graphs, efficient (i.e., practical) algorithms exist to compute tree-decompositions with optimal width. More-over, in such case, the time-complexity of above-mentioned dynamic programming algorithms becomes dominated by the size of the tree-decompositions and, therefore, it becomes interesting to minimize it.
In report, we study the problem of computing tree-decompositions with minimum size. Obviously, if the width is not constrained, then the problem is trivial since there always exists a tree-decomposition of a graph with one bag (the full vertex-set). Hence, given a graphGand an integerk≥tw(G), we consider the problem of minimizing the size of a tree-decomposition ofGwith width at mostk.
Related Work. The problem of computing “good” tree-decompositions has been extensively studied. Computing
optimal tree-decomposition - i.e., with widthtw(G)- is NP-complete in the class of general graphsG[1]. For any fixedk≥1, Bodlaender designed an algorithm that computes, in timeO(kk3
n), a tree-decomposition of widthkof anyn-node graph with treewidth at mostk[3]. Very recently, a single-exponential (ink) algorithm has been proposed that computes a tree-decomposition with width at most5kin the class of graphs with treewidth at mostk[4]. As far as we know, the only practical algorithms for computing optimal tree-decompositions hold for graphs with treewidth at most1(trivial sincetw(G) = 1if and only ifGis a tree),2(graphs excludingK4as a minor) [16],3[2, 11, 12] and 4[14].
We are not aware of any work dealing with the computation of tree-decompositions with minimum size. In [8], Dereniowskiet al.consider the problem of size-constrained path-decompositions. Given any positive integerkand any graphGwith pathwidth at mostk. Letlk(G)denote the smallest size (length) of a path-decomposition ofGwith width
at mostk. For any fixedk≥4, computinglkis NP-complete in the class of general graphs and it is NP-complete, for
any fixedk≥5, in the class of connected graphs [8]. Moreover, computinglkcan be solved in polynomial-time in the
class of graphs with pathwidth at mostkfor anyk≤3. Finally, the “dual” problem is also hard: for any fixeds≥2, it is NP-complete in general graphs to compute the minimum width of a tree-decomposition with sizes[8]6.
Our results.Letkbe any positive integer andGbe any graph. Iftw(G)> k, let us setsk(G) =∞. Otherwise, let
sk(G)denote the minimum size of a tree-decomposition ofGwith width at mostk. See a simple example in Fig. 1. We first prove in Section 2 that, for any (fixed)k≥4, the problem of computingsk is NP-hard in the class of graphs
with treewidth at mostk. Moreover, the computation ofskfork≥5is NP-hard in the class of connected graphs with
treewidth at mostk. Furthermore, the computation ofs4is NP-complete in the class of planar graphs with treewidth
3. In Section 3, we present a general approach for computingsk for anyk≥1. In the rest of the report, we prove that
computings2can be solved in polynomial-time. Finally, we prove thats3can be computed in polynomial time in the
class of trees and 2-connected outerplanar graphs.
a 1 s G b v u c a b v u c b b a (G) = 4 s2 a b v u c b b (G) = 2 s3 a b v u c a (G) = 2 b v u c a k>3 s (G) = 1
Fig. 1.Given a treeGwith five vertices, for anyk≥1, a minimum size tree decomposition of width at mostkis shown. So we see thats1(G) = 4,s2(G) =s3(G) = 2,sk>3(G) = 1.
2
NP-hardness in the class of bounded treewidth graphs
In this section, we prove that: 6
Theorem 1. For any fixed integerk ≥4(resp.,k≥5), the problem of computingskis NP-complete in the class of
graphs (resp., of connected graphs) with treewidth at mostk.
Note that the corresponding decision problem is clearly in NP. Hence, we only need to prove it is NP-hard. Our proof mainly follows the one of [8] for size-constrained path-decompositions. Hence, we recall here the two steps of the proof in [8]. First, it is proved that, if computinglkis NP-hard for anyk≥1in general graphs, then the
computation oflk+1is NP-hard in the class of connected graphs. Second, it is shown that computingl4 is NP-hard
in general graphs with pathwidth4. In particular, this implies that computingl5is NP-hard in the class of connected
graphs with pathwidth5. The second step consists of a reduction from the3-PARTITION problem [9] to the one of computingl4. Precisely, for any instanceIof3-PARTITION, a graphGIis built such thatIis a YES instance if and
only ifl4(GI)equals a defined valueℓI.
Our contribution consists first in showing that the first step of [8] directly extends to the case of tree-decompositions. That is, it directly implies that, if computingskis NP-hard for somek≥4in general graphs, then so is the
computa-tion ofsk+1in the class of connected graphs. Our main contribution of this section is to show that, for the graphsGI
built in the reduction proposed in [8], any tree-decomposition ofGIwith width at most4and minimum size is a path
decomposition. Hence, in this class of graphs,l4=s4and, for any instanceIof3-PARTITION,Iis a YES instance
if and only ifs4(GI)equals a defined valueℓI. We describe the details in what follows.
Lemma 1. If the problem of computingskfor an integerk≥1is NP-complete in general graphs, then the
computa-tion ofsk+1is NP-complete in the class of connected graphs.
Proof. LetGbe any graph. We construct an auxiliary connected graphG′
fromGby adding a vertexaadjacent to all vertices inV(G). Given two integersk, s≥1, in the following, we prove that there is a tree decomposition ofGwith width at mostkand size at mostsif and only if there is a tree decomposition ofG′
with width at mostk+ 1and size at mosts.
First, assume that(T,X)is a tree decomposition ofGwith width at mostkand size at mosts. Addain each bag ofX. Then we obtain a tree decomposition ofG′
with width at mostk+ 1and size at mosts. Now let(T′,X′)
be a tree decomposition ofG′
with width at mostk+ 1and size at mosts. We are going to find a tree decomposition ofGwith width at mostkand size at mosts. LetXabe the set of all bags inX′ containinga.
LetTa be the subtree ofT′ induced by the bags inXa. Every vertexv ∈ V(G)is contained in a bag inXa because
va∈E(G′)
. For any edgeuv∈E(G), there is a bagX ⊇ {a, u, v}inX′
since{a, u, v}induces a clique inG′
. So
X ∈ Xa. Deleteain each bag ofXaand denote byX−the obtained set of bags. So(Ta,X−)is a tree decomposition
ofGwith width at mostkand size at mosts.
Before doing the reduction from the 3-PARTITIONproblem to the problem of computings4, let us first recall its
definition.
Definition 1. [3-PARTITION]
Instance: A multisetSof3mpositive integersS= (w1, . . . , w3m)and an integerb.
Question: Is there a partition of the set {1, . . . ,3m} into m sets S1, . . . , Sm such that
P
i∈Sjwi = b for each
j= 1, . . . , m?
This problem is NP-complete even if|Sj|= 3for allj= 1, . . . , m[9].
Given an instance of 3-PARTITION, in the following, we construct a disconnected graphG(S, b)as in [8]. First, for eachi ∈ {1, . . . ,3m}, we construct a connected graphHias follows. Takewi copies ofK3, denoted byK3i,q ,
q = 1, . . . , wi, and wi−1 copies ofK4, denoted byK4i,q ,q = 1, . . . , wi−1 (the copies are mutually disjoint).
Then for eachq= 1, . . . , wi−1, we identify two different vertices ofK i,q
4 with a vertex ofK i,q
3 and with a vertex
ofK3i,q+1, respectively. This is done in such a way that each vertex of eachK3i,qis identified with at most one vertex from other cliques. Informally the cliques form a ’chain’ in which the cliques of size 3 and 4 alternate. See Figure 2(a) for an example ofHiwherewi = 3.
Second, we construct a graph Hm,b as follows. Takem+ 1copies ofK5, denoted byK51, . . . , K5m+1, and m
copies of the path graphPbof lengthb(Pbhasbedges andb+ 1vertices), denoted byPb1, . . . , Pbm. (Again, the copies
3 i,1 K 3 i,2 K 3 i,3 K 4 i,1 K 4 i,2 K (a)Hi, wherewi= 3. 5 1 K 5 2 K 5 3 K 4 1 P 4 2 P (b)H2,4
Fig. 2.Examples of gadgets in graphG(S, b).
K5j, and identify the other endpoint with a vertex ofK5j+1. Moreover, do this in a way that ensures that, for eachj, no vertex ofK5jis identified with the endpoints of two different paths. See Figure 2(b) for an example ofH2,4.
LetG(S, b)be the graph obtained by taking the disjoint union of the graphsH1, . . . , H3mand the graphHm,b.
In the following, we prove that there is a tree decomposition ofG(S, b)of width 4 and size at mosts = 1−2m+ 2P3mi=1wiif and only if there is a partition of the set{1, . . . ,3m}intomsetsS1, . . . , Smsuch thatPi∈Sjwi=bfor eachj= 1, . . . , min the instance of 3-PARTITION.
In Lemma 2.2 of [8], a path decomposition ofG(S, b)of width 4 and length1−2m+ 2P3mi=1wiis constructed
if there is a partition of the set{1, . . . ,3m}intomsetsS1, . . . , Smsuch thatPi∈Sjwi=bfor eachj= 1, . . . , min the instance of 3-PARTITION. Obviously, this path decomposition is also a tree decomposition ofG(S, b)of width 4 and sizes. So we have the following lemma.
Lemma 2. Given a multisetSof3mpositive integersS= (w1, . . . , w3m)and an integerb, if there is a partition of
the set{1, . . . ,3m}intomsetsS1, . . . , Smsuch thatPi∈Sjwi =bfor eachj = 1, . . . , m, thenG(S, b)has a tree decomposition of width at most 4 and size at mosts= 1−2m+ 2P3mi=1wi.
Now we prove the other direction.
Lemma 3. IfG(S, b)has a tree decomposition(T,X)of width at most 4 and size at mosts= 1−2m+ 2P3mi=1wi,
then there is a partition of the set{1, . . . ,3m}intomsetsS1, . . . , Smsuch that
P
i∈Sjwi=bfor eachj= 1, . . . , m.
Proof. Lemma 2.6 in [8] proved that ifG(S, b)has a path decomposition(T,X)of width at most 4 and length at most
1−2m+ 2P3mi=1wi, then there is a partition of the set{1, . . . ,3m}intomsetsS1, . . . , Smsuch thatPi∈Sjwi=b for eachj = 1, . . . , m. So it is enough to prove that any tree decomposition(T, X)ofG(S, b)of width at most 4 and size at mosts= 1−2m+ 2Pi=13mwiis a path decomposition ofG(S, b).
As proved in Lemma 2.3 of [8], each bag in(T, X)contains exactly one of the cliquesK3i,q, K i,q 4 , K
j
5. Indeed,
each of these cliques has size at least 3. Moreover, any two of them share at most one vertex, and no two cliques of size 3 (K3i,q) share a vertex. So each bag of(T,X)contains at most one of the cliquesK
i,q 3 , K i,q 4 , K j 5. However, for
any clique, there is a bag in(T,X)containing its vertices. Sincesequals the number of the cliquesK3i,q, K4i,q, K5j, each bag of(T,X)contains exactly one of them.
Moreover let us prove that any edge in K4i,q, K5j, Pbj (i.e. both the two endpoints of the edge) is contained in exactly one bag. Since each bag in(T, X)contains exactly one of the cliquesK3i,q, K4i,q, K5j, the two endpoints of any edge in the pathsP1
b, . . . , P m
b are contained in a bag containing someK i,q
3 . (The bags containing aK i,q
4 (resp.,K j 5)
cannot add another two vertices (resp., one vertex) since(T,X)is a tree decomposition of width at most 4.) Every bag containing someK3i,q contains at most one edge in the pathsPb1, . . . , P
m
b , because the bag can add at most another
two vertices and anyK3i,q andP j
b are disjoint. There arembedges in the pathsPb1, . . . , P m
b and there arembbags
containing someK3i,q, so every bag containing aK i,q
3 contains exactly one edge in the pathsPb1, . . . , P m
b . So any edge
in the pathsP1 b, . . . , P
m
b is contained in exactly one bag. Also each bag containing someK i,q
3 contains 5 vertices, so
it does not contains any edge (i.e. both its two endpoints) inK4i,qorK j
5. Therefore, any edge onK i,q 4 , K
j
5is contained
in exactly one bag.
Now we prove that there are only two leaves inT and soT is a path. If a bag containing someK3i,q and an edge
(a)F 1 F F2 F3 4 1 P 4 2 P (b)H2,4
Fig. 3.Example of the new gadget inG(S, b).
other edges inG(S, b). This is a contradiction with any edge (its two endpoints) onPbjare contained only in one bag.
So any bag containing someK3i,qis not a leaf bag inT. Similarly, we can prove that any bag containing anyK i,q 4 or
K5jfor1< j < m+ 1is not a leaf bag inT. Thus there are only two bags containingK1
5andK5m+1are leaves inT.
Then we get the following corollary.
Corollary 1. It is NP-complete to computes4in the class of graphs of treewidth at most4.
Theorem 1 follows from Lemma 1 and Corollary 1. We furthermore modify the reduction to prove theorem 2.
Theorem 2. It is NP-complete to computes4in the class of planar graphs of treewidth at most3.
Proof. As in the previous reduction, we build a graphG(S, b)for an instance of 3-PARTITION; we keep the subgraphs
Hias they are and modify the graphHm,bas follows. We replace them+1copies ofK5bym+1copies of the graphF
that consists of aK4and aK3sharing an edge as depicted in Figure 3(a). We denote the copies byF1, F2, . . . , Fm+1.
The new graphG(S, b)we obtain is planar and has treewidth3.
Lemma 2 is still true and for 3 to be correct we need to prove that ifG(S, b)has a tree decomposition(T,X)of width at most 4 and size at mosts= 1−2m+ 2P3mi=1wi, then there is a bag of(T,X)containingFi, for eachFi,
i∈1, . . . , m+ 1. Let us denote byKi
3andK4i the two cliques sharing exactly one edge that formFi. Each of these
cliques, should appear in one bag. Note that among all the cliques ofG(S, b), the only cliques that can coexist in a bag are of the formKi
3andK4i since the sum of the number of vertices of any other two cliques is more than5. Let us
suppose that there existsj∈1, . . . , m+ 1such that no bag of(T,X)containsFj, i.e.K3jandK j
4are not in the same
bag. In this case the number of bags of(T,X)is at least the number of the cliquesK3i,q, K i,q 4 , Ki ′ 4 (i ′ 6 =j), plus the two bags containingK3jandK
j
4. This gives a size of at least2−2m+ 2
P3m
i=1wiwich is not possible.
3
Notations and preliminaries
In this section, we present the definitions and notations used throughout the report and some well-known facts about tree-decompositions.
3.1 Notations
Given a graphG= (V, E), for anyS⊆V, For an integerc≥0, a graphG= (V, E)isc-connectedif|V|> cand no subsetV′⊆V
with|V′|< c
is a separator inG. A2-connected componentofGis a maximal 2-connected subgraph. Let (T,X)be any tree-decomposition of G. Abusing the notations, we will identify a node t ∈ V(T)and its corresponding bagXt∈ X. This means that, e.g., instead of sayingt∈V(T)is adjacent tot′ ∈V(T)inT, we can
also say thatXt∈ X is adjacent toXt′ ∈ X inT. A bagB ∈ X is called aleaf-bagifBhas degree one inT. Let
k≥1andGbe a graph withtw(G)≤k. A subsetB ⊆V(G)is ak-potential-leafif there is a tree-decomposition
(T,X)with width at mostkand sizesk(G)such thatBis a leaf bag of(T,X). A subgraphH ⊆V is ak -potential-leafofGifV(H)is ak-potential-leaf ofG. Note that ak-potential-leaf has size at mostk+ 1. Given a class of graphs Cand integerk ∈N∗
, a set of graphsP is called acomplete set ofk-potential-leavesofC, if for any graphG∈ C, there exists a graphH ∈ Psuch thatHis ak-potential-leaf ofG.
A tree-decomposition isreducedif no bag is contained in another one. It is straightforward that, in any leaf-bagB
of reduced tree-decomposition, there isv ∈V such thatvappears only inBand soN[v]⊆B. Note that it implies that any reduced tree-decomposition has at mostn−1bags.
In the following we define twotransformation rules, that take a tree-decomposition (T,X)of a graph G, and computes another one without increasing the width nor the size.
Leaf. LetX ∈ X andNT(X) ={X1,· · · , Xd}. Assume that, for any1 < i≤d,Xi∩X ⊆X1. Let(T∗,X∗) =
Leaf(X, X1,(T,X))denote the tree-decomposition ofGobtained by replacing each edgeXiX ∈E(T)by an
edgeXiX1for any1< i≤d. Note thatX becomes a leaf-bag after the operation. See in Fig. 4. Reduce. LetXX′ ∈E(T)
withX ⊆ X′
. Let(T∗,X∗) =Reduce(X, X′,(T,X))
denote the tree-decomposition ofGobtained by deleting the bagX from the tree-decompositionLeaf(X, X′,(T,X))
. Note that the size of the tree decomposition is decreased by one after the operation.
From any tree-decomposition ofGwith widthkand sizes, it is easy to obtain a reduced tree-decomposition ofG
with width at mostkand size at mosts−1by applying the Reduce operation while it is possible (i.e., while a bag is contained in another one). In particular, any minimum size tree decomposition is reduced.
1 X 2 X d X X 1 T 2 T d T 1 X 2 X d X X 1 T 2 T d T
➡
( T, X ) ( T*, X*)Fig. 4.In a tree decomposition(T,X),NT(X) ={X1,· · ·, Xd}and for any1< i≤d,Xi∩X⊆X1. For1≤i≤d,Ti∪Xi induces the subtree containingXiinT\ {XXi}. Replace each edgeXiX ∈ E(T)by an edgeXiX1 for any1< i ≤d. This gives a tree decomposition(T∗,X∗) =Leaf(X, X1,(T,X)).Xis a leaf-bag in(T∗,X∗).
We conclude this section by a general lemma on tree-decompositions. This lemma is known as folklore, we recall it for completness.
Lemma 4. Let(T,X)be a tree decomposition of a graphG. LetX ∈ X andv, w ∈X. If there exists a connected component inG\X containing a neighbor ofv and a neighbor ofw, then there is a neighbor bag ofX in(T,X)
containingvandw.
Proof. First, let us note that, for any connected subgraphH of G, the set of bags of T that contain a vertex ofH
induces a subtree ofT(the proof is easy by induction on|V(H)|).
LetCbe a connected component inG\X containing a neighbor ofvand a neighbor ofw. By above remark, let
T′
Cbe the subtree ofT induced by the bags that contain some vertex ofC. Moreover, because no vertices ofC are
contained in the bagX, thenT′
Cis a subtree ofT\X. LetTCbe the connected component ofT\Xthat containsTC′.
LetY ∈V(TC)be the bag ofTCwhich is a neighbor ofX inT. Letx∈N(v)∩Cbe a neighbor ofvinC. Then
there exists a bagZ∈ X inTCcontaining bothxandv. So bothXandZcontain vertexv. Then the bagY, which is
on the path betweenXandZinT, also containsv. Similarly, we can prove thatw∈Y.
Corollary 2. Let(T,X)be a tree decomposition of a 2-connected graphG. LetX ∈ X and|X| ≤2. Then there is a neighbor bagY ofXin(T,X)such thatX ⊆Y.
Proof. SinceGis 2-connected,|V(G)| ≥3. So there exist at least another bag exceptX inX.
If|X| = 1, letX = {v}. Then there is a neighbor bagY of X containingv, sinceGis 2-connected andv is adjacent to some vertices inG. SoX ⊆Y.
OtherwiseX = 2and letX ={v, w}. LetG1be any connected component inG\X. Ifvis not adjacent to any
vertex inG1, then{w}separatesV(G1)from{v}. It contradicts with the assumption thatGis 2-connected. So any
connected component inG\Xcontaining a neighbor ofvand a neighbor ofw. From Lemma 4, there is a neighbor bagY ofX containingv, w, i.e.X ⊆Y.
3.2 General approach
In what follows, we propose polynomial-time algorithms to compute minimum-size tree-decompositions of graphs with small treewidth. Our algorithms mainly use the notion of potential-leaf.
Let k ≥ 1 andG = (V, E)be a graph withtw(G) ≤ k. The key idea of our algorithms is to identify a fi-nite complete set of potential-leaves. Then, our algorithms are recursive: given a graphGand ak-potential-leafH
from the complete set, we compute a minimum-size tree-decomposition ofGby addingH to a minimum-size tree-decomposition of a smaller graph.
The next lemmas formalize the above paragraph.
Lemma 5. Letk≥1andG= (V, E)be a graph withtw(G)≤k. LetB ⊆V be ak-potential-leaf ofG. LetS⊂B
be the set of vertices ofBthat have a neighbor inV \B. Thensk(G) =sk(GS\(B\S)) + 1.
Proof. Let us first provesk(G)≤sk(GS\(B\S)) + 1. Suppose that(TS,XS)is a minimum size tree decomposition
of width at mostkof the graphGS\(B\S). Then there exists a bagX ∈ XS containingSbecauseS induces a
clique in the graphGS\(B\S). So add the bagB and make it adjacent toX in the tree decomposition(TS,XS).
Then we obtain a tree decomposition of width at mostkfor graphGof sizesk(GS\(B\S)) + 1.
Now we prove thatsk(G)≥sk(GS \(B\S)) + 1. Let(T,X)be a minimum size tree decomposition ofGof
width at mostksuch thatB is a leaf bag in it. Note that, ifB =V thenGS \(B \S)is the empty graph. Let us
assume thatB⊂V. Then(T,X)is also a tree decomposition ofGS. LetBbe adjacent to the bagY in(T,X). Then
S ⊂Y since each vertex inSis contained in another bag in(T,X). Let(T′,X′)
be the tree decomposition obtained by deleting the vertices inB\Sin all the bags of(T,X). ThenBis changed toB′=S∈ X′
and letY be changed to
Y′∈ X′
. SoB′⊆Y′
. Then the tree decompositionReduce(B′, Y′,(T′,X′))
is a tree decomposition ofGS\(B\S)
of sizesk(G)−1. Sosk(G)−1≥sk(GS\(B\S)).
This lemma implies the following corollary:
Corollary 3. Letk∈N∗andCbe the class of graphs with treewidth at mostk. If there is ag(n)-time algorithmA k
that, for anyn-vertex-graphG∈ C, computes ak-potential-leaf ofG. Thenskcan be computed inO(g(n)·n)time in
the class ofn-vertex graphs inC. Moreover, a minimum size tree decomposition of width at mostkcan be constructed in the same time.
Proof. LetG∈ Cbe an-vertex-graph. Let us apply AlgorithmAkto find a subgraphHofGing(n)time, which is a
k-potential-leaf ofG. LetS⊂V(H)be the set of vertices having a neighbor inG\H andG′
=GS\(V(H)\S).
Then, by Lemma 5,sk(G) = sk(G′) + 1. Finally, |V(G′)| ≤ n−1 andG′ has treewidth at most k. We then
proceed recursively. So the total time complexity is O(g(n)·n). Moreover, for any minimum size (sk(G′ )) tree decomposition(T′
,X′ )ofG′
of widthk, there is a bagXcontainingSsinceSinduces a clique inG′
. Add a new bag
N =V(H)adjacent toXin(T′
,X′
). The obtained tree decomposition is a minimum size (sk(G) =sk(G′
) + 1) tree decomposition ofGof width at mostk.
4
Graphs with treewidth at most
2
In this section, we describe algorithmA2computes a2-potential-leaf of a given graph. In particular, all graphs
consid-ered in this section have treewidth at most2, i.e. partial 2-trees. Please see a complete set of 2-potential-leaf of graphs of treewidth at most 2 in Fig. 5. We are going to prove that any of the subgraphs in Fig. 5 is a potential-leaf and then that each non-empty graph of treewidth at most 2 contains one of them as a 2-potential-leaf.
q p q b G f c a c (a) a f p f α f b G G G G (b) (c) (d) (e)
see in Lemma 6 in Lemma 7 in Lemma 8 in Lemma 9 in Lemma 9
Fig. 5.Complete set of 2-potential-leaves of graphs of treewidth at most 2.
Lemma 6. LetGbe a graph with treewidth at most2andp∈V(G)such thatN(p) ={f, q}andf has degree one (see in Fig. 5(a)). Then{f, p, q}is a 2-potential-leaf ofG.
Proof. Let(T,X)be any tree-decomposition ofGwith width at most2 and size at mosts ≥ 1. We show how to modify it to obtain a tree-decomposition with width at most2and size at mostsand in which{f, p, q}is a leaf bag.
Sincef p ∈E(G), there is a bagB in(T,X)containing bothf andp. We may assume thatBis the single bag containingf(otherwise, deleteffrom any other bag). Similarly, sincepq∈E(G), letXbe a bag in(T,X)containing bothpandq.
First, let us assume thatX =B ={f, p, q}. In that case, we may assume thatX is the single bag containingp
(otherwise, deletepfrom any other bag). IfXis a leaf bag, then the lemma is proved. Otherwise, letX1,· · · , Xdbe
the neighbors ofX inT. Sincefandpappear only inX, thenX∩Xi⊆ {q}for any1≤i≤d. If there is1≤i≤d
such thatq ∈ Xi, let us assume w.l.o.g., that q ∈ X1. By definition of the operationLeaf, the tree-decomposition
Leaf(X, X1,(T,X))has width at most2, same size as(T,X), andXis a leaf.
Second, consider the case whenX 6=B. There are two cases to be considered. EitherB ={f, p}orB={f, p, x} withx6=q. In the latter case, note that there is another bagB′
, neighbor ofB, that containsxunlessxis an isolated vertex ofG. In the former case or ifxappears only inB(in which case,xis an isolated vertex), letB′
be any neighbor ofB. Let(T′
,X′
)be obtained by deletingf, pin all bags of(T,X). Then, contract the edgeBB′
inT′
, i.e., remove
Band make any neighbor ofBadjacent toB′
. Note that, in the resulting tree-decomposition ofG\ {f, p}, there is a bagX′
containingqand with|X′| ≤
2(the bag that results fromX). Finally, add a bag{f, p, q}adjacent toX′
and, if nodexwas only inB, then addxtoX′
. The result is the desired tree-decomposition.
Lemma 7. LetGbe a graph with treewidth at most2andq∈V(G)such thatqhas at least two one-degree neighbors
f andp(see in Fig. 5(b)). Then{f, p, q}is a 2-potential-leaf ofG.
Proof. Let(T,X)be any tree-decomposition ofGwith width at most2 and size at mosts ≥ 1. We show how to modify it to obtain a tree-decomposition with width at most2and size at mostsand in which{f, p, q}is a leaf bag.
Sincef q ∈E(G), there is a bagB in(T,X)containing bothf andq. We may assume thatBis the single bag containingf(otherwise, deleteffrom any other bag). Similarly, sincepq∈E(G), letXbe a bag in(T,X)containing bothpandq. Again, we may assume thatXis the single bag containingp(otherwise, deletepfrom any other bag).
First, let us assume that X = B = {f, p, q}. If X is a leaf bag, then the lemma is proved. Otherwise, let
X1,· · ·, Xd be the neighbors ofX inT. Sincef andpappear only inX, thenX ∩Xi ⊆ {q}for any1 ≤ i≤d.
If there is1 ≤i≤dsuch thatq∈Xi, let us assume w.l.o.g., thatq∈X1. By definition of the operationLeaf, the
tree-decompositionLeaf(X, X1,(T,X))has width at most2, same size as(T,X), andXis a leaf.
Second, let us assume thatX ={f, q}orB={p, q}. In the former case, removepfrom any bag and addptoX. In the latter case, removef from any bag and addf toB. In both cases, we get a bag{f, p, q}as in the first case.
Otherwise, letB={f, q, x},x6=p, andX ={p, q, y},y6=f.
– If B andX are adjacent in T, then add a new bag N = {q, x, y}; remove B andX and make each of their neighbors adjacent to the new bagN and, finally, add a leaf-bag{f, p, q}adjacent toN. See in Fig. 6(a). The obtained tree-decomposition has the desired properties.
– Otherwise, if there is a neighborB′
ofBwithq, x∈B′
, then removeB, make all neighbors ofBadjacent toB′
and finally add a leaf-bag{f, p, q}adjacent toX. The obtained tree-decomposition has the desired properties.
– Otherwise, letB′
be the neighbor ofBon the path betweenBandX. In this case,q∈B′
andx /∈B′
. Moreover,q
does not belong to any neighbor ofBthat containsxand the other way around:xdoes not belong to any neighbor ofB that containsq. For any neighborY ofB withq ∈ Y (and hencex /∈ Y), replace the edgeY B ∈ E(T)
with the edgeY B′
. Finally, replace the edgeBB′ ∈
E(T)by the edgeBX. See in Fig. 6(b). In the resulting tree-decomposition ofG,BandXare adjacent and we are back to the first item.
B X 1 T T2
➡
q,p,y f,q,x f,p,q N 1 T q,x,y T2(a) In the tree decomposition(T,X), letT1∪B
(resp.T1 ∪B) induce the subtree containing B
(resp.X) inT\{BX}. DeleteBandXand make each of their neighbors adjacent to the new bag
N = {q, x, y}; and add a leaf-bag{f, p, q} ad-jacent toN. B X
➡
q,p,y f,q,x Y q,... q,... B' B X q,p,y f,q,x Y q,... q,... B' x,... Z x,... Z(b) To be simple and clear, we show only the in-duced path fromBtoX inT and two neighbors
Y, Z 6=B′ofB.Y containsqandZcontainsx.
Then we just changeYto be adjacent toB′instead
ofBand changeBto be adjacent toXinstead of
B′.
Fig. 6.Explanation of proof of Lemma 7.
Lemma 8. LetGbe a graph with treewidth at most2andq ∈V(G)such thatqhas one neighborf with degree1
and for any vertexw∈N(q)\ {f},{w, q}belongs to a 2-connected component ofG.
If Ghas an isolated vertex α, then {q, f, α} is a2-potential-leaf; otherwise{q, f} is a2-potential-leaf (see in Fig. 5(c)).
Proof. Let(T,X)be any tree-decomposition ofGwith width at most2 and size at mosts ≥ 1. We show how to modify it to obtain a tree-decomposition with width at most2and size at mostsand in which{f, q, α}is a leaf bag if
Ghas an isolated vertexα; and otherwise{f, q}is a leaf bag.
Sincef q ∈E(G), there is a bagB in(T,X)containing bothf andq. We may assume thatBis the single bag containingf(otherwise, deletef from any other bag).
1. IfB={f, q}, then the intersection ofBand any of its neighbor inTis empty or{q}. If there is a neighbor ofB
containingq, then letXbe such a neighbor; otherwise letXbe any neighbor ofB. By definition of the operation
Leaf, the tree-decompositionLeaf(B, X,(T,X))has width at most2, same size as(T,X), andBis a leaf. If there are no isolated vertices, we are done. Otherwise, if there is an isolated vertexαinG, then deleteαin all bags of the tree-decompositionLeaf(B, X,(T,X))and addαto bagB, i.e. makeB ={f, p, α}. The result is the desired tree decomposition.
2. Otherwise letB={f, q, x}.
(a) Ifx is a neighbor of q, then xand qare in a 2-connected component of G. So there exists a connected component inG\B containing a vertex adjacent toxand a vertex adjacent toq. From Lemma 4, there is
a neighborX ofB in(T,X)containing bothxandq. Then by definition of the operationLeaf, the tree-decompositionLeaf(B, X,(T,X))has width at most2, same size as(T,X), andBis a leaf. Then deletex
inB, i.e.B ={f, q}. Finally, ifαis an isolated vertex ofG, remove it to any other bag and add it toB. The result is the desired tree decomposition.
(b) Otherwisexis not adjacent toq. If there is a neighborX ofBin(T,X)containing bothxandq, then(T,X)
is modified as in case 2a. Otherwise, any neighbor ofBin(T,X)contains at most one ofqandx.
If there is a neighbor ofB inT containingq, then letY be such a neighbor ofB; otherwise letY be any neighbor ofB. Delete the edges betweenB and all its neighbors not containingxexceptY in(T,X)and make them adjacent toY.
If there is no neighbor ofBcontainingx, thenxis an isolated vertex and we get a tree decomposition of the same size and width as(T,X), in which there is a leaf bagB={f, q, x}. It is a required tree decomposition. Otherwise letZ be a neighbor of B in(T,X)containing x, then delete the edges between B and all its neighbors containingxexceptZ in(T,X)and make them adjacent toZ. NowBhas only two neighborsY
andZ andB∩Y ⊆ {q},B∩Z = {x}andY ∩Z = ∅. Delete the edge betweenBandZ and makeZ
adjacent toY. DeletexinB, i.e. makeB = {f, q}. See the transformations in Fig. 7. Then we get a tree decomposition of the same size and width as(T,X), in whichB = {f, q}is a leaf bag. Again, ifαis an isolated vertex ofG, remove it to any other bag and add it toB. The result is the desired tree decomposition.
B
➡
f,q,x Y no x q,... x,... x,... Z B f,q,x Y no x q,... x,... x,... Z➡
B f,q Y no x q,... x,... x,... Z W U W U W UFig. 7.To be simple and clear, we show only the subtree induced byB, Y and another three neighborsZ, W, UofB.Y contains
q;Z, Uboth containxandW does not containx. First we make the bag not containingx, e.g.W adjacent toY instead ofB; and make the bag containingxexceptZ, e.g.Uadjacent toZinstead ofB. Second, makeZadjacent toY instead ofBand deletex
inB. ThenB={f, q}is a leaf-bag.
Lemma 9. LetGbe a graph of treewidth at most 2. Letb ∈ V(G)withN(b) = {a, c}. IfN(a) = {b, c}(see in Fig. 5(d)) or if there is a path, with at least one internal vertex, betweenaandcinG\ {b}(see in Fig. 5(e)), then {a, b, c}is a 2-potential-leaf ofG.
Proof. LetG= (V, E)be a graph of treewidth at most 2. Letb ∈ V with exactly2neighborsa, c ∈ V satisfy the hypotheses of the lemma. IfV ={a, b, c}, the result holds trivially, so let us assume that|V| ≥4.
Let(T,X)be a reduced tree decomposition of width at most 2 ofG. From(T,X), we will compute a tree decom-position(T∗,X∗)
ofGwithout increasing the width or the size and such that{a, b, c}is a leaf-bag of(T∗,X∗)
. LetX be any bag of(T,X)containing{a, b}andY be any bag containing{b, c}. The bagsX, Y exist because
ab, bc∈E. IfX ={a, b}, then there exists a connected component inG\Xcontaining a neighbor ofaand a neighbor ofb. By Lemma 4, there is a neighbor ofXin(T,X)that contains bothaandb, contradicting the fact that(T,X)is reduced. So|X|= 3and, similarly,|Y|= 3.
– Let us first assume thatX=Y ={a, b, c}. In particular, it is the case whenN(a) ={b, c}since{a, b, c}induces a clique. We may assume thatbonly belongs to bagX(otherwise, removebfrom any other bag).
IfN(a) ={b, c}, then we can also assume thataonly belongs toX. LetZbe any neighbor ofBcontainingcif exists; otherwise letZbe any neighbor ofB (Z exists since|V| ≥4). Otherwise, there exists a pathP between
aandc inG\ {b}with at least one internal vertex. In this latter case, there exists a connected component in
G\Xcontaining a neighbor ofaand a neighbor ofc. So by Lemma 4, there is a neighbor bagZofX in(T,X)
– Otherwise,X ={a, b, x}andY ={b, c, y}withx6=candy6=a; and there exists a pathP betweenaandcin
G\ {b}with at least one internal vertex. LetQbe the path betweenXandY in(T,X). We may assume thatb
only belongs to the bags inQ, because otherwisebcan be removed from any other bag.
• IfX is adjacent toY, then by properties of tree-decomposition,X∩Y separatesaandc. Since{b}does not separateaandc,X∩Y ={b, x}, i.e.x=y. In this case,(T∗,X∗)
is obtained by makingX ={a, c, x}and removingY from(T,X), then making all neighbors ofY adjacent toX and finally, adding a bag{a, b, c} adjacent toX.
• Otherwise, letX′
be the bag in the pathQcontaininga, which is closest toY. Similarly, letY′
be the bag in the pathQcontainingc, which is closest toX. Finally, letQ′
be the path fromX′
toY′
inT and note that
bbelongs to each bag inQ′
andaandcdo not belong to any internal bag inQ′
. Then we may assume thatb
only belongs to the bags inQ′
, because otherwisebcan be removed from any other bag. IfX′
andY′
are adjacent inT, the proof is similar to the one in previous item. Otherwise, letZ be the neighbor ofX′
inQ′
. By properties of tree-decompositions,X′∩Z
separatesaandc. Since{b}does not separateaandc, letX′∩Z = {b, x′}. SinceZ 6={b, x′}
because(T,X)is reduced, thenZ ={b, x′, z}
for somez ∈ V. Replacebwithain all the bags. By doing this(T,X)is changed to a tree decomposition
(Tc,Xc)of the graphG/abobtained by contracting the edgeabinG. In(Tc,Xc), the bagX′
has become
Xc = {a, x′}
andZ is changed to beZc = {a, x′, z}. SoXc
can be reduced in(Tc,Xc)
. MoreoverY is changed toYc={a, c, y}. To conclude, let us add the bag{a, b, c}
adjacent toYc
in the tree decomposition
Reduce(Xc, Zc,(Tc,Xc))
. See in Fig. 8. The result is the desired tree-decomposition(T∗,X∗)
ofG.
X' Y'
➡
b,c,y'a,b,x' b,x',z
Z
Replace b with a in all bags
Y b,c,y X a,b,x X' Y' a,c,y' a,x' a,x',z Z Y a,c,y X a,x
➡
Reduce X' and add {a,b,c} adjacen to Y Y' a,c,y' a,x',z Z Y a,c,y X a,x a,b,c
Fig. 8.To be simple and clear, we show only the path fromXtoY. After the two transformations,{a, b, c}is a leaf-bag.
Before going further, let us introduce some notations. Abridgein a graphG = (V, E)is any subgraph induced by two adjacent verticesuandvofG(i.e.,uv∈E) such that the number of connected components strictly increases when deleting the edgeuv, but not the two verticesu, vinG, i.e.,G′
= (V, E\ {uv})has strictly more connected components thanG. A vertexv∈V is acut vertexif{v}is a separator inG. A maximal connected subgraph without a cut vertex is called ablock. Thus, every block of a graphG= (V, E)is either a 2-connected component ofGor a bridge or an isolated vertex. Conversely, every such subgraph is a block. Different blocks ofGintersect in at most one vertex, which is a cut vertex ofG. Hence, every edge ofGlies in a unique block, andGis the union of its blocks.
Let G = (V, E)be a connected graph and letr ∈ V. A spanning treeT of Gis a BFS-tree of G if for any
v ∈ V(G), the distance fromrtovinGis the same as the one inT. LetB ={C : Cis a block ofG}. Theblock graphofGis the graphB(G)whose vertices are the blocks ofGand two block-vertices ofB(G)are adjacent if the corresponding blocks intersect, that is,B(G) = (B,{C1C2 : C1, C2 ∈ BandC1∩C2 6=∅}). Note thatB(G)is
connected. Finally, ablock-treeofGis any BFS-treeF(with any arbitrary root) ofB(G). See an example in Fig. 9. There is a linear (in the number of edges) algorithm for computing all blocks in a given graph [10]. Also a BFS-tree can be found in linear (in the number of vertices plus the number of edges) time. So given a graphG= (V, E), we can compute a block treeF ofGinO(|V|+|E|)time.
1 C 2 C 3 C 5 C 4 C 6 C 7 C 8 C 9 C 10 C 11 C 1 C 2 C 3 C 4 C C5 6 C 7 C 8 C C9 10 C C11
G
B(G)
Fig. 9.GraphGis connected. Fori= 1, . . . ,11, eachCiis a block ofG.B(G)is the block graph ofG. The BFS tree ofB(G) with bold edges is a block tree ofGwith rootC1.
Theorem 3. There is an algorithm that, for anyn-vertex-m-edge-graph Gwith treewidth at most2, computes a 2 -potential-leaf ofGin timeO(n+m).
Proof. Ifn ≤ 3, thenV(G)is a 2-potential-leaf of G. Let us assume thatn ≥ 4. First, let us compute the set of isolated vertices inG, which can be done inO(n)time. IfGhas only isolated vertices, then any three vertices induce a 2-potential-leaf ofG. Otherwise, there is at least one edge inG.
LetG1be any connected component ofGcontaining at least one edge. If|V(G1)|= 2, then from Lemma 9, either
Ghas an isolated vertexαand{α, u, v}is a 2-potential-leaf or{u, v}is a 2-potential leaf.
Otherwise,|V(G1)| ≥3. Compute a block treeF ofG1rooted in an arbitrary blockR. This can be done in time
O(n+m). Note that any node inF corresponds to either a 2-connected component ofGor a bridgeuv∈E(G). Let
Cbe a leaf block inF, which is furthest fromRand|V(C)|is maximum. There are several cases to be considered.
1 C 2 C 3 C 5 C 4 C 7 C 8 C 9 C 11 C 1 C 2 C 3 C 4 C C5 7 C 8 C C9 11 C
G
F
Fig. 10.This graphGis an induced subgraph of the graph in Fig. 9. Its block treeF, with rootC1, has two blocks less than the one in Fig. 9 (the blocksC6andC10). All leaf blocks,C7, C8, C9, C11, inFcontains two vertices ofG.
– let us first assume thatCis a bridge inG, i.e.Cconsists of one edgef p∈E(G)andpis a cut vertex. Thenfhas degree one inGbecauseCis a leaf block inF. LetPbe the parent block ofCinF. Then any child blockAof
P inFconsists of one edge becauseChas the maximum number of vertices among all the children ofP; andA
IfP has another child block exceptCinFcontaining the cut vertexp, then this child block also consists of one edgef′
p ∈ E(G), wheref′
has degree one inGbecause this child is also a leaf block inF. (For example, in Fig. 10, takeCasC8, which intersectsC9with a cut vertex.) From Lemma 7,{f, p, f′}is a 2-potential-leaf.
OtherwisePhas only one child blockCinFcontaining the cut vertexp. Then any vertex inNG(p)\ {f}belongs toP. IfP is also a bridge inG, i.e.,Pconsists of one edgepq∈E(G), thenphas degree 2 inG. (For example, in Fig. 10, takeCasC11, whose parentC5is also a bridge inG.) From Lemma 6,{f, p, q}is a 2-potential-leaf
ofG. Otherwise,P is a 2-connected component ofGandp∈ V(G)satisfies the hypothesis of Lemma 8. (For example, in Fig. 10, takeCasC7, whose parentC4is a 2-connected component ofG.) Hence, eitherGhas an
isolated vertexαand{α, f, p}is a 2-potential-leaf or{f, p}is a 2-potential-leaf.
– Finally, let us assume thatCis a 2-connected component ofG. It is known that any graph with at least two vertices of treewidthkcontains at least two vertices of degrees at mostk[5]. There is no degree one vertex inCbecause
C is 2-connected. So there exists two vertices with degree 2 inC. SinceC is a leaf inF, there is only one cut vertex ofGinC. So there exists a vertexbinCwhich has degree two inG. If|V(C)| ≥ 4, then there exists a path between two neighborsa, cofbinG\ {b}containing at least one internal vertex. (For example, in Fig. 9, takeCasC10.) From Lemma 9,{a, b, c}is a 2-potential-leaf. OtherwiseCis a triangle{a, b, c}with at least two
vertices with degree2inG. Again from Lemma 9,{a, b, c}is a 2-potential-leaf. So the total time complexity isO(n+m).
Corollary 4. s2can be computed in polynomial-time in general graphs. Moreover, a minimum size tree decomposition
can be constructed in polynomial-time in the class of partial 2-trees.
Proof. LetGbe any graph. It can be checked in polynomial-time whethertw(G)≤2(e.g. see [17]). Iftw(G)>2, thens2=∞. Otherwisetw(G)≤2, then the result follows from Theorem 3 and Corollary 3.
5
Minimum-size tree-decompositions of width at most
3
In this section, we study the computation ofs3in the class of trees and 2-connected outerplanar graphs.
5.1 computation ofs3in trees
In this subsection, given a treeG, we show how to find a 3-potential-leaf inG. We characterize a complete set of 3-potential-leaves of trees in Fig. 11. We first prove that each of the subgraphs in Fig. 11 is a 3-potential-leaf and then that any tree with at least four vertices contains one of them.
g g h G p (a) p f g f p G G G (b) (c) (d) (e) ' f g f p G ' f p f f f ' f ''
see in Lemma 12 in Lemma 13 in Lemma 14 in Lemma 15 in Lemma 16
Lemma 10. Let(T,X)be a tree decomposition of a treeG. LetX ∈ X andNT(X) = {X1, . . . , Xd}ford≥ 1.
Suppose that for any1≤i≤d,Xi∩X ⊆ {x}. Then there is a tree decomposition(T′,X′)ofGof the same width
and size as(T,X)such thatXis a leaf bag.
Proof. If there is a bagXifor1≤i≤dcontainingx, then letB beXi. Otherwise letBbe any neighbor ofX. By
definition of the operationLeaf, the tree-decompositionLeaf(X, B,(T,X))is a desired tree decomposition.
Lemma 11. LetGbe a tree rooted atr∈V(G). Letf be a leaf inG. Letpbe the parent off and letgbe the parent ofpinG. Letphave degree 2 inG. Let(T,X)be a tree decomposition ofGof width at most3and size at mosts≥1. If there is no bag in(T,X)containing all off, p, g, then there is a tree decomposition(T′,X′)ofGof width at most
3 and size at mostssuch that{f, p, g} ∈ X′
is a leaf bag.
Proof. Sincef p ∈ E(G), there is a bagBin(T,X)containing bothf andp. We may assume thatB is the single bag containingf (otherwise, deletef from any other bag). Similarly, sincepg ∈ E(G), letX be a bag in(T,X)
containing bothpandg. LetPbe the path inT fromBtoX. Thenpis contained in all bags onPand we may assume thatpis not contained in any other bags (otherwise, deletepfrom any other bag). LetB′
be the neighbor ofBonP. ThenB∩B′ ⊇ {
p}. Note that it is possible thatB′ =X.
IfB={f, p}, then make all other neighbors ofBadjacent toB′
and deleteB. Add a bag{f, p, g}adjacent toX. The result is a desired tree decomposition(T′
,X′ ).
Otherwise,Bcontains at least one vertex not in{f, p}. IfB∩B′
={p}, then{p}separatesgfrom any vertex in
B\ {p}. SoB\ {p}={f}, i.e.,B ={f, p}. It contradicts with the assumption. So|B∩B′| ≥2
and let{p, x} ⊆B∩B′
. Then create a bagZ= (B\ {f, p})∪(B′\ {p, x})
. (Note thatx∈Z
sincex∈B.) So|Z| ≤4. MakeZadjacent to all neighbors ofBand all neighbors ofB′
; and delete the two bagsB
andB′
; and deletef, pfrom all bags. Finally add another new bagN ={f, p, g}adjacent to some bag containingg. The obtained tree decomposition has width at most3, same size as(T,X), and a bagN ={f, p, g}.
Lemma 12. LetGbe a tree rooted atr∈V(G)and|V(G)| ≥4. Letf be a leaf inG. Letpbe the parent off and letgbe the parent ofpinG. Suppose that bothpandghave degree 2. Lethbe the parent ofg(see in Fig. 11(a)), then
H =G[{f, p, g, h}]is a 3-potential-leaf ofG.
Proof. Let(T,X)be any reduced tree decomposition of width at most3and size at mosts≥1ofG. We show how to modify it to obtain a tree-decomposition with width at most3and size at mostsand in which{f, p, g, h}is a leaf bag.
From Lemma 11, we can assume that there is a bagB in(T,X)containing allf, p, g. We may assume thatBis the single bag containingf, p(otherwise, deletef, pfrom any other bag). Sincegh∈E(G), letY be a bag in(T,X)
containing bothhandg.
1. IfB =Y ={f, p, g, h}, then the intersection ofBand any of its neighbor inT is contained in{h}. A desired tree decomposition can be obtained from Lemma 10.
2. IfB ={f, p, g}, then the intersection ofB and any of its neighbors inT is contained in{g}. From Lemma 10, there is a tree-decomposition(T′,X′))
of the same width and size as the ones of(T,X)such thatB ={f, p, g} is a leaf. Then delete B in the tree-decompositionLeaf(B, B′,(T,X))
and add a new bag N = {f, p, g, h} adjacent toY. The obtained tree decomposition has the desired properties.
3. Otherwise,B ={f, p, g, x}wherex6=h. Then the intersection ofB and any of its neighbor inT is contained in{g, x}. LetP be the path inT fromB toY. Thengis contained in all bags onP. LetB′
be the neighbor of
B onP. Note that it is possible thatB′ = Y
. IfB∩B′ = {g}, then{g}
separateshfromx. So x ∈ {f, p} i.e. B = {f, p, g}, a contradiction with the assumption. So we have B∩B′ = {g, x}. By definition of the
operation Leaf, the tree-decomposition Leaf(B, B′,(T,X))
has width at most3, same size as (T,X), and
B = {f, p, g, x} is a leaf. Then deleteB in the tree-decomposition Leaf(B, B′,(T,X))
and add a new bag
N = {f, p, g, h}adjacent toY. The obtained tree decomposition has the desired properties since{g, x} ⊆ B′
and{g, h} ⊆Y.
Lemma 13. LetGbe a tree rooted atr ∈ V(G)and|V(G)| ≥ 4. Letf a leaf inG. Letpbe the parent off and letgbe the parent of pinG. Ifphas degree 2 andghas a childf′, which is a leaf inG(see in Fig. 11(b)), then
Proof. Let(T,X)be any reduced tree decomposition of width at most3and size at mosts≥1ofG. We show how to modify it to obtain a tree-decomposition with width at most3and size at mostsand in which{f, p, g, f′}
is a leaf bag.
From Lemma 11, we can assume that there is a bagB in(T,X)containing allf, p, g. We may assume thatBis the single bag containingf, p(otherwise, deletef, pfrom any other bag). Sincegf′ ∈
E(G), letY be a bag in(T,X)
containing bothf andg. We may assume thatY is the single bag containingf′
(otherwise, deletef′
from any other bag).
– IfB =Y ={f, p, g, f′}, then the intersection ofB
and any of its neighbor inT is contained in{g}. A desired tree decomposition can be obtained from Lemma 10.
– IfB={f, p, g}, then deletef′
inY and addf′
inB, then we are in the previous case.
– Otherwise,B ={f, p, g, x}wherex6=f′
. Then the intersection ofBand any of its neighbor inT is contained in{g, x}. LetPbe the path inT fromBtoY. Thengis contained in all bags onP. LetB′
be the neighbor ofB
onP. IfB∩B′
={g, x}, then by definition of the operationLeaf, the tree-decompositionLeaf(B, B′
,(T,X))
has width at most 3, same size as (T,X), and B = {f, p, g, x} is a leaf. Then in the tree-decomposition
Leaf(B, B′,(T,X))
, deletef′
inY and removexfromB and addf′
toB, i.e. makeB = {f, p, g, f′}. The
obtained tree decomposition has the desired properties since{g, x} ⊆B′
. OtherwiseB∩B′={g}. Deletef′
from the bagY and addxinY; deletexfromBand addf′
inB, i.e., make
B ={f, p, g, f′}; finally make all neighbors ofB
exceptB′
adjacent toY since now{g, x} ⊆Y. The result is the desired tree decomposition.
Lemma 14. LetGbe a tree rooted atr∈V(G)and|V(G)| ≥3. Letf be one of the furthest leaves fromr. Letpbe the parent off and letgbe the parent ofpinG. Ifghas degree at least 3 and any child ofghas degree 2 inG(see in Fig. 11(c)), thenH =G[{f, p, g}]is a 3-potential-leaf ofG.
Proof. Let(T,X)be any reduced tree decomposition of width at most3and size at mosts≥1ofG. We show how to modify it to obtain a tree-decomposition with width at most3and size at mostsand in which{f, p, g, f′}
is a leaf bag.
From Lemma 11, we can assume that there is a bagB in(T,X)containing allf, p, g. We may assume thatBis the single bag containingf, p(otherwise, deletef, pfrom any other bag).
1. IfB = {f, p, g}, then the intersection of B and any of its neighbor inT is contained in {g}. A desired tree decomposition can be obtained from Lemma 10.
2. Otherwise,B ={f, p, g, x}. Then the intersection ofBand any of its neighbor inT is contained in{g, x}. (a) If there is a neighborB′
of B such thatB ∩B′ = {g, x}, then by definition of the operationLeaf
, the tree-decompositionLeaf(B, B′,(T,X))
has width at most3, same size as(T,X), andB ={f, p, g, x}is a leaf. Then deletexinB in the tree-decompositionLeaf(B, B′
,(T,X))since{g, x} ⊆ B′
. The obtained tree decomposition has the desired properties.
(b) Otherwise any neighbor ofBcontains at most one ofgandx. Ifxis not adjacent tog, then there is a connected component inG\Bcontaining a neighbor ofgand a neighbor ofx. From Lemma 4, there exists a neighbor bag ofBin(T,X)containinggandx. It is a contradiction. So we havexis adjacent togin this case.
i. xis a child ofg. Thenxhas exactly one childy, which is a leaf inGsincefis one of the furthest leaves fromr. Sinceyx∈E(G), there is a bagY in(T,X)containing bothyandx. We may assume thatY is the single bag containingy(otherwise, deleteyfrom any other bag). Since{g, x} ⊂Band any neighbor ofB contains at most one ofg andx, any bag exceptB contains at most one ofg andx. Theng /∈ Y
becausex∈Y. Soy, x, gare not contained in one bag. From Lemma 11, we can modify(T,X)to obtain a tree-decomposition(T′,X′)
of width at most3and size at most shaving a leaf bagX = {y, x, g}. Note thatx(resp.y) plays the same role asp(resp.f) inG, i.e.,g, p, fandg, x, yare symmetric inG. Hence, the result is a desired tree decomposition.
ii. xis the parent ofg. Letp′
be another child ofgand letf′
be the child ofp′
, which is a leaf inG. Let
B′
be the bag in(T,X)containing bothf′
andp′
. We may assume thatB′
is the single bag containing
f′
(otherwise, deletef′
from any other bag). LetX′
be a bag containing bothp′
X′ 6
=B (becausep′
/
∈ B). Sinceg ∈ X′
any bag exceptBcontains at most one ofgandx, we have
x /∈X′
. In the following, we modify(T,X)to obtain a tree-decomposition(T′
,X′
)with width at most3
and size at mostshaving a bag{f′
, p′
, g}. Then we are in case 1, sinceg, p, fandg, p′
, f′
are symmetric inG.
IfB′ =X′ ={f′, p′, g}
then, we are done. IfB′ =X′ ={f′, p′, g, x′}. Thenx′
is notx, which is the parent ofg, sincex /∈X′
. So we can do as in case 2a or case 2(b)i. Otherwise,B′ 6=X′
. From Lemma 11, we can modify(T,X)to obtain a tree-decomposition with width at most3and size at mostshaving a leaf bag{f′, p′, g}.
Lemma 15. LetGbe a tree rooted atr ∈ V(G)and|V(G)| ≥ 4. Letf a leaf inG. Letpbe the parent off. Ifp
has exactly two childrenf, f′
inGand letgbe the parent ofpinG(see in Fig. 11(d)), thenH =G[{f, f′
, p, g}]is a 3-potential-leaf ofG.
Proof. Let(T,X)be any reduced tree decomposition of width at most3and size at mosts≥1ofG. We show how to modify it to obtain a tree-decomposition with width at most3and size at mostsand in which{f, f′
, p, g}is a leaf bag.
Sincef p ∈E(G), there is a bagB in(T,X)containing bothf andp. We may assume thatBis the single bag containingf(otherwise, deletef from any other bag). Similarly, letB′
be the single bag in(T,X)containing bothf′
andp. LetXbe a bag containing bothpandg.
1. IfB =B′ =X ={f, f′, p, g}, then we can assume thatB
is the single bag containingp(otherwise, deletep
from any other bag). So the intersection ofBand any of its neighbor inT is contained in{g}. Then a desired tree decomposition can be obtained from Lemma 10.
2. IfB =B′
={f, f′
, p}, then the intersection ofB and any of its neighbor inT is contained in{p}. LetY be a neighbor ofBinTcontainingp. By definition of the operationLeaf, the tree-decompositionLeaf(B, Y,(T,X))
has width at most 3, same size as (T,X), and B = {f, f′, p}
is a leaf. Then deleteB and add a new bag
N ={f, f′, p, g}
adjacent toX. The result is a desired tree decomposition. 3. IfB=B′
={f, f′
, p, x}andx6=g, then the intersection ofBand any of its neighbor inTis contained in{p, x}. Sincex /∈ {f, f′
, g},pis not adjacent tox. There is a connected component inG\B containing a neighbor of
pand a neighbor ofx. From Lemma 4, there exists a neighbor bag ofBin(T,X)containingpandx. LetY be such a neighbor ofBinT. By definition of the operationLeaf, the tree-decompositionLeaf(B, Y,(T,X))has width at most 3, same size as(T,X), andB ={f, f′
, p, x}is a leaf. Then deletexfromB and we get a tree decomposition having a bag{f, f′, p}. So we are in case 2.
4. IfB 6=B′
and|B| ≤ 3, then deletef′
inBand addf′
inB. Then we are in case 2 or 3. It is proved similarly if
B 6=B′
and|B′| ≤3
. 5. OtherwiseB6=B′
and|B|=|B′|= 4
. LetB ={f, p, x, y}andB′ ={f′, p, x′, y′}. LetP
be the path inTfrom
BtoB′
. Thenpis contained in all bags onP. LetY be the neighbor ofBonP. IfB∩Y ={p}, then{p}separates
xfromx′
. Butpis not a separator between any two vertices inV(G)\ {f, f′}. It is a contradiction. So w.l.o.g. we
can assume thatB∩Y ⊇ {p, x}. Deletingf, f′, p
in all bags of(T,X). Add a new bagZ={x, y} ∪Y \ {p, x} adjacent to all neighbors of the two bagsB, Y and deleteBandY. Finally add another new bagN ={f, f′, p, g}
adjacent to a bag containingg. The obtained tree decomposition has the desired properties.
Lemma 16. LetGbe a tree rooted atr∈V(G)and|V(G)| ≥4. Let all children ofpbe leaves inGandphave at least three childrenf, f′, f′′(see in Fig. 11(e)). ThenH=G[{p, f, f′, f′′}]is a 3-potential-leaf ofG.
Proof. Let(T,X)be any reduced tree decomposition of width at most3and size at mosts≥1ofG. We show how to modify it to obtain a tree-decomposition with width at most3and size at mostsand in which{p, f, f′, f′′}
is a leaf bag.
Since f p ∈ E(G), there is a bagB in(T,X) containing bothf andp. We may assume that B is the single bag containingf (otherwise, deletef from any other bag). Similarly, letB′
(resp.B′′
) be the single bag in(T,X)
containing bothf′
(resp.f′
) andp.
1. IfB =B′ =B′′={f, f′, f′′, p}, then the intersection ofB
and any of its neighbor inTis contained in{p}. A desired tree decomposition can be obtained from Lemma 10.
2. IfB =B′
={f, f′
, p}, then deletef′′
inB′′
and addf′′
inB. Then we are in case 1. It can be proved similarly ifB =B′′ ={f, f′′ , p}orB′ =B′′ ={f′ , f′′ , p}. 3. IfB =B′ = {f, f′, p, x} andx6=f′′
, then the intersection ofB and any of its neighbor inT is contained in {p, x}.
Ifxis a child ofp, thenxis also a leaf inGandxplay the same role asf′′
. Then we are in case 1. So in the following we assume thatxis not a child ofp.
Ifxis not the parent of p, thenpis not adjacent tox. So there is a connected component inG\B containing a neighbor of pand a neighbor of x. From Lemma 4, there exists a neighbor bag of B in(T,X)containing
p andx. LetY be such a neighbor of B in T. By definition of the operation Leaf, the tree-decomposition
Leaf(B, Y,(T,X))has width at most3, same size as(T,X), andB ={f, f′
, p, x}is a leaf. Then deletexfrom
Band we get a tree decomposition having a bag{f, f′
, p}. So we are in case 2. Otherwisexis the parent ofp. LetPbe the path inT fromBtoB′′
. Thenpis contained in all bags onP. LetY
be the neighbor ofBonP. IfB∩Y ={p, x}, then by definition of the operationLeaf, the tree-decomposition
Leaf(B, Y,(T,X))has width at most3, same size as(T,X), andB = {f, f′, p, x}
is a leaf. Then deletingx
fromB we are in case 2. Otherwise,B∩Y ={p}. So{p}separatesxfrom all vertices inB′′\ {p}. Then all
vertices inB′′\ {
p}are children ofpand so they are leaves inG. So we can assume that any vertex inB′′\ {
p} are contained only inB′′
(otherwise we can delete it in any other bags). Then deletef, f′
fromBand add vertices ofB′′\ {
f′′
, p}inB; and makeB′′
={f, f′
, f′′
, p}. Then we are in case 1. The casesB=B′′={f, f′′, p, x}
andx6=f′
orB′=B′′={f′, f′′, p, x}
andx6=f can be proved similarly. 4. Otherwise, none two off, f′
, f′′
are contained in a same bag. If|B| ≤3, then deletef′
inB′
and addf′
inB. Then we are in case 2 or 3. It is proved similarly if and|B′| ≤3
or|B′′| ≤3
.
Otherwise|B|=|B′|=|B′′|= 4
. In the following, we are going to modify(T,X)to obtain a tree-decomposition with width at most3and size at mostshaving a bagXcontaining at least two off, f′, f′′
orf ∈Xand|X| ≤3. Then we are in the above cases. Note that all children ofpplay the same role (they are all leaves) inG. So it is enough to get thatXcontains at least two children ofpor thatXcontains one child ofpand|X| ≤3.
LetTpbe the subtree inTinduced by all the bags containingp. If|V(Tp)| ≤2, there exists one bag containing at
least two children ofpsincephas at least three children. Then it is done. So we assume that|V(Tp)| ≥3. There is a bagR∈V(Tp)containing bothpandg. RootTpatRand letL∈V(Tp)be one of the furthest leaf bag inTp
fromR. If there is no child ofpinL, then we can deletepinLand considerTp\ {L}. So we can assume there is
a vertexl∈L, which is a child ofpinG. LetY be the neighbor ofLinTp. If the intersection ofL∩Y ={p},
thenpseparate any vertex inL\ {p}and any vertex inY \ {p}. So at least one ofL, Y, denoted asX, contains onlypand children ofp. Then eitherX contains at least two children ofporX contains only one children and |X|= 2. So(T,X)andXsatisfy the desired properties.
Otherwise,|L∩Y| ≥2. IfY has no other child exceptLinTp, thenY =6 Rsince|V(Tp)| ≥3. LetX ={p, l}if
Y contains no child ofp; andX ={p, l, l′}
ifY contains one childl′
ofp. Add a new bagZ=Y ∪L\X. Since |Y ∩L| ≥2,|Y ∪L| ≤6. Then|Z| ≤4, sinceX ⊆Y ∪Land|X| ≥2. MakeZ adjacent to all neighbors of
Y, LinTand deleteY, L. Finally makeXadjacent toR. The obtained tree decomposition andXhave the desired properties.
Otherwise,Y has at least another childL′
inTp. ThenL′is also a furthest leaf fromRinTp, sinceLis a furthest
leaf fromR. For the same reason asL, there is a vertexl′ ∈
L, which is a child ofpinG. LetL={l, p, x, y} andL′
={l′
, p, x′
, y′}. So the intersection of
L(resp.L′
) and any of its neighbors exceptY inT is contained in{x, y}(resp.{x′
, y′}). Create a new bag
N ={x, y, x′
, y′}
adjacent to all neighbor ofL, L′
and deleteL, L′
. Finally add another bagX = {p, l, l′}
adjacent toY. The obtained tree decomposition and X have the desired properties.
From Lemmas 12- 16 and Corollary 3, we obtain the following result.
Corollary 5. s3and a minimum size tree decomposition of width at most 3 can be computed in polynomial-time in the
class of trees.
LetGbe any tree. If|V(G)| ≤4, thenV(G)is a 3-potential-leaf. Let us assume that|V(G)| ≥5. RootGat any vertexr. Letf be one of the furthest leaves fromrinG. Letp, g, hbe the first three vertices on the path fromf tor
inG(if exist), i.e.pisf’s parent;gisp’s parent; andhisg’s parent inG.
– Ifg, pboth have only one child inG, then{f, p, g, h}is a 3-potential-leaf ofGfrom Lemma 12;
– Ifphas only one child andghas a childf′
, which is a leaf inG, then{f, p, g, f′}
is a 3-potential-leaf ofGfrom Lemma 13;
– Ifphas only one child and any child ofghas exactly one child, then{f, p, g} is a 3-potential-leaf ofGfrom Lemma 14;
– Ifphas only one child and there exist a childp′
ofg, which has exactly two childrenf1, f2, then{f1, f2, p′, g}is
a 3-potential-leaf ofGfrom Lemma 15;
– Ifphas only one child and there exist a childp′
ofg, which has at least three childrenf1, f2, f3, then{f1, f2, f3, p′}
is a 3-potential-leaf ofGfrom Lemma 16;
– Ifphas exactly two childrenf, f′
, then{f, f′
, p, g}is a 3-potential-leaf ofGfrom Lemma 15;
– Otherwisephas at least three childrenf, f′, f′′
, then{f, f′, f′′, p}
is a 3-potential-leaf ofGfrom Lemma 16. In fact, the algorithm for trees can be extended to forests by consider their connected component, i.e., trees. The only difference is in Lemma 14 the 3-potential-leaf becomes{f, p, g, α}if there is an isolated vertexαin the given forest.
5.2 Computation ofs3in 2-connected outerplanar graphs
In this subsection, given a 2-connected outerplanar graph G, we sho