22
ZOR - Mathematical Methods of Operations Research (1995) 41:325-346 V~, I ] [t Optimal Node Disjoint Paths on Partial 2-Trees: A Linear Algorithm and Polyhedral Results F. MARGOT, A. PRODON, TH. M. LIEBLING D6partement de math6matiques, EPF Lausanne 1015 Lausanne, Switzerland Abstract: We present an O(p" n) algorithm for the problem of finding disjoint simple paths of minimum total length between p given pairs of terminals on oriented partial 2-trees with n nodes and positive or negative arc lengths. The algorithm is in O(n) if all terminals are distinct nodes. We characterize the convex hull of the feasible solution set for the case p = 2. Keywords: 2-tree, disjoint paths, polyhedral characterization. The problem of disjoint paths is stated as follows: Given a graph G = (V, E) and p pairs (sl, tl), ..., (Sp, tp), of nodes of G, find or decide there are no p node disjoint paths P1 ..... Pp such that Pi joints si to ti for i = 1 .... , p. It is known to be polynomially solvable for p = 2 (see, for example, [10], [i 1], [14]) and for p fixed (but with an astronomic constant [12]). If p is part of the input, the problem is NP-complete as shown in [6] and when G is a directed graph and directed paths from s i to t~ are asked for, the problem is NP-complete even when p = 2 (see [5]). In the corresponding optimization problem, a length function for the edges of G is given and one is to find paths PI, ..., Pp as above, minimizing the sum of their lengths (if there are circuits of negative length, we require the paths to be elementary). This problem is polynomially solvable if G is a directed acyclic graph (see [5]; the algorithm given there can be extended to handle the weighted case) or if G is a partial k-tree (can be deduced from general problem treated in [2], [9]). In the first section of this paper, we present an O(I VI) algorithm for solving this problem on a directed partial 2-tree with 2p distinct nodes sl, tl ..... sp, tp. If the 2p nodes are not distinct, a setting of the problem occuring fre- quently in VLSI design applications, a variant of the algorithm works with complexity O(p'[ VD. This is an improvement over the algorithm of Scheffler [13] which has a complexity on O(p4"[ V[) when used on partial 2-trees. Our algorithm can be generalized to work on partial k-trees, for k > 3: if the 2p nodes are distinct its complexity remains O(1VI), otherwise it is polynomial in I VI and 0340-9422/95/41:3/325- 346 $2.50 1995 Physica-Verlag, Heidelberg

Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Embed Size (px)

Citation preview

Page 1: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

ZOR - Mathematical Methods of Operations Research (1995) 41:325-346 V ~ , I ] [ t

Optimal Node Disjoint Paths on Partial 2-Trees: A Linear Algorithm and Polyhedral Results

F. MARGOT, A. PRODON, TH. M. LIEBLING

D6partement de math6matiques, EPF Lausanne 1015 Lausanne, Switzerland

Abstract: We present an O(p" n) algorithm for the problem of finding disjoint simple paths of minimum total length between p given pairs of terminals on oriented partial 2-trees with n nodes and positive or negative arc lengths. The algorithm is in O(n) if all terminals are distinct nodes. We characterize the convex hull of the feasible solution set for the case p = 2.

Keywords: 2-tree, disjoint paths, polyhedral characterization.

The problem of disjoint paths is stated as follows: Given a graph G = (V, E) and p pairs (sl, tl), . . . , (Sp, tp), of nodes of G, find or decide there are no p node disjoint paths P1 . . . . . Pp such that Pi joints si to ti for i = 1 . . . . , p. It is known to be polynomially solvable for p = 2 (see, for example, [10], [ i 1], [14]) and for p fixed (but with an astronomic constant [12]). If p is part of the input, the problem is NP-complete as shown in [6] and when G is a directed graph and directed paths from s i to t~ are asked for, the problem is NP-complete even when p = 2 (see [5]).

In the corresponding optimization problem, a length function for the edges of G is given and one is to find paths PI, . . . , Pp as above, minimizing the sum of their lengths (if there are circuits of negative length, we require the paths to be elementary). This problem is polynomially solvable if G is a directed acyclic graph (see [5]; the algorithm given there can be extended to handle the weighted case) or if G is a partial k-tree (can be deduced from general problem treated in [2], [9]). In the first section of this paper, we present an O(I VI) algorithm for solving this problem on a directed partial 2-tree with 2p distinct nodes sl, tl . . . . . sp, tp. If the 2p nodes are not distinct, a setting of the problem occuring fre- quently in VLSI design applications, a variant of the algorithm works with complexity O(p'[ VD. This is an improvement over the algorithm of Scheffler [13] which has a complexity on O(p4"[ V[) when used on partial 2-trees. Our algorithm can be generalized to work on partial k-trees, for k > 3: if the 2p nodes are distinct its complexity remains O(1VI), otherwise it is polynomial in I VI and

0340-9422/95/41:3/325- 346 $2.50 �9 1995 Physica-Verlag, Heidelberg

Page 2: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

326 F. Margot et al.

p but not in k. In the second section of this paper, we give a description of the polytope associated to the case p = 2 on a 2-tree.

1 Node Disjoint Paths on Partial 2-Trees

The separating properties of partial k-trees and in particular of partial 2-trees will lead to a linear time construction of the optimal solution on the whole graph G by properly composing partial optimal solutions on subgraphs. Note that although the existence of linear time algorithms for a broad class of problems on partial k-trees was already established in [3] (see also [16]), the node disjoint p.ath problem is not likely to be in the class treated there, as will be seen below.

1.1 Problem Formulation and Partial 2-Tree Construction

A partial 2-tree can be defined recursively in terms of composition rules as follows:

The primitive graphs for the set of partial 2-tree are the graphs consisting of two nodes u and v that are either isolated or joined by an edge. The nodes u and v are called terminals of these graphs. If G 1 = (1/1, EI) and G 2 = (I11, Ez) are partial 2-trees with terminals ua, v~ and u2, vz respectively, then:

a) The graph obtained by identifying vl and uz is a partial 2-tree with terminals u 1 and v z. This graph is the series composition of G1 and G z.

b) The graph obtained by identifying ul and u2 and also v t and v2 is a partial 2-tree, the parallel composition of G1 and G 2. This graph has terminals ut (=u2) and vl (=v/) .

A 2-tree G is a partial 2-tree whose primitive graphs are edges, without parallel edges and such that all subgraphs obtained during the construction have their terminals joined by an edge in G.

A parse tree for a partial 2-tree G is a binary tree whose leaves are primitive graphs of G and where each inner node is the partial 2-tree obtained by com- posing the subgraphs represented by its two sons, its root being the whole graph G. Series and parallel composition are identified by comparing the sets of termi- nals of the father and his two sons.

For a given partial 2-tree with node set V, the parse tree is not unique, but one such tree can be determined in O(I VI) 1-15] and from here on we shall assume that for each partial 2-tree a parse tree is fixed.

Page 3: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 327

The problem we consider is: Given a partial 2-tree G = (V, E), 2p distinct nodes of Gsl, tl, s2, t2, . , . , sp, tp and a length function for the edges of G, determine p elementary node disjoint paths such that the i th path joins s~ to t~ and the sum of the lengths of the p paths is minimum. The length function for the edges of G is real valued. In fact, we solve a slightly more general problem where each edge of the partial 2-tree has an orientation (i.e. is an arc) and where directed disjoint paths are to be found.

1.2 Subgraphs, Terminals and Restricted Optimal Solutions

The generic algorithm [3] for solving problems on a partial k-tree G uses the fact that a list of equivalence classes for partial solutions on subgraphs of G is known as well as a description of series and parallel compositions of optimal representa- tives of these equivalence classes: the algorithm composes the equivalence classes of the subgraphs composed in the parse tree to obtain a representative of each of the equivalence classes of the whole graph G, containing in particular the solution of the problem. The algorithm to be developed here is a slightly general- ized version of this approach. In this section, we introduce a classification of partial solutions for the node disjoint paths problem for a graph with terminals u and v.

Let G' = (V', E') be a partial 2-tree with terminals u and v appearing during the construction of G (i.e. G' corresponds to a node of the parse tree of G) and S := {ilsi ~ V'}, T : = {ilti ~ V'}.

Path Pi starts (resp. ends) in G' if i is in S (resp. T). A path starting or ending in G' is said to be rooted in G'. A path uses a node u ~ V' if u is on it. A path quits G' through u ~ V' if it uses u, its arc ending at u (if it exists) is in G' and its arc starting at u is not in G'. A path enters G' via u e V' if it uses u, its arc ending at u is not in G' and its arc starting at u (if it exists) is in G'. A path touches a node u ~ V' if it uses u without quitting or entering G' through u.

According to the balance of paths starting or ending in G', this graph is said to be of:

Type I

Type II

Type I I I

Type I V

Ty.pe V

if S = T .

ifS ~ T a n d ISI = ITI + 1 .

if T _~ S and I TI = [SI + 1 .

i fS _ T a n d ISI = ITI + 2 .

if T _ Sand ITI = ISI + 2 .

Page 4: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

328 F. Margot et al.

�9 ~176

s2 " ~

(

.o'~...Q

t2

"22"-. : . . o :

s2 " ' ' " - . ' [ , :

. . "6 . . . . . . . . - ; . . . . . . . . . . : b

s3 ." s3

, ."6- . . . . . . . .-" . . . . . . . . . . : b

Fig. 1. Upper part: Graph G' with terminals u and v. Two interchangeable solutions on G' are depicted

TypeVI i f l S - T I = I T - S ] = I .

Type Vl l if G' is of no previous type .

Note that if G' is of type VII, then the disjoint paths don't exist, since then iS - T[ + IT - SI > 3, i.e. the set {u, v} separates at least three pairs of nodes (s~, ti). The paths joining these pairs have to quit or enter G' through either u or v, so at least two of them have one node in common, which contradicts the disjointness.

Any G' with terminals u and v induces an equivalence relation between admis- sible solutions of the problem, i.e. two solutions are equivalent on G' if their restrictions to G' are interchangeable without losing admissibility in G (see Fig. 1). This equivalence is characterized by the role played by the terminals u and v with regard to the restriction of the solution to G'. Therefore, the equiva- lence is really one between these restrictions and two restrictions will be in the same equivalence class if u and v play the same roles in them. The following labels attached to the pairs (u, v) of terminals describe their roles: A pair (u, v) of terminals is labelled l, lv where either

a) l, (and analogously, Iv) has value:

- F: Free (no path rooted in G' uses this node), - B: Busy (one path rooted in G' touches this node), - s~: The path P~ rooted in G' quits G' through this node, - t~: The path P~ rooted in G' enters G' through this node, or

Page 5: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 329

b) the pair l, lv has value:

- ~?: If a path not rooted in G' contains a path in G' from v to u (the label [~ is defined analogously),

- g~: If one path starting and ending in G' quits G' via u and enters G' through v (the label ~ is defined analogously).

Each labelling corresponds to precisely one equivalence class whose dependence on the subscripts of the corresponding labels leads to 0(p 2) such classes. Instead of the equivalence classes themselves, patterns of these classes (a pattern is a set of equivalence classes) will be used, making the number of patterns and hence the complexity of the composition rules independent of p. This will yield an 0(I VI) algorithm for the resolution of the overall problem.

Two equivalence classes are in the same pattern if their respective labellings differ only by subscripts: for example, equivalence classes sl F, s2F and s3F are all in the same pattern named s~F and equivalence classes s I $2, s2s 1 and s 3 s 2 are in the same pattern named s~sj. Note that a pattern does not define an equiva- lence class on the set of restrictions of solutions as for example a solution in sis2 can not be interchanged with'a partial solution in s2s 1 while keeping the admissi- bility of the solution.

The various possibilities for the labelling of the pair (u, v) of terminals induce the following twenty patterns of equivalence classes with respect to G' (the first symbol of a pattern is the label of u, the second is that of v):

Suppose that G' is of type I.

- If in an admissible solution no path quits or enters G', the restriction of this solution to G' corresponds to one of the patterns FF, FB, BF or BB.

- If a path not rooted in G' uses edges of G', then this path enters G' through u (resp. v) and quits G' through v (resp. u) and the corresponding pattern is ?~ (resp. ~[).

- If a path rooted in G' quits G' through u (resp. v) and returns to G' through v (resp. u), the pattern is ~ (resp. ig).

Suppose now that G' is of type II. As one path of G' has one of its extremities outside G', it has to quite G' either through u or v and the restriction of an admissible solution is one of the patterns s~F, Fs~, s~B or Bs~.

Similarly, if G' is of type III, any restriction has one of the patterns t~F, Ft~, tiB or Bt ,

If G' is of type IV, any restriction has the pattern sis j. If G' is of type V, any restriction has the pattern t~tj. If G' is of type VI, any restriction has one of the patterns s~tj or t~s~. Finally, if G' is of type VII, the problem has no solution. Note that this classification is complete, as the division into types clearly is

and for each type all possibilities are listed. Therefore, the total number of equivalence classes depends on p, the number of paths, and this is a non standard

Page 6: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

330 F. Margot et al.

feature. In fact, the generic linear time algorithm for solving problems on partial 2-trees described in [3] uses the boundedness of the number of equivalence classes to obtain composition rules with complexity O(1).

In order to obtain an algorithm with complexity O(I VI) for our problem, we remove this dependence on p using the fact that, for a subgraph G' and for one given pattern, the number of subscripts corresponding to a possible partial solution is independent of p: For the patterns corresponding to a graph G' of type II (resp. type III) there is only one possibility for i, namely {i} = S - T (resp. {i} = T - S), for the pattern corresponding to a graph of type IV (resp. V) there are two equivalence classes, sisj and sis i (resp. tit~ and t / i ) with {i , j} = S - T (resp. { i , j } = T - S) and if G' is of type VI, {i} = S - T and {j} = T - S. Hence, the maximum number of equivalence classes which need be calculated for one subgraph G' is at most eight. Moreover, rather than composi- tion rules for equivalence classes,the algorithm will use composition rules for the patterns of equivalence classes with conditions on the subscript(s) appearing in the two composed equivalence classes.

In other words, the number of non empty equivalence classes for each node of the parse tree is bounded by a constant, but the total number of equivalence classes depends on p. This latter dependencey is removed by using patterns and giving the composition tables for them instead of the standard composition tables for equivalence classes.

1.3 Description o f the Algorithm

If G' is a graph obtained by series (resp. parallel) composition of graphs G1 and G2, the series (resp. parallel) composition of the associated equivalence classes is well defined as will be seen below. Composition of two equivalence classes consists in pasting one representative of each class and adding the corresponding path lengths. The optimality principle implies that only optimal representatives need be considered. Therefore it suffices to compute one optimal representative per equivalence class for primitive graphs and then, following the parse tree, compose optimal representatives of the equivalence classes of the two sons to obtain optimal representatives of the equivalence classes of the father.

1.3.1 Initialization

For clarity, some further notation will be useful. Denote the nodes of G by V = {vl, v z . . . . . v,} and let set ~ = {sl, till = 1 . . . . . n} mark the path extremi- ties. A node of V gets the additional name st, t~ or N (for normal) if it is the origin of the path P~, its destination or none respectively.

Page 7: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees

Table 1. Initialization for primitive graphs

331

u v non empty class(es)

N si N tl N si ti si ti si

N N si N ti sj

ti si

si

FF(O); t$(c,,,) siF(O); Bsi(cuv) FsJO) tiF(O) Fti(O); t iB (c~) slsj(O) tlb(O) ~i(o); ~ B ( c J ~(o) Sitj(O) tjsi(O)

Recall that the parse tree associated with G has as its leaves (i.e. primitive graphs) pairs of nodes of G that are either isolated or joined by an arc. The terminals of these primitive graphs carry the name of the corresponding nodes in G and their additional name is obtained as follows: Suppose that node vj has the additional name x e 5 e in G and that more than one terminal of the primitive graphs of G has name vj. Then the additional name of these terminals vj is N for all but one terminal whose additional name is set to x. This means that the extremity x is contained in exactly one primitive graph of G, the other primitive graphs of G sharing the node vj consider v i as a normal node. This condition on the additional name will simplify the description of the composition rules.

Let (u, v) be an arc with length c,v; this arc is a primitive graph of G and, according to the additional names of u and v, the non empty equivalence classes it induces are given in Table 1 where the length of the optimal representative for each such class is given in parentheses.

The initialization of a primitive graph containing two nodes u and v not joined by an arc may be deduced from Table 1, either by joining the two nodes by an imaginary arc of length 0% or what amounts to the same, by just taking into account the left column of the equivalence classes given in Table 1.

1.3.2 Parallel Composition Rule

Let G1 and G 2 be two graphs that will be composed in parallel yielding the graph G'. Of course all three graphs have the same terminals u and v. Each entry in Table 2 gives the equivalence class pattern resulting from the composition of a pattern of G 1 with one of G2 (void entries indicate forbidden compositions).

The algorithm performs as follows: One optimal representative of each pos- sible equivalence class of G1 (resp. G2) is known; to compute an optimal repre- sentative of each possible equivalence class of G' we try to compose the represen-

Page 8: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Tab

le 2

. P

aral

lel

com

po

siti

on

tab

le

FF

B

F

FB

B

B

saF

F

sa

SaB

B

s~

t~F

F

t~

t~B

B

t~

SaS b

ta tb

Sa tb

tb

Sa

FF

B

F

FB

B

B

~ ~

E

FF

B

F

FB

B

B

~ ~

E

BF

B

B

FB

B

B

BB

B

B

~ B

B

~ B

B

BB

siF

F

si

siB

B

s i

siF

F

s i

siB

Bs

~ B

s i

s~B

Bs i

si

B

tiF

F

ti

tiB

B

t i

tiF

F

t i

tiB

B

t i

Bti

t~

B

Bti

ri

B

s~F

s~

B

Bs.

s~

s i

BF

Sa

t i

BB

F

s~

Bs~

s~

B

sis a

tl

s a

FB

B

B

s~B

B

B

Bs~

B

B

t~F

t~

B

Bt~

B

F

t~s~

B

B

t~t~

F

t a

Bt a

t~

B

sit a

F

B

BB

tl

t a

t.B

BB

B

t~

BB

SaSh

R

S b

saB

t~t b

B

t b

t,B

S a t b

S a

B

Bt b

t~

Sa

Bsa

tb

B

s~sj

sisj

s~B

BB

t,9

tltj

Btj

t~B

BB

sitj

tjs,

s,tj

tjs,

s~B

mj

tin

BB

B

B

Page 9: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 333

e -

[-

g ~2~

~2 ~ g ~ g

',~

r~

g ~

',~ ~

,'~ ~

a a

t~

a ~

Page 10: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

334 F. Margot et al.

tative of each equivalence class of G1 with the representative of each equivalence class of G2, using Table 2 and paying attention to the subscript(s). If the resulting pattern is shown in bold face, then the corresponding subscripts of the equiva- lence classes of G~ and G2 must match: For example, if an equivalence class of G 1 is $1s2, the one of G 2 can be taF, Ft 2 or t~t 2 but not t2F. Note that label F matches with every subscript and label B with none. The length of the ob- tained representative of an equivalence class of G' is simply the sum of the lengths of the two composed optimal representatives of equivalence classes of G and G2, and for each non empty equivalence class of G', we keep the optimal representative.

1.3.3 Series Composition Rule

Let G1 with terminals u, w and G z with terminals w, v be two graphs that will be composed in series yielding the graph G' with terminals u, v. Analogous remarks as for the parallel composition apply here, except that when subscripts must match, this only concerns the labels of w. Table 3 gives the possible compositions of equivalence classes of G1 (vertically) and those of G2 (horizontally); void entries indicate forbidden compositions.

The algorithm may now be summarized as follows:

1.4 Algorithm

lnput: A partial 2-tree G = (V, E), a length function for the arcs of G, 2p distinct terminal nodes of Gs 1, tl , s 2, t2, . . . , Sp, tp.

Output: An optimal solution to the minimum length node disjoint directed paths problem on G.

1) Determine a parse tree for G. 2) Initialize each leaf of the parse tree. 3) Follow the parse tree that determines at each phase the two subgraphs G 1

and G 2 to be composed yielding graph G'. Determine if the composition is series or parallel. Apply the corresponding composition rule to obtain one optimal represen-

tative for each equivalence class of G'. Repeat 3) until G is reached.

Page 11: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 335

4) The optimal solution on G is the best among the computed representatives of the equivalence classes FF, FB, BF and BB of G. If these four classes are empty, no solution exists.

