CDMTCS

Research

Rep ort

Series

Practical Enumeration

Metho ds for Graphs of

Bounded and

Treewidth

Michael J. Dinneen

Department of Computer Science

University of Auckland

Auckland, New Zealand

CDMTCS-055

September 1997

Centre for Discrete Mathematics and Theoretical Computer Science

Practical Enumeration Metho ds for

Graphs of Bounded Pathwidth and

Michael J. Dinneen

Department of Computer Science

University of Auckland, Private Bag 92019

Auckland, New Zealand

Abstract. Using an algebraic representation for graphs of b ounded path-

width or treewidth we provide simple metho ds for generating these families in

increasing order of the number of vertices and edges. We also study canonic

representions of xed- and free- b oundaried graphs of b ounded width.

1 The Setting

Many combinatorial search problems can be limited to a domain of \b ounded width"

graphs. The goal of this pap er is to establish practical metho ds for generating graphs

of this typ e. For example, the enumeration techniques of this pap er have b een im-

plimented and successfully utilized in the search for forbidden minor characterizations

[CD94, CDF95]. This pap er is very much self-contained and concerns the combinatorial

notions of pathwidth and treewidth. We de ne and prove a few basic results ab out these

graph width parameters in Sections 2 and 3 b efore presenting our simple enumeration

metho ds in Section 4.

The reader is assumed to have a familiarity with graph theory, as may be obtained

from any one of the standard intro ductory graph theory texts (e.g. [BM76, CL86]). A

few of our basic graph-theoretical conventions follows, where we restrict our attention to

nite simple undirected graphs (i.e., those nite graphs without lo ops and multi-edges).

A graph G =(V; E ), in our context, consists of a nite set of vertices V and a set of edges

E , where each edge is an unordered pair of vertices. We use the variables n (sometimes

jGj) and m to denote the order (number of vertices) and size (number of edges) of a

graph.

We study the p opular notions of treewidth and pathwidth, intro duced by Rob ertson

and Seymour [RS83, RS84]. Informally, graphs of width at most k are subgraphs of

-like or path-like graphs where the vertices form cliques of size at most k +1. We are

interested in certain subsets of the set of all nite graphs. In particular, the graph families

de ned by all graphs with either pathwidth or treewidth at most k have \b ounded

combinatorial width." In general, the width of a graph is de ned in many p ossible ways, 1

often in uenced by the graph problems that are b eing investigated. For example, for

VLSI layout problems we may de ne the width of a (which represents

a circuit) as the least surface area needed over all layouts, where vertices and edge

connections are laid out on a grid. Two sets of graphs that we study are graphs of

b ounded pathwidth and treewidth. These width metrics and the corresp onding graph

families that are b ounded by some xed width are imp ortantforavariety of reasons:

1. These families are minor-order lower ideals.

2. They playa fundamental role in the pro of of the Graph Minor Theorem.

3. Many p opular classes of graphs are subsets of these families.

4. These widths are used to cop e with intractability.

5. There are many natural applications.

The rst statement is particularly imp ortant for forbidden-minor obstruction set com-

putations [CD94, CDF95]. Note that if H is a minor of a graph G then the pathwidth

(treewidth) of H is at most the pathwidth (treewidth) of G.

Regarding the development of graph algorithms, wewant to emphasize that there is

a common trend in that practical algorithms often exist for restricted families of graphs

(such as trees or planar graphs), while the general problems remain hard to solve for

arbitrary input. This tendency for ecient algorithms includes instances where the

problem's input is restricted to graphs of b ounded pathwidth or b ounded treewidth.

2 Intro duction to Pathwidth and Treewidth

The use of b ounded combinatorial width is imp ortant in such diverse areas as computa-

tional biology, linguistics, and VLSI layout design [KS93, KT92, Moh90]. For problems

in these areas, the graph input often has a sp ecial tree-like (or path-like) structure. A

measure of width of these structures is formalized as the treewidth (or pathwidth). It

is easy to nd examples of families of graphs with b ounded treewidth such as the sets

of series-parallel graphs, Halin graphs, outer-planar graphs, and graphs with bandwidth

at most k (see Section 2.3 and [Bo d86]). One also nds other natural classes of graphs

with b ounded treewidth in the study of the reliability of communication networks and in

the evaluation of queries on relational databases [MM91, Bie91, Arn85]. The treewidth

parameter also arises in places such as the eciency of doing Choleski factorization and

Gaussian elimination [BGHK95, DR83].

The pathwidth and treewidth of graphs have proven to b e of fundamental imp ortance

for at least two distinct reasons: (1) their role in the deep results of Rob ertson and 2

Seymour [RS83, RS86, RS91, RS], and (2) they are \common denominators" leading to

ecient algorithms for b ounded parameter values for many natural input restrictions

of NP-complete problems. To further explain this second phenomenon, consider the

classic NP-complete problem of determining if a graph G has a vertex cover of size

k , where b oth G and k are part of the input. It is known that if k is xed (i.e., not

part of the input) then all yes instances to the problem have pathwidth at most k .

This restricted problem can be solved in linear time for any xed k (e.g. see [CD94]).

For more examples see [Bo d86, FL92, Moh90]. In general, many problems, such as

determining the indep endence of a graph, can be solved in linear time when the input

also includes a b ounded-width path decomp osition (or tree decomp osition) of the graph

(see [Arn85, AP89, Bo d88a, CM93, WHL85] and [Bo d86] for many further references).

Examples of this latter typ e are di erent from the vertex cover example b ecause a width

b ound for the yes instances is not required (e.g., for every xed k there exists a graph

of indep endence k with arbitrarily large treewidth).

Another well-known fact ab out the set of graphs of pathwidth or treewidth at most

k is that each set is characterizable by a set of forbidden minors. We denote these

