Information Processing North-Holland
Letters
44 (1992) 2.51-253
21 December
1992
The greedy algorithm is optimal for on-line edge coloring Amotz Bar-Noy * IBM T.J. Watson Research Center, Yorktown Heights, NY 10598, USA
Rajeev Motwani Computer Science Department, Stanford University, Stanford, CA 94305, USA
Joseph Naor ** Department of Computer Science, Technion - Israel Institute of Technology, Technion City, Haifa 32000, Israel Communicated by D. Dolev Received 20 June 1990 Revised 21 September 1992
Keywords: Algorithms;
graph
coloring;
graph;
algorithms;
1. Introduction The chromatic number of a graph G, x(G), is the minimum number of colors needed to color the vertices such that adjacent vertices receive different colors. The chromatic index, x’(G), is the minimum number of colors needed to color the edges such that adjacent edges receive different colors. Determining both x(G) and x’(G) was shown to be NP-complete. [4]. Very little is Correspondence to: A. Bar-Noy, IBM T.J. Watson Research Center, P.O. Box 704, Yorktown Heights, NY 10598, USA. * This work was carried out while this author was visiting Stanford University and supported in part by a Weizmann fellowship, by contract ONR N00014-88-K-0166, and by a grant of Stanford Center for Integrated Systems. * * Most of this work was done while the author was with the Computer Science Department, Stanford University and supported by contract ONR N00014-88-K-0166. OOZO-0190/92/$05.00
0 1992 - Elsevier
Science
Publishers
randomized
algorithms
known on polynomial time approximations to x(G). The best bounds were achieved by [ll] for general graphs and by [2,3] for 3-colorable graphs. However, for edge coloring the situation is by far better. Vizing’s theorem states that A
B.V. All rights reserved
251
Volume
44, Number
5
INFORMATION
PROCESSING
The algorithm assigns a color to the current vertex or edge based only on past history; color assignments cannot be changed. This process can be viewed as a game between two players: an algorithm and an adversary. The adversary decides on the graph and also on the order in which the input is presented to the algorithm. The performance ratio of an on-line algorithm &’ on G is the ratio of the number of colors used by XZ to the number of colors in an optimal off-line coloring. On-line algorithms can be either deterministic or randomized. The performance ratio of a randomized algorithm is guaranteed with probability at least l/c, for some constant c. In the randomized case, the adversary has to commit itself to the graph before the computation starts, as opposed to the deterministic case. This is the weakest type of adversary for randomized on-line algorithms and is called the oblivious adversary by [ll. Any lower bound proved for this kind of adversary naturally holds for the stronger types as well. Recently, there has been increasing interest in on-line graph algorithms. For vertex coloring, Lo&z, Saks and Trotter [9], and Vishwanathan 1101 gave on-line algorithms for arbitrary graphs. Kierstead 181, Gyarfb and Lehel [51, and Irani [61 studied on-line coloring algorithms in various families of graphs. Karp, Vazirani and Vazirani [7] studied on-line bipartite matching algorithms and proved that a randomized algorithm performs much better than a deterministic one. The greedy coloring algorithm scans the vertices or edges one-by-one, and assigns each vertex or edge the minimum possible color. Obviously, it is an on-line algorithm. For vertex coloring, it uses at most A + 1 colors; for edge coloring it uses at most 24 - 1 colors. In this note we are concerned with on-line edge coloring. We show that the greedy algorithm, which has performance ratio 2, is optimal in both the deterministic and the randomized case. In both cases, we define a graph such that any on-line algorithm must use 24 - 1 colors, independent of whether the graph is given edgeby-edge or vertex-by-vertex. In the deterministic case A = O(log n), and in the randomized case
A = O((log n)“*). 252
LETTERS
21 December
1992
2. The lower bounds We first describe the lower bound for the deterministic case. The proof relies on a pigeonhole argument. Assume to the contrary that the algorithm can color any n-vertex graph that has maximum degree A with only 24 - 2 colors. The adversary provides the algorithm with the following graph: p stars of degree A - 1 (see Fig. 1). In the edge-by-edge model the order in which the edges are revealed to the algorithm is not important. In contrast, in the vertex-by-vertex model, for each star, the adversary reveals all the vertices but the center vertex. (Note that by doing that, the star is completely revealed, yet the adversary can still add more edges that are adjacent to the center.) Clearly, each star must be colored with A - 1 different colors and this will be denoted as the labelling of the star. If p is large enough, then there must be A stars that were labelled with the same labelling by the algorithm. The adversary now reveals a special vertex which is adjacent to the centers of these A stars and is called the pivot. The algorithm has to provide A new colors that are different from the A - 1 colors used in the labelling of these A stars. All together the algorithm uses 24 - 1 colors; a contradiction. Let us now compute the value of n. Define (Y= (2;:: >, to be the number of distinct labellings with A - 1 labels. It follows from the pigeon-hole argument that it suffices to choose p = (A - 1)a + 1. The overall number of vertices in the graph
Fig. 1. In the deterministic case, out of p stars there must be A stars with the same labelling. In the probabilistic case, with a positive probability there are A stars with the same labelling.
Volume
44, Number
5
INFORMATION
PROCESSING
is n = AD + 1. An easy calculation shows that n < A2. 4’ and therefore A is of order log n. We now proceed with the probabilistic case. The difficulty with adapting the latter proof to the probabilistic case is that the adversary must commit beforehand to which stars the pivot is connected. To overcome that, the adversary chooses uniformly in random A stars out of the p stars and connects their center with the pivot. (The value of p remains the same as in the deterministic case.) The adversary will succeed if and only if it “guesses” correctly which are the A stars that received the same labelling. Let the probability of this happening be E. Obviously E > l/(z) since we know that there must be at least A stars with the same labelling. The adversary now repeats this process (of revealing 0 stars with a pivot vertex) y times so as to amplify its probability of success. Let us now analyze the values of y and n. Since E 2 l/(z), the adversary fails with probability less than (1 - l/pAIy. Taking y = /3* implies failure with probability at most l/e. Now, n = $$A + 1) or II < 4 O(*‘). Hence, in the probabilistic case, A is of order (log n)‘/2.
3. Discussion We have presented tight upper and lower bounds for on-line edge coloring and have proved that the greedy strategy is optimal. Our proofs hold only for graphs for which the maximal degree is relatively small (at most log n). An interesting open problem is whether better bounds can be achieved for graphs whose maximal degree is larger. This seems less plausible in the deterministic case, but perhaps one can devise a randomized algorithm that would edge color a graph better than the greedy algorithm for high degree graphs. We suggest the following randomized algorithm. For each edge revealed, choose uniformly
LETTERS
21 December
1992
in random a color among its free colors. We conjecture that with probability greater than some constant, A + O(alog n) colors suffice. Note that A + sZ(fi) is the minimum number of colors needed by this algorithm because of the following graph: an edge e adjacent to A edges on both sides. The adversary first reveals one side, then the other, and the edge e last. It is not hard to see that the minimum number of colors needed for the probability of success to be at least a constant is A + Ck(fi>.
References Dl S. Ben-David,
A. Borodin, R.M. Karp, G. Tardos and A. Wigderson, On the power of randomization in on-line algorithms, in: Proc. 22nd Ann. ACM Symp. on Theory of Computation (1990) 379-386. algorithm for 3-colDl A. Blum, An 6(n0.4)-approximation oring, in: Proc. 21st Ann. ACM Symp. on Theory of Computing (1989) 535-542. 3-coloring, in: 131 A. Blum, Some tools for approximate Proc. 31st Ann. Symp. on Foundations of Computer Science (1990) 554-562. and D.S. Johnson, Computers and In141 M.R. Garey tractability - A Guide to the Theory of NP-Completeness (Freeman, San Francisco, CA, 1979). 151 A. Gylrfas and J. Lehel, On-line and first-fit colorings of graphs, J. Graph Theory 12 (1988) 217-227. 161 S. Irani, Coloring inductive graphs on-line, in: i&c. 31st Symp. on the Foundations of Computer Science (1990) 470-479; Also: Algorithmica, special issue on on-line algorithms, to appear. 171 R. Karp, U.V. Vazirani and V.V. Vazirani, An optimal algorithm for on-line bipartite matching, Proc. 22nd Ann. ACM Symp. on Theory of Computation (1990) 352-358. 181 H.A. Kierstead, The linearity of first-fit coloring of interval graphs, Siam .I Discrete Math. 1 (1988) 526-530. 191 L. Lovasz, M. Saks and W.T. Trotter, An on-line graph coloring algorithm with sublinear performance ratio, Discrete Math. 75 (1989) 319-325. Randomized on-line graph coloring, in: [IO1 S. Vishwanathan, Proc. 31st Symp. on the Foundations of Computer Science (1990) 464-469; Also: J. Algorithms, to appear. Improving the performance guarantee for 1111 A. Wigderson, approximate graph coloring, J. ACM 30 (1983) 729-735.
253