Transcript
Page 1: Parallel and On-Line Graph Coloring

Ž .JOURNAL OF ALGORITHMS 23, 265]280 1997ARTICLE NO. AL960836

Parallel and On-Line Graph Coloring

Magnus M. HalldorssonU´ ´

Science Institute, Uni ersity of Iceland, IS-107 Reykja¨ik, Iceland

Received April 19, 1994; revised June 27, 1996

We discover a surprising connection between graph coloring in two orthogonalparadigms: parallel and on-line computing. We present a randomized on-line

Ž .coloring algorithm with a performance ratio of O nrlog n , an improvement oflog n factor over the previous best known algorithm of Vishwanathan. Also, from'

the same principles, we construct a parallel coloring algorithm with the sameperformance ratio, for the first such result. As a byproduct, we obtain a parallelapproximation for the independent set problem. Q 1997 Academic Press

1. INTRODUCTION

At the heart of most partition and allocation problems is a graphcoloring question. The graph coloring problem involves assigning valuesŽ .or colors to the vertices of a graph so that adjacent vertices are assigneddistinct colors, with the objective of minimizing the number of colors used.

We seek graph coloring algorithms that are both effecti e and efficient.Efficiency means, among other things, using computation time bounded bya polynomial in the size of the input. Effectiveness means that the qualityof the coloring is never much worse than the optimal coloring; it ismeasured in terms of the performance ratio of the algorithm, defined asthe ratio of the number of colors used to the minimum number of colorsneeded, maximized over all inputs. In this paper we present a reasonablyeffective and efficient graph coloring algorithm that yields both paralleland on-line algorithms.

* E-mail: [email protected]. Research partly performed at Rutgers University, Tokyo Instituteof Technology, and Japan Advanced Institute of Science and Technology}Hokuriku, andsupported there by a DIMACS Graduate Fellowship, a Toshiba Endowed Chair, and a PFUEndowed Chair, respectively.

265

0196-6774r97 $25.00Copyright Q 1997 by Academic Press

All rights of reproduction in any form reserved.

Page 2: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´266

A parallel algorithm is said to be efficient if it uses time polylogarithmicand processors polynomial in the size of the input. The coloring problem isof central importance in parallel and distributed computation, as a meansof scheduling nonconflicting concurrent tasks. Previous parallel algorithm

w xhave attained the degree bound of Brooks’s theorem 9 , 5-coloring ofw xplanar graph 6 , and some other special cases, but no nontrivial perfor-

mance guarantee on general graphs was known. We present a parallelalgorithm that uses at most 3nŽky2.rŽky1. colors on k-colorable graphs, for

Ž .a performance ratio of O nrlog n , where n is the number of vertices.An algorithm is said to be on-line if the color assigned to vertex i is

independent of vertices with index greater than i. This corresponds tovarious dynamic situations, such as the assignments of frequencies tomobile users. The on-line graph coloring problem has been widely studiedw x1, 8, 14 and for various other reasons as well. In particular, an algorithm

Ž U .that improves the trivial performance ratio to O nrlog n was given by'w x Ž .Lovasz et al. 15 , and a randomized algorithm with ratio of O n on´

Ž .'3-colorable graphs and O nr log n ratio on general graphs was given byw x w xVishwanathan 17 . We improve here the randomized algorithm of 17 , for

Ž .a performance ratio of O nrlog n .We first present in Section 2 a sequential graph coloring algorithm with

Ž .a performance ratio of O nrlog n , and use it to derive both a parallelŽ . Ž .algorithm in Section 3 and a randomized on-line algorithm in Section 4

with the same performance ratio. The randomized algorithm is an im-w xprovement of an algorithm of Vishwanathan 17 , and the performance

Ž .'ratio of O nr log n compares favorably with the lower bound forŽ 2 . w xrandomized on-line coloring of V nrlog n 11 . The performance ratio of

the parallel algorithm is the first of its kind. It also compares favorablyŽ Žwith the best performance ratio known for sequential coloring of O n log

.2 3 . w xlog n rlog n 10 , and the best lower bound known for that quantityŽ . 1ye w xassuming P / NP of n , for each e ) 0 5 . Finally, using the parallel

Ž Ž .2 .coloring algorithm, we obtain in Section 5 an O n log log nrlog nperformance ratio for the parallel independent set problem. This also

Ž 2 . w xcompares favorably to the sequential upper bound of O nrlog n 3 and1ye w xthe lower bound of n , for each e ) 0 12 . See Table 1 for comparisons.

