An efficient algorithm for edge-ranking trees Efficient Algorithm for Edge-Ranking Trees ......

12
An Efficient Algorithm for Edge-Ranking Trees Xiao Zhou and Takao Nishizeki * Department of System Information Sciences Graduate School of Information Sciences Tohoku University, Sendai 980-77, Japan Abstract. An edge-ranking of an undirected graph G is a labeling of the edges of G with integers such that all paths between two edges with the same label i contain an edge with label j > i. The problem of finding an edge-ranking of G using a minimum number of ranks has applica- tions in scheduling the manufacture of complex multi-part products; it is equivalent to finding the minimum height edge separator tree. Deogun and Peng and independently de la Torre et al. have given polynomial- time algorithms which find an edge-ranking of trees T using a minimum number of ranks in time O(n 3) and O(n 3 logn) respectively, where n is the number of nodes in T. This paper presents a more efficient and simple algorithm, which finds an edge-ranking of trees using a minimum number of ranks in O(n2) time. 1 Introduction An edge-ranking of a graph G is a labeling of edges of G with positive integers such that all paths between two edges with the same label i contain an edge with label j > i [DP90, IRV91]. The integer label of an edge is called the rank of the edge. The minimum number of ranks needed for an edge-ranking of G is called the edge-ranking number and denoted by X~r(G). An edge-ranking of G using X~r(G) ranks is called an optimal edge-ranking of G. The edge-ranking problem is to find an optimal edge-ranking of a given graph G. The problem seems to be NP-complete in general [dlTGS93]. The problem has applications in scheduling the manufacture of complex multi-paxt products; it is equivalent to finding the minimum height edge separator trees of G. The edge-ranking of trees, in particular, can be used to model the parallel assembly for a product from its components in a quite natural manner [BDJ+94, dlTGS93, IRV88a, IRV88b, IRV91]. Fig. 1 depicts an optimal edge-ranking of a tree using four ranks. An edge-coloring of a graph G is to color all the edges of G so that no two ad- jacent edges axe colored with the same color. By the definition of edge-rankings, two edges which are incident to the same vertex cannot have the same rank, and hence any edge-ranking of a graph is also an edge-coloring. This implies that the maximum vertex degree of a graph G is a lower bound on the edge-ranking number x~(G) of G [DP90, IRV91]. Furthermore it is known that log 2 n _< X~r(G) for any connected graph G of n vertices [IRV91]. * E_maih (zhoulnishi)@ecei.tohoku.a~.jp

Transcript of An efficient algorithm for edge-ranking trees Efficient Algorithm for Edge-Ranking Trees ......

An Efficient Algori thm for Edge-Ranking Trees

Xiao Zhou and Takao Nishizeki *

Department of System Information Sciences Graduate School of Information Sciences Tohoku University, Sendai 980-77, Japan

Abs t rac t . An edge-ranking of an undirected graph G is a labeling of the edges of G with integers such that all paths between two edges with the same label i contain an edge with label j > i. The problem of finding an edge-ranking of G using a minimum number of ranks has applica- tions in scheduling the manufacture of complex multi-part products; it is equivalent to finding the minimum height edge separator tree. Deogun and Peng and independently de la Torre et al. have given polynomial- time algorithms which find an edge-ranking of trees T using a minimum number of ranks in time O(n 3) and O(n 3 logn) respectively, where n is the number of nodes in T. This paper presents a more efficient and simple algorithm, which finds an edge-ranking of trees using a minimum number of ranks in O(n 2) time.

1 I n t r o d u c t i o n

An edge-ranking of a graph G is a labeling of edges of G with positive integers such that all paths between two edges with the same label i contain an edge with label j > i [DP90, IRV91]. The integer label of an edge is called the rank of the edge. The minimum number of ranks needed for an edge-ranking of G is called the edge-ranking number and denoted by X~r(G). An edge-ranking of G using X~r(G) ranks is called an optimal edge-ranking of G. The edge-ranking problem is to find an optimal edge-ranking of a given graph G. The problem seems to be NP-complete in general [dlTGS93]. The problem has applications in scheduling the manufacture of complex multi-paxt products; it is equivalent to finding the minimum height edge separator trees of G. The edge-ranking of trees, in particular, can be used to model the parallel assembly for a product from its components in a quite natural manner [BDJ+94, dlTGS93, IRV88a, IRV88b, IRV91]. Fig. 1 depicts an optimal edge-ranking of a tree using four ranks.

