linear algorithms for edge-coloring trees and unicyclic graphs

3
Volume 9, number 3 INFORMATION PROCESSING LE’ITERS 5 October 1979 LINEAR ALGORITHMS FOR EDGE-COLORING TREES AND UNICYCLIC GRAPHS Sandra MITCHELL and Stephen HEDETNIEMI Department of Computer Science, University of Oregon, Eugene, OR 97403, U.S.A. Received 2 1 May 1979 Graphs, computational complexity 1. Introduction The chromatic index x’(C) of a graph G = (V, E) is the minimum order k of a partition El, E2, . . . . Ek of the edges F. of G, such that for every i, 1 < i < k, no two edges in Ei have a vertex in common. In 1964 [4] Vizing showed that for any graph G, A < x’(G) < A + 1, where A equals the maximum degree of any vertex in G. Since then interest has been focused on finding classes of graphs for which x’(G) = A (e.g. Beineke and Fiorni [l]). Ictzrest has also b+_n focused on the comp!_!tational problem of determin- ing x’(G) and a minimum edge partition (coloring) of an arbitrary graph G. It re.mains an open question whether or not this problem is NP-complete (cf. Garey and Johnson [3] 1. However, Gabow [2] has designed a worst-case O(V ‘I* E log V + V) algorithm for determining a minimum edge coloring of an arbit- rary bipartite graph with ‘v” vertices, In this paper we present a simple worst-case O(V) 12345678910 TREE 12132442 8 algorithm for determining a minimum edge coloring for an arbitrary tree T with V vertices. With a minor addition this algorithm can also be used to determine a minimum edge coloring of an arbitrary unicyclic graph. It is suggested that this edge coloring technique can b< successfully applied to a variety of other classes of graphs. 2. An O(V) algorithm fcr edge-coloring a tree A basic component of this algorithm is the data structure used to represent a tree (and unicyclic graph); we use the recursive data structure illustrated in Fig. 1. Algorithm EDGE-COLOR makes one pass, from left-to-right, across the TREE-array, coloring the edges in a ‘greedy’ fashion, using the next lowest, available color for each edge. For each vertex 1, the algorithm maintains two variables, FIRST(I) and 12 14 8 9 10 15Qx c----J- 1 2 l-yq )a 5 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1s UNICYCLE 6 1 2 3 4 5 6 1 2 9 6 8 7 9 6 Fig. 1.

Upload: sandra-mitchell

Post on 25-Aug-2016

227 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Linear algorithms for edge-coloring trees and unicyclic graphs

Volume 9, number 3 INFORMATION PROCESSING LE’ITERS 5 October 1979

LINEAR ALGORITHMS FOR EDGE-COLORING TREES AND UNICYCLIC GRAPHS

Sandra MITCHELL and Stephen HEDETNIEMI Department of Computer Science, University of Oregon, Eugene, OR 97403, U.S.A.

Received 2 1 May 1979

Graphs, computational complexity

1. Introduction

The chromatic index x’(C) of a graph G = (V, E) is the minimum order k of a partition El, E2, . . . . Ek of the edges F. of G, such that for every i, 1 < i < k, no two edges in Ei have a vertex in common. In 1964 [4] Vizing showed that for any graph G, A < x’(G) < A + 1, where A equals the maximum degree of any vertex in G. Since then interest has been focused on finding classes of graphs for which x’(G) = A (e.g. Beineke and Fiorni [l]). Ictzrest has also b+_n focused on the comp!_!tational problem of determin- ing x’(G) and a minimum edge partition (coloring) of an arbitrary graph G. It re.mains an open question whether or not this problem is NP-complete (cf. Garey and Johnson [3] 1. However, Gabow [2] has designed a worst-case O(V ‘I* E log V + V) algorithm for determining a minimum edge coloring of an arbit- rary bipartite graph with ‘v” vertices,

In this paper we present a simple worst-case O(V)

12345678910 TREE 12132442 8

algorithm for determining a minimum edge coloring for an arbitrary tree T with V vertices. With a minor addition this algorithm can also be used to determine a minimum edge coloring of an arbitrary unicyclic graph. It is suggested that this edge coloring technique can b< successfully applied to a variety of other classes of graphs.

2. An O(V) algorithm fcr edge-coloring a tree

A basic component of this algorithm is the data structure used to represent a tree (and unicyclic graph); we use the recursive data structure illustrated in Fig. 1.

Algorithm EDGE-COLOR makes one pass, from left-to-right, across the TREE-array, coloring the edges in a ‘greedy’ fashion, using the next lowest, available color for each edge. For each vertex 1, the algorithm maintains two variables, FIRST(I) and

12 14

8 9 10

15Qx c----J- 1 2

l-yq )a 5 4