This connection between apparently unrelated algorithmic paradigms isquite surprising, as the two paradigms we study are seemingly orthogonaland incompatible. Parallel computation is inherently off-line, and on-linecomputation inherently sequential. Nevertheless, there are certain strongsimilarities; in particular, both require a loose coupling among subprob-lems. Parallel algorithms benefit greatly from locality, which can be thoughtof as a case of limited information similar to the on-line regime. On-line

Page 3: Parallel and On-Line Graph Coloring

PARALLEL AND ON-LINE COLORING 267

TABLE 1New and Known Results on Approximate Graph Coloring

On-Line

Deterministic Randomized Parallel Sequential

U 2 3Ž . w x Ž . w x Ž Ž . .Known O nrlog n 15 O nr log n 17 O n lg lg n rlog n'upperbounds

Ž . Ž .Here O nrlog n O nrlog n2 2 1ye 1yeŽ Ž .. Ž . w x Ž Ž .. Ž . w xKnown V nrlog n V nrlog n 11 V n V n 5

lowerbounds

algorithms know more about certain other subproblems, but with lesscontrol over what they learn.

2. APPROXIMATE COLORING ALGORITHMS

In this section, we present and analyze the underlying sequential,off-line coloring algorithm that forms the basis of the parallel and on-linevariants.

Let us first review what we have learned from previous methods. First,w xconsider an algorithm due to Wigderson 19 . Given a three-colorable

'graph on n vertices, we look for a vertex of degree at least n . Theneighborhood of that vertex must be two-colorable, so we color theseneighbors with two fresh new colors in linear time and remove them from

'the graph. We repeat this until maximum degree falls below n , for at' Žmost n iterations. The remaining graph can easily be colored using max

' '.degree q 1 F n colors, for a combined total of 3 n colors. This princi-ple can be generalized to graphs of larger chromatic number, where thekey observation is that the neighborhood of any node in a k-colorablegraph must be k y 1 colorable. This allows us to break the problem into acollection of somewhat easier subproblems.

The problem with this approach is that it fills the color classes insequence. We need a method that accumulates many color classes concur-rently, rather than searching for individual independent sets. We extract

w xan idea from the on-line algorithm of Vishwanathan 17 .A simple greedy algorithm, sometimes referred to as First Fit, works as

Žfollows. The vertices are processed in sequence, according to some arbi-.trary order, and each vertex is assigned to the first color to which none of

the preceding neighbors of the vertex have been assigned. If we are given a

Page 4: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´268

limited number of colors, it may not be possible to color all the vertices.The resulting coloring of a subset of the vertices is called a maximal partialcoloring of the graph.

A maximal partial coloring is an assignment of some of the nodes intofixed number of ‘‘greedy’’ color classes so that each remaining node isadjacent to some node in each greedy class. The important point is thateach color class partitions the remaining nodes into subsets of the neigh-borhoods of the nodes in the color class. If we choose a small class, theremaining uncolored nodes induce relatively few subproblems. The totalnumber of colors used is then the number of greedy color classes, plus thesum of the number of colors used in the subproblems. Such a maximalpartial coloring is easy to achieve sequentially, via the First Fit algorithm

Ž .which assigns a vertex to the first compatible color class if one exists .We state the main algorithm in Fig. 1. The algorithm finds a maximal

partial coloring, partitions the remaining nodes around the smallest colorclass, and recurses on those subproblems, with the recursion bottoming outat bipartite graphs. When the chromatic number is too large for us tohandle, with respect to the size of the graph, we settle on the trivialcoloring of one color per vertex.

THEOREM 2.1. The number of colors used by Color on k-colorableŽ . Žky2.rŽky1. Ž . ŽŽ . .graphs is at most f k ? n , where f k s 1 q O log k rk .

Ž .Proof. Let A n, k denote the maximum number of colors used byŽ .the algorithm to color any k-colorable graph on n vertices. Let f k de-

1rŽky1.ŽŽ . Ž .Žky2.rŽky1.. Ž .note 2 k y 1 r k y 2 , and let AA n, k denoteŽ . Žky2.rŽky1. Ž . Ž .f k n . Our proposition is that A n, k F AA n, k , for all positive

integers n, k, k G 2.The proof proceeds by induction on k, with the base case, k s 2,

established by an optimal bipartite algorithm. Hence, assume from here onŽ . Ž .that A n, k y 1 F AA n, k y 1 , for all positive integers n.

Ž .K-Color G, kbegin

Ž . Ž .if k F 2 BipartiteColor GŽ .else if k ) log n Assign each vertex a different color.

elseŽ . 1r Žky1.Ž Ž ..Žky2.rŽky1.s ¤ s n, k s 2 nr k y 2