The complexity of points 1) and 2) is O(I VI), point 3) has complexity 0(1) and is performed O(1V[) times. This algorithm determines the value of the solution, but can be adapted in the usual manner of dynamic programming to yield the solution itself in O(I VI).

1.5 Extensions

It is possible to modify the algorithm for the case where the s 1 . . . . . tp are not distinct, without increasing its complexity, however only if no more than a constant number m of paths between the same pair of nodes must be found. Without this condition, the complexity increases for the following reason: sup- pose that G', with terminals u and v, is a subgraph of G corresponding to a node of the parse tree for G and q paths joining u to v in G are to be found. Then, O(q) equivalence class patterns (where none, exactly one, two . . . . . respectively all q paths are totally contained in G') are needed. The modified algorithm runs in O(1VI) with the above condition and in O(p'l VI) if it is dropped.

It is also possible to use the same type of algorithm on a partial k-tree for all fixed k if the parse tree is given, but the number of patterns grows very quickly. The best algorithm known to determine a parse tree for a partial k-tree is in O(I VI) [4].

2 Polyhedral Characterization of Bipaths

In this section, we consider the directed graph obtained by replacing each edge of a 2-tree by two opposite arcs and give a complete characterization of the polyhedron representing the convex hull of the arc incidence vectors of all elementary disjoint paths joining two distinct pairs of nodes (also called bipaths for short). This result is obviously not an overwhelming achievement for practi- cal purposes as the corresponding problem may be solved very efficiently using the algorithm of the previous section. But as usual, the secret hope is that the study of a characterization of a simple problem may help understand the struc- ture of the polytope for a more general problem. Here, we show that a linear description very close to a classical 2-multicommodity flow formulation yields the associated polytope for p = 2 when the underlying graph is a 2-tree. No

Page 12: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

336 F. Margot et al.

e t

0 . . . . . o o . 0

�9 o o ' ~

Fig. 2. Plain line: Ladder L joining s to t; dashed line: Component G based on (e, f ) with respect to L

results are available for bipaths on general graphs or for p > 2 on a 2-tree (without variable redefinition, as e.g. in [8], which introduces a large number of variables).

For simplicity, the figures will always represent undirected graphs though two arcs should replace each edge and the term "edge" will correspond to a pair of opposite arcs.

First we shall treat the polyhedral characterization for the case p = 1 on 2-trees, which will be used subsequently for the bipath problem. The basic structure leading to the characterization is that of a ladder (to be introduced below). The polyhedron will be first derived for a ladder and then generalized to arbitrary 2-trees.

A ladder is a 2-tree which is either K2, Ka or has exactly two nodes of degree 2 (see Fig. 2). Thus a ladder is an outerplanar graph and if it has at least four nodes, exactly two of them (s and t) are of degree 2. We call the edges of the corresponding outer circuit the sides of the ladder and the remaining ones the steps of the ladder. Recall that a graph is outerplanar if it has a planar represen- tation such that all its nodes are on its outer face.

Observe that every 2-tree with distinguished non adjacent nodes s and t contains a unique ladder with s and t having degree two. This ladder (called ladder joining s to t) can be found by successive deletion of nodes of degree two different from s and t. Note that in the case where s and t are adjacent, the same procedure will yield the single edge (s, t) which will be taken as the ladder joining s and t.

2.1 Polyhedron of the Elementary Paths on a 2-Tree

For general graphs and arbitrary costs (positive and negative ones), it is not known how to express the problem of finding the shortest directed elementary path between two nodes s and t as an LP in real variables, but on a ladder with s and t having degree 2, this can be done as follows:

Page 13: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 337

min ~ (c .x . la �9 E(G)) (1)

s.t. ~ (x,[a e 6+(0) - ~, (x, la �9 6-(i)) = 1

i f / = s

ifi = t

Vi �9 V(G) -- {s, t}

(2)

(x. la �9 6(i)) < 1 Vi e V(G) (3)

xa > O Ya �9 E(G) (4)

x a = 0 u ~ M (5)

where E(G) consists of those arcs obtained by replacing each edge of the ladder by two opposite arcs; M is the set of all arcs of the ladder which are on no elementary path from s to t (these arcs correspond to the two elementary paths from t to s on the sides of the ladder); ~+(i):= {(i,j)l(i,j) ~ E(G)}; 6- ( i ) := {(j, i)[ (j, i) e E(G)}; x is a vector and Xa a component of this vector. When there is no ambiguity, we don't make a distinction between the characteristic vector of a set and the set itself.

The polyhedron described by constraints (2)-(5) is called P,.

Lemma 1: Let G be a ladder with two nodes s and t of degree < 2. The extreme points of P, are exactly the elementary paths from s to t.

Proof'.

1) Let x be an elementary path from s to t. It is clear that x e P, and x is the only point of P, which satisfies the restrictions x, > 0 for all arcs a outside the path x with equality, i.e. x is an extreme point of P,.

2) The matrix describing the constraints of P, is totally unimodular (it corre- sponds to the matrix of the flow from s to t with capactity constraints), and so the extreme points of P, are all integer. Suppose now that x is an extreme point of P, and x is not a path from s to t. The constraints imply that x represents an elementary path from s to t and a set of circuits; due to constraints (3) these circuits and the path from s to t are pairwise disjoint. Due to constraints (5) each circuit contains a step of the ladder, thus crosses each path from s to t. Therefore x is a path from s to t. �9

Let G be an arbitrary 2-tree with two distinguished nodes s and t and L the ladder joining s to t in G. Each connected component of G - L is adjacent to precisely two nodes e and f of L such that (e, f ) is an edge of L. A win9 based on

Page 14: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

338 F. Margot et al.

(e, f ) is a connected component of G - L adjacent to e and f along with the edges joining it to these nodes. The component G(e, f ) based on (e, f ) with respect to L is defined as the union of all wings based on (e, f ) (see Fig. 2). We call Ce: (resp. C:e) the set of the arcs of G(e, f ) that can be used by an elementary path from e to f (resp. from f to e). Note that neither C~: n o r C f e contain a directed cycle and that each arc in the component G(e, f ) is in exactly one of these two sets (this is easily shown by induction on the number of nodes in G(e, f)).

Lemma 2: Let G be a 2-tree, s and t two distinct nodes of G, L the ladder joining s to t in G and C the set of the components based on the edges of L. The extreme points of P* defined by relations (6) to (10) below are exactly the elementary paths from s to t:

(x~la E c5+(i)) -- Z (x,,la ~ 6-(i)) = (i 0 i f / = s

1 i f / = t

v i V ( L ) - {s, t}

(6)

(Xala~6-(O)<_1 ViG V(L) (7)

x~ > O Va ~ E(G) (8)

X a = 0 Va ~ M* (9)

E (xala ~ (C, s n c5 +(i)) - E (x.la ~ (Cef ('3 (~-( i)) ~- 0"~ VC E C , Vi G V(C)

Y', (x, la ~ (Cse n 6+(0) - ~ (x, la ~ (C:e n 6-(0) OJ (10)

where M* contains the set M as defined for P. as well as those sets Ce: (resp. C:e) corresponding to components G,: based on an edge (e, f ) of the ladder L such that arc (e, f ) (resp. arc (f, e)) is in m.

Proof: The proof is similar to that of Lemma 1, since constraints (10) imply that, for an extreme point x of P*, the only circuits which may occur have to use both extremities of some step of the ladder L, i.e. cross every path from s to t. �9

2.2 Polyhedron of Two Disjoint Paths on a 2-Tree

A set {u, v} _ V(G) is a separator of G if its deletion disconnects G. Note that, on a 2-tree, every separator {u, v} is indeed an edge. Let A, B be two subsets of nodes

Page 15: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 339

u v u v = b u = a ~ _ _ . _ _ . ~ v = b

i) ii) iii) iv)

Fig. 3. (i) a and b not separated by {u, v}; (ii) a and b separated by {u, v}; (iii) and (iv) degenerate cases: a and b separated by {u, v}

of G; a separator {u, v} of G separates A from B if for each a E A and b ~ B every path joining a to b uses u or v. (see Fig. 3).

Let G be a 2-tree and 5p = {Sl, tl , s2, t2} four distinct nodes of G such that every node of G with degree 2 is in ~ This set of four nodes will henceforth be called 5 ~. We call P*~ (resp. P 'z) the polyhedron P* corresponding to sl and t~

1 (resp. x2). (resp. s2 and t2) with variables xa Let P be the polyhedron in EIEI x EIEI with variables x = (x 1, x 2) and restric-

tions:

x 1 e P*I (11)

x2 ~ Pe*2 (12)

(x~ + X2I a e 6-(i)) _< 1 Vi E V(G) - {s,, s2} . (13)

x ~ = 0 ' r 1,2 (14)

To define N 1 consider the ladder L 2 joining s z and t 2 in G. N 1 contains all steps of L2 as well as all arcs in the components (w.r. to L2) which do not contain either Sl or tl and based on the steps of L2. The definition of N 2 is similar.

We will show that P is the convex hull of the bipaths on G and that P may be modified to handle all 2-trees. Constraints (11)-(12) express a 2-commodi ty flow problem, so, for x = (x 1, x 2) s P we call x 1 (resp. x 2) a flow; x 1 (resp. x z) is a convex combinat ion of elementary paths joining sl to tl (resp. s2 to t2), since all restrictions of Pe*~ and P*2 are satisfied. A path o f x ~ (resp. a path o f x z) is an elementary path joining s~ to t~ (resp. s 2 to t2) using only arcs a where xJ > 0

2 0). Call intersection of x I and x 2 the set of nodes of G used by both (resp. x, > flows, i.e. where they cross.

Lemma 3: Let G be a 2-tree, 5t the set of four extremities such that every degree two node of G is in :7. There exists a part i t ion of 5p into {a, b}, {c, d} and an edge (e, f ) such that {e, f } separates {a, b} from {c, d).

Proof." Choose as G' = (V', E') a primitive graph containing two nodes a and b in 5 ~ or the first graph containing such nodes and found during the construct ion

Page 16: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

340 F. Margot et al.

of G. Let {c, d} := 5 a - {a, b}. By the definition of 2-trees, the two terminals e and f of G' separate {a, b} from {c, d} and (e, f ) is an edge of G. �9

Lemma 4: Let G be a 2-tree, S~ the set of four extremities such that every degree two node of G is in 5 a and a partition of 50 into {a, b}, {c, d} satisfying Lemma 3. If the following procedure is applied on G, the resulting graph G' is a ladder.

0) Let G' := G; 1) While there exists a degree two node z in G' with neighbors x and y such that

neither {z, x} nor {z, y} separates {a, b} from {c, d} in G then delete z from G'.

Proof." The graph G' obtained by the above procedure is a 2-tree as deleting a degree two node of a 2-tree yields a 2-tree. Moreover G' contains at least one edge as the partition {a, b}, {c, d} satisfies Lemma 3 and no edge separating {a, b} from {c, d} is deleted. It remains to show that G' is either K2, K3 or has exactly two degree two nodes.

If G' contains at most two nodes of degree two, then G' is a ladder, by definition.

Suppose that G' contains at least three degree two nodes zl, z2 and z3. Note that as G' is a 2-tree, if two degree two nodes are adjacent in G' then G' is a K3. Thus one can suppose that zl, z2 and za are not adjacent. As z~ has not been deleted during the procedure, it has one neighbour x~ such that {z~, xl} separates {a, b} from {r d}, for i = 1, 2, 3. Suppose w.l.o.g, that {zl, Xl} separates {a, b} from {c, d, z2, z3} and that {z2, x2} separates {c, d} from {a, b, zl, z3}. Hence there exists a path in G joining a (resp. r to zl (resp. z2) which does not use x3 or z3. Consider now the ladder L12 joining zx to z2 in G'. Note that x3 r z~ (resp. x3 r z2) as z3 and Zl (resp. z2) are supposed to be non adjacent. As z3 has degree two, z3 is not in L~2 and thus {z3, x3} does not separate {z~} from {z2} in G'. But then there is a path in G joining a to c which does not use z 3 or x3, a contradiction. �9

Upon applying the procedure of Lemma 4, we obtain a ladder joining u to u'. Let v (resp. v') a neighbour ofu (resp. u') such that {u, v} (resp. {u', v'}) separates {a, b} from {c, d}. In the sequel, the resulting graph G' will be called the ladder joining {u, v} to {u', v'}.

Any 2-tree G such that each node of G with degree two is in 5g may be seen as a ladder joining {u, v} to {u', v'} with possibly some additional wings based on {u, v} and on {u', v'}. More precisely, if a and b are not separated by {u, v}, then there is one wing based on {u, v}, containing a and b. If a and b are separated by {u, v}, then either two, one or no wings are based on {u, v}, depending on the cardinality of {a, b} c~ {u, v}. Hence, there are at most five connected components in G - {u, v, u', v'}.

Page 17: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees

Sl ~ s2

uqk ,8 V

Fig. 4. Illustration for the proof of lemma 5

34t

L e m m a 5: Let G, 50, {u, v} and {u', v'} be as above and x = (x 1, x 2) an extreme point of P. Then x ~ and x 2 can not cross outside the ladder joining {u, v} to {u',

Proof" In the proof, we can interchange the roles of sl and tl and/or s2 and t2. Restrictions (13) and (14) imply the lemma, except if s~ and s2 are not separated by {u, v} (see Fig. 4). In the latter case, x 2 can't use u and x I can't use v (due to restrictions (13) and (14)). If the flows cross in p, then on this subgraph, x ~ (resp. x 2) is a convex combination of elementary path joining sl to u (resp. s2 to v). Let

(resp. r) be the sum of the coefficients of the convex combination associated with the paths joining s~ to u (resp. s2 to v) using p. Due to restrictions (13), we have ~ + fl < 1 and thus (x ~, x 2) is a convex combination of the bipaths (sa ~ u, S 2 -'~ U), (S 1 ~ U, S 2 "~ p ~ V) and (sl ~ p --+ u, s2 --* v). Hence, x can't be extreme.

Let L be a ladder, with q and r of degree 2; one may associate a level to each of its nodes by numbering them as follows: q gets number 1 and one of its neighbors (~ r) receives number 2. Then, iteratively, the only unlabeled node adjacent to two already numbered nodes receives the next number, until all nodes are numbered.

L e m m a 6: Let G, 6:, {u, v} and {u', v'} be as in above, suppose that {u, v} separates {sl, q} from {s2, t2) and x = (x ~, x 2) is an extreme point of P. One may find an elementary path of x 1 joining s~ to tl which does not cross x 2.

Proof." To verify that a path of x 1 does not c r o s s X 2 we only have to check that this is true for the nodes of the ladder joining {u, v} to {u', v'}, due to lemma 5. We distinguish two cases:

a) 'There exists a path of x 1 joining sl to t 1 which doesn't use any arc of the ladder joining {u, v} to {u', v'}. Consider the following possibilities:

al) sl and t 1 are separated by {u, v} (see Fig. 5i)): x 2 can't use (u, v) or (v, u) because (u, v) separates sx from tl and hence (u, v) e N2. One may assume

Page 18: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

342 F. Margot et al.

t!

i) Fig. 5. Illustrations for the proof of lemma 6

Sl u ~ v tl

ii)

that u has degree 2 in the ladder. Then the flow X 2 c a n not use u, so if (sx ~ u ~ q ) is a pa th of x 1, it is the wanted one, otherwise, x 1 saturates v and (si ~ v ~ t i) is.

a2) s~ and tl are not separated by {u, v} (see Fig. 5ii)): u or v is sa turated by x 1 (otherwise (Sl ~ p ~ t~) is the wanted path). Assume that u is sa turated by x a. Then x z can ' t use u. I f (s l ~ u ~ p ~ t~) is a pa th o f x ~, this is the wanted one, otherwise x 1 saturates v and (sl - u - p ~ v - q ) is.

