An efficient algorithm for edge-coloring series parallel ...

14
An Efficient Algorithm for Edge-Coloring Series- Parallel Multigraphs X. Zhou, S. Nakano, H. Suzuki and T. Nishizeki Department of Information Engineering, Faculty of Engineering, Tohoku University, Sendai 980, Japan Abstract Many combinatorial problems can be efficientlysolved for series-parallelgraphs or partial k-trees. The edge-coloring problem is one of a few combinatorial problems for which no efficient algorithms have been obtained for series-parallelmultigraphs. This paper gives an algorithm which optimally edge-colors a given series-parallel multigraph in time O([V[z~), where V is the set of vertices and A the maximum degree. 1. Introduction This paper deals with the edge-coloring problem which asks to color, using a minimum number of colors, all edges of a given graph so that no two adjacent edges are cdlored with the same color. It is known that many combinatorial problems can be solved very efficiently, say in linear time, for series-parallel graphs or partial k-trees [TNS, ACPD, AL, C]. Such a class of problems has been characterized in terms of "forbidden graphs" or "extended monadic logic of second order" [TNS, ACPD, AL, C]. The edge-coloring problem does not belong to such a class, and is one of a few well-known problems for which no efficient algorithms of low complexity order have been obtained for series- parallel multigraphs. Even a polynomial time algorithm has not been obtained for the edge-coloring problem of series-parallel multigraphs until quite recently []3]. For series- parallel simple graphs, which have no multiple edges, the edge-coloring problem can be solved in time O(IVHE[) where V is the set of vertices and E the set of edges of a graph [TN]. Systo, referring [TN], conjectured that there would exist a linear algorithm to solve the edge-coloring problem for series-parallel muitigraphs, which may have multiple edges [Sys]. Very recently Bodlaender gave a polynomial-time algorithm of high complexity order to solve the edge-coloring problem for series-parallel (simple) graphs or partial k- trees. His algorithm runs in time O(IV[Ae4) for series-parallel multigraphs. Note that the maximum degree z3 is not a constant in general. On the other hand, recently Seymour [Sey] has proved that x(G) = max{z3, IF(G)] } holds for any series-parallel multigraph G, where x(G) is the chromatic index of G, i.e., the minimum number of colors required for an edge-coloring of G, _r'(G) = max { ~ l E(U) l : U C V(G), [ U l> 3 and odd } Ul-1 -

Transcript of An efficient algorithm for edge-coloring series parallel ...

Page 1: An efficient algorithm for edge-coloring series parallel ...

An Efficient Algorithm for Edge-Coloring Series- Parallel Multigraphs

X. Zhou, S. Nakano, H. Suzuki and T. Nishizeki

Department of Information Engineering, Faculty of Engineering, Tohoku University, Sendai 980, Japan

Abstract Many combinatorial problems can be efficiently solved for series-parallel graphs or

partial k-trees. The edge-coloring problem is one of a few combinatorial problems for which no efficient algorithms have been obtained for series-parallel multigraphs. This paper gives an algorithm which optimally edge-colors a given series-parallel multigraph in time O([V[z~), where V is the set of vertices and A the maximum degree.

1. Introduction This paper deals with the edge-coloring problem which asks to color, using a minimum

number of colors, all edges of a given graph so that no two adjacent edges are cdlored with the same color. It is known that many combinatorial problems can be solved very efficiently, say in linear time, for series-parallel graphs or partial k-trees [TNS, ACPD, AL, C]. Such a class of problems has been characterized in terms of "forbidden graphs" or "extended monadic logic of second order" [TNS, ACPD, AL, C]. The edge-coloring problem does not belong to such a class, and is one of a few well-known problems for which no efficient algorithms of low complexity order have been obtained for series- parallel multigraphs. Even a polynomial time algorithm has not been obtained for the edge-coloring problem of series-parallel multigraphs until quite recently []3]. For series- parallel simple graphs, which have no multiple edges, the edge-coloring problem can be solved in time O(IVHE[) where V is the set of vertices and E the set of edges of a graph [TN]. Systo, referring [TN], conjectured that there would exist a linear algorithm to solve the edge-coloring problem for series-parallel muitigraphs, which may have multiple edges [Sys]. Very recently Bodlaender gave a polynomial-time algorithm of high complexity order to solve the edge-coloring problem for series-parallel (simple) graphs or partial k- trees. His algorithm runs in time O(IV[Ae4 ) for series-parallel multigraphs. Note that the maximum degree z3 is not a constant in general. On the other hand, recently Seymour [Sey] has proved that x(G) = max{z3, IF(G)] } holds for any series-parallel multigraph G, where x(G) is the chromatic index of G, i.e., the minimum number of colors required for an edge-coloring of G,

_r'(G) = max { ~ l E(U) l : U C V(G), [ U l> 3 and odd } U l - 1 -

Page 2: An efficient algorithm for edge-coloring series parallel ...

517

and E(U) is the set of edges of G whose both ends belong to U. Using the equation above, one can find the chromatic index x(G) of G in polynomial time, say in time O([V[a). However his proof does not seem to yield a polynomial-time algorithm to actually find an edge-coloring of G using x(G) colors. In this paper we give a very efficient algorithm to solve the edge-coloring problem, that is, decide x(G) and find an edge-coloring of G using x(G) colors, for any series-parallel multigraph G in time O([VIA ). Thus the complexity is much improved. Our algorithm is not based on Seymour's result above, but uses general techniques employed by Bodlaender for partial k-trees as well as new idea specific to series-parallel graphs (i.e. partial 2-trees).

2. Defini t ions In this section we give some basic definitions. We denote by G = (V, E) a graph with

vertex set V and edge set E. The set of vertices and the set of edges of G are often denoted by V(G) and E(G), respectively. A (two-terminal) series-parallel multigraph is defined recursively as follows:

1. A graph G of a single edge is a series-parallel multigraph. The ends u and w of the edge are called the terminals of G and denoted by u(G) and w(G).

2. Let G1 be a series-parallel multigraph with terminals u(G1) and w(G1), and let G~ be a series-parallel multigraph with terminals u(G2) and w(G2). (a) A graph G obtained from G1 and G2 by identifying vertex w(G1) with vertex

u(G2) is a series-parallel multigraph whose terminals are u(G)(=u(Gm)) and w(G)(--w(G2)). Such a connection is called a series connection, and G is denoted by G -- GI �9 G2.

(b) A graph G obtained from G1 and G2 by identifying u(G~) with u(G2) and w(G1) with w(G2) is a series-parallel multigraph whose terminals are u(G)(=u(G1)=u(G2)) and w(G)(-w(G1)=w(G2)). Such a connection is called a parallel connection, and G is denoted by G = G1 II G2.

The terminals u(G) and w(G) of G are often denoted simply by u and w. We denote by d(v) the degree of vertex v E V. The maximum degree of G is denoted by A. Let d(G) = d(u) + d(w) and #t(G) = min{d(u), d(w)}. The set of edges joining vertices vl and v2 is denoted by g(vl, v2). An edge-coloring ~o of G is an assignment of colors to the edges in G such that no two adjacent edges have the same color. The number of colors used by an edge-coloring ~o is denoted by #~ , the color assigned to edge e E E is denoted by ~o(e), and for a set A C_ g of edges, ~0(A) denotes the set of colors assigned to the edges in A. If a color e E ~o(g) is not used for any edges incident with vertex v, then we say that c is missing at v. The set of colors missing at v is denoted by M(v). Define S(~o) to be the set of edges whose colors appear at the terminal u and do not appear at w. Define similarly T(~) by interchanging u and w. Define R(~o) to be the set of edges whose colors appear at both u and w. Define Q(~o) to be the set of edges whose colors appear neither at u nor at w. The numbers of colors used by S(~o), T(~o), R(~) and Q(~o) are denoted by s(~), t(~), r(~) and q(~), respectively. The sets of colors ~(S(~)), ~(T(~)), ~(R(~)) and ~(Q(~)) are denoted simply by ~(S), ~(T), ~(R) and ~(Q), respectively. Then the following equations hold:

= + + +

= +

d(w) = +

Page 3: An efficient algorithm for edge-coloring series parallel ...

518

and dCG) = s(~) + t(~) + 2r(~).

The chromatic indez x(G) of a graph G is the minimum number of colors used by an edge- coloring of G. For a nonnegative integer i, x(G, i) is defined to be the minimum number of colors used by an edge-coloring of G such that exactly i colors appear at both u and w, that is, x(G, i) = min{#~o : ~o is an edge-coloring of G with r(~o) = i} if there exists such a coloring; otherwise, define x(G, i) = oo. Clearly x(G) = min{x(G, i) : 0 < i < A}.

3. S imple a l g o r i t h m In this section, we present a simple but not efficient algorithm to solve the edge-

coloring problem for series-parallel multigraphs. Our idea is to compute recursively x(G, i) for all integers i, 0 < i < A. However, this is not easy because x(G, i) cannot eas- ily be expressed in terms of x(G1, it) and x(G2, i2) when G = Gt [I G2 or G = Gt �9 G2. We need to introduce intermediate functions Xp(G, i, it , ia) and xs(G, i, it, i2), defined below, so that the set of all functions is closed under the connections 11 and �9

For an edge-coloring ~ of a series-parallel multigraph G such that G = Gx II Gg, let ~t be an edge-coloring of Gt such that ~t(e) = ~(e) for e E E(Gt) and let ~2 be an edge-coloring of G2 such that ~2(e) = ~(e) for e E E(G2). We call ~ the extcntion of two colorings ~t and ~z. Let ~ he an edge-coloring of G such that r (~)=i , r (~ l )=Q and r(~a)=ia for nonnegative integers i, it and is. Define Xp(G,i, it, i2) to be the minimum number of colors used by such an edge-coloring ~ of G if there exists such an edge-coloring ~; otherwise, define Xp(G, i, i1, i2) = oo. Define similarly xs(G, i, it, is) for the case when G=GI �9 G2. Then clearly

{~ {xp(G,i, it ,i2)} if G = Gt II G2; x(G, i) = .n'fin{x,(G, i, it, i9.)} if G = Gt �9 Gg..

I111~

The following six lemmas hold for nonnegative integers i, it and is.

L e m m a 3.1 If G = Gt II G2, then

fmax{X(Gl , i l ) , x (G2 , ig.),d(G) - i] i f i l + i s _< i _< il + i9. + a p ; Xp(G,i, it,i2) I. co otherwise,

where ap = min{d(u(Gx)) - il, d(w(G2)) - is} + min{d(u(G2)) - iz, d(w(G1)) - it}.

Proof . Clearly Xp(G, i, it, i2) > max{x(Gt, it), x(G2' i2), d(G) - i}, and if i < ix + is or il + i2 + ap < i then Xp(G,i ,Q,i2) = 00. Therefore it suffices to prove that Xp(G, i, it, is) <_ max{x(G1, il), x(G2, is), d(G) - i} for every integer i, it + is < i < il + is + ap.

Let ~ be an edge-coloring of G1 such that #rl = X(Gl, i l ) and r(~) = il, and let r be an edge-coloring of G2 such that # r = x(G2, is) and r(r = i2./ ,From 7/and r we actually construct a coloring ~o of G such that r(~,) = i, r(~Ol) = il, r(~,2) = is and #~0 = max{x(G1, it), x(G2, i2), d(G) - i}. One may assume w.l.o.g, that x(G1, il) >_ x(G2, is) and ~(E(Gt)) fl r = r Consider an edge-coloring ~0 of G which is an extention of the two colorings 7/and r that is,

Page 4: An efficient algorithm for edge-coloring series parallel ...

519

= j 't/(e) i f e E E ( a l ) ; ~(e) [ r i f e E E(G2).

Then r(~ol) = il and r(~o~) = iz, but r(~o) = il + i2 and #to = X(Gl , i t ) + x(G2, is). Therefore we shall alter the coloring ~o. Let a and ~ be any nonnegative integers such that

i = a + / ~ + it + i s , and 0 < a < min{d(u(G1)) - il , d(w(G2)) - i2~,

0 ~ ~ ~. min{d(u(G2)) - i2,d(w(G1)) h i . We rename a + j3 colors of the coloring r replace any a colors in r with a colors in y(S), and replace any j3 colors in r with f~ colors in 0(T). Then the coloring to obtained from 7/and this altered r satisfies r(to ) = i.

Thus we shall alter ~ so that # ~ = max{x(Gt, il), x(G2, is), d(G) - i}. There are two cases. C a s e l : X(Gl , i l ) > _ d ( G ) - i .

In this case we alter r so that r C ~(E(G1)), and hence #to = x(G1, il). Clearly the following four equations holds:

d(G1) = 2it + sol ) + t(~l), d(G2) = 2i~ + s(r + t(r

d(G) = d(G1).+ d(G?), and x(G1, il) = il + s(~) + t(Ti) + q(o). /,From these four equations and x(Gt , it) > d(G) - i and i = it + is + a + ~, we have

q(y) > i2 + (s(r - f~) + (t(r - a). Therefore we can rename some more colors of r as follows: replace all the i2 colors in r the remaining s(r - fl colors in r and the remaining t(r - a colors in r with colors in ~?(Q). We finally replace all the colors in r with colors in Gt not used yet. This can be done since x(G1, it) >_ x(G2, i2). Then the coloring to obtained from and this altered r satisfies #~o = x(Gt , it), r(~o) = i, r(~ol) = it and r(~o2) = is. Case 2: x(G1, it) < d ( a ) - i .

In this case we niter 0 and r so that r I and r and hence ~, use only the d(G) - i colors in o(S) U 0(T) U 0(R) U r U r U r as follows. Since d(G) - i > x(G1, it), q(0) < i2 + (s(r - / 9 ) + (t(r - a). Therefore we can replace all the colors in 0(Q) with any q(0) colors among the i2 colors in r plus the remaining s(r - ~ colors in r plus the remaining t(r - a colors in r Since d(G) - i > x(G2,i2), q(r < il + (t(r/) - /~ ) + (s(0) - a). Therefore we can replace all the colors in r with any q(r colors among the it colors in 0(R) plus the remaining s0/) - a colors in ri(S) plus the remaining t(r/) - / ~ colors in 0(T). Then the coloring ~o obtained from these altered ~/and r satisfies #~o = d(G) - i, r(~) = i, r ( ~ o l ) ---- it and r(toz) = i~. Q.g.:D.

Similarly, we have the following lemma for the case when G = G1 �9 G2.

L e m m a 3.2 Let G = GI*G2 and v = w(Gt) = u(G2). Let it and i2 be two nonnegative integers and )~ = max{x(Gt , it), x(G2, is), d(v)}. Then

~" max{x,(G, O, ia, is) - i, ~, x . (G, c~,, il, i2) - ~, + i} if 0 < i < as; xs(G, i, il, is) t oo otherwise,

where a , = min{d(G) - il - i2,6t(G)}. El

Page 5: An efficient algorithm for edge-coloring series parallel ...

520

To prove Lemma 3.2 we first give the following four lemmas.

L e m m a 3.3 Let G be a series-parallel multigraph such that G = G1 �9 Gs, and let i be a nonnegative integer. If xs(G, i, il, is) • oo and xs(G, i + 1, il, is) # oo then [x,(G, i, il, is) - Xs(G, i + 1, ih i2)l < 1.

P r o o f . We first prove x,(G, i, il, i2) < x,(G, i + 1, i,, is) + 1. Let ~ be a coloring of G such that # ~ = x,(G, i + 1, it, is), r(~) = i + 1, r(~ol) = it and r(~o2) = i2. Every color in ~o(R) belongs to ~1(S) N ~os(T), ~Ol(R) N ~os(T), or ~ol(S) N ~s(R). Therefore ~(R) N (~ol(S) U ~s(T)) r ~b and hence there exists an edge e 6 R(~o) N (S(~1) U T(~s)) adjacent to u(G) or w(G). Recoloring e with a new color, we obtain a coloring ~o' of G such that #~o' = #~o + 1, r(~ ') = i, r(~o~) = it and r(~o~) = iz. Thus x,(G, i, ix, is) < x,(G, i + 1, ix, is) + 1.

We next prove X, (G, i + 1, ix, is) < xs(G, i, it, i2)+ 1. Consider a coloring ~ of G such that # r = x.(G, i, ix, is), r(~) = i, r (~ l ) = it and r(~2) = i2. There are two cases. Case i: S(~) NS(vh) r @ or T(~) N T(V~2) r 4.

We may assume w.l.o.g, that S(~) N S(~1) # r Then there exists an edge (u, vx) 6 S(~o) N S(r adjacent to u(V). Since x , ( G , i + 1,ix,i~) # oo, d(w) = r ( ~ ) + t(~) _> i + 1 > r(~o) and hence t(~o) > 1. Let c be an arbitrary color in r Recolor with color d the edge (u, Vl) and all the edges colored with c in G2. Then the resulting coloring ~' satisfies r(~o') = i + 1, r(~0~) = Q, r ( ~ ) = i2 and # ~ ' = #~o+ 1. C a s e 2: S(~) N S(~I) = r and T(~) N T(~os) = ~b.

We first prove ~I(S) N ~s(T) # r Since S(~) n S (~ , ) = r S (~ , ) C_ R(~). Similarly T(~2) C_ R(~). Therefore S(~x) U T(~s) C_ R(~). Let p be an arbitrary coloring of G such that r(p) = i + 1, r ( tq) = ix and r(ps) = is. Then clearly p(R) C_ pI(S) IA #s(T). Therefore

i + 1 < 8(m) + t( s)

= (d(u) - i t) + (d(w) - i2)

= S( l) + tC 2) = I ,x(s) u sCT)l + I I(S) n ,sCT)l < i + [~I(S) f'l ~s(T)l ,

and hence ~x(S) N ~os(T) # 4. Since ~x(S) U ~s(T) # 4, there are two edges el = (u, z) 6 S(~I) and es = (w, y) 6

T(~s) colored with the same color. Since i < d(u) and S(~o) N S(~I) = r there must exist an edge e3 = (u, z') 6 R(~Ol) - R(~). Similarly there exists an edge e4 = (w, y~) 6 R ( ~ ) - R(~o). Let c/, 1 < j S 4, be the color of ej. Note that Cl = c2. Clearly the following 7/and r are colorings of Gx and G2, respectively:

c4 if ~x(e) = c3, ~/(e) = ei if ~i(e) = e4,

co if ~x(e) = cx, ~ol(e) otherwise,

and e0 if ~2(e) = c4,

r c4 i f e = e 2 , ~o2(e) otherwise,

Page 6: An efficient algorithm for edge-coloring series parallel ...

521

where e0 is a new color. Then the extention ~o" of r /and ~b

f ~ ( e ) i f e E E ( G x ) , 9"(e) ~b(e) if e E E(Gz)

is a coloring of G such that r(9~') = il, r(9~) = i~, r (9") = i + 1 and # 9 " = x(G, i, i~, i2) + I. 0..s .~.

L e m m a 3.4 If G = GI * Gg. then x, (G, O, il, is) -- max{x(G1, i1), x(G2, is), d(v), d(G), d(Gx) - il + is, d(G2) - i2 + il},

where v is the vertex in G which was w(Gt) in G1 and u(G~) in G:.

P r o o f . Let 7 = max{x(G~, il), x(G~, is), d(v), d(G), d(G1) - ix + is, d(G2) - is + ix }. Then obviously x,(G, 0, il, is) _> 7- Therefore we shall prove xs(G, O, il, is) <_ 7.

Let r /be a coloring of G1 such that # t / = x(G~,i l ) and r(t/) = ix, and let ~b be a coloring of G2 such that #~b = x(G2,i:) and r(~b) = is. Assume that ~(E(G1)) N ~b(E(Gz)) = ~. Consider the extention ~o of the two colorings 7/and ~b. Then r (9) = 0, r(91) = il and r(~o2) = i2, but # 9 = X(G1, il) + x(G~, i9.). Therefore we shall alter 9 so that # 9 = 7. There are four cases. C a s e 1 : 7 = x(G1, il) or 7 = X(G2, is).

One may assume w.l.o.g, that 7 = x(Gl , ix). We rename all the colors of ~ with those of t/. Obviously

X(G1, il) = s(r/) + t(o ) + q(rl) + il, (3.1)

x(G2, is) = + + + is, (3.2) d(~) : t(r}) + { 1 + s(~b) + i2, (3.3)

d(G) = s(o ) + il + t(~b) + i2, (3.4)

d(G1) - ix + i2 = s(r]) + t(o ) + il + is, (3.5) and d(G2) - i2 + il = s(~b) + t(~b) + il + is. (3.6)

/,From these equations and x(G1, il) > max{d(v), a(G), d(GI) - il + i2, a(G2) - is + il}, we have

q(q) > max{s(~b) - s(0) + i2,t(~b) - t(~) + is, (s(~b) - s(~)) + (t(~b) - t(o)) + i2, i2}

= is + max{s(~b) - s(rl), 0} + max{t(r - t(ff), 0}.

Therefore we can replace the ix colors in ~b(R), any max{s(~b) - s(r/), 0} colors in ~b(S) and any max{t(~b) - t07), 0} colors in ~b(T) all with colors O(Q). We further replace the remaining colors in ~b(S) with colors in r/(S), and the remaining colors in ~b(T) with colors in r/(T). Finally we replace all q(~b) colors in ~b(Q) with the remaining colors in ~/not used yet. This can be done since #~7 >__ #~b. Then the extention 9 of r /and this altered ~b is a coloring of G and satisfies # 9 = x(GI, ia), r (9) = 0, r(91) -- il and r(~,2) = is. C a s e 2: 7 = d(v).

/,From (3.1) - (3.3), (3.5), (3.6) and d(v) > ma~{x(G1, il), x(G2, i2), d(Gx) - il + is, d(G2) - is + it }, we have the following four inequalities:

s(~b) - s(o) + i2 >_ q(~), t(o ) - t(~b) + il > q(~b),

and _>

Page 7: An efficient algorithm for edge-coloring series parallel ...

522

t(o) >__ t(r

Therefore we alter 0 and r so that 0 and r and hence their extention ~, use only the d(v) colors in y/(T) U T/(R) U r U r as follows:

(1) replace all s01 ) colors in t/(S) with colors in r (2) replace all t(r colors in r with colors in T/(T); (3) replace all q(r/) colors in T/(Q) with any q0/) colors among the colors in r

plus the remining s(r - sit/) colors in r and

(4) finally replace all q(r colors in r with any q(r colors among the colors in t/JR ) plus the remaining t(~}) - t(r colors in 1}(T).

Then the extention ~a of these altered 7} and r satisfies #to = d(v), r(~) = 0, rico1 ) = il and r(~2) = i2. C a s e 3: 7 = d(G).

/,From (3.1), (3.2), (3.4) - (3.6) and diG ) >_ max{x(Gl,i l) , x(G2, i2), d(G1) - il + i2, d(G2) - i2 + il}, we have the following four inequalities:

t(r - t0/) + i2 >

s(r/) - s(r + it >

t(r >__ and s(~/) >

Therefore we alter ~ and r so that 7/and r and ~/(S) U 7/(R) U r U r as follows:

(1) replace all s(~b) colors in r with colors in ~/(S); (2) replace all t(0) colors in o(T) with colors in r (3) replace all q(~/) colors in T/(Q) with any q0/) colors among the colors in r

plus the retaining t(r - t(o) colors in r

q(r

, ( r

hence ~0, use only the d(G) colors in

and (4) finally replace all qir colors

0i R) plus the remaining s(~}) Then the extention ~ of these altered and r(~2) = i2.

in r with any qir colors among the colors in - sic ) colors in ~/(S). ~/and r satisfies # ~ = d(G), r(~) = O, r(~ol) = il

Case 4 : 7 = d(G1) - il + i2 or 7 = diG2) - i2 + il. One may assume w.l.o.g, that 7 = d(G1) - il + i2 . / ,From (3.1) - i3.5) and d(G1) -

il + i2 > max{x(G~, i l ) , x(G2, i2), d(v), diG)}, we have the following four inequalities:

>__ t(o) >__

i2 > a n d ($(17) - 8(r + (t(17) - t ( r + i l _~

Therefore we alter ~/and r so that ~/and r and hence ~, colors in 0(S) U ~/(T) U t/(R) U r as follows:

(1) replace all s(r colors in r with colors in T/(S); (2) replace all t(r colors in r with colors in ~/(T); (3) replace all q(r/) colors in ~/(Q) with colors in r

and

s(r t(r q0/), q(r

use only the d(G1) - il + i2

Page 8: An efficient algorithm for edge-coloring series parallel ...

523

(4) finally replace all q(~b) colors in ~b(Q) with any q(~b) colors among the colors in ~/(R) plus the remaining t(z/) - t(~b) colors in ~/(T) plus the retaining s07 ) - s(~b) colors in ~}(S).

Then the extent ion ~ of these altered ~} and tb satisfies # to = d (Gi ) - ix + i2, r (~ ) -- 0, r(~01) = il and r(to~) = i2. Q.~.~D.

L e m m a 3.5 If G = GI �9 G~ then xa(G, as, i t , i9.) = max{d(v) , x ( G t , ix), x(G~, i2), 6t(G) + d(v) - ix - iz} ,

where v = w ( G t ) = u(G~) and as = min{d(G) - i~ - iz, ~t(G)}.

P r o o f . Let 7 = max{d(v) , x(Gx, ix), X(G2, i2), 6t(G) + d(v) - il - i2}. We first prove x , ( G , as, i l , i2) > 7. Clearly, xs(G, a, , ix, i2) > m~{d(v), X(Gx, ix), x(G2, i2)}. Therefore we shall prove x , ( G , as, ix, i2) > 6t(G) + d(v) - ix - i2. If dft(G) < ix + i2 then the inequal i ty tr ivially holds. Therefore one m a y assume tha t 6t (G) > ix +i2. T hen as = 6t (G) since d(G) - ix - i2 >_ 26t(G) - ix - i9. > 6t(G). Let to be any coloring of G such tha t r (~ ) = dft(G), r(~ox) = ix and r(~2) = i2. Then there are at least d(v) - ix - i2 edges which are incident to v and whose colors are different f rom those in R(~o). There fore xs (G, (~,, i t , i2) > 6t(G) + d(v) - ix - i2.

We next prove xs(G, as, ix, i2) < 7. Let ~/be a coloring of Gx such tha t #~} = x(G1, ix) and r(r}) = ix, and let ~b be a coloring of G2 such tha t #~b = x(G2, i2) and r(!b) = i2. One may assume tha t ~}(E(GI))A~b(E(G2)) = ~. Consider the extent ion ~o of the two colorings 11 and ~b. Then r(~ox) = ix and r(to2) = i2, but r(to) = 0 and #~o = x(G1, i x ) + x(G2, i2). Therefore we shall al ter ~0 so tha t r(to) = as and # to = 7. There are three cases. C a s e l : 6 t ( G ) > i t + i ~ .

In this case as = 6t(G) and 6t(G) + d(v) - ix - i2 > d(v). Fur the rmore s(~7) = d(u) - ix > 6t(G) - ix > i2 and t(~b) = d(w) - i2 > i1. There are two subeases. Casel.l: 7 = 6 t ( G ) + d ( v ) - i l - i 2 .

One may assume w.l.o.g, tha t d(u) < d(w) . Then as = 6t(G) = d(u) and ix + s(0) - i9. _< t ( r / ,From 7 -> x ( G x , i i ) , 7 >- x (G2 , i2 ) , d(v) = ix + i2 + t(~) + s ( r and d(u) = s(r}) + ix, we have q(z}) < s(~b) and q(~b) + t(~b) - il - (s(r}) - i2) _< t(~}). Therefore we can alter ,7 and ~b so tha t z / and ~b, and hence their ex tent ion to, use only the d(u) + d(v) - ix - i2 colors in ~/(S) U T}(R) U T/(T) O ~b(S), as follows:

(1) replace all i~ colors in zb(R) with colors in r}(S); (2) replace any ix + s(0) - i2 colors in ~b(T) with the ix colors in r}(R) plus the

remaining s(r/) - iz colors in ~}(S); replace all q(r/) colors in ~/(Q) with colors in ~b(S); (3)

and (4) finally replace all q(r colors in r and the remaining t ( r - ix - (s(r}) - i2)

colors in r with any q(r + t ( r - il - (s(r/) - i2) colors in T}(T). Then the extent ion ~ of these altered r} and r satisfies #to = d(u) + d(v) - ix - i2 = 7,

= d ( , ) = a . , r( x) = ix a n d = i2 .

C a s e 1 . 2 : 7 = m a x ( x ( G 1 , ix), x(G2, i2)}. One m a y assume w.l.o.g, tha t x (Gx , i l ) > x(G2, i2). zF rom d(u) >_ dft(G), d (w) >

6t(G), x(G1, i l ) > ~t(G) + d(v) - il - i2 and x (Gx , i l ) _> x(G2, i2), we have the following inequalities:

~t(G) - ix - i2 < min{s(~) - i2,t(~b) - ix}, s(~b) < q(7/) + max{0, d(u) - d(w)},

Page 9: An efficient algorithm for edge-coloring series parallel ...

524

and

d(w) - d(u) + q(r -- {(t(r - i1) -(s(~/) - i~)} + q(r _< t(q) + q(y) - s(r q(r < t ( . ) + {(s(q) - i2) - (t(r - it)} + q(.) - s(r

if d(u) <_ d(w), otherwise.

Therefore we alter r so that r C_ ~7(E(Gt)), as follows: (1) replace all i2 colors in r with colors in y(S); (2) replace any ix colors in r with colors in y(R); (3) replace any 6t(G) - it - i2 colors in r with the remaining s(y) - i2 colors in

.(s); replace all the s(r colors in r with any s(r colors among the colors in ~/(Q) plus the remaining max{O, d(u) - d(w)} colors in y(S);

(4)

and (5) finally if d(u) < d(w) then replace all the q(~b) colors in r and the remaining

d(w) - d(u) colors in r with any d(w) - d(u) + q(r colors among the colors in ~(T) plus the remaining colors in ~(Q), otherwise replace all q(r colors in r with the remaining t(~) + {(s(~/) - i~) - (t(r - il)} + q(z/) - s(r colors in y not used yet.

Then the extention ~ of these altered y and r satisfies # ~ = # 7 = 7, r(~) = 6t(G) = a . , r (~ t ) = it and r(~2) = i2. Case 2: max{d(u), d(w)} < it + i2.

In this case we have s(9) < i2, t ( r _< it, as = d(G) - it - i2 = s(~l) + t(r and 6t(G) + d(v) - ix - i2 <_ d(v). Since 7 = max{d(v), x(Gx, ix), x(G2, i2)}, there are two subcases. C a s e 2.1: 3, = d(v) .

One may assume w.l.o.g, that d(u) <_ d(w), that is, 6t(G) = d(u). ~From d(v) >__ x(Gt, ix) and dCv) > x(G2, i2) we have q0?) -< sCdd)+i2-s(y) and q(r < t ( t? )+i t - t ( r Therefore we can alter ,1 and r so that ,7 and r and hence their extention ~o, use only the d(v) colors in y(T) U y(R) U r V r as follows:

(1) repalce all s(y) colors in ~/(S) with colors in r (2) replace all t ( r colors in r with colors in y(R); (3) replace all q(~) colors in ~(Q) with any q(~/) colors among the s(r colors in

r plus the remaining i2 - s(y) colors in r and

(4) finally replace all q(r colors in r with any q(r colors among the t(~/) colors in ~(T) plus the remaining il - t ( r colors in ~(R).

Then the extention ~ of these altered ~ and r satisfies # ~ - d(v) - 3', r(~) - s(~) + t ( r = a, , r(901) = il and r(~o2) = i2. Case 2.2: ? = max{x(G1, il), x(G2, i2)}.

One may assume w.l.o.g, that x(G1, Q) _> x(G2, i2). LFrom x(Gt , i l) >_ x(G2,i2) and x(G1, il) ~ d(v) we have q(r _< t07 ) + q(~) - s(r - (i2 - s(~)) + il - t (~) and i2 - s07) + s(r _< q(~). Therefore we alter r so that r C_ ~7(E(Gt)), as follows:

(1) repalce any s(~) colors in r with colors in ~(S); (2) repalce all t ( r colors in r with colors in ~(R); (3) repalce the remaining i2 - s07) colors in r and the s(r colors in r with

colors in ~(Q); and

Page 10: An efficient algorithm for edge-coloring series parallel ...

525

(4) finally replace all q(r colors in r with the remaining t(~/) + q(r/) - s(r - (i2 - s(T/)) + il - t ( r colors in t /not used yet.

Then the extention 9 of~7 and this altered r satisfies # 9 - # t / - 7, r(9) -" S(~l)d-t(r -- a, , r(91) = il and r(9s) = is. C a s e 3: d(u) <_ Q + is <_ d(w) or d(w) <_ il + i2 <_ d(u).

One may assume w.l.o.g, that d(u) <_ i~ + is <_ d(w). In this case we have s(t/) _< i~, t(~b) _> Q, 6t(G) = d(u), a , = d(u) and S t ( G ) + d ( v ) - i x - is <_ d(v). Since 3, = max{d(v), X(G1, ix), x(Gs, is)}, there are three subcases. Case 3.1: T = d(v).

/,From d(v) > x(G1, il) and d(v) > x(G2, is) we have q(T/) _< s(r + i~ - s(T/) and t ( r - il + q(r _< t(T/). Therefore we can alter ~/and r so that ~ and r and hence their extention 9, use only the d(v) colors in ~/(T) U ~/(R) U r U ~b(R), as follows:

(1) repalee all s(~/) colors in ~?(S) with colors in r (2) repalce any il colors in r with the il colors in ~/(R); (3) repalee all q(~/) colors in ~/(Q) with any q07) colors among the s(r colors in

r and the remaining i2 - sO7 ) colors in r and

(4) finally replace the remaining t (r - il colors in r and all q(r colors in r with colors in ~/(T).

Then the extention 9 of these altered ~/and r satisfies # 9 = d(v) = 7, r (9) = d(u) = or., r(91) = ix and r(92 ) = i2. Case 3.2: 7 = x(Gl, i l ) .

/,From X(G1, i l) > x(G2, i2) and x(G1, il) >_ d(v) we have q(r + t ( r - il < t(r/) + q(rl) - s ( r - (i2 - s(rl)) a n d i2 - s(0) + s ( r < q(~). Therefore we can alter r so that r C_ T/(E(G1)), as follows:

(1) repalce any sO? ) colors in r with colors in T/(S); (2) repalce any il colors in r with the ix colors in ~/(R); (3) repalce the remaining i2 - s(7/) colors in r and the s(r colors in r with

any i2 - s(T/) + s(r colors in t/(Q); and

(4) finally replace all q(r colors in r and the remaining t ( r - il colors in r with the remaining t(T/) + q(T/) - s(r - (i2 - sO7)) colors in ~ not used yet.

Then the extention 9 of 7/and this altered r satisfies # 9 = # 7 = 7, r (9) = d(u) = a , , r(91) = il and r(92 ) = i2. Case 3.3: 7 = x(G2,i2).

/,From x(G2, i2) > x(GI, i l ) and t ( r - il - tO1) + i2 - s(T/) and t(~/) _< rI(E(GI) ) C r as follows:

(1) repalce all s(T/) colors in r/(S) with colors in r (2) repalce all i1 colors in r/(R) with colors in r (3) repalce all t(~/) colors in r/(T) with any t(T/) colors among the q(r colors in r

plus the remaining t (r - il colors in r and

(4)

x(G2, i2) >_ d(v) we have q(r/) _< s ( r q ( r q(r + t (r - il. Therefore we can alter r/so that

finally replace all q(~/) colors in ~/(Q) with the remaining s(r + q(r + t ( r - il - tO1) + i2 - s(~) colors in r not used yet.

Then the extention 9 of this altered T/and r satisfies # 9 = # r = 7, r(9) = d(u) = a., r(91) = il and r(9s) = is. Q.s

Page 11: An efficient algorithm for edge-coloring series parallel ...

526

L e m m a 3.6 Let G = G t �9 Gs, v = w ( G 1 ) = u ( G s ) . Assume that ~ = m a x { d ( v ) , x ( G t , i t ) , x ( G 2 , i2)} is finite. Then

x s ( G , i, ix, i2) =

if x s ( G , O, ix, is) - )t < i < as - x , ( G , as, i t , is) + )~, where as = min{d(G) - it - is, ~t(G)}. [3

The proof of Lemma 3.6 is omitted due to the lack of space. Now we prove Lemma 3.2.

P r o o f o f L e m r n a 3.2 If i > as then the lemma trivially holds. Therefore we only prove that the lemma holds for all i, 0 _< i _< as. Let /~ - xa(G, 0, il, i2) - ~ and 7 -" a s - x ( G , as, i l , i 2 )+) t . Lemma 3.6 implies that if fl < i _< 7 then x s ( G , i, i l , i2) - )t, and hence the claim holds. If 0 _< i < /~ then f rom/~ -- xs (G,O, i l , i 2 ) - )~ and 7 - as - x ( G , a, , il, i2) + A we have

x s ( G , O, i l , i2) - i > x s ( G , O, i l , i2) - =)~

= x s ( G , a , , i l , i2) - a , + 7

>__x,(G, or,, i1,'/2) - as + i.

Furthermore if 7 < i < as then similarly we have

x s ( G , as, ix, is) - as + i > x s ( G , as, i l , i2) - as + 7 =)~

=xs(G, 0, ix, is) - / ~

> x s ( G , O, i l , is) - i.

Therefore it suffices to prove that if 0 < i < # then x , ( G , i , i l , i 2 ) = x s ( G , O , i x , i 2 ) - i and if 3' < i < as then x s ( G , i, i l , is) = x , ( G , as, ix, is) - as + i:

We first prove that if 0 < i < /~ then x s ( G , i, ix, i2) = x s ( G , O, ix, i2) - i. Lemma 3.3 implies that x s ( G , i, ix, i2) >_ x s ( G , O, ix, is) - i. Furthermore by Lemma 3.3 and 3.6, we have

x s ( G , i, ix, i2) < x s ( G , ~, ix, is) + ~ - i

= )~ + x s (G , O, ix, i2) - )~ - i

= x s ( G , O , i t , i s ) - i.

Therefore x s ( G , i, i l , i2) = x , ( G , O, i t , is) - i. We next prove that if "y < i < as then x s ( G , i , ix , i2) = x s ( G , a , , i x , i s ) - as + i.

Lemma 3.3 implies that x s ( G , i, i t , i2) >_ x s ( G , as, i t , i2) - as + i. Furthermore by Lemma 3.3 and 3.6, we have

x s ( G , i, i t , is) < x s ( G , 7, i t , i2) + i - 7

= ~ + i - a s + x s ( G , a , , i l , i s ) - A

= x s (G , as, i l , i 2 ) - as + i.

Therefore x s ( G , i, i t , i2) = x s ( G , as, i t , is) - as + i. Q . s

Page 12: An efficient algorithm for edge-coloring series parallel ...

527

The lemmas above imply that Xp(G, i, il, i2) and x,(G, i, il, i2) for fixed integers i, il and i2 can be computed in constant time if x(G1, il) and x(G2, i~.) are known. Therefore we obtain the following straightforward algorithm.

1 P r o c e d u r e Color(G); 2 begin a if G has exactly two vertices

I" i 4 t h e n x(G, i) := C~

5 e l se i f G = Gx II G2 s t hen begin 7 Color(G1); s Color(G2);

if i = IE[ otherwise

{ Compute all x(G1, il) } { Compute all x(G2, is) }

9 compute all xp(G, i, il, is) by using Lemma 3.1; lo for each i, 0 < i < A, x(G, i) := mi.n{xp(G, i, ix, is)}

$1~S2

11 e n d 12 else begin { G = G1 �9 G2 } 13 Color(G1); { Compute all x(Gx, il) } 14 Color(G2); { Compute all x(G2, i2) } x5 compute all xs(G, i, il, is) by using Lemma 3.2; 16 for each i, 0 < i < A, x(G, i) := min{xs(G, i, il, i2)}

11112

17 e n d is end; Lines 9, 10, 15 and 16 in the algorithm above can be done in time O(A3), and there

occurs at most [V] recursive calls during the execution of Color(G). Therefore the total running time of the algorithm is O(IVIA3). In the following section we will prove that the function x(G, i) is "convex" with respect to variable i, and using the fact, we give an efficient method to compute x(G, i) in lines 9, 10, 15 and 16.

4. E f f i c i e n t a lgor i thm In this section we give an algorithm which solves the edge-coloring problem for series-

parallel multigraphs in time O(IVIA ). We first show that x(G, i) is a convex function with respect to variable i: for any integers i, h and j such that h < i < j, x(G, i) < max{x(G , h), x(G, j)}. Then, by using the convexity, we improve the time complexity of the algorithm above by showing that at lines 9, 10, 15 and 16, x(G, i) for all i can be computed in time O(A). The proofs of the following two lemmas are omitted due to the lack of space.

L e m m a 4.1 Let G be a series-parallel multigraph and i be a nonnegative integer. If x(G, i) • r and x(G, i + 1) r then Ix(G, i) - x(G, i + 1)1 < 1. []

L e m m a 4.2 Let G be a series-parallel multigraph and let h and j be nonnegative inte- gers with h _< j . If x(G, h) r oo and x(G, j ) r then x(G, i) _< max{x(G, h), x(G, j)} for every i, h _< i _< j . []

We show that x(G, i) can be computed for all i total in time O(A) for the case when G = G1 II G2. The other case when G = G1 * G2 is omitted due to the lack of space. Let

Page 13: An efficient algorithm for edge-coloring series parallel ...

528

i~ain = min{itlx(Gt, il) ~ oo},

iF i" = min{izlx(G2, i2) ~ co}, and imin = i~ain +/Fin.

Then x(G, i) = co for all i < imin, and

x(G, imin) ._ Xp(G, imin, i~nin,/Fin)

= max{x(Gt, s~in), x(G2,/Fin), d(G) - imin}

Therefore one can compute x(G, imin) in time O(A). We compute all the other x(G, i), i =/rain + 1,/rain + 2, ..., A, in this order. Lemma 4.1 implies that, for every i >/ram,

x ( G , i - 1 ) - 1, x(G,i) = x ( G , i - 1),

x ( G , i - 1 ) + I, or OO.

We give a method to determine, for fixed integers i and j , whether x(G, i) < j or not. Clearly, using the method three times, one can compute x(G, i) for a fixed i if x(G, i - 1 ) has been known. Lemma 3.1 implies that x(G, i) < j if and only if there exist integers ix and i2 such that

x(Gt , il) _< j, (4.1)

X(G2, i2) _< j, (4.2) d(G) - i < j, (4.3)

it + i2 < i, (4.4)

i <__ d(u), (4.5)

i < d(w), (4.6)

i < d(G1) - il + i2, and (4.7) i <_ d(G2) - i2 + il. (4.8)

~From Lemma 4.2, we have known that x(G, i) is convex. Therefore inequalities (4.1) and (4.2) can be transformed into the following inequalities:

al < il __< bl and (4.9) a2 _< i2 _< b2, (4.10)

where al -- min(i t l x(G1, i l) ~ j}, bt = max{hi x(G1, il) _< j}, a2 = min{i2l x(G2, i2) < j } and b2 = max{i2[ x(G2, i2) < j}.

Furthermore, inequalities (4.3)-(4.8) can be rewritten as follows:

a < i < / ~ , i t + i 2 < i , a n d

7 < it - i 2 < 6,

(4.11) (4.12) (4.13)

Page 14: An efficient algorithm for edge-coloring series parallel ...

529

where a,/~, 7 and 6 are constants determined by fixed i and j. Clearly, one can determine in constant time whether there are integers i1 and i2 satisfying all of (4.9), (4.10), (4.12) and (4.13). Thus, for fixed i and j, one can determine whether x(G, i) ~_ j in constant time if al, bl, a2 and b2 have been known. For all j, 0 _~ j ~ 3A-- 1, one can easily compute al, bl, as and b2 above in time O(A). (Note that, for every multigraph G, the chromatic index of G is less than 2A, and hence x(G, i) < 3A for every i unless x(G, i) = oo.) Thus, we can compute x(G, i) for all i in time 0(.4) for the case when G - G1 II G2.

We have showed that the procedure Color can be implemented so that it runs in time O(IV[A). Although Color finds the chromatic index of a series-parallel multigraph G, it can be modified so that it actually colors G. Thus we conclude the paper by the following theorem.

Theorem The edge-coloring problem can be solved in time O(]VIA ) and space O(IVl/t) for a series-parallel multigraph G = (V, E).

References

[ACPD]

[ALl

[B]

[c]

[Sey]

[Sys]

[TN]

[TNS]

S. Arnborg, B. Courcelle, A. Proskurowski, and D. Seese, An algebraic theory of graph reduction, Tech. Rept. 91-36, Laboratoire Bordelais de Recherche en Informatique, Bordeaux, 1991. S. Amborg and J. Lagergren, Easy problems for tree-decomposable graphs, Journal of Algorithms, 12, 2, pp.308-340, 1991. H. L. Bodlaender. Polynomial algorithms for graph isomo~hism and chro- matic index on partial k-trees, Journal of Algorithms, 11, 4, pp.631-643, 1990. B. Courcelle, The monadic second-order logic of graphs I: Recognizable sets of finite graphs, Information and Computation, 85, pp.12-75, 1990. P. D. Seymour, Colouring series-parallel graphs, Combinatorica 10(~), pp. 379-392, 1990. M. Syslo, NP-complete problems on some tree-structured graphs: a review, In M. Nagl and J. Perl, editors, Proc. WG'83 International Workshop on Graph Theoretic Concepts in Comouter Science, pp. 342-353, Univ. Verlag Rudolf Trauner, Linz, West Germany, 1983. O. Terada and T. Nishizeki, Approximate algorithms for the edge-coloring of graphs, Trans. Inst. of Electronics and Communication Eng. of Japan, J65-D, 11, pp. 1382-1389, 1982. K. Takamizawa, T. Nishizeki, and N. Saito, Linear-time computability of combinatorial problems on series-parallel graphs, J. of ACM, 29, 3, pp. 623- 641, 1982.