Ž .ResidueNodes ¤ MaximalPartialColor G, sFind the smallest greedy color class, and let w , . . . , w be its nodes.1 pPartition the ResidueNodes into R , . . . , R such that nodes in R are adjacent to w .1 p i ifor i s 1 to p

Ž .Color R , k y 1iend

FIG. 1. An approximation algorithm for k-colorable graphs.

Page 5: Parallel and On-Line Graph Coloring

PARALLEL AND ON-LINE COLORING 269

The number of colors used by our algorithm is the number of greedyŽ .colors, s s s n, k , plus the number of colors used in the t subproblems,

Žeach on m vertices. To maintain sanity and simplicity of presentation, wej. Ž . Ž . Ž .ignore all ceilings. Note that AA n, k s k y 1 s n, k , so our main task is

to show that the number of colors used in the subproblems be at mostŽ . Ž . Ž Ž . .Žky2.rŽky1.k y 2 s n, k s 2 k y 2 n . Intuitively, we find that the worstcase occurs when the subproblems are all of equal size, and then derivethe worst-case number of subproblems.

If g is the total number of vertices in the greedy color classes, then thenumber of vertices in the smallest class, and thus the number of subprob-lems, is at most grs. By the inductive assumption, we can assume that thenumber of colors used in the subproblems is bounded by AA. Thus,

grs

A n , k F s q AA m , k y 1 .Ž . Ž .Ý jjs1

Since the approximation function is convex, the sum is maximized whenthe subproblem sizes are all equal.

g Ý mj jA n , k F s q max ? AA , k y 1 n s g q m .Ž . Ý j½ 5ž /s grsg j

Substitution and simplification give

Ž . Ž .ky3 r ky2n y gA n , k F s q max g ?Ž . ž /½ 5gg

k y 21rŽky2. y1rŽky2.? 2 ? s .Ž . Ž .ky3 r ky2k y 3Ž .

Ž . ŽŽ . .Žky3.rŽky2.The function h g s g ? n y g rg attains a maximum valuek

Ž .Žky3.rŽky2. Ž .of k y 3 nr k y 2 , conveniently simplifying the formula. Bystraightforward algebraic manipulation, we find that

1rŽky2. y1rŽky2.A n , k F s q 2 n ? s s AA n , k .Ž . Ž .

Our algorithm assumes that the chromatic number of the graph is givenas input. To circumvent that, we can run the algorithm for all naturalnumbers less than n, and retain the best result. A more efficient binary

Ž .search approach adds only a log k s O log log n factor to the time com-w xplexity. Start with the range 0, n , as the algorithm is guaranteed to fail for

k s 0 and succeed for k s n, and run the algorithm for the midvalue ofthe interval. If it succeeds, run it on the lower half; if it fails, run it on the

Page 6: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´270

upper half. At the end we have determined a value k for which the0algorithm succeeds while failing for k y 1. Then k must be a lower0 0bound on the chromatic number of the graph, and our performance noworse than if this was given.

Ž .COROLLARY 2.2. The performance ratio of Color is O nrlog n .

Proof. The ratio of the size of the approximation to the chromaticŽ Ž xy2.rŽ xy1. .number x of the graph is O n rx , which is maximized when

x f log n.

3. PARALLEL COLORING ALGORITHM

In this section we discuss how to parallelize the steps of the precedingcoloring algorithm, while maintaining an identical performance.

The main algorithm can be parallelized easily by executing the loopiterations in parallel. The bipartite graphs can be colored exactly byfinding a forest of rooted spanning trees using the Euler tour techniqueŽ w x.see 13 , computing the depth of each node using list ranking, andassigning nodes of odd depth one color and nodes of even depth the othercolor.

The hard part is finding a maximal partial coloring. A construction ofw xLuby 16 reduces it to the maximal independent set problem which has

Ž .known NC solutions. see Fig. 2 .We create a new graph GX that consists of copies of the original graph,

with vertices in different copies adjacent iff they correspond to the sameoriginal vertex. Consider a maximal independent set I in GX, and let C bei

Ž .MaximalPartialColor G, xbegin

Construct graph GX on n ? x vertices:Ž X . � j Ž . 4V G s ¨ : ¨ g V G , j s 1, . . . , ni iŽ X . �Ž j z . Ž Ž . Ž ..4E G s ¨ , ¨ : i s s k j s z n ¨ , ¨ g E Gi j i y

Ž X .I ¤ MIS G .C ¤ I l Gi, i s 1, . . . , xiResiduenodes ¤ G y Dx Cis1 i