b) All pa ths of x I use at least one edge of the ladder.

Then x I saturates u and v. Attach a level to each node of the ladder as described above, u and v receiving the levels 1 and 2. We say that a pa th of x 1 is of level k if the node of highest level used by this pa th has level k. We take the pa th of x 1 which has m in imum level. I t is easy to check that every node of the ladder used by this pa th is sa turated by x ~. This pa th can ' t be crossed by x 2 and hence is the wanted path. �9

Lemm 7: Let G, 5~, {u, v} and {u', v'} be as above, suppose that {u, v} separates {sa, t~ } f rom {s2, t2 } and x = (x 1, x 2) is an extreme point of P. If the intersection of x i and x 2 is non empty, one m a y find an e lementary pa th of x ~ joining Sl to t~ using every node where x ~ and x 2 cross.

Proof'.

a) Assume that there is only one node in the intersection of x 1 and x 2. The l emma is then trivially true.

b) Assume that the only intersection nodes are u and v. This implies that x 2 uses (u, v) or (v, u) (because u or v is of degree two in the ladder). Hence, s I and t i have to be not separated by (u, v) (otherwsie (u, v) separates s~ f rom tl and x 2 can ' t use (u, v) due to restrictions (14)) and x I uses no other node of the ladder. The either pa th (sl ~ u ~ v ~ t l) or (s i ~ u ~ p ~ v --* t i ) is the one looked for.

c) Otherwise, a t tach a level to each node of the ladder as described above, u and v receiving the levels 1 and 2. Let i be the node of the ladder which is in the