An edge-coloring of a graph G is to color all the edges of G so that no two ad- jacent edges axe colored with the same color. By the definition of edge-rankings, two edges which are incident to the same vertex cannot have the same rank, and hence any edge-ranking of a graph is also an edge-coloring. This implies that the maximum vertex degree of a graph G is a lower bound on the edge-ranking number x~(G) of G [DP90, IRV91]. Furthermore it is known that log 2 n _< X~r(G) for any connected graph G of n vertices [IRV91].

* E_maih (zhoulnishi)@ecei.tohoku.a~.j p

119

Fig. 1. An optimal edge-ranking of a tree T.

The node-ranking problem of a graph G is defined similarly [IRV88a, KMS88]. A node-ranking of G is a labeling of vertices of G with integers such that all paths between two vertices with the same label i contain a vertex with label j > i. The node-ranking problem is to find a node-ranking of a given graph G using the minimum number of ranks. The node-ranking problem is NP-complete in general [BDJ+94, Pot88]. On the other hand Schaffer has presented a linear algorithm to solve the node-ranking problem for trees [Sch89]. Very recently Bodlaender et al. have given a polynomial time algorithm to solve the node-ranking problem for graphs with treewidth at most k for fixed k [BDJ+94].

Deogun and Peng [DP90] have given the first polynomial-time algorithm to solve the edge-ranking problem for trees, which takes O(n 3) time. Their algo- rithm consists of the following two steps: (1) transform the edge-ranking prob- lem for trees into the equivalent node-ranking problem for line-graphs of trees which they call "clique-trees'; and (2) find a node-ranking of clique-trees with a minimum number of ranks. Recently de la Torre et al. have rediscovered a polynomial-time algorithm which solves the edge-ranking problem for trees by means of a complicated greedy procedure, but the time complexity is O(n 3 log n) [dlWGS931.

In this paper we give a more efficient and simple algorithm which solves the edge-ranking problem for trees in O(n 2) time. Our algorithm improves the known algorithms [DP90, dlTGS93] in time-complexity and simplicity. We di- rectly solve the edge-ranking problem for trees without transforming it to the node-ranking problem for cliques trees or using a complicated greedy procedure. More precisely, we find an optimal edge-ranking of a given tree T by means of "bottom-up tree computation" on T: we find an optimal edge-ranking of a subtree rooted at an internal node of T from those of the subtrees rooted at its children.

2 P r e l i m i n a r i e s

In this section we define some terms and present easy observations. Let T = (V, E) denote a tree with node set V and edge set E. We often denote by V(T)

120

and E(T) the node set and the edge set of T, respectively. We denote by n the number of nodes in T. T is a "free tree," but we regard T as a "rooted tree" for convenience sake: an arbitrary node of tree T is designated as the root of T. We will use notions as: root, node, internal node, child and leaf in their usual meaning. An edge joining nodes u and v is denoted by (u, v). The degree of node v is denoted by d(v). A sum T + T t of two trees T and T ~ is a graph (V(T) U V(T') , E(T) U E(T')) .

The definition of an edge-ranking immediately implies the following lemma [DES0, IRV91].

L e m m a 1. Any edge-ranking o/ a connected graph labels exactly one edge with the largest rank.

Let ~ be an edge-ranking of a tree T. The number of ranks used by ~ is denoted by # ~ . One may assume w.l.o.g, that ~ uses the ranks in [1, #~]. An edge e of T and rank ~(e) are visible (from the root with respect to ~p) if all the edges (except e) in the path from the root to e have ranks smaller than ~(e). Define L(~) as