� 4return C , ResidueNodesiend

FIG. 2. Maximal partial coloring algorithm in parallel.

Page 7: Parallel and On-Line Graph Coloring

PARALLEL AND ON-LINE COLORING 271

the set of vertices in I belonging to the ith copy of G in GX. Note that notwo vertices in I correspond to the same vertex in G; thus I and C mapi

X X Ž . Xone-to-one to subsets I and C of V. Moreover, each vertex in V G y Iiis adjacent to some vertex in each CX, as otherwise its addition to I wouldistill be independent. Hence, the CX form a maximal partial coloring of G.i

The complexity of the maximal partial coloring algorithm is dominatedby the complexity of the maximal independent set algorithm used. The

Ž 2 < <.faster algorithm known for the latter problem runs in O log V time, duew x w xto Luby 16 . A processor-efficient algorithm of Goldberg and Spencer 7Ž 3 < <. Ž < < < <. < <runs in O log V time with V q E rlog V processors. The number of

X Ž . Ž Žvertices of the composed graph G is s ? n, where s s s n, k s nr k y..Žky2.rŽky1.2 is the number of greedy bins allocated. The number of edges

s< < Ž . Ž < < .is then s E q n - s E q ns , and thus the processor complexity of our2

Ž < < . 3algorithm would be s E q ns rlog n - n .The complexity of the main algorithm is also dominated by k recursion

levels of calls to the maximal partial coloring subroutine, adding a factor ofŽ .k s O log n to the time complexity.

4. ON-LINE COLORING ALGORITHM

We show in this section how to convert Color into an on-line algorithm.The on-line coloring problem is defined as follows. An adversary selects

a graph and an ordering of the vertices. It feeds us one node at a timealong with its edges to the nodes already received. We are to irrevocablyassign that node a color consistent with the colors of the previous nodes.We are allowed arbitrary amount of time but we are not given any furtherinformation about the graph, including its size and chromatic number.

In order to deter the adversary from foreseeing our every move, ran-domization frequently proves useful. An adversary is said to be obli ious if

Žit picks the graph and the ordering before we make any choices i.e..without knowledge of the values of the random bits , rather than construct-

ing the graph adaptively according to our choices. We measure theexpected number of colors used by a randomized algorithm on a givengraph, where the exepectation ranges over the values of the random bits.The performance ratio is then defined as the ratio of this expectation tothe chromatic number, maximized over all graphs.

For some on-line problems, randomized algorithm against adaptiveadversary form an intermediate model between the deterministic and therandomized oblivious cases. For the graph coloring problem, however, noresults are known that are specific to this model.

Page 8: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´272

In order to convert the off-line algorithm into an on-line one, severalchanges need to be made and hurdles to be overcome. The greatest changeis that we must process the nodes fully in sequence, rather than processingthe chromatic levels in sequence. We must also overcome three difficul-ties: the size of partitioning classes will not be known before they must bechosen, the size of the input will not be known, and the chromatic numberwill be unknown.

The first hurdle is that a partitioning class must be selected in advance,before we know its eventual size. The concern is that if the size will belarge, many subproblems will be spanned. The solution is to use random-ization: pick a uniformly random class as a partitioning class. Since theadversary must choose the ordering of the graph in advance, the expectednumber of nodes in the class will be sufficiently small.

The second problem is estimating the size of the input, and recursively,the sizes of the subproblems. For this we apply a well known trick in the

Ž w x.on-line trade see, e.g., 15 , the doubling strategy, which works as follows.Assume, to begin with, that the size of the input, n, equals 2 i, for i initiallyequal 0. When the actual number of nodes exceeds this estimate, weincrement the estimate to the next power of 2, retire the old color classesand start afresh with a new set of color classes. We continue this way andwhen the input finally ends our estimate of n is never off by more than afactor of 2. Since the function giving our approximation performance isnecessarily convex, it follows that the overhead caused by this strategy isno more than a small constant.

It is important to notice that we can apply the same strategy recursivelyfor the subproblems as well. From the perspective of an on-line algorithm,

Žthe subgraph induced by the nodes in a residue class i.e., in a ‘‘subprob-.lem’’ is structurally no different from the original problem, except for the

fact that the chromatic number is one less. We shall therefore allocate setsof color classes to this subproblem completely independent of the othersubproblems or the parent problem. This strategy is what primarily distin-guishes our algorithm from Vishwanathan’s.

The third problem}not knowing the chromatic number in advance}canbe handled similarly. To begin with, we assume the graph is 2-colorable,and as our assumptions are shattered, usually by the bipartite algorithmstumbling upon a nonbipartite subgraph, we increment our estimate byone, and start from scratch with a fresh set of colors.