Page 19: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 343

intersection of x 1 and x 2 and has the highest level in the ladder. One path of x ~ using i necessarily uses all the nodes with lower level than i, i.e. uses all the nodes in the intersection of x ~ and X 2. �9

Lemma 8: Given G and 5 e such that all nodes of degree two in G are in 5 e, the extreme points of polyhedron P given by (11)-(14) are exactly the bipaths.

Proof." Clearly, every bipath is an extreme point of P. Let x = (x 1, X 2) be an extreme point of P. If x is integer, then it is a bipath. Assume that x is not integer. If x ~ and x 2 have no intersection, then x 1 and x 2 are both convex combinat ions of elementary paths and x is a convex combinat ion of bipaths and can't be extreme for P, a contradiction. With lemma 5, we know that all the intersections of x 1 and x 2 are on the ladder described in Lemma 4. To complete the proof, consider the following cases, letting {u, v} and {u', v'} be defined as above:

a) {u, v} separates {sl, s2} from {tl, t2}. Constraints (14) imply that none of the flows uses any step of the ladder,

nor arcs (u, v), (v, u) (u', v') or (v', u'). Thus we have the situation of the Fig. 6 corresponding to a convex combinat ion of bipaths.

b) {u, v} separates {sl, tl} from {s2, t2}. Using lemmas 4 and 5, we can find a path A 1 o f x ~ which does not intersect