parameterized lower ideals by k {Pathwidth and k {Treewidth. Some recently dis-

covered obstruction sets for k {Treewidth, 1  k  3, are given in [APC87 ]. Besides

the two obstructions, K and S (K ), for 1{Pathwidth , a set of 110 obstructions for

3 1;3

2{Pathwidth (see [Kin89]) is the only other known forbidden-minor characterization

for b ounded pathwidth or treewidth.

2.1 Treewidth and k -trees

Informally, a graph G has treewidth at most k if its vertices can b e placed (with rep eti-

tions allowed) into sets of order at most k + 1 and these sets arranged in a tree structure,

where (1) for each edge (u; v )of G b oth vertices u and v are memb ers of some common

set and (2) the sets containing any sp eci c vertex induces a subtree structure. Fig-

ure 1 illustrates several graphs with b ounded treewidth (pathwidth). Below is a formal

de nition of treewidth.

De nition 1 A tree decomp osition of a graph G =(V; E ) is a tree T together with a

col lection of subsets T of V indexed by the vertices x of T that satis es:

x

[

1. T = V .

x

x2T

2. For every edge (u; v ) of G there is some x such that u 2 T and v 2 T .

x x

3. If y is a vertex on the unique path in T from x to z then T \ T  T .

x z y 3 Treewidth = 1 Treewidth = 2

contains contains at most k+1 at most k+1 vertices vertices

Treewidth k Pathwidth k

Figure 1: Demonstrating graphs with b ounded treewidth (and pathwidth). 4

The width of a tree decomposition is the maximum value of jT j1 over al l vertices x

x

of the tree T . A graph G has treewidth at most k if there is a tree decomposition of G

of width at most k . Path decomp ositions and pathwidth are de ned by restricting the

tree T to be simply a path (see Section 2.2 below).

De nition 2 A graph G is a k -tree if G is a k -clique (complete graph) K or G is

k

0

obtainedrecursively from a k -tree G by attaching a new vertex w to an induced k -clique

0

C of G , such that the open neighborhood N (w )= V(C). A partial k -tree is any subgraph

of a k -tree.

Alternatively, a graph G is a k -tree if

1. G is connected,

2. G has a k -clique but no (k + 2)-clique, and

3. every minimal separating set is a k -clique.

The ab ove result was taken from one of the many characterizations given in [Ros73].

The next useful result app ears in many places [ACP87 , RS86, Nar89].

Theorem 3 The set of partial k -trees is equivalent to the set of graphs with treewidth

at most k

2.2 Pathwidth and k -paths

To generate graphs of b ounded pathwidth (and treewidth) we build from graphs that

have a distinguished set of lab eled vertices. These are formally de ned next.

De nition 4 For a positive integer k , a k -simplex S of a graph G = (V; E ) is an

injective map @ : f1; 2;:::;kg ! V . A k-b oundaried graph B = (G; S ) is a graph

S

G together with a k -simplex S for G. Vertices in the image of @ are cal led b oundary

S

vertices (often denoted by @ ). The graph G is cal led the underlying graph of B .

We now de ne a family of graphs where each member has a linear structure. As in

Theorem 3, a graph has pathwidth at most k 1 if and only if it is a subgraph of an

underlying graph in the following set of k -b oundaried graphs. Our de nition of a k -path

is consistent (except for the base clique) with other de nitions that use a lab eled set of

b oundary vertices with one fewer vertex (see for example [BP71]). Later in this section,

Lemmas 9 and 11, we justify these two claims.

De nition 5 Agraph G is a (k 1)-path if there exists a k -boundariedgraph B =(G; S )

in the fol lowing family F of recursively generated k -boundaried graphs. 5

1. (K ;S) 2F where S is any k -simplex of the complete graph K .

k k

0 0 0 0

2. If B =((V; E );S) 2F then B =((V ;E );S ) 2F

0

where V = V [fvg for v 62 V , and for some j 2f1;2;:::kg:

0

(a) E = E [f(@ (i);v) j 1  i  k and i 6= j g, and

S

(

v if i = j

0

0

(b) S is de ned by @ (i)= :

S

@ (i) otherwise

S

A partial k -path is subgraph of a k -path.

Item 2 in the ab ove de nition states that a new b oundary vertex v can b e added as

long as it is attached to any current(k1)-simplex within the active k -simplex S . The

0

set of b oundary vertices of B is the closed neighborhood N [v ] of the new vertex v .

The de nition of a tree decomp osition is easily sp ecialized for this path-structured

case.

De nition 6 A path decomp osition of a graph G =(V; E ) is a sequence X ;X ;:::;X

1 2 r

of subsets of V that satisfy the fol lowing conditions:

[

1. X = V .

i

1ir

2. For every edge (u; v ) 2 E , there exists an X , 1  i  r , such that u 2 X and

i i

v 2 X .

i

3. For 1  i

i k j

The pathwidth of a path decomp osition X ;X ;:::;X is max jX j1. The path-

1 2 r 1ir i

width of a graph G, denoted pw (G), is the minimum pathwidth over al l path decompo-

sitions of G.

The next de nition makes the development of b ounded pathwidth algorithms easier

to understand and prove correct.

De nition 7 A path decomposition X ;X ;:::;X of pathwidth k is smo oth, if for al l

1 2 r

1  i  r , jX j = k +1, and for al l 1  i

i i i+1

It is evident that any path decomp osition of minimum width can b e transformed into

a smo oth path decomp osition of the same pathwidth. There is a corresp onding notion

of a smooth tree decomposition. See [Bo d93] for a simple pro cedure that converts any

tree decomp osition into a smo oth tree decomp osition. From a smo oth decomp osition of

width k we can easily emb ed a graph in a k -path or k -tree (e.g., see pro of of Lemma 11). 6

To initiate the reader (and for completeness), wenow givetwo basic results regarding

the notion of pathwidth [RS91]. We use part of the second result when we prove that

our algebraic graph representation (given in Section 3) is correct.

Lemma 8 If a graph G has components C ;C ;:::;C then

1 2 r

pw (G)= max fpw (C )g :

i

1ir

i i i

Pro of. For 1  i  r , let X ;X ;:::;X be a path decomp osition for comp onent C

i

1 2 s

i

with minimum width w = pw (C ). The sequence of sets

i i

1 1 1 2 2 2 r r r

X ;X ;:::;X ;X ;X ;:::;X ;:::;X ;X ;:::;X

1 2 s 1 2 s 1 2 s

r

1 2

S S

r r

is a path decomp osition of G since (1) V (C )=V(G), (2) E (C )=E(G), and

i i

i=1 i=1

a b

(3) X \ X = ; for 1  i  s , 1  j  s , and 1  a < b  r . The width of this

a b

i j

r r

decomp osition is max fw g, so pw (G)  max fpw (C )g.

i i

i=1 i=1

Let X ;X ;:::;X be a path decomp osition of G of minimum width. For any com-

1 2 s

p onent C of G, let D = X \ V (C ) for j = 1; 2;:::s. We claim that D ;D ;:::;D

i j j i 1 2 s

is a path decomp osition of C . Since for all v 2 V (G) there is an X such that v 2 X ,

i k k

S

D = V (C ). Likewise, since for every edge (u; v ) 2 E (G) there is an X such

j i k

1j s

that u 2 X and v 2 X . So if (u; v ) 2 E (C ), then b oth u 2 D and v 2 D . Finally,

k k i k k

for 1  i

i k j i k j k k

for 1  k  s, pw (C )  pw (G) for any comp onent C of G. 2

i i

The following well-known lemma shows that the pathwidth of a partial k -path is at

most k . Thus we can justi ably think of partial k -paths as either subgraphs or as minors

of k -paths.

Lemma 9 If G is a k -path then pw (G)=k. Further, if H is a minor of G, H  G,

m

then pw (H )  k .

Pro of. We rst prove that any k -path G obtained from a de ning (k + 1)-b oundaried

graph (G; S ) has a path decomp osition X ;X ;:::;X of width k where X = imag e(S )

1 2 r r

(i.e., X is the set of b oundary vertices). For the base case of G a (k + 1)-clique, the

r

hyp othesis holds since X = f1; 2;:::;k +1g = V(G) is a path decomp osition of width

1

k . For the inductive step, assume X ;X ;:::;X is a path decomp osition for G. Let

1 2 r

0

G be the k -path built from some (G; S ) by applying case 2 of De nition 5. If we set

0 0

X = imag e(S ) then X ;X ;:::;X ;X is the required path decomp osition of G . [

r +1 1 2 r r+1

0

(1) The new vertex v is in X , (2) all new edges (u; v )inE(G)nE(G)have u2X

r +1 r+1

and v 2 X , and (3) X \ X  X \ X implies X \ X  X for 1  i

r +1 i r +1 i r i r +1 j 7

To see that any k -path G has a lower b ound of k for its pathwidth, rst notice that

G contains a clique C of size k +1. For any path decomp osition X = X ;X ;:::;X

1 2 r

of G, let Y = X \ V (C ) for 1  i  r . If any jY j >k then the width of X is at least

i i i

k . Supp ose jY j k for all Y . There must then be a Y and a Y , 1  i< j  r, such

i i i j

that u 2 Y n Y and v 2 Y n Y for di erentvertices u and v . Since (u; v ) 2 E (C ), there

i j j i

must be some Y , 1  k  r , such that u 2 Y and v 2 Y . Now fu; v g 6 Y \ Y so

k k k i j

either k j. But v 62 Y for k  i, and u 62 Y for k  j . This contradicts X

k k

b eing a path decomp osition (i.e., it fails the edge covering requirement). Therefore, the

pathwidth of any k -path is k .

For the second part of the theorem, we start with a path decomp osition X =

X ;X ;:::;X of width k for a k -path G. It is sucient to show that any one-step minor

1 2 r

H of G has a path decomp osition of width at most k . For edge deletions, H = G nf(u; v )g,

the original path decomp osition X is a path decomp osition of the minor H . For isolated

vertex deletions, H = G nfvg, the path decomp osition X nfvg;X nfvg;:::;X nfvg

1 2 r

is a path decomp osition of the minor H . For edge contractions, H = G = (u; v ), let

(

X if X \fu; v g = ;

i i

Y =

i

X [fwgn fu; v g otherwise

i

for 1  i  r , where w is the new vertex created by the contraction. The sequence

Y = Y ;Y ;:::;Y is a path decomp osition of the edge contracted minor H . The widths

1 2 r

of these path decomp ositions for the three typ es of one-step minors is at most k .

We justify the edge contraction case and leave the other two simpler cases to the

S

reader. By de nition, Y = V (H ). Let (a; b) 2 E (H ). If fa; bg\fu; v g = ; then

i

1is

some Y = X contains b oth a and b. Otherwise, consider any edge (a; b)=(x; w ). An

i i

edge incident to vertex w implies that either (x; u) 2 E (G) or (x; v ) 2 E (G). Thus

some X contains x and either one or b oth of u and v . And so, Y = X [fwgn fu; v g

i i i

contains b oth x and w . Finally, let i be the minimum index such that w 2 Y and k be

i

the maximum index such that w 2 Y . Without loss of generality, assume u 2 X . If

k i

u 2 X then Y ' X nfvg and Y is a path decomp osition of H . Otherwise, v 2 X . Since

k k

(u; v ) 2 E (G), there exists a j , i  j  k , such that b oth u 2 X and v 2 X . Since X

j j

is a path decomp osition, u 2 X for i  m  j , and v 2 X for j  m  k . So w 2 Y

m m m

for i  m  k , and w 62 Y for mk. Therefore, for 1  i< j

m

have Y \ Y  Y . 2

i k j

 

k +1

Corollary 10 Any graph of order n and pathwidth k has at most +(nk 1)  k

2

edges.

Pro of. We easily prove that equality holds for k -paths by induction on the number of

vertices. Since the smallest k -path is the complete graph G = K , our base case holds

k +1 8

 

k +1

since jE (K )j = . If a k -path G has n>k+1 vertices, then there exists a vertex

k +1

2

0

v that was added to a smaller k -path G = G nfvg (using the recursive de nition of

0

k -paths). When vertex v was added to G , there were exactly k new edges added to o.

   

k +1 k +1

So G must have +((n1) k 1)  k + k = +(n k 1)  k edges. 2

2 2

From the ab ove corollary we see that graphs of b ounded pathwidth have at most a

linear number of edges (with resp ect to n). It is not dicult to show that graphs of

treewidth k also have this same b ound. So, since the input size is linear in the number

of vertices (for our b ounded width algorithms), there is no confusion when we talk ab out

having a linear time algorithm.

We now complete this subsection by proving the converse of Lemma 9.

Lemma 11 Any graph G of pathwidth at most k is a subgraph of a k -path.

Pro of. If G has at most k +1 vertices we can embed G in the base clique K , the

k +1

smallest k -path. Otherwise, let X ;X ;:::;X be a smo oth path decomp osition of G

1 2 r

of width k . We can map the vertices of X into the base clique K . By induction,

1 k +1

i

assume that wehaveemb edded the vertices of [ X in a k -path where X is the set of

j i

j =1

b oundary vertices of the (k + 1)-b oundaried graphs B =(G ;S ), generated by the rules

i i i

of De nition 5. We can construct the next (k + 1)-b oundaried graph B =(G ;S )

i+1 i+1 i+1

by adding the unique vertex v 2 X n X in step 2 of De nition 5 and dropping the

i+1 i

0

unique vertex v 2 X n X from the simplex S of the previous k -path G . Since each

i i+1 i i

X , 1  i  r is mapp ed to a k + 1-clique, every edge of G is mapp ed to an edge of the

i

k -path G  G. 2

r

2.3 Other graph-theoretical widths

There are actually manytyp es of combinatorial width metrics for graphs. Often a set of

graphs b ounded by one typ e of combinatorial width is a subset of a class of graphs with

another b ounded parameter. A relationship b etween treewidth and several graph widths

is given by Bo dlaender in [Bo d88b]. In addition, Wimer's dissertation [Wim87] explores

the relationships b etween 2-terminal recursive families (e.g., series-parallel graphs, outer-

planar graphs, and cacti). This work is now highlighted in Figure 2.

We brie y describ e two of the b ounded width families, given in Figure 2, that orig-

inated from VLSI linear layout problems. A linear layout of a graph G = (V; E ) is

a bijection f : V ! f1; 2;:::;jV jg, that is, an assignment of integers 1 to jV j to the

vertices. The bandwidth of a layout is the maximum value of jf (i) f (j )j over all edges

(i; j ) 2 E , that is, the maximum distance any edge has to span in the layout. The

cutwidth of a layout is the maximum number of edges (i; j ) such that f (i)  k

treewidth  k

k -outerplanar chordal graph, max clique  k

cutwidth  k

series-parallel

pathwidth  k

outerplanar

cyclic bandwidth  k

Halin graphs

bandwidth  k

interval graph, max clique  k

almost k trees

prop er interval graph, max clique  k

cacti

forests

caterpillars

trees

Note that each constants k denotes a di erent constant. For example,

the set of all graphs of bandwidth k is contained in the set of graphs of

0 2

=(k +k)=2. cutwidth k

Figure 2: A partial order of several b ounded-width families of graphs. 10

over all 1  k

layout p osition k and k +1. The bandwidth (cutwidth) of the graph is the minimum

bandwidth (cutwidth) over all linear layouts. Both of these \min of max" de nitions

are similar to the pathwidth and treewidth de nitions that we saw earlier. In fact, the

pathwidth of a graph is equivalent to the vertex separation of a graph which is also

de ned as a linear layout problem [EST87].

The de nition of interval graphs may be found in most intro ductory graph theory

b o oks. We conclude this section with a description for two of the other less known

b ounded-width families. A Halin graph is a planar graph G = T [ C , where T is a tree

of order at least 4 with no degree twovertices and C is a simple cycle connecting all and

only the leaves of T . A cactus (memb er of the cacti family) is a connected outer-planar

graph that has single edges and simple cycles as its blo cks.

3 Algebraic Graph Representations

Recall that we are mainly interested in nite simple graphs. However, some of our

graphs have a vertex b oundary of size k , meaning that they have a distinguished set of

vertices lab eled 1; 2;:::;k. We sometimes use 0 (instead of k ) as a b oundary lab el. One

imp ortant op eration on k -b oundaried graphs is given next.

De nition 12 Two k -boundariedgraphs (each with a boundary of size k )can be \glued

together" with the  operator, cal led circle plus, that simply identi es vertices with the

same boundary label.

Example 13 The binary operator  on two 3-boundariedgraphs A and B is il lustrated

below. Note that common boundary edges (in this case, the edges between boundary

vertices 1 and 2) are replaced with a single edge in G = A  B .

1 1

2 2

3 3

G = A  B

A B 11

3.1 Op erator sets and t-parse s

In this section we show that (t + 1)-b oundaried graphs of pathwidth at most t are

generated exactly by strings of unary op erators from the following operator set  =

t

V [ E :

t t

n n

V = f 0 ;:::; t g and

t

i j j 0  i

t

To generate the graphs of treewidth at most t, the additional binary op erator  is added

to  . The semantics of these op erators on (t + 1)-b oundaried graphs G and H are as

t

follows:

n

G i Add an isolated vertex to the graph G, and lab el it as

the new b oundary vertex i.

i j Add an edge b etween b oundary vertices i and j of G (and G

ignore if the edge already exists).

G  H Take the disjoint union of G and H except that b ound-

ary vertices of G and H that are lab eled the same are

identi ed (i.e., the circle plus op erator).

De nition 14 A parse is a sequence (or tree, if  is used) of operators [g ;g ;:::;g ]

1 2 n



n n

in  that has vertex operators i and j occurring in [g ;g ;:::;g ] before the rst

1 2 n

t

edge operator i j , 0  i



De nition 15 A t-parse is a parse [g ;g ;:::;g ] in  where al l the vertex operators

1 2 n

t

n n n

0 , 1 , ..., t appear at least once in [g ;g ;:::;g ]. That is, a t-parse is a parse

1 2 n

with t +1 boundary vertices.

For clarity, we say that a treewidth t-parse is any t-parse containing at least one 

op erator and a pathwidth t-parse is any t-parse without  op erators.

Intuitively, t-parse s represent (t + 1)-b oundaried graphs that have pathwidth (or

treewidth) at most t. We justify this statement later in this section. These graphs

are constructed by using the rules de ned for the unary vertex and edge op erators and

the binary circle plus op erator. The simplex S of a t-parse (i.e., the corresp onding

n n

b oundaried graph) is informally de ned to be @ (i)= i , 0 i t, where each i is

S

the last o ccurrence in the parse. The symbol @ is used to denote the set of b oundary

vertices of a b oundaried graph.

As we pro ceed with our study of graphs of b ounded width, we use the phrase \a

t-parse G"inone of three ways:

 as a(t+ 1)-b oundaried graph (also called G), 12

 as an implied path (or tree) decomp osition of a graph, or

 as a data structure (e.g., for dynamic programs).

Thus, a t-parse G is used with standard ob ject-oriented terminology (i.e., a t-parse G

\is a" b oundaried graph and G \has a" decomp osition), where any op erations on graphs

may also b e applied to a t-parse G.

De nition 16 Let G = [g ;g ;:::;g ] be a t-parse and Z = [z ;z ;:::;z ] be any

1 2 n 1 2 m

sequence of operators over  . The concatenation () of G and Z is de ned as

t

G  Z =[g ;g ;:::;g ;z ;z ;:::;z ]:

1 2 n 1 2 m



The t-parse G  Z is cal led an extended t-parse , and Z 2  is cal led an extension. For

t

the treewidth case, G and Z are viewed as two connected subtree factors of a parse tree

G  Z instead of two parts of a sequence of operators.

n

A vertex op erator g = i , for any 0  i  t, in a t-parse G =[g ;g ;:::;g ] is

j n 1 2 n

n

called a boundary vertex if g 6= i for j

k

De nition 17 A graph G is generated by  if there is a (t +1)-boundaried graph

t

(B; S ) = G =[g ;g ;:::;g ] such that B ' G for some t-parse G . That is, G is

n 1 2 n n

isomorphic to an underlying graph of a t-parse.

For ease of discussion throughout the remaining part of this section, we mainly limit

ourselves to graphs of b ounded pathwidth. In certain situations, where required, we

provide additional information p ertaining to graphs of b ounded treewidth.

De nition 18 Let G =[g ;g ;:::;g ] bea boundariedgraph represented as some parse

n 1 2 n

over  . A pre x graph (of length m) of G is G =[g ;g ;:::;g ], 1  m  n.

t n m 1 2 m

Lemma 19 Every t-parse G =[g ;g ;:::;g ] represents a graph with a path decompo-

n 1 2 n

sition of width t.

Pro of. Without loss of generality, let G =[g ;g ;:::;g ]bea(t+ 1)-b oundaried graph.

n 1 2 n

Let v denote the index of the i-th vertex op erator in the t-parse G . Let I be the set

i n

of these v and for i 2 I ,

i

X = fj j g is a b oundary vertex of G g

i v v

j i

We claim that X = X ;X ;:::;X is a path decomp osition of width t for G .

1 2 n

jIj 13

For any vertex op erator g , de ne l abel (g ) to be i if g is the i-th vertex op erator

k k k

S

in G . By de nition of the X 's, X = f1; 2;:::;jIjg = V (G ). For any edge op erator

n i i n

i j of G , let b (g ) and b (g ) denote the indices of the preceding vertex op erators g =

n 1 k 2 k k

n n

i and j , resp ectively. For each edge op erator g = i j of G , let u = l abel (b (g ))

k n 1 k

and v = l abel (b (g )). Since edge op erators add edges to the current b oundary of a

2 k

pre x graph, either X or X must contain b oth u and v . Assuming i < j , X \ X

u v i j

represents the b oundary vertices of G that did not change from G . So for any k ,

v v

j i

i

i j i k i j k

n n n

Finally, since only (and exactly) the vertex op erators 0 , 1 , ..., t app ear in

G we have max fjX jg = t +1. So X is a path decomp osition of width t for G .

n 1ijI j i n

2

And next we prove the result in the other direction.

Lemma 20 Every partial t-path of order at least t +1 is represented by some t-parse.

Pro of. We rst show that every t-path can be represented by some t-parse . We prove

inductively from the recursive de nition of t-paths. The initial (t + 1)-clique can be

represented by the following sequence of op erators over  .

t

n n n n n

01; 2 ; 02; 1 2; 3 ; 0 3; 13; 23;:::; t ; 0 t ; 1 t ;:::; t{1 t ] [ 0 ; 1 ;

For the inductive step, assume that any t-path G with an active t +1 simplex S is

represented by an op erator string G =[g ;g ;:::;g ] such that @ is de ned prop erly.

m 1 2 m S

The recursive op eration of \replacing a simplicial vertex with a new vertex v (forming

a new clique)" can b e mo deled by app ending the op erator sequence of the form

n

[ i ; 0 i ;:::; i{1 i ; i i+1 ;:::; it ]

to G dep ending on which simplicial vertex (b oundary vertex i) should be replaced.

m

Thus, any t-path can b e represented by a t-parse over  .

t

To represent partial t-paths, note that each edge is represented by one or more edge

op erators. By simply deleting all of these edge op erators, any edge in the t-parse is

removed. Thus, by rep eatedly deleting edges, we get a t-parse for any partial t-path.

2

Note that many t-parse representations may exist for a partial t-path since many path

decomp ositions are generally p ossible. Finally, combining the previous two lemmas we

have the following theorem.

Theorem 21 The family of graphs (t-parses) generatedby  equals the family of partial

t

t-paths of order at least t +1. 14

Corollary 22 A graph G has pathwidth t if and only if it is generated by  but not

t

 .

t-1

Pro of. If a graph G is generated by then it has pathwidth t 1. If G has pathwidth

t-1

t then it is a partial t-path and by the ab ove theorem it has a t-parse representation

over  . 2

t

For a treewidth analog to Theorem 21, we have the following result.

Theorem 23 The set of treewidth t-parses represents the set of graphs of order at least

t +1 and treewidth at most t.

Pro of. We rst show that any t-parse G has a tree decomp osition (T; fT g) of width t

x

where the current b oundary of G is in some T , x 2 T . We prove this by induction on

x

the number of op erators in G and whether or not G has any  op erators. For the base

cases of no  op erators, we have by Lemma 19, a path decomp osition X = X ;:::;X

1 r

of width t. Thus G has a tree decomp osition (P ; fX j i 2 V (P )g), where P denotes

r i r r

a path of length r . Note that by our constructive pro of the set X contains the current

r

b oundary of G.

Now assume G contains at least one  op erator. Wehave three cases. If G = G  G

1 2

0 0 00 00

then let (T ; fT g) and (T ; fT g) be tree decomp ositions for G and G , resp ectively.

1 2

x x

0 00

Since b oth G and G have fewer op erators than G, there exists sets T and T that

1 2

x x

contain the b oundary of G and G (or of G itself ). A tree decomp osition of G of the

1 2

0 00

desired form is constructed by identifying T and T in the two subtree decomp ositions.

x x

0 0

i j ] then let (T ; fT g) b e a tree decomp osition of the desired form for G . If G = G  [

1 1

x

0 0 0 0

Since b oth b oundary vertices i and j are in some vertex set T for some x 2 T ,(T ;fT g)

x x

0 0

n

is the required tree decomp osition for G. Similarly, if G = G  [ i ], let (T ; fT g) be

1

x

a tree decomp osition of the desired form for G . Let T be the tree constructed by

1

0 0

attaching a vertex i to T at vertex x, where T contains all the b oundary vertices of

x

0 0 0

G . Set T = T nfig[ fig where i represents the old b oundary vertex. This proves

1 i

x

that every t-parse has treewidth at most t.

Now we show that any t-tree G with at least t +1 vertices contains a t-parse repre-

sentation. As in the pro of of Lemma 20, any partial t-tree is representable by removing

the appropriate edge op erators. Our pro of is based on a smo oth tree decomp osition

(T; fT g) of G. In particular, jT j = t +1 for all x 2 T and jT \ T j = t whenever u

x x u v

and v are adjacent in T . We recursively build a t-parse for G by arbitrarily picking a

ro ot vertex r of T and having T as the nal t-parse b oundary.

r

0

We rst require a function  that takes a t-parse H and returns a t-parse H where

i;j

the b oundary lab els i and j have b een interchanged. (The reader should observe that the 15

function  is easy to construct.) For the pro of b elow we assume that the underlying

i;j

graph G is lab eled 1; 2;:::;jGj, and that any partial t-parse will have b oundary vertex

i less than b oundary j , whenever the underlying lab el for i is less than the underlying

lab el for j . This boundary order is needed to keep things aligned when we use the 

op erator.

If G has t +1 vertices (i.e., a clique K ) then the construction given in Lemma 20

t+1

for the t-path case is sucient. We now recursively build a t-parse for G based on the

degree d  1 of a ro ot vertex r . Let v ;:::;v be the neighb ors of vertex r in T . For

1 d

i i

each 1  i  d consider the subtree decomp osition (T ; fT g) induced by the subtree

x

of T ro oted at v . By induction we have t-parse s G ;:::;G for these pieces of G with

i 1 d

b oundary sets T ;:::;T , resp ectively.

v v

1

d

If d =1, we have the following t-parse, where i denotes the b oundary vertex repre-

senting the single vertex in T n T , for the original t-parse G (using the pro of metho d

v r

1

of Lemma 20).

n

0 i ;:::; i{1 i ; i i+1 ;:::; i t ] G  [ i ;

1

If the new b oundary vertex i is out of b oundary order with resp ect to T then we can

r

apply the  function (p ossibly several times with di erent vertices i and j ).

i;j

If d>1 then we apply one vertex op erator for each subtree parse and a total of d 1

circle plus op erators to combine the pieces. The vertex op erator is chosen the same way

0

as in the d = 1 case and we mayhave to p ermute with the  function. Let G denote

i;j

i

a particular t-parse , for 1  i  d. The t-parse for G is then created by the following

parse.



0



G

d

0

G

d1



0



G

3

0 0

G G

1 2

Note that multi-edges created by the rep eated  op erators are ignored. 2

3.2 Some t-parse examples

The next three examples illustrate our algebraic representation of t-b oundaried graphs

of b ounded width. The rst two t-parse examples are graphs of pathwidth 2 which are

then combined with the circle plus op erator to form a graph of treewidth 2. 16

Example 24 A t-parse with t = 2, and the graph it represents. (The shaded vertices

denote the nal boundary.)

0 0

1 1

2 2

n n n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 1 2 ; 1 ; 0 1 ; 1 2 ; 0 ; 0 1 ; 0 2 ; 2 ; 0 2 ; 1 2 ]

Example 25 Another 2-parse and the graph it represents.

0 0

1 1 1

2 2

n n n n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 1 2 ; 1 ; 0 1 ; 1 2 ; 1 ; 0 1 ; 1 2 ; 0 ; 0 1 ; 0 2 ; 2 ; 0 2 ; 1 2 ]

Example 26 We demonstrate the circle plus operator  with the 2-boundaried graphs

(2-parses) given in the previous two examples. The second graph is re ected and glued

onto the rst graph's boundary. In general, the pathwidth of a t-parse usual ly increases

when the binary operator  is used (although not in this example).

0

1

2 17

3.3 Other op erator sets

The t-parse representation for graphs of pathwidth (or treewidth) at most t is not unique.

Wenow presenttwo di erent op erator sets for representing graphs of b ounded combina-

torial width. Many other algebraic representations are available, sometimes in disguised

form, by other sources (e.g., see [Bor88, BC87, CM93, Wim87]). The following two ex-

amples illustrate two extremes regarding the number of op erators required to represent

graphs of pathwidth (or treewidth) of at most k . The rst set shows that only a constant

numb er (4) of op erators is needed, indep endent of the width k [Fel]. The second set uses

a p olynomial numb er of op erators p er b oundary size, but generates k -b oundaried graphs

for pathwidth k (instead of graphs with b oundary size k + 1). We p oint out that another

\middle ground" op erator set based on a combination of these two sets is given in [Lu93].

A constant sized op erator set , for graphs with pathwidth at most k , consists of two

k

b oundary p ermutation op erators p and p and the two t-parse graph building op erators

1 2

n

01. The domain for these op erators is again (k + 1)-b oundaried graphs. The 0 and

p ermutation op erators are used to relab el the b oundary. These p ermutations, given in

the standard cyclic form, are p =(0;1) and p =(0;1;:::;k). These two p ermutations

1 2

generate the symmetric p ermutation group S and hence, by applying in succession,

k +1

arbitrary relab elings of the b oundary are p ossible. It is easy to see that , with its 4

k

op erators, generates exactly the same set of b oundaried graphs as our pathwidth t-parse

op erator set  . We also observe the following:

k

Observation 27 A graph G has treewidth at most k if and only if it is obtainable by

using the 5 operators [ fg.

k

A big pathwidth op erator set, called , for k -b oundaried graphs of pathwidth at

k

most k , contains the t-parse op erator set  and has the following two additional

k 1

op erator typ es. In the de nitions b elow G denotes any k -b oundaried graph.

G i Add a p endent vertex to the current b oundary vertex i

of G, and lab el it as the new b oundary vertex i.

G fb ;b ;:::;b g Add a new interior vertex and attach it to all of the

1 2 p

b oundary vertices b ;b ;:::;b of G,1p

1 2 p

Example 28 Below we il lustrate the operator set in generating a 3-boundariedgraph

3

of pathwidth 3. 18

0 0

1 1

2 2

n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 1 2 ; 0 ; 0 1 ; 0 2 ; 1 ; f0; 1; 2g ; 0 1 ; 2 ; 1 2 ; f0; 1g ]

We now prove that this op erator set that uses a smaller b oundary size can be used

to represent graphs of b ounded pathwidth.

Theorem 29 The operator set generates precisely the set of graphs of pathwidth at

k

most k .

Pro of. Clearly if a graph has n  k vertices (which means it has pathwidth at most

k 1) then it is representable by a sequence that starts with n distinct vertex op erators

and an edge op erator for each edge.

We next show, without loss of generality, that every (well-de ned) sequence



n n

S =[ 0 ; 1 ;:::; k-1 ;s ;s ;:::;s ]

1 2 r



of op erators represents a graph of pathwidth at most k . We do this by showing

k

how to build a t-parse G, t = k , for representing the underlying graph. For each pre x

S = [:::;s ;s ;:::;s ], we have a corresp onding pre x t-parse G of G, where  is

i 1 2 i (i)

some increasing integer function. The construction uses a \spare" (but variably lab eled)

b oundary vertex of  for simulating the fb ;b ;:::;b g and i op erators. For the

k 1 2 p

following discussion we use  (j ) to denote a injective map from the b oundary of S to

i

the b oundary of G and the integer v to denote the unique b oundary lab el not in the

(i)



n n

image of  . We start by setting G =[ 0 ; 1 ;:::; k-1 ],  to be the identity map,

(0)



and v = k . Now we have four cases for the inductive steps:

0 0

n n

1. If s = i =  (i), G = G  [ i then for i ].

r (r ) (r 1)

2. If s = i j then G = G  [  (i)  (j ) ].

r

(r ) (r 1)

n

3. If s = i then G = G  [ v ;  (i) v ]. Swap the values of (i) and v .

r

(r ) (r 1)

4. If s = fb ;b ;:::;b g then

r 1 2 p

n

G = G  [ v ;  (b ) v ;  (b ) v ;:::; (b ) v ]:

1 2 p

(r ) (r 1) 19

Thus, since any pathwidth t-parse, t = k , has pathwidth at most k so do es any k -

b oundaried graph generated by .

k

Wenow show that any k -path G is representable by a string of op erators. Again

k

i j or replace fb ;b ;:::;b g this is sucient since we can remove edge op erators

1 2 p

op erators to obtain any partial k -path. Let X = X ;X ;:::X be a smo oth path

1 2 r

decomp osition of G. We constructively build a partial parse P using op erators for

i k

S

each vertex induced k -path de ned by X . The current b oundary of P will be

j i

1j i

@ (P )=X \X , for 1  i

i i i+1

of P , de ne @ (u) to b e the corresp onding b oundary lab el in 0; 1;:::;k 1. The initial

i i

K clique is parsed by

k +1

n n n n

01; 2 ; 02; 12; 3 ; 0 3; 13; 23;:::; P =[ 0 ; 1 ;

1



0 k {1 ; 1 k {1 ;:::; k{2 k {1 ; f0; 1;:::;k{1g ] k-1 ;



where @ (u) is assigned arbitrarily for the vertices X n X . Let ol d denote the unique

1 2 1 i

vertex in X n X and new denote the unique vertex in X n X , for 1  i

i i+1 i i+1 i

have two cases to consider when constructing P from P , for 1  i  r 2.

i+1 i

If new = ol d then

i i+1

P = P  [ f0; 1;:::;k{1g ]

i+1 i

else (i.e., new 6= ol d ) for j = @ (ol d )

i i+1 i i

P = P  [ j ; 0 j ;:::; j{1 j ; j j +1 ;:::; j k{1 ]

i+1 i

then @ (new )= j. The nal parse for G is simply P = P  [ f0; 1;:::;k{1g ] to

i+1 i r r 1

end with a K clique (assuming r>1). 2

k +1

One of the reasons why we picked the t-parse op erator set  over other p ossible

t

sets is that we want each unary op erator to add something signi cant (but not to o

complex) to its (t + 1)-b oundaried graph argument. For example, for obstruction set

computions, wewant a smo oth and rapid path, via these graph building op erators, to the

obstructions (but do not wanttooversho ot the graph family to o far by adding complex

graph pieces). That is, we b elieve that the search tree is smaller using our choice of

op erators. An analogy from the computer architecture world is that we would prefer a

RISC chip over one with a full and powerful instruction set (or, in the other extreme,

one with only tedious nano-co de primitives). Another reason for our choice is that we

want a pre x prop erty of the parse strings for obstruction set searching [Din95]. 20

4 Simple Enumeration Schemes

As indicated by the topic of this pap er, the two main invariants that we study are the

pathwidth and the treewidth metrics. Many combinatorial graph search problems can

be restricted to domains of b ounded width (e.g., obstruction set searches). To take

advantage of a particular b ounded invariant a practical metho d is needed to generate

all these restricted graphs. How to do this smartly is the topic of this section.

As seen by the examples in Section 3, it is easy to represent (with a computer)

graphs of pathwidth or treewidth of at most t by strings of unary op erators or by trees

with the additional binary  op erator. This suggests a natural way of enumerating all

these b ounded width graphs: Just enumerate all p ossible valid combinations of t-parse

strings (or t-parse trees). Unfortunately, many di erent t-parses corresp ond to the same

underlying graph. To reduce our search pro cess we need to know when two t-parse s

represent the same graph. We formalize this concept next.

De nition 30 Two k -boundaried graphs B = (G ;S ) and B = (G ;S ) are free-

1 1 1 2 2 2

b oundary isomorphic, denoted B ' B , if there exists a graph isomorphism  between

1 @ 2

f

G and G such that

1 2

f(@ (i)) j 1  i  k g = f@ (i) j 1  i  k g :

S S

1 2

That is, boundary vertices of G are mapped under  to boundary vertices of G . And

1 2

B and B are xed-b oundary isomorphic if there exists an isomorphism  such that

1 2

(@ (i)) = @ (i) for 1  i  k :

S S

1 2

That is, each boundary vertex i of G is mapped under  to boundary vertex i of G .

1 2

There exists known p olynomial-time algorithms to determine whether two graphs of

b ounded treewidth are isomorphic [Bo d90] (also see [YBdFT97]). However, we would

still liketoavoid the isomorphism problem (as much as p ossible, anyway).

Our goal is to nd an enumeration scheme that generates each free-b oundary iso-

morphic t-parse at most once.

4.1 Canonic pathwidth t-parse s

One simple way of generating each free-b oundary isomorphic t-parse is to de ne equiva-

lence classes of t-parse s and generate one representative for each class of free-b oundary

isomorphic graphs. A t-parse is said to b e canonic, with resp ect to some linear ordering

of t-parse s, if it is a minimum t-parse within its equivalence class. For an enumeration

scheme, these minimum representatives should be de ned so that extending the set of 21

canonic representatives of order n generates a set (or sup erset) of the canonic represen-

tatives of order n +1. Here, if we generate a non-canonic t-parse of order n +1 we discard

it b efore generating the canonic representatives of order n +2. We call an enumeration

order (scheme) simple if this prop erty holds.

The simplest linear ordering of t-parse s is a lexicographical order of the parse strings.

We de ne the lex-canonic order between two t-parse s by comparing op erators at equal

indices (from the b eginning of each string) until a di erence is found. The individual

op erators in  are related as follows:

t

n

j k . 1. Vertex op erator i is less than any edge op erator

n n

2. Vertex op erator i is less than any vertex op erator j whenever i

i j , where i < j , is less than edge op erator k l , where k < l , 3. Edge op erator

whenever i

A canonic t-parse in the lex-canonic order < (called a lex-canonic t-parse) is any

l

t-parse G such that G < H for any free-b oundary isomorphic t-parse H ' G where

l @

f

H 6= G. Since any pre x of a lex-canonic t-parse is also lex-canonic, a simple enumeration

scheme is p ossible using this form of canonicity. (This pre x prop erty is easily seen by

assuming that a pre x P of a lex-canonic t-parse G = P  S is not lex-canonic then a

contradiction arises regarding G b eing lex-canonic. That is, consider a lexicographically

0 0 0

less t-parse P  S < G that is free-b oundary isomorphic to G, where P < P and

l l

0

P ' P .)

@

f

Example 31 Several t-parses are listed below in increasing lex-canonic order. The

fourth t-parse is not lex-canonic since it is free-boundary isomorphic to the second

t-parse. Likewise, the fth t-parse is free-boundary isomorphic to the rst (which is

also lex-canonic).

n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 0 ; 0 1 ]

n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 0 2 ; 0 ; 0 1 ; 0 2 ]

n n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 0 2 ; 0 ; 0 1 ; 0 2 ; 1 ; 0 1 ]

n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 1 2 ; 1 ; 0 1 ; 1 2 ]

n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 1 2 ; 2 ]

We now present an alternate canonic representation for pathwidth t-parse s. The

main b ene t of this scheme, based on a non-lexicographical order, is that most non-

canonic t-parse s are easily determined (bychecking for required canonicity prop erties of

the parse string). For any t-parse P , let v seq (P ) b e the vertex subsequence of the parse,

n

that is, just the vertex op erators i for some i, and let v pos(P ) b e the p ositions of the

vertex op erators in the original t-parse. 22

Example 32 For the t-parse

n n n n n n

G = [ 0 ; 1 ; 2 ; 0 1 ; 0 2 ; 0 ; 0 1 ; 0 2 ; 1 ; 0 1 ; 2 ]

we have

n n n n n n

v seq (G)=( 0 ; 1 ; 2 ; 0 ; 1 ; 2 )

and

v pos(G)=(1;2;3;6;9;11) .

De nition 33 For two t-parses P and P of the same free-boundary graph, we de ne

1 2

a linear order < as fol lows where the symbol < denotes the lexicographical order on

c

integer sequences and < denotes the lex-canonic order on  operator sequences.

l t

1. If v pos(P ) < v pos(P ) then P < P .

1 2 1 c 2

2. Else if v seq (P ) < v seq (P ) then P < P .

1 l 2 1 c 2

[Here v pos(P )= v pos(P ).]

1 2

3. Else if P < P then P < P .

1 l 2 1 c 2

[Here v pos(P )= v pos(P ) and v seq (P )= v seq (P ).]

1 2 1 2

The order < is a linear order b ecause < is a linear order (i.e., if case 3 is ever

c l

reached then either P < P or P < P holds).

1 c 2 2 c 1

For the remainder of this section, a t-parse P of a free-b oundary graph G is termed

0 0 0

canonic if there is no other parse P such that P ' P and P < P . The idea b ehind

@ c

f

this t-parse order is that wewantvertex op erators to come earlier in the parse. For the

n

linear order < we note that anyvertex op erator i and any edge op erator j k do not

c

need to b e compared lexicographically.

We now state some useful facts ab out canonic t-parses (using the < order).

c

n n

Lemma 34 Let G =[g ;g ;:::;g ] be a canonic t-parse. If g = i and g = j

n 1 2 n k k

1 2

are consecutive vertex operators, then for any edge operator g = a b , k < k < k ,

k 1 2

either a = j or b = j .

Pro of. Assume that, for some k

1 2 k

0

the following parse, G , represents the same free-b oundary graph.

n

0

n n

G =[g ;g ;:::;g ab;g ;:::;g ] = i ;:::;g ;g ;:::;g = j ;g =

1 2 k k +1 n k1 k+1 k k

n 1 2 2

0

But v pos(G ) is lexicographically less than v pos(G ). This can not happ en since G is

n n

n

canonic. So, we must have either a = j or b = j in order to prevent the p ossible edge

shift. 2 23

The previous lemma states that any edge op erators that immediately precedes a

n n

vertex op erator i must b e adjacent to the previous i . The next result regarding the

p osition of the b oundary edges follows easily from the previous lemma.

i j is a boundary edge of G , Lemma 35 Let G be a canonic t-parse. If g =

n n m

1  m

n n

Pro of. If not, the next vertex op erator would have to b e i or j . 2

The following lemma states that any pre x of a canonic t-parse is also canonic.

This means that using < to de ne t-parse canonicity is suitable for a simple t-parse

c

enumeration scheme.

Lemma 36 If G is a canonic t-parse then the pre x G is a canonic t-parse.

n n1

Pro of. If this is not true, then there exists H ' G , with H < G . Let

n1 @ n1 n1 c n1

f

 : V (G ) ! V (H ) be a free-b oundary isomorphism mapping between G and

n1 n1 n1

H . De ne

n1

8

n n

<

 if g = i

i n

: h =

n

:

  if g = i j

i j n

Now consider H = H  h . The parse H is isomorphic to G with H < G . So we

n n1 n n n n c n

must have H 6< G . 2

n1 c n1

We now turn to the problem of determining when an extension of a canonic t-parse

is also canonic.

Lemma 37 Let G be a canonic t-parse. If Z = [ i j ] is a single edge operator ex-

n

tension, then G = G  Z can be tested for canonicity with a constant number of

n+1 n

isomorphism cal ls.

Pro of. Supp ose G is not canonic. Then there exists a free-b oundary isomorphic

n+1

t-parse H ' G with H < G . Since b oth G and H contain b oundary

n+1 @ n+1 n+1 c n+1 n+1 n+1

f

edges we know from Lemma 35 that the last vertex op erator has index k  n (that is,

k = n +1 \number of b oundary edges" ). An isomorphism mapping  : V (G ) !

n+1

V (H ) shows that the t-parses H and G are free-b oundary isomorphic. This is seen

n+1 k k

by noting that for any edge (a; b) of G , G nf(a; b)g' H nf( ; )g. Since

n+1 n+1 @ n+1 a b

f

G is canonic the pre x G is also canonic (likewise H ), so H ' G implies H = G .

n k k k @ k k k

f

Thus, if G is not canonic then its canonic t-parse representation is identical to

n+1

G except for the b oundary edges at the end of the parse. If there are i b oundary

n+1

 

t+1

( )

2

edges then we have at most p ossible t-parses to consider. 2

i 24

Example 38 Below is an instance of where a constant number of isomorphism cal ls

would tel l us that the extended t-parse H is not canonic. This example is created by

adding an edge between a pendent vertex and an isolatedboundary vertex of the canonic

t-parse G. The t-parse K is free-boundary isomorphic to H and canonic.

n n n n n

0 1; 0 ; 0 2 ] G =[ 0 ; 1 ; 2 ; 3 ;

n n n n n

H =[ 0 ; 1 ; 2 ; 3 ; 0 1; 0 ; 0 2; 1 3 ]

n n n n n

0 1 ; 0 ; 0 1 ; 2 3 ] K =[ 0 ; 1 ; 2 ; 3 ;

We can easily eliminate an isomorphism check for several of the p ossible t-parse s

mentioned in the previous lemma. For a prosp ective t-parse H to be free-b oundary

n+1

isomorphic to G , the degree sequences of the b oundaries must be identical. These

n+1

degree sequences can be re ned to include b oth the number of b oundary and non-

b oundary incident edges. That is, these two \ordered pair" degree sequences (one for

G and one for H ) must coincide.

n+1 n+1

n

Observation 39 Let G be a canonic t-parse. If Z = [ i ], a single vertex operator

n

extension, then G  Z is non-canonic if Lemma 34 is violated, which is likely and easy

n

to check.

The next lemma helps us detect other non-canonic situations for any t-parse of length

n that ends with a vertex op erator.

Lemma 40 With m < n being the smal lest index of any edge operator of a canonic

t-parse G , there are no consecutive vertex operators g and g in G , for m

n i i+1 n

n

Pro of. First consider two identical vertex op erators i consecutive in G . One of

n

n

these can be replaced by a 0 and moved to the rst of the string since the semantics

n n

of[..., i , i ] causes an internal isolated vertex. Now a sux of G with two di erent

n

consecutive vertex op erators can be rewritten as (assuming G is canonic)

n1

n n n n n

G  [ j ]=[:::; i k ; i j ; i ; j ] > [:::; i j ; j ; i k ; i ]

n1 c

that is less in the < order. If there are more than two consecutive vertex op erators,

c

n n n

a b ; i ; j ; k ;:::] then we can also shift one of these earlier. Here, the vertex [:::;

that can be shifted b efore the edge op erator ab is determined by fi; j; k gnfa; bg. 2

One thing that is not quite resolved is how to eciently handle the not so easy

vertex op erator cases. If b oth Lemmas 34 and 40 are not violated we still do not know

n

if a t-parse G  [ i ] is canonic. We b elieve that a non-canonic t-parse can pass b oth

n

these lemmas for only a very few sp ecial cases (mayb e not even enough times to worry 25

ab out). Even without a fast canonic algorithm for this case, we still have a fast metho d

for generating all b ounded pathwidth graphs. Since the set of graphs of pathwidth at

most t is obtained from the set of canonic t-parse s (and we generate a sup erset), the

ab ove statements provide us with an ecient means of generating each such partial

t-path with a constant sized b oundary exactly once. If one wishes, a free-b oundary

isomorphism algorithm can b e used to check for redundancies. Our implementation uses

a variation of the one presented in [SD76]; but there exists theoretically more ecient

algorithms (e.g. [Bo d90]).

4.2 Canonic treewidth t-parses

It is known that b oth free and ro oted tree generation can b e done eciently (in constant

amortized time) with one of the algorithms given in [Wil89,WROM86, BH80]. To alge-

braically represent a graph of b ounded treewidth (i.e., a generalized \b ounded-width"

tree) we mo del its underlying tree decomp osition structure as an equivalent tree (of

maximum degree three) using our treewidth op erator set  (see Theorem 23). Again,

t

since many tree decomp ositions of minimum width exist for a given graph we strive for

a canonic representation. In the discussion given b elow, we incorp orate the additional

binary op erator  within the pathwidth lexicographical canonic scheme (i.e., we expand

the domain for the < order).

l

We view a treewidth t-parse T as a ro oted parse tree where the current set of active

b oundary vertices are inferred from the op erator semantics.

The rst simpli cation for our enumeration scheme is to restrict the t-parse argu-

ments for the  op erator. We simply require that no b oundary edges o ccur in b oth

t-parses G and G b efore G  G is enumerated. Any edge that needs to be adjacent

1 2 1 2

to two b oundary vertices is added with edge op erators after (or ab ove) the circle plus.

To compare two t-parse s that have di erent underlying tree decomp osition trees, we

use a ranking metho d similar to the one commonly used for ranking ro oted trees [BH80].

The idea for our new linear order (details to come shortly) is to de ne another set of

t-parse equivalence classes (with resp ect to each tree decomp osition structure) and then

linearly order these classes.

De nition 41 Let v (G) denote the number of vertex operators in a t-parse G. A sig-

nature s(G) for a t-parse G is an integer sequence de nedrecursively with respect to the

root's operator type:

1. If G = G  [ i j ] then s(G)= s(G ).

1 1

n

2. If G = G  [ i ] then s(G)= [v(G);s(G )].

1 1 26

3. If G = G  G , where without loss of generality s(G )  s(G ), then s(G) =

1 2 1 2

[s(G );s(G )].

1 2

A signature s is less than a signature s if js j < js j, or js j = js j and s < s in

1 2 1 2 1 2 1 2

lexicographic order.

1 1

For any two t-parse s G and G that have the same signature, let (B ;B ;:::) and

1 2

1 2

2 2

(B ;B ;:::) be the pathwidth t-parse branches of G and G , resp ectively, obtained

1 2

1 2

from a p ost-order traversal of the structural tree. These vertex and edge op erators are

sequenced from leaves to ro ot. Two t-parses G and G (not necessarily free-b oundary

1 2

1 2

isomorphic) can be compared lexicographically by comparing B with B , starting at

i i

i =1, and increasing i until a di erence is found.

Example 42 A treewidth 1-parse is shown below for S (K ), a subdivided K .

1;3 1;3

0 0 0

1 1 1

n n n n n

A =[ 0 ; 1 ; 0 1; 0 ; 0 1; 1 ] AA (AA)[ 0 1; 0 ; 0 1 ]

With the far right edge operator 0 1 being the root, the signature of this 2-boundaried

graph is [9; 4; 3; 2; 1; 4; 3; 2; 1].

De nition 43 Atreewidth t-parse G is structurally canonic if it has the smal lest signa-

ture over al l t-parse representations of graphs free-boundary ( xed-boundary) isomorphic

to G. In addition, the t-parse G is treewidth canonic if it is the lexicographic mini-

mum t-parse over al l structural ly canonic representations within the free-boundary ( xed-

boundary) isomorphic equivalence class. We cal l these orderings of treewidth t-parses the

free-boundary (or xed-boundary) lex-rank order.

It is understo o d from the context whether we are talking ab out the free or xed

b oundary cases, with the latter case b eing more common.

Lemma 44 Ifagraph G of treewidth t also has pathwidth t then the structural ly canonic

(and treewidth canonic) t-parse for G has no  operators.

Pro of. This follows from the fact that a t-parse with more  op erators also has more

vertex op erators (the circle plus op erator absorbs t +1 vertices). Since the length of

a signature for a t-parse equals the number of vertex op erators, any signature without

 op erators (i.e., a pathwidth t-parse ) is less in the treewidth t-parse comparison order

than any non-trivial treewidth t-parse . 2 27

The ab ove lemma allows us to do computations (enumerations) for pathwidth t-parse s

and then reuse (if using the lex-canonic pathwidth scheme) any partial results for these

t-parses when computing within the treewidth t-parse domain. For example, for the

obstruction set search metho d describ ed in [Din95] we could reuse any pro ofs of graph

minimality or nonminimality from a previous search that was restricted to pathwidth

t-parses.

Our treewidth analog to Lemma 36's \pre x of canonic is canonic" is given b elow.

Lemma 45 For the xed-boundary case, any rooted induced subtree S of a treewidth

canonic t-parse T is also treewidth canonic.

Pro of. By induction on the numb er of op erators, it suces to lo ok at pre xes with one

less op erator. Let g denote the last op erator of T . The validity of this statement for the

n

n

j k ) follows from the left asso ciative semantic pathwidth op erators (g = i or g =

n n

interpretation of these unary op erators. That is, if there exists a pre x S with a more

canonic parse, then applying the unary op erator g to S contradicts T b eing treewidth

n

canonic. For the treewidth op erator case, g = , assume T = G  G is a treewidth

n 1 2

canonic t-parse. By de nition of treewidth canonic, we can also assume G  G (in lex-

1 2

rank order). If there exists a t-parse H that is xed-b oundary isomorphic to G that has

1 1

0

a smaller rank, then the xed-b oundary isomorphic t-parse T = H  G contradicts the

1 2

fact that T is treewidth canonic. This contradiction can take place either in or outside

T 's structurally canonic equivalence class. That is, if s(H )

1 1

b etter structural equivalence class for T . The same argument holds for the child parse

G replaced with G . 2

1 2

As a consequence of the ab ove lemma there is a simple enumeration scheme (as

was given in Section 4.1 for the pathwidth t-parses) for generating all xed-b oundaried

t-parses of treewidth at most t. Note that like our free-b oundary pathwidth case, ex-

tending a canonic xed-b oundaried t-parse G may yield a non-canonic t-parse G  Z ,

but any pre x (subtree) of a xed-b oundary canonic H is canonic. An example of the

former problem is given b elow.

0 0

'

G  Z = @ = H

1 1

2 2

n n n n n n n n n n

[ 0 ; 1 ; 2 ; 0 1 ; 0 2 ; 0 ]  [ 1 ] ' [ 0 ; 1 ; 2 ; 0 1 ; 0 ; 12; 1 ]

@

The subtree prop erty of Lemma 45 do es not hold for the free-b oundary treewidth

case since the semantics of the binary op erator  require xed-b oundary vertices. For 28

example, consider the free-b oundary canonic 1-parse A  B , where A is taken from

n n n n

01; 1 ; 01; 0 ]. Here b oth subtrees A and B are Example 42 and B = [ 0 ; 1 ;

free-b oundary isomorphic but B is not treewidth canonic for the free-b oundary case.

Acknowledgement

Most of the pathwidth t-parse theory presented here was obtained during several tea-time

discussions with Kevin Cattell with regards to feasible obstruction set search strategies

(e.g., [CD94]). Of course, I take all resp onsibility for the correctness of the material that

is presented here.

References

[ACP87] Stefan Arnb org, Derek G. Corneil, and Andrzej Proskurowski. Complexity of

nding emb eddings in a k -tree. SIAM Journal on Algebraic Discrete Methods,

8:277{284, April 1987.

[AP89] Stefan Arnb org and Andrzej Proskurowski. Linear algorithms for NP-hard prob-

lems restricted to partial k -trees. Discrete Applied Mathematics, pages 11{24,

1989.

[APC87] Stefan Arnb org, Andrzej Proskurowski, and Derek G. Corneil. Minimal forbidden

minor characterization of a class of graphs. Col loquia Mathematica Societatis

Janos Bolyai, 52:49{62, 1987.

[Arn85] Stefan Arnb org. Ecient algorithms for combinatorial problems on graphs with

b ounded decomp osability { A survey. BIT, 25:2{23, 1985. Invited pap er.

[BC87] Michel Bauderon and Bruno Courcelle. Graph expressions and graph rewritings.

Mathematical System Theory, 20:83{127, 1987.

[BGHK95] Hans L. Bo dlaender, John R. Gilb ert, Hjalmtyr Hafsteinsson, and Ton Kloks. Ap-

proximating treewidth, pathwidth, and minimum elimination tree height. Journal

of Algorithms, 18:238{255, 1995.

[BH80] Terry Beyer and Sandra Mitchell Hedetniemi. Constant time generation of ro oted

trees. SIAM Journal on Computing, 9:706{712, 1980.

[Bie91] Daniel Biensto ck. Graph searching, path-width, tree-width and related problems

(a survey). In Reliability of Computer and Communication Networks, volume 5

of DIMACS Series in Discrete Mathematics and Theoretical Computer Science,

pages 33{49. Asso ciation for Computing Machinery, 1991.

[BM76] J. A. Bondy and U. S. R. Murty. Graph Theory with Applications. MacMillan,

1976. 29

[Bo d86] Hans L. Bo dlaender. Classes of graphs with b ounded tree-width. Technical Re-

p ort RUU-CS-86-22, Dept. of Computer Science, University of Utrecht, P.O. Box

80.012, 3508 TA Utrecht, the Netherlands, December 1986. (Also in Bul letin of

the EATCS 36 (1988), 116{126).

[Bo d88a] Hans L. Bo dlaender. Dynamic programming algorithms on graphs with b ounded

treewidth. In Proceedings of the International Col loquium on Automata, Lan-

guages and Programming, volume 317 of Lecture Notes on Computer Science,

pages 105{119. Springer-Verlag, 1988. 15th ICALP.

[Bo d88b] Hans L. Bo dlaender. Some classes of graphs with b ounded treewidth. Bul letin of

the EATCS, 36:116{126, 1988.

[Bo d90] Hans L. Bo dlaender. Polynomial algorithms for graph isomorphism and chromatic

index on partial k -trees. Journal of Algorithms, 11:631{644, 1990.

[Bo d93] Hans L. Bo dlaender. A linear time algorithm for nding tree-decomp ositions

of small treewidth. In Proceedings of the ACM Symposium on the Theory of

Computing,volume 25, 1993.

[Bor88] Richard Brian Borie. Recursively Constructed Graph Families: Membership and

Linear Algorithms. Ph.D. thesis, Georgia Institute of Technology,Scho ol of Infor-

mation and Computer Science, 1988.

[BP71] L.W. Beineke and R.E. Pipp ert. Prop erties and characterizations of k -trees. Math-

ematika, 18:141{151, 1971.

[CD94] Kevin Cattell and Michael J. Dinneen. Acharacterization of graphs with vertex

cover up to ve. In Vincent Bouchitte and Michel Morvan, editors, Orders, Algo-

rithms and Applications, ORDAL'94, volume 831 of Lecture Notes on Computer

Science, pages 86{99. Springer-Verlag, July 1994.

[CDF95] Kevin Cattell, Michael J. Dinneen, and Michael R. Fellows. Obstructions to

within a few vertices or edges of acyclic. In Proceedings of the Fourth Workshop

on Algorithms and Data Structures, WADS'95, volume 955 of Lecture Notes on

Computer Science, pages 415{427. Springer-Verlag, August 1995.

[CL86] Gary Chartrand and Linda Lesniak. Graphs and Digraphs. Wadsworth Inc., 1986.

[CM93] Bruno Courcelle and M. Mosbah. Monadic second-order evaluations on tree-

decomp osable graphs. Theoretical Computer Science, 109:49{82, 1993.

[Din95] Michael J. Dinneen. Bounded Combinatorial Width and Forbidden Substructures.

Ph.D. dissertation, Dept. of Computer Science, University of Victoria, P.O. Box

3055, Victoria, B.C., Canada V8W 3P6, Decemb er 1995.

[DR83] I. S. Du and J. K. Reid. The multifrontal solution of inde nite sparse symmetric

linear equations. ACM Transactions on Mathematical Software, 9:302{325, 1983. 30

[EST87] J. A. Ellis, I. H. Sudb orough, and J. Turner. Graph separation and searchnumb er.

Rep ort DCS-66-IR, Dept. of Computer Science, University of Victoria, P.O. Box

3055, Victoria, B.C. Canada V8W 3P6, August 1987.

[Fel] Michael R. Fellows. private communication. Dept. of Computer Science, Univer-

sity of Victoria.

[FL92] Michael R. Fellows and Michael A. Langston. On well-partial-order theory and its

application to combinatorial problems of VLSI design. SIAM Journal on Discrete

Mathematics, 5:117{126, February 1992.

[Kin89] Nancy G. Kinnersley. Obstruction set isolation for layout permutation problems.

Ph.D. Thesis, Dept. of Computer Science, Washington State University, Pullman,

WA 99164, 1989.

[KS93] Haim Kaplan and Ron Shamir. Pathwidth, bandwidth and completion problems

to prop er interval graphs. Technical rep ort 285/93, The Moise and Frida Eskenasy

Institute of Computer Sciences, Tel Aviv University,Novemb er 1993.

[KT92] Andras Kornai and Zsolt Tuza. Narrowness, pathwidth, and their application in

natural language pro cessing. Discrete Applied Mathematics, 36:87{92, 1992.

[Lu93] Xiuyan Lu. Finite state prop erties of b ounded pathwidth graphs. Master's pro ject

rep ort, Dept. of Computer Science, University of Victoria, P.O. Box 3055, Victo-

ria, B.C., Canada V8W 3P6, 1993.

[MM91] E. Mata-Montero. Resilience of partial k -tree networks with edge and no de fail-

ures. Networks, 21:321{344, 1991.

[Moh90] Rolf H. Mohring. Graph problems releted to gate matrix layout and PLA fold-

ing. In G. Tinhofer, E. Mayr, H. Noltemeier, and M. Syslo (in co op eration with

R. Albrecht), editors, Computational Graph Theory, Computing Supplementum 7,

pages 17{51. Springer-Verlag, 1990.

[Nar89] Chandrasekharan Narayanan. Fast paral lel algorithms and enumeration techniques

for partial k -trees. Ph.D. dissertation, Dept. of Computer Science, Clemson Uni-

versity, August 1989.

[Ros73] Donald J. Rose. On simple characterizations of k -trees. Discrete Mathematics,

7:317{322, 1973.

[RS] Neil Rob ertson and Paul D. Seymour. Graph Minors. XX. Wagner's conjecture.

in progress.

[RS83] Neil Rob ertson and Paul D. Seymour. Graph Minors. I. Excluding a Forest.

Journal of Combinatorial Theory, Series B, 35(1):39{61, 1983.

[RS84] Neil Rob ertson and Paul D. Seymour. Graph Minors. III. Planar tree-width.

Journal of Combinatorial Theory, Series B, 36:49{64, 1984. 31

[RS86] Neil Rob ertson and Paul D. Seymour. Graph Minors. I I. Algorithmic asp ects of

tree-width. Journal of Algorithms, 7:309{322, 1986.

[RS91] Neil Rob ertson and Paul D. Seymour. Graph Minors. X. Obstructions to tree-

decomp ositions. Journal of Combinatorial Theory, Series B, 52:153{190, 1991.

[SD76] D. C. Schmidt and L. E. Dru el. A fast backtracking algorithm. Journal of the

Association Computing Machinery, 23(3):?{445, July 1976.

[WHL85] T. V. Wimer, S. T. Hedetniemi, and R. Laskar. A metho dology for constructing

linear time graph algorithms. Congressus Numerantium, 50:43{60, 1985.

[Wil89] Herb ert S. Wilf. Combinatorial Algorithms: AnUpdate,volume 55 of CBMS-NSF

Regional Conference Series in Applied Mathematics, chapter Listing Free Trees,

pages 31{36. SIAM, 1989.

[Wim87] T. V. Wimer. Linear algorithms on k -terminal graphs. Ph.D. dissertation, Dept.

of Computer Science, Clemson University, August 1987. Rep ort No. URI-030.

[WROM86] Rob ert A. Wright, Bruce Richard, Andrew Odlyzko, and Brendand D. McKay.

Constant time generation of free trees. SIAM Journal on Computing, 15:540{548,

1986.

[YBdFT97] Koichi Yamazaki, Hans L. Bo dlaender, Bab ette de Fluiter, and Dimitrios M.

Thilikos. Isomorphism for graphs of b ounded distance width. Technical rep ort

25, Dept. of Computer Science, University of Utrecht, P.O. Box 80.089, 3508 TB

Utrecht, the Netherlands, 1997. 32