Finally, we need to find on-line versions of the subroutines called byw xalgorithm K-COLOR. As stated in 15 , there is a simple algorithm for

on-line coloring bipartite graphs using no more than 2 log n colors. And aFirst-Fit algorithm that is restricted to using only the greedy color classesactually available is perfect for performing a maximal partial coloring.

The resulting algorithm is shown in Figs. 3]5.

Page 9: Parallel and On-Line Graph Coloring

PARALLEL AND ON-LINE COLORING 273

Ž .On-line-Color G{ 4On-line color a graph Gbegin

k ¤ 2Ž .Root ¤ New-Coloring-Tree 2, k

Ž Ž ..foreach ¨ g V G in sequence doŽ .Result ¤ K-Color-Online Root, ¨

Ž .if Result s Failure thenk ¤ k q 1

Ž .Root ¤ New-Coloring-Tree 2, kend

FIG. 3. On-line graph coloring algorithm.

The on-line algorithm colors the graph by constructing and maintaininga coloring tree. This tree contains each previous vertex in a greedy colorclass at some node in the tree. Each node in the tree contains thefollowing static1 information: n, the capacity of the subtree; k, the col-

Ž .orability of the subtree; s s s n, k , the number of greedy bins; and part,the index of the partitioning bin. Each node also contains the following

w xvariables: N, the current number of vertices in the subtree; P 1 . . . s , the

1 Static in the sense that the values are given at the creation of the subtree rooted by thenode.

Ž .K-Color-Online T , ¨� 4Re-entrant procedure.� 4Assign a color to the vertex ¨ using coloring tree T.� 4Return success or failurebegin

with T doŽ .if k F 2 then

Ž Ž ..return BipartiteColor T , ¨Ž .if N G n then

Ž .T ¤ New-Coloring-Tree 2n, kN ¤ N q 1for j ¤ 1 to s do

Ž w x.if ¨ is non-adjacent to all vertices in P j thenw x Ž w x w x.Assign ¨ the color P j or COLOR ¨ ¤ P j

Ž .return Success� 4¨ must now be adjacent to some node in each color class

w xNon-deterministically choose a neighbor w of ¨ in partitioning class P partŽ w x )if R w is uninitialized then

w x Ž .R w ¤ New-Coloring-Tree 1, k y 1Ž Ž w x ..return K-Color-Online R w , ¨

end

FIG. 4. A randomized on-line coloring algorithm.

Page 10: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´274

Ž .New-Coloring-Tree n , k0 0� 4Create and return a new coloring tree with capacity n and chomatic upper bound kbegin

with T don ¤ n0k ¤ k0

Ž . Ž c Ž ..Žky2.rŽky1.s ¤ s n, k s 2 nr k y 2w xP 1, . . . , s ¤ A new set of colors

part ¤ Random integer between 1 and sN ¤ 0

return Tend

FIG. 5. Create and initialize a new coloring tree.

Ž .greedy bins the bins themselves are static; their contents are dynamic ;and R , a residue tree for each vertex assigned to the partitioning binw

w xP part . Finally, each node implicitly contains a host of cut-off subtrees.Here, c is a constant, whose optimal value is determined in the analysis.When a vertex ¨ arrives, the algorithm will assign it to one of the static

greedy bins at the root whenever possible. If this fails, we choose anyw xneighbor w of ¨ in the partitioning bin P part . The vertex is then sent

w x Žrecursively to the subproblem corresponding to the subtree R w which is.constructed if necessary . This continues until the colorability index of the

tree is at most 2, in which case we know how to on-line color the nodeefficiently.

Two invariants must be maintained in each subtree of the coloring tree:

1. N F n. That is, the number of vertices in the subtree at any timecannot exceed the capacity of the subtree.

2. The colorability index for the subtree rooted at node ¨ must be atleast one greater than the colorability index for the subtree rooted at somechild of ¨ . This ensures that the colorability index stays an upper bound onthe chromatic number of the graph.

The former invariant is maintained by K-Color-Online by creating a newsubtree with double the capacity, whenever the vertex count exceeds

Ž .capacity. The old greedy bins color classes are then set aside and neverused again, and the vertices they contain do not factor into the coloringassignment other than that their number is still a part of the content of thesubtree.

The latter invariant is maintained by On-line-Color, again by cutting offthe old tree and creating a new tree with a colorability index one larger.Such an action is triggered by the failure of the on-line bipartite coloring