x 2, a path B1 of x ~ using all the nodes in the intersection of x ~ and x 2, and similarly two paths A 2 and B2 of x 2 with the corresponding properties.

Let ~j = min(x~la e Aj), flj = min(x~la e Bj), j = 1, 2 and 6 = min{71, ~2, ill, f12}. Consider now y = (yl, y2) such that:

I Xla -- 6, u e B,

y ] = ~ x ] + a , V a e A 1

L x 1 otherwise I x + 6, u e B 2

y 2 = x 2 - 6 , V a e A 2

x 2 otherwise

u k u'

sl t 1

. . . . . . . r v 1-k v'

Fig. 6. Illustration for the proof of lemma 8

Page 20: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

344 F. Margot et al.

It is clear that y e P, and one may analogously construct z = (z 1, Z 2) ~ P such that:

I xi, + 6, Va e B 1

i Jx~ 3, V a e A 1 Z a ~

I L x , 1 otherwise

I X -- 3, Va E B 2

' l z. = x. 2 + 3, Va E A 2

x~ otherwise

But then x = ~ (y + z) and x can't be extreme.

Let G be a 2-tree and 5 ~ four distinct nodes of G. Graph G contains a unique minimal 2-tree G' containing 5e and such that all its nodes having degree 2 are in 5 e. Define C to be the set of components based on the edges of G' as in the case where G' was a ladder.