1 2 3 4 5 6 7 8 9 10 11 12 13 14 1s UNICYCLE 6 1 2 3 4 5 6 1 2 9 6 8 7 9 6

Fig. 1.

Page 2: Linear algorithms for edge-coloring trees and unicyclic graphs

Volume 9, number 3 INFORMATION PROCESSING LE’ITERS 5 October 1979

LAST(I), which at any time record the first and most recent (not equal to the FIRST) color assigned to an edge incident with vertex I. It is important to note that the first color (i.e. integer) which is assigned to

incident with an arbitrary vertex I can be relatively ; but the next colors assigned to edges incident t tex I start at I and continue 23, . ..) FIRST(I)-1, FIRST(I)+l, . . . etc.

Algorithm EDGE-COLOR To color the edges of a tree T with a minimum

number of edges so that no two edges with the same color have a vertex in n. The tree T is repre-

1) l ** TREE(V); the coEors used are the integers I ,2,3, . . . . COLOR(i) records the color assigned to the edge (&TREE(i)) for 2 63 -6 v.

(initialize) for14 toVdo

FIRST(I) * 0 LAST(I) * 0

od (color the edges}

fotJ+-2 toVdo (get the parent of vertex J}

PARENT + TREE(J) (determine the next color available of PARENT}

if LAST(PARENT) + 1 # FIRST(PARENT) then NEXT-COLOR + LAST(PARENT) + 1 else NEXT-COLOR c- FIRST(PARENT) + L

fi LAST(PARENT) + NEXT-COLOR COLOR(J) + NEXT-COLOR FIRST(J) c- NEXT-COLOR

WI

The O(V), worst-case time complexity of Algorithm EDGE-COLOR is obvious, as is the fact that the algo- rithm determines a proper coloring.

orithm EDGE-COLOR produces oring, follows inductively from x J is assigned ‘COLOR(J) =

NEXTCOLOR’, then vertex PARENT (i.e. TREE(J)) must have edges with consecutive colors 1,2, .*.,

However, this also follows from a more general result that if G is a bipartite graph, then x’(T) = 0 (cf. Wilson [S 1).

3. An O(V) algorithm for edpxoloring a unicyclic

graph

Let G be a unicyclic graph whose cycle is of length k and whose cycle vertices are vl, v2, . . . . vk. We can determine a minimum edge-coloring of G by first applying Algorithm EDGE-COLOR to the tree which results from deleting the edge (vi, vk). After this, it only remains to assign a color to edge (vi, vk). This’ can be done using the following procedure:

{color last edge) if LAST(K) + 1 < FIRST(K) < LAST(l) + L

then COLOR( 1) + max{LAST( l),FIRST(K)) +l else COLOR( 1) + max (LAST( l),LAST(K)) + 1

fi

The correctness of this modified algorithm for a minimum edge-coloring of a unicyclic graph follows directly from the correctness of Algorithm EDGE- COLOR (for trees) and the fact that there is essen- tially only one case where the color assigned to edge (vi , vk) is greater than the degree of v1 and vk . This one case occurs for a cycle C2k+i of odd length, in which case edge (vi, vZk+i) is assigned color 3. This leads to the following interesting result:

Theorem. Let G be a unicyclic graph. Then x’(G) = A t 1 if and only if G is a cycle of odd length

4. Summary

Although it is not known whether the edge-coloring problem is NP-complete for arbitrary graphs, it is no worse than O(V ‘12E log V t V) for bipartite graphs, and then even easier O(V) far trees and unicyclic graphs. We strongly suspect that the edge-coloring technique used in this paper applies to other classes of graphs as well, anci may even provide an insight or two to the general problem.

Acknowledgment

The authors would like to thank E&rat omandi, the edge-coloring spired

this paper.

Page 3: Linear algorithms for edge-coloring trees and unicyclic graphs

Volume 9, number 3 INFORMATION PROCESSING LETTERS 5 October 1979

References [ 3) M. Garey and D. Johnson, Computers and Intractability (Freeman, San Francisco, 1979) 286.

[ 13 I.,. Beineke and F. Fiorni, On small graphs critical with respect to edge-colorings, Discrete Math. 16 (1976) 109- 121.

[2] H. Gabow, Using Euler partitions to edge color bipartite

[4] V. Viking, On the estimate of the chromatic number of a graph, Diskret. Analiz. 3 (1964) 25-30.

[S] R. Wilson, Introduction to Graph Theory (Oliver and Boyd, Edinburgh, 1972).

multigraphs, Internat. J. Comput. Information Sci. 5 (19763 345-355.