Page 11: Parallel and On-Line Graph Coloring

PARALLEL AND ON-LINE COLORING 275

algorithm at some leaf, when some leaf becomes three-chromatic, and theeffect filters up the path to the root.

4.1. Analysis

The analysis of the performance of the on-line algorithm resembles thatof the parallel approximation, but is more involved. The heart of theanalysis is contained in the following result.

Ž Žky2.rŽky1.Ž .1rŽky1..THEOREM 4.1. K-Color-Online uses at most O n log nexpected number of colors on k-colorable graphs with n ¨ertices.

Ž .Proof. Let us first define some notation. Let A n, k denote themaximum expected number of colors the algorithm uses to color any

Ž .k-colorable graph on n vertices, when n is known in advance. Let B n, ksimilarly be the maximum expected number of colors when n is not knownin advance. Let c denote a real-valued constant to be defined later. Weshall need the following functions and constants:

Ž . Ž .ky2 r ky1c2c sk ž /k y 2

Ž .1r ky1Žky2.rŽky1.s n , k s c ? n log nŽ . Ž .k

AA n , k s k y 1 s n , kŽ . Ž . Ž .BB n , k s 2 crŽky1.AA n , k .Ž . Ž .

Ž . Ž .BB n, k is the upper bound that we shall prove for B n, k , and similarlyŽ . Ž . Ž .AA n, k is the bound for A n, k . s n, k denotes the number of greedy

bins allocated, as previously defined. Default logarithm is base 2.Given the above notation, the proposition of the theorem can be

restated as

B n , k F BB n , k , for all n , k , k G 2.Ž . Ž .

The proof proceeds by induction on k simultaneously for A and B. ForŽ . Ž . Ž .the base case, observe that B n, 2 s A n, 2 F 2 log n s AA n, 2 s

Ž . Ž . Ž .BB n, 2 . To prove the inductive step, we first show that A n, k F AA n, k ,for any positive integer n.

Ž .The number A n, k of bins used during the time that the size estimaten remains unchanged, equals the number of greedy bins plus at most the

Page 12: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´276

average cost of the subproblems over the s different choices of a partition-ing bin. The latter amounts to at most

ns i1Ž i.B m , k y 1 , 1Ž .Ž .Ý Ý js is1 js1

where n is the number of elements in greedy bin i and mŽ i. the number ofi jresidue nodes induced by the jth node in bin i. Let g denote the totalnumber of elements placed in greedy bins. By the inductive assumption

Ž .and the convexity of BB, 1 is at most

1 n y gmax g ? BB s ? , k y 1 .½ 5ž /s gg

We now plug in the value of BB, obtaining

Ž . Ž .ky3 r ky2n y gmax g ? ? c ? k y 2Ž .ky1ž /½ 5gg

Ž . Ž .1r ky2 1r ky2c? 2 rs ? log n .Ž . Ž .

As in Theorem 1, the maximum of the inner function simplifies theformula, leading to

A n , k F s q k y 2 ? s n , k s AA n , k .Ž . Ž . Ž . Ž .

Ž . Ž .Hence, A n, k F AA n, k , for any n. We now show that this implies thatthe same holds for B and BB, from which the theorem follows.

In general, we do not know the number of nodes in advance, at any levelin the recursion. The algorithm fixes a value for n, and when that counthas been exceeded, it doubles its expectation for the total number of

u vvertices. We obtain d s log n subproblems, coloring the nodes� 4 � 4 � dy2 dy1 4 � dy1 41 , 2, 3 , . . . , 2 , . . . , 2 y 1 , 2 , . . . , n , respectively. Let rn de-note the total number of nodes colored by the end of the last doublingstep, i.e., rn s 2 dy1.

The total number of bins used is at most the sum of the bins used oneach of the size-bounded subproblems, the residue bins used on the lastŽ .1 y r n nodes, and the greedy bins allocated in the last step. That is,

dy1 rn 1B n , k F AA , k q AA 1 y r n , k q AA n , k .Ž . Ž . Ž .Ž .Ý iž / k y 12is1

Page 13: Parallel and On-Line Graph Coloring

PARALLEL AND ON-LINE COLORING 277

The first term evaluates to

dy1yi Žky2.rŽky1. Žky2.rŽky1.AA rn , k 2 F AA rn , k r 2 y 1 .Ž . Ž . Ž .Ý

is1

Maximizing the first two terms over the choices for r using standardcalculus yields

Ž .1r ky1 1Ž .y ky1Žky1.rŽky2.B n , k F 1 q 2 y 1 q AA n , k .Ž . Ž . Ž .ž / k y 1