i ( ~ ) = {~(e) [ e e E is visible},

and call L(~) the list of an edge-ranking ~ of the rooted tree T. Obviously #V E L(~) and ~(e) E L(~) for every edge e incident to the root. The ranks in the list L(~) are sorted in decreasing order. Thus the edge-ranking ~ in Fig. 1 has the list L(~) = {4, 3, 1}.

We define the lexicographical order -~ on the set of decreasing sequences (lists) of positive integers as follows: let A = {a l , . . . , ap} and B -- { b l , . " , bq} be two sets (lists) of positive integers such that al > ..- > ap and bl > . . . > bq, then A -~ B if and only if there exists an integer i such that

(a) aj = b i for all 1 < j < i, and (b) either ai < bi or p < i < q.

We write A _ B if A = B or A -~ B. For integers c~ and/? , a < /? , we denote by [a, fl] the set of integers between c~ and/~, that is, [a, fl] = {c~, a + 1 , - . . , fl}. If c~ > /~, then [~,/?] = r Obviously the following (1)-(3) hold for any integer a > l :

i f A _ B, then A - [1,~] ~ B - [ 1 , c~]; (1)

if A _ B and A - [1, c~] = B - [1, ~], then A n [1, a] _ B f'l [1, cr]; and (2)

if A -~ B and A - [1, c~] = B - [1, c~], then A t3 [1, a] -~ B n [1, cr]. (3)

An edge-ranking ~ of T is critical if L(~) _ L(~/) for any edge-ranking of T. The optimal edge-ranking depicted in Fig. 1 is indeed critical. The list of a critical edge-ranking of T is called the critical list o] tree T and denoted by L* (T). Thus L* (T) corresponds to an equivalent class of optimal edge-rankings of T. Since any critical edge-ranking is optimal, it suffices to find a critical edge- ranking of T.

The subtree of T rooted at node v is denoted by T(v). Let e = (u, v) be an edge in T such that v is a child of u. Then the tree obtained from T(v) by adding

121

e is called the subtree of T rooted at edge e and is denoted by T(e). We denote by T - T(e) the tree obtained from T by deleting all edges in T(e) and all nodes in T(e) except u.

For an edge-ranking ~ of tree T and a subtree T ~ of T, we denote by ~[T ' a restriction of ~ to E(T ' ) : let ~ ' = ~]T' , then ta'(e) = !a(e) for e e E(T' ) . By Lemma 1 T has exactly one edge e with the largest rank # ~ . Denote by T ( # ~ ) the subtree T(e) rooted at the edge e. Let T ' = T - T ( # ~ ) , then

L(~) = { # ~ } U L(~]T ' ) . (4)

If ~ is a critical edge-ranking of T, then by (2) and (4) ~ IT ' is a critical edge- ranking of T ~. Let T ~ be the tree obtained from T(e) by deleting e. I f ~ is an optimal edge-ranking, then

X'~(T'), X'~(T") < # ~ = X',(T). (5)

3 O p t i m a l E d g e - R a n k i n g

The main result of this paper is the following theorem.

T h e o r e m 2. An optimal edge-ranking of a tree T can be found in O(n 2) time where n is the number of nodes in T,

In the remaining of this section we give an O(n 2) algorithm for finding a critical edge-ranking of a tree T. Our algorithm uses the technique of "bo t tom-up tree computat ion." For each node u of a tree T, we construct a critical edge-ranking of T(u) from those of u's children. This can be done in t ime O(nd(u)), and hence the total running time is O(n2), as shown later.

We first have the following lemma.

L e m m a 3. If a tree T has two edge-disjoint subtrees Ta and Tb with X~r(Ta) = X~r(Tb) = c, then c + 1 < x~(T).