Theorem 9: Given a 2-tree G and the set 5 e of four distinct nodes of G. Consider the polyhedron P* defined by:

xl ~ Pe*l (15)

X 2 E P*2 (16)

(xi. + xZ~la ~ g)(i)) < 1 Vi ~ V(G') (17)

x . J = 0 Va ~ Nf, j = 1, 2 (18)

where N* (j = 1, 2) contains Nj as defined for P and Cef (resp. Cfe ) if the edge (e, f ) (resp. (f, e)) is in Nj, u e C.

The extreme points of P* are exactly the corresponding bipaths.

Proof." Clearly, every bipath is an extreme point of P*. Let C e C be a component based on {e, f } and x an extreme point of P*. As the component C is contained in a component based on the ladder joining si to tl, x t restricted to C is a convex combination of elementary paths from e to f and/or f to e. Note that constraints (17) for a node of C are implied by those for e and f and the flow equations. Hence, if two paths P1 and Pz of x 1 join e to f in the component based on (e, f ) , x is a convex combination of the solutions using only P1 resp. P2. Hence, the flow x x (resp. x 2) on the component based on (e, f ) corresponds to at most one path from e to f and one path from f to e. We can then apply Lemma 8, these paths playing the role of arcs of G'. �9

Page 21: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

Optimal Node Disjoint Paths on Partial 2-Trees 345

. . . I

s 1

Fig. 7. A non integral extreme point for the case p = 3. Each plain line carries a flow with value 1/2 and the dashed lines are not used by the flow

As a concluding remark, notice that the polyhedron similar to that described by

relations (15)-(18) but for three disjoint paths is not the convex hull of the wanted solutions, as the n o n integer solut ion of Fig. 7 is extremal for it.

We gratefully acknowledge the referee's m a n y helpful suggestions to improve the presenta t ion of this paper.

References

[1] Arnborg S, Proskurowski A (1986) Characterization and recognition of partial 3-trees. SIAM J Alg Disc Meth 7:303-340

[2] Arnborg S, Proskurowski A (1989) Linear time algorithms for NP-hard problems restricted to partial k-trees. Discrete Appl Math 23 : 11-24

[3] Bern W, Lawler EL, Wong L (1987) Linear time computation of optimal subgraphs of decom- posable graphs. J of Algorithms 8:216-235

[4] Bodlaender HL (1993) A linear time algorithm for finding tree-decompositions of small treewidth. Proc 25th STOC 226-234

[5] Fortune S, Hopcroft J, Wyllie J (1980) The directed subgraph homeomorphism problem. Theoret Comput Sci I0, 2:111-121

[6] Karp RM (1975) On the complexity of combinatorial problems. Networks 5:45-68 [7] Margot F (1987) Chemins disjoints sur un 2-arbre. Diploma thesis, EPF Lausanne I-8] Martin RK, Rardin RL, Campbell BA (1990) Polyhedral characterization of discrete dynamic