Inspection shows that this is at most

B n , k F 23.77rŽky1.AA n , k .Ž . Ž .

Thus we set c s 3.77, and the theorem follows.

Ž Ž xy2.rŽ xy1.THEOREM 4.2. Our on-line algorithm uses at most O nŽ .1rŽ xy1..log n colors, without a priori knowledge of either n or the chromatic

Ž .number x G .

Proof. We maintain a lower bounded estimate k on the chromaticnumber of the graph. This estimate is incremented only when the currentgraph has been proven to be non-k-colorable. Consider the nodes coloredwhile the estimate was i. If we denote their count by N , we know thati

Ž .On-line-Color used no more than BB N , i colors to color those nodes.iŽ .This can be bounded from above by BB N , k , which is a convex function.i

Thus the sum of these values, i s 2, . . . , k, is maximized when all N areiequal, for a total number of colors.

n Ž .1r ky1k y 1 BB , k F k y 1 BB n , kŽ . Ž . Ž .ž /k y 1Ž .1r ky1Žky2.rŽky1.F 39n log n .Ž .

We obtain the same performance ratio as in the off-line case, with asimilar proof.

Ž .COROLLARY 4.3. Randomizing on-line coloring is O nrlog n approx-imable.

5. INDEPENDENT SETS IN PARALLEL

The parallel coloring algorithm can also be used to find cliques orw xindependent sets in parallel, via an observation due to Wigderson 18 .

Recall that the algorithm used at most nŽky2.rŽky1. colors, where the graph

Page 14: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´278

was provably not k y 1 colorable since a k-chromatic subgraph had beenfound. This subgraph is formed by the pivot nodes w at each of the k y 2i

Ž .recursive levels, along with a nonbipartite subgraph i.e., an odd cycle atthe end of the recursion. These pivot nodes are, by definition, mutuallyadjacent, as well as adjacent to the odd cycle, thus producing a k-clique.Since the clique number of the graph is at most the chromatic number,which is at most the number of colors we used, this yields a nŽky2.rŽky1.rk

Ž .approximation of the maximum clique, for an O nrlog n performanceratio. Finally, recall that we can obtain an independent set algorithm withthe same performance by applying our algorithm to the complement graph.Notice that the algorithm runs in polylogarithmic time, for all ‘‘interesting’’

Ž 2 .values of k i.e., k F log n .Another source of a parallel independent set algorithm can be found in

w xthe first step of Berger and Rompel’s 2 coloring algorithm. It essentiallyinvolves choosing polynomial number of random vertex subsets of sizelog n and testing for nonadjacency. This can be made deterministic via thekpigeonhole principle without destroying the independence of the samples,and hence can be parallelized trivially. This method yields an nrlog nkapproximation.

Notice that the two methods complement each other, since ourrWigder-son’s method performs best for small values of k, while the above randomsampling performs relatively better for larger values of k. If we run bothmethods and retain the better result, we get an algorithm with a perfor-mance ratio of

nŽky2.rŽky1. nmax min ,ž /k log nk k

Ž Ž .2 .which is minimized when k s log nr2 log log n as O n log log nrlog n .

5.1. Graphs with Large Independent Sets

We shall show how given a graph with an independence number at least'Ž . Ž .1r3 q e n, we can find an independent set of size V n in polylogarith-

mic time.The method starts by removing a maximal collection of disjoint triangles

Ž .cliques of size 3 from the graph. Such a collection can be obtained as amaximal independent set in the graph whose vertices are all the trianglesin the original graph, with edges between intersecting triangles. Since atmost one node in each triangle can be a member of a given independent

Ž .set, at least e n s V n nodes remain after the triangle removal.Given a triangle-free graph, we apply the algorithm of Fig. 6, which is

w xbased on a sequential algorithm of 3 . The algorithm finds a maximal

Page 15: Parallel and On-Line Graph Coloring

PARALLEL AND ON-LINE COLORING 279

Ž .TriangleFreeIS Gbegin

Ž . Ž .I ¤ MaximalIndependentSet G s w , w , . . . , w1 2 tŽ .N ¤ V G0

for i ¤ 1 to t do� Ž . Ž . Ž .4N ¤ N l ¨ g V G : ¨ , w f E Gi iy1 i

� Ž . Ž . Ž .4N ¤ N l ¨ g V G : ¨ , w g E Gi iy1 iŽ � 4 � 4 � 4.return max N , w j N , . . . , w , w , . . . , w j N , w , w , . . . , w1 1 2 1 2 ty1 t 1 2 t

end