Proof. Clearly c < X'~(T). Suppose that X~(T) = c. Then by Lemma 1 T has exactly one edge e with rank c in an optimal edge-ranking of T. Remove the edge e from T, and let T ' and T H be the resulting two trees. Then by (5) X~r(T'), X~r(T '') < c. Since Ta and Tb are edge-disjoint, either Ta or Tb, say Ta, does not contain e. Then Ta is a subgraph of either T ~ or T ' , say T ~, and hence

! X~r(Ta) < X~(T ') < c, contrary to the assumption xr(Ta) = c. Q.C.~.

Let Vl,. " " , "Up be children of an internal node u of T, let el = (u, vl), 1 E i < p, and let T p = T(el) + . . . +T(ep). Our idea is that a critical edge-ranking of T(el) can be constructed from a critical edge-ranking of T(vl) and that a critical edge- ranking of T p can be constructed from those of T ( e l ) , . . . ,T(ep). ~Te have the following two lemmas.

L e m m a 4. If ~ is an edge-ranking of T p, then

122

(a) L(~) = Ul<i<,L(~lT(e i ) ) , and (b) sets L(~IT~e~) , 1 <_ i < p, are pairwise disjoint.

Conversely, g tai, 1 <_ i < p, are edge-rankings of T(ei) and sets L(~i) are pairwise disjoint, then the labeling ~ of E ( T p) extended from ~i, 1 < i < p, is an edge-ranking of T p and L(~) = Ul<i<_p L(Vi)"

Proof. immediate from the definition of an edge-ranking and its list. Q.C.7:).

L e m m a 5. Let m = max{x'~(TP-1), x ' (T (ep) ) } , then x ' ( T p) = m or m + 1.

Proof. Clearly m < x" (TP). Therefore it suffices to prove that X'~(T p) < m + 1. Let ~ and r be critical edge-raakings of T p-1 and T(ep), respectively. Extend

and r to an edge-labeling ~ of T p as follows:

, ( e ) = { ~(e) if e E E(Tp-1) , r if e 6 E(T(ep)) - {ep}, and m + l i f e = e p .

Clearly q is an edge-ranking of T p and # y < m + 1. Therefore x ' ( T p) < m + 1. Q.E.~).

The following Lemma 6 gives a necessary and sufficient condition for x ' ( T v) = m .

L e m m a 6 . Let m -: m a x { x ' ( T P - 1 ) , x ' ( T ( e p ) ) } . Then x ' ( T p) = m if and only if the following (a) or (b) holds:

(a) L*(T , - 1 ) n L*(T(ep)) = r or (b) there exists fl 6 [~ + 1, m] such that ~ ~ L*(T p - l ) U i* (T(ep) ) where c~

is the maximum integer in L*(Tp-1) ~ L*(T(ep)).

V 1

6

1 2

V 7 v8 V 9 VlO

Fig. 2. Critical edge-raakings of T(el) and T(e2).

123

Before presenting a proof, we illustrate the conditions (a) and (b) for the tree T in Fig. 1. Fig. 2 depicts critical edge-rankings of T(el) and T(e2). Let p = 2, then T p-1 = T(el), Xtr(T p-l) = 3, x~(T(ep)) = 3, m = 3, L*(T p-l) = {3,2}, L*(T(ep)) = {3,1}, L*(T p-l) Cl L*(T(ep)) = {3}, c~ = 3, and [a + 1, m] = r Thus neither (a) nor (b) holds.

Proof of Lemma 6. *== Let ~ and r be critical edge-rankings of T p-1 and T(ep), respectively. Then L(~) = L*(T p-l) and L(r = L*(T(ep)). From ~ and r we construct an edge-ranking ~/of T p with # ~ / = m.

Suppose first that (a) holds, that is, L(~) f? L(r = r Then by Lemma 4

,f ~(e) if e 6 E(TP-1), and 7/(e) = [ r if e 6 E(T(ep))

is an edge-ranking of T p and #~} = m. Suppose next that (b) holds. Let r be an edge-ranking of T(ep) such that

{ ~ ( if e = ep; r = e) otherwise.

Then fl is visible, but none of the ranks in L(r Cl [1, fl] is visible with respect to r in T(ep). Hence L(r = (L(r - [1 , fl]) U{fl}. Since L(~) n L ( r C_ [1, fl - 1],

L(~) N L(r = L(~) Cl L(r - [1, fl] = r

Hence by Lemma 4

{~(e) i fe 6 E(T p-l), and ~/(e) = r if e 6 E(T(ep))

is an edge-ranking of T p with #q < re,. Suppose that x~(T p) = m but neither (a) nor (b) holds:

L*(T p-l) N L*(T(ep)) 7 s r and

[c~ + 1,m I C L*(T p-l) U L*(T(ep))

(6)

(7)

where c~ is the maximum integer in L*(T p-l) fl L*(T(ep)). Note that m is the largest integer in L*(T p-l) U L*(T(ep)). Let q be a critical edge-ranking of T p, and let qa = qlT p-1 and ~/b = qlT(ep) �9 By Lemma 4

L(7}) = L(t}a) U L(yb), and

L(r/a) Cl L(r}b ) = r

(8) (9)

Clearly

LO?a) h L*(TP-1), and

L(qb) ~ L*(T(ep)).

(10)

(11)

124

By (1) L(y~) - [1 , al _ L*(T p-i) - [ i , al and L(~lb) --[1, al _ L*(T(ep)) - [1 , al. We then claim

L(y~) - [1, a] = L*(T p-i) - [1, a], and (12)

L(yb) - [1, a] = L*(T(ep)) - [1, a I. (13)

If (12) or (13) does not hold, that is, L(y~) - [1, a] ~- L*(T p- i ) - [ 1 , a] or L(yb) --[1, c~] ~- L*(T(ep)) - [1 , a], then

L(~) - [1, a] = (L(ya) - [1, a]) U (L(~b) - [1, a]) by (8)) ~- (L*(T p-i) - [1 , a]) U (i*(T(ep)) - [1, a]) by (9)) = L*(T p-i) U L*(T(ep)) - [1, c~] = [a + 1, inf. by (7))

Thus L(~/) _ {m + 1} and hence # y _> m + 1, contrary to the supposition X'~(T p) = m. Thus we have verified (12) and (13).

By (2) and (10) - (13) we have

L(rla ) f'l [1, a] ___ L*(T p- i ) N [1, a] _ {a}, and (14)

L(yb) N [1, a] _ L*(T(ev) ) n [1, a] _ {a} (15)

since c~ e L*(T p-i) N n*(T(ev) ). However, by (9) we have either a tg L(ya) or a r L(yb) and hence either L(y~) n [1, a] -( {a} or L(yb) N [1, a] -~ {a}, contrary to (14) or (15). Q.E.T).

In order to find a critical edge-ranking of T p from those of T p-1 and T(ev) , we need the following four lemmas.

L e m m a T . Let vi, v2 and v3 be children of an internal node u, and let ei = (u, vi), i = 1, 2,3. I f L*(T(ei)) ~_ t*(T(e2)), then L*(T(ei)+T(e3)) ~_ i*(T(e2)+ T(e3)).

L e m m a 8. Let v be a child of an internal node u, and let ei = (u, v). Let ~ be a critical edge-ranking of T(v), and let 7 = min{l > 1 I I r L(~)}. Then

ire E E(T(v)), and = i f =

is a critical edge-ranking o fT(e l ) . Given ~, one can find such ~ in O(n) time.

Proof. One can easily observe that ~ is an edge-ranking of T(el) and

L(~) = (L(~) - [1, 7 - 11) U {7}-

Let ~' be any critical edge-ranking of T(ei) . Then

L(rl') = (L(~'lT(v)) -[1,~/ '(ei) - 1])U {~'(el)}.

(16)

(17)

Furthermore ~'(ei) ~ L(~'IT(v)); (18)

125

otherwise 7}' would not be an edge-ranking of T(el ) . By (17) and (18) we have

L*(T(e l ) ) = L(q') >~ L(~I'[T(v)) ~ L(~).

On the other hand, since [ 1 , ~ - 1] C_ L(~) and 3~ r L(~) , by (16) L(q) is the lexicographically smallest one among all the lists ~- L(~) . Thus we have L*(T(e l ) ) ~_ n ( , ) . Q.E.Z).

L e m m a g . Let Vl and v2 be children of an internal node u, and let el = (u, vl) and e2 = (u, v2). Let ~ and r be critical edge-rankings of Ta = T(e l ) and Tb = T(e2), respectively. Let T~ ! = Ta(#~) and T~ = T~-T~' . Let m = m a x { # ~ , # r I f X~r(T 2) = m, m = # ~ , and 7}' is a critical edge-ranking of T~a + Tb, then

( ~(e) if e �9 E(T~a'), and ~}(e) = ;f(e) if e �9 E(T~ -{- Tb)

is a critical edge-ranking o f T 2. (Remember T 2 = T(e~) + T(e2) = T~ + Tb.)

Proof. We first claim tha t # ~ ' < m 1, tha t is, ! ! _ - xr(T~ + Tb) < m -- 1. Since ! T ~ x ~ ( T : ) = X ~ ( a ) m and Ta and Tb are edge-disjoint subtrees of T 2 by

L e m m a 3 we have

x~(Tb) _< m -- 1. (19)

By (5) we have ! !

x~(T~) < m = X'~(Ta). (20)

Suppose for a contradiction that X~(T~ + Tb) ---- m. Then by (19), (20) and Lemma 6 L*(T'~) n L*(Tb) ~ r and [~ + 1, m - 1] C_ L*(T') U L*(Tb) where is the max imum integer in L*(T~) n L*(Tb). Since L*(T~) = {m} U L*(T~) by (4), we have a �9 L*(Ta) N L*(Tb) and [~ + 1, m] C_ L*(T~) U L*(Tb). Hence by L e m m a 6 X!~(T 2) = m -{- 1, a contradict ion. Thus we have verified #7]' < m - 1.

Since #~/~ < m - 1, one can easily observe tha t q cons t ructed from ~1' and is an edge-ranking of T 2 and L(~/) = {m} kJ L*(T' a + Tb).

We finally prove tha t ~ is a critical edge-ranking of T 2, tha t is, L(~) ___ L(~) for any critical edge-ranking ~ of T 2. Since X!,.(T 2) = m, m = # ~ �9 L(~). Since L(~) is a critical list ofTa , L((]T~) ~_ n(~) ~ {m} and hence m �9 L(~]T~). Since T~ = T~ - Ta', by (4)

n (~ ) = {m} U L(~]T'~) ~ {m} U L*(T~).

Let ~' = ~[T~ and T' a" = T~ - Ta(#~') = Ta - Ta(#~]Ta). Let p be a crit ical edge-ranking of Ta'!~ and let

#(e) = (~(~) if e �9 E(To(#~')), p(e) if e �9 E(T~").

Then # is an edge-ranking of T~, and L(#) = {m} kJ n(p). Since ~ is a crit ical edge-ranking of Ta, L(~) -~ L(#). ~Ve therefore have

{m} U L*(T:) ~ L(~) ~_ n(#) = {m} LJ L(p) = {m} U L*(T~"),

126

and consequently L*(Tta) ~_ L*(T~a '') by (2). Therefore by Lemma 7

L*(T a + Tb) ~ L*(Ta" + Tb). (21)

Clearly

Ta t' + Tb = T 2 - Ta(#~'). (22)

By (21) and (22) we have

L*(T~ + Tb) "g L*(T 2 - Ta(#~')) .

Thus we have

L(y) = {m} U L*(T a + Tb) _ {m} U L*(T 2 - T~(#~')) = L(().

Q.c.7).

Thus, since ~[T~ is a critical edge-ranking of T~, the problem of constructing a critical edge-ranking y of T 2 = Ta + Tb from critical edge-rankings ~ and r can be reduced to the problem of constructing a critical edge-ranking y' of a smaller tree Tta + Tb = T 2 - Ta" from critical edge-rankings ~[Ta ~ and r when X~ (T2) = m.

L e m m a 10. Let vi and v2 be children of an internal node u, and let et = (u, Vl) and e2 = (u, v2). Let ~ and r be critical edge-rankings of T(el) and T(e2), respectively. Let m = max{#~ , # r I f x~(T 2) = m + 1 and L(~) ~ L(r then

{ ~(e) ire 6 E(T(e l ) ) , ~(e) = r l i e 6 E(T(e2)) - {e2}, and

m + l f i e = e 2

is a critical edge-ranking of T 2.

We have the following two lemmas which imply Lemmas 9 and 10. We omit the proofs since they can be proved similarly as Lemmas 9 and 10.

L e m m a 11. Let Vl," " , vp be children of an internal node u, and let ei = (u, vi) for each i. Let ~ and r be critical edge-rankings of Ta = T p-1 and Tb = T(ep), respectively. Let m = max{#~ , # r and suppose that X~r(T p) = m.

(a) / f n ( ~ ) _ L(r then

f ~(e) if e e E(T~'), and , (e) = [ , ' (e) if e e E(T~ + Tb)

is a critical edge-ranking o f t p, where T~a ' = Ta(#~) , T~a = Ta - T~' and ~' is a critical edge-ranking o] Tla + Tb.

(b) q L ( r ~- L(~), then

)" r if e e E(T~'), and ~?(e) = [ y'(e) if e e E(Ta + T~)

is a critical edge-ranking of T p, where T~' = Tb(#1b), T~ = Tb -- T~' and ~' is a critical edge-ranking of Ta + T~.

127

L e m m a 12. Let v l , . . . , vp be children of an internal node u, and let ei = (u, vi) for each i. Let ~ and r be critical edge-rankings of Ta = T p-1 and Tb = T(ep), respectively. Let m = m a x { # ~ , # r and suppose that x ' ( T p) = m + 1. Let L(~IT(ej) ) be the lexicographically largest list among L(~JT(ei)), 1 < i < p - 1.

(a) If L(~JT(ej)) -< L(r then

(p(e) if e 6 E(Ta), y(e) = r if e e E(Tb) - {ep}, and

m + l if e = ep

is a critical edge-ranking of T p. (b) If L(~IT(ej) ) ~_ L(r and rl' is a critical edge-ranking of T i = TP -

T(ej) , then

{~( e) ire �9 E(T(e j ) ) - {ej}, y(e) = y'(e) if e �9 Z(T~a + Tb), and

m + l i f e = e j

is a critical edge-ranking of T p.

By Lemmas 8, 11 and 12 above we have the following recursive algorithm to find a critical edge-ranking of a subtree T(u) rooted at a node u.

P r o c e d u r e Edge-aanking(T(u)); b e g i n

1 if u is a leaf t h e n r e t u r n a trivial edge-ranking: r ~ r 2 else 3 b e g i n 4 let V l , . . . , v p be the children of u, and let ei = (u, vi) for all i, 1 < i < p ; 5 for i := i to p do Edge-aanking(T(vi)); 6 for i := 1 t o p do

find a critical edge-ranking of T(ei) from a critical edge-ranking of T(vi) by Lemma 8;

7 for i := 2 to p do 8 find a critical edge-ranking of T i

from those of T I-1 and T(ei) by Lemmas 6, 11 and 12; 9 r e t u r n a critical edge-ranking of T(u) {T(u) = T p}

10 end end.

Clearly one can find a critical edge-ranking of a tree T by calling P r o c e d u r e Edge-Ranking(T(r)) for the root r of T. Therefore it suffices to verify the time- complexity of the algorithm. As we show the detail later, one execution of line 8 takes in O(n) time. Furthermore line 8 is executed at most d(u) - 1 times in the for-loop at line 7. Therefore the for-loop at line 7 can be done in O(d(u)n) time. Since P r o c e d u r e Edge-Ranking is recursively called for all nodes, the total running time is

128

This completes the proof of Theorem 3.1. We finally give an implementation of line 8 of Edge-Ranking, which finds a

critical edge-ranking y of T i from a critical edge-ranking T of T i-1 and a critical edge-ranking r of T(ei) .

P r o c e d u r e Line-8(9% r ~/); beg in

1 L : = r { L = L ( , ) } 2 let Ta := T i-1 and Tb := T(ei); 3 let La := L(T) and Lb := L(r 4 whi le La N Lb # r do beg in 5 a := max{ /6 La VI Lb}; {or does not increase } 6 fl := min{l >_ a + 1 ] I r La U Lb}; { fl decreases } 7 if La U Lb - [1, fl] # r t h e n

{ x ' ( T a + Tb) = m where m = max{x'~(T~), x ' (Tb ) } since (b) in Lemma 6 holds }

S for each label l 6 L~ U Lb -- [1, fl] in decreasing order do 9 i f / 6 L~ t h e n beg in { cf. Lemma l l (a ) }

10 T" := Ta(#(gvlTa)); { T" is the subtree (of Ta) rooted at

11 ~/ITa" := ~]Ta"; 12 Ta := Ta - Ttat; 13 La := La - {l}; 14 L := L U {/} 15 end 16 else beg in { l 6 Lb, cf. Lemma 11(b) } 17 T~' := Tb(#(r 18 , ITS' := r 19 Tb := Tb -- T~'; 20 Lb := Lb -- {1}; 21 L := L U {l} 22 end;

23

24 25 26 27 28 29 30 31 32 33 34

the edge e with the largest label l = 9~(e) } { oIT~" has been decided }

{ prune Ta t } { La = L(~]Ta) }

{ 7/]Tg' has been decided } { prune ~-~' }

{ ib = i(r }

{ f l = m + l a n d x ' r ( T a + T b ) = m + l } let ej be the edge with the lexicographically largest list L(9~[Ta(ej))

among the edges ej, 1 _< j < i - 1, remaining in Ta; i f L(9~lTa(ej)) ~" Lb t h e n beg in { cf. Lemma 12 }

, [ (Ta(e j ) - ej) := ~l(Ta(ej) - ej); ,(e~) : = ~; La := La - L(~ITa(ej) ) ; To : = G - G ( e j ) ; L := L U {fl};

e n d e l s e beg in

, l (Tb - ei) :-- r - el); , (e i) : = ~; Lb := r

{ rl[Ta(ed) has been decided }

{ prune Ta(ed) }

{ i(~iTo(e~)) "< Lb }

( T1]T b has been decided }

129

35 36 37 38 39 40 41 42

let Tb be empty tree; L := L O {fl}

e n d end;

~IT~ := ~IT~; ~lTb := r L:= L U L a U L b

end;

{ L~ N Lb = r eL Lemma l l } { ~]JTa has been decided } { ~]JTb has been decided }

{ ,] has been decided }

Whenever lines 5 and 6 are executed, a does not increase and/3 always decreases. Furthermore fl > a. Thus lines 5-37 in the whi le- loop are executed at most n times. Noting this fact, one can easily observe that the book-keeping operations takes O(n) t ime in total. Thus P r o c e d u r e Line-8 takes O(n) time.

R e m a r k : A more sophisticated implementat ion leads to an O(nlogn) algo- rithm. We omit the detail for the sake of space.

References

[BDJ+94]

[dlTGS93]

[DP90]

[IRV88a]

[IRV88b]

[IRV911

[KMSS8]

[Pot88]

[Sch89]

H. Bodlaender, J.S. Deogun, K. Jansen, T. Kloks, D. Kratsch, H. Mfiller, and Zs. Tuza. Ranking of graphs. In Proc. of International Workshop on Graph-Theoretic Concepts in Computer Science, Herrsching, Bavaria, Germany, 1994. P. de la Torte, R. Greenlaw, and A. A. Schgffer. Optimal ranking of trees

in polynomial time. In Proe. of the 4th Ann. ACM-SIAM Symp. on Discrete Algorithms, pp. 138-144, Austin, Texas, 1993. J. S. Deogun and Y. P. Peng. Edge ranking of trees. Congressus Numeran- tium, 79, pp.19-28, 1990. A. V. Iyer, H. D. Ratliff, and G. Vijayan. Optimal node ranking of trees. Information Processing Letters, 28, pp.225-229, 1988. A.V. Iyer, H.D. Ratliff, and G. Vijayan. Parallel assembly of modular prod- ucts - an analysis. Technical Report PDRC, Technical Report 88-06, Georgia Intitute of Technology, 1988. A. V. Iyer, H. D. Ratliff, and G. Vijayan. On an edge-ranking problem of trees and graphs. Discrete Applied Mathematics, 30, pp.43-52, 1991. M. Katchalski, W. McCuaig, and S. Seager. Ordered colourings. manuscript, University of Waterloo, 1988. A. Pothen. The complexity of optimal elimination trees. Technical Report CS-88-13, Pennsylvania State University, U.S.A., 1988. A. A. Schaffer. Optimal node ranking of trees in linear time. Information Processing Letters, 33(2), pp.91-99, 1989.