programming. Operations Research 38:127-138 [9] Matousek J, Thomas R (1988) On the complexity of finding iso- and other morphisms for

partial k-trees. Working paper [10] Pearl Y, Shiloach Y (1978) Finding two disjoint paths between two pairs of vertices in a graph.

J of the ACM 25, 1 : 1-9 [11] Robertson N, Seymour PD (1985) Graph minors - A survey. London Mathematical Society

Lecture Note Series 103, Cambridge University Press 153-171 [12] Robertson N, Seymour PD (1988) An outline of a disjoint paths algorithm. Preprint

Page 22: Optimal node disjoint paths on partial 2-trees: A linear algorithm and polyhedral results

346 F. Margot et al.

[13] Scheffler P (1988) Linear-time algorithms for graphs of bounded tree-width. The DISJOINT- PATHS-problem. In: Graphentheorie und ihre Anwendungen, Stadt Wehlen 1988, PH Dresden, Dresd Reihe Forsch 5, 9: 49-52

[14] Shiloach Y (1980) A polynomial solution to the undirected two paths problem. J of the ACM 27, 3: 445-456

[15] Wald A, Colbourn CJ (1983) Steiner trees, partial 2-trees, and minimum IFI networks. Net- works 13:159-167

[16] Wimer TV, Hedetniemi ST, Laskar R (1985) A methodology for constructing linear graph algorithms. Congr Numerantium 50:43-60

Received: July 1993 Revised version received: March 1994