FIG. 6. Algorithm for finding independent sets in triangle-free graphs.

independent set with an ordering of the vertices in the set, and finds thecommon non-neighborhoods N of any prefix of the vertices, as well as theicomplementary neighborhoods N . Each neighborhood must be indepen-ident since the graph contains no triangles, and is also contained in anearlier non-neighborhood. The final result is the largest of these indepen-dent sets considered, and its size must be at least the smallest t such that

t 'Ž . G n, or approximately 2n .2

Finding the recursive non-neighborhoods N is a prefix computation thatican be performed in logarithmic time with linear number of processors.The complexity is therefore asymptotically equivalent to that of the MISalgorithm used.

The above construction can be generalized to find independent sets ofŽ 1rŽky1..size V n in k-clique free graphs, providing a constructive parallel

w xproof of the upper bound on Ramsey numbers of Erdos and Szekeres 4 .˝That also allows us to find such independent sets in graphs with indepen-dence number greater than nrk for k ) 3, but, alas, the processorcomplexity of removing the k-cliques grows as fast as nk.

ACKNOWLEDGMENTS

I thank Ravi Boppana and Sundar Vishwanathan for helpful discussions and the twoanonymous referees for comments that improved the presentation. I also thank Sundar forreinventing Luby’s construction for me.

REFERENCES

Ž .1. D. Bean, Effective coloration, J. Symbolic Logic 41, 1976 , 469]480.2. B. Berger and J. Rompel, A better performance guarantee for approximate graph

Ž . Ž .coloring, Algorithmica 5, No. 4 1990 , 459]466.3. R. B. Boppana and M. M. Halldorsson, Approximating maximum independent sets by´

Ž . Ž .excluding subgraphs, BIT 32, No. 2 1992 , 180]196.

Page 16: Parallel and On-Line Graph Coloring

MAGNUS M. HALLDORSSON´ ´280

4. P. Erdos and G. Szekeres, A combinatorial problem in geometry, Compositio Math. 2˝Ž .1935 , 463]40.

5. U. Feige and J. Kilian, Zero knowledge and the chromatic number, in ‘‘Proceedings ofConference on Computation Complexity,’’ June 1996.

6. A. V. Goldberg, S. A. Plotkin, and G. E. Shannon, Parallel symmetry-breaking in sparseŽ . Ž .graphs, SIAM J. Discrete Math. 1, No. 4 1988 , 434]446.

7. M. Goldberg and T. Spencer, Constructing a maximal independent set in parallel, SIAMŽ . Ž .J. Discrete Math. 2, No. 3 , 1989 , 322]328.

Ž8. A. Gyarfas and J. Lehel, On-line and first fit colorings of graphs, J. Graph Theory 12, No.´ ´. Ž .2 1988 , 217]227.

Ž .9. P. Hajnal and E. Szemeredi, Brooks coloring in parallel, SIAM J. Discrete Math. 3, No. 1´Ž .1990 , 74]80.

10. M. M. Halldorsson, A still better performance guarantee for approximate graph coloring,´Ž .Inform. Process Lett. 45 1993 , 19]23.

11. M. M. Halldorsson and M. Szegedy, Lower bounds for on-line graph coloring, Theoret.´Ž .Comput. Sci. 130 1994 , 163]174.

12. J. Hastad, Clique is hard to approximate within n1y e, manuscript, 1996.˚13. R. Karp and V. Ramachandran, A survey of parallel algorithms for shared-memory

Ž .machines, In ‘‘Handbook of Theoretical Computer Science’’ J. van Leeuwen, Ed. , Vol.A, Chap. 17, pp. 869]941, Elsevier, Amsterdam, 1990.

14. H. A. Kierstead and W. T. Trotter, An extremal problem in recursive combinatorics, In‘‘Proceedings, 12th Southeastern Conference on Combinatorics, Graph Theory, and

Ž .Computing,’’ Congr. Number. 33 1981 , 143]153.15. L. Lovasz, M. Saks, and W. T. Trotter, An online graph coloring algorithm with sublinear´

Ž .performance ratio, Discrete Math. 75 1989 , 319]325.16. M. Luby, A simple parallel algorithm for the maximal independent set problem, SIAM J.

Ž .Comput. 15 1986 , 1036]1053.Ž .17. S. Vishwanathan, Randomized online graph coloring, J. Algorithms 13 1992 , 657]669.

18. A. Wigderson, personal communications.19. A. Wigderson, Improving the performance guarantee for approximate graph coloring. J.

Ž . Ž .Assoc. Comput. Mach. 30, No. 4 1983 , 729]735.


Top Related