
TL;DR
This paper presents improved sequential algorithms for edge-coloring graphs efficiently with fewer colors, including a faster deterministic method and a simpler randomized approach, advancing the state-of-the-art in edge-coloring.
Contribution
The authors develop a faster $O(|E| oot sqrt{|V|})$ algorithm for $(d+1)$-edge-coloring and introduce a simple, high-probability randomized variant, along with a new algorithm for multigraphs.
Findings
Improved runtime from $O(|E| oot sqrt{|V|} ext{ to } O(|E| oot sqrt{|V|})$ for edge-coloring.
A simple randomized algorithm with same asymptotic runtime and high probability success.
New algorithm for $(2d-1)$-edge-coloring of multigraphs with $O(|E| ext{log } d)$ time.
Abstract
We develop sequential algorithms for constructing edge-colorings of graphs and multigraphs efficiently and using few colors. Our primary focus is edge-coloring arbitrary simple graphs using colors, where is the largest vertex degree in the graph. Vizing's Theorem states that every simple graph can be edge-colored using colors. Although some graphs can be edge-colored using only colors, it is NP-hard to recognize graphs of this type [Holyer, 1981]. So using colors is a natural goal. Efficient techniques for -edge-coloring were developed by Gabow, Nishizeki, Kariv, Leven, and Terada in 1985, and independently by Arjomandi in 1982, leading to algorithms that run in time. They have remained the fastest known algorithms for this task. We improve the runtime to with a small modification and careful analysis.…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Fast and Simple Edge-Coloring Algorithms
Corwin Sinnamon Department of Computer Science, Princeton University, Princeton, NJ 08540, USA.
*Email:*[email protected]
Abstract
We develop sequential algorithms for constructing edge-colorings of graphs and multigraphs efficiently and using few colors. Our primary focus is edge-coloring arbitrary simple graphs using colors, where is the largest vertex degree in the graph. Vizing’s Theorem states that every simple graph can be edge-colored using colors. Although some graphs can be edge-colored using only colors, it is NP-hard to recognize graphs of this type [Holyer, 1981]. So using colors is a natural goal. Efficient techniques for -edge-coloring were developed by Gabow, Nishizeki, Kariv, Leven, and Terada in 1985, and independently by Arjomandi in 1982, leading to algorithms that run in time. They have remained the fastest known algorithms for this task.
We improve the runtime to with a small modification and careful analysis. We then develop a randomized version of the algorithm that is much simpler to implement and has the same asymptotic runtime, with very high probability. On the way to these results, we give a simple algorithm for -edge-coloring of multigraphs that runs in time. Underlying these algorithms is a general edge-coloring strategy which may lend itself to further applications.
1 Introduction
An edge-coloring of a graph is an assignment of colors to edges such that any two incident edges have different colors. A -edge-coloring is one that uses at most colors. Edge-coloring is a standard notion in mathematics and has been well studied in many contexts; this paper is about sequential algorithms for constructing them.
Edge-coloring graphs efficiently and in few colors is a classic problem in graph algorithms, with natural applications to various scheduling tasks, e.g. [1, 9, 21, 25]. This problem has been considered in the context of simple graphs [17, 3], multigraphs [19, 22], bipartite multigraphs [2, 12, 16], and planar graphs [10, 11], to name a few. There has also been extensive work on distributed edge-coloring algorithms, e.g. [4, 18]. Some recent work has explored dynamic edge-coloring [7, 8, 13], where the coloring must be maintained as edges are inserted and deleted. Across this area of study, there is a natural tradeoff between the number colors used and the efficiency or simplicity of the algorithm. In most cases, using more colors yields simpler, faster algorithms. In general, we prefer to use as few colors as possible.111The chromatic index of (denoted ) is the smallest. number of colors in any edge-coloring of .
Let be a simple graph having vertices and edges, and let be the maximum degree of any vertex in . Clearly, at least colors are needed to edge-color because the edges incident to any vertex must be assigned different colors. Vizing’s Theorem [24] states that is always -edge-colorable.222Note that Vizing’s theorem is only true for simple graphs; multigraphs can require up to colors [23]. This leaves a very small gap: requires either or colors. Unfortunately, distinguishing between graphs that require colors and those that require colors is NP-hard [20]. Since it seems infeasible to always use the optimal number of colors is infeasible, so we settle for .
It is then natural to aim for using colors. A 1985 technical report of Gabow, Nishizeki, Kariv, Leven, and Terada [17] presents an algorithm for edge-coloring simple graphs using colors.333See also [3] and the discussion of that work in [17]. Their algorithm runs in time. Although there has been significant progress for algorithms on some restricted graph classes (bipartite graphs, for example [12]), there have been no faster algorithms proposed to edge-color arbitrary simple graphs in colors. This paper improves the runtime to , first by a deterministic algorithm, and then by a much simpler randomized one.
Contributions
In this paper, we present three algorithms for edge-coloring graphs: Greedy-Euler-Color, Euler-Color, and Random-Euler-Color. They are founded on a general recursive strategy for edge-coloring that we lay out in detail. The strategy is a generalization of the methods used by Gabow et al. in [17], and may help in developing other edge-coloring methods.
- •
Greedy-Euler-Color finds a -edge-coloring of a multigraph in time. It is simple and efficient, and perhaps the most natural possible application of our strategy. Note that time for -edge-coloring can be achieved using a known dynamic edge-coloring algorithm [7].
- •
Euler-Color is an algorithm that uses colors and runs in time, improving on the result of [17]. Surprisingly, this is achieved with one subtle change to the algorithm of [17] and some additional analysis which removes a factor of from the runtime.
- •
Random-Euler-Color is a much simpler randomized version of Euler-Color that uses colors and runs in time with probability .
We consider Random-Euler-Color the primary contribution of this paper, due to its efficiency and simplicity. To approach the same runtime, both Euler-Color and the algorithm of [17] rely on a complex subroutine (Color-Many in this paper and Parallel-Color in [17]). Random-Euler-Color avoids that type of procedure using randomness, and runs just as quickly with very high probability.
We also present three coloring subroutines: Color-One, Random-Color-One, and Color-Many. They are needed by Euler-Color and Random-Euler-Color.
The paper is organized as follows. Section 2 presents the edge-coloring strategy. Sections 3, 4, and 5 introduce the three main algorithms of this paper and analyze them. The rest of the paper tackles the subroutines. Section 6 introduces the necessary definitions, Section 7 presents Color-One, Section 8 presents Random-Color-One, and Section 9 presents Color-Many.
2 Edge-coloring with Recursion
In this section, we present our edge-coloring strategy, setting the stage for the main algorithms of this paper. It can be approached with little preliminary discussion.
2.1 Preliminaries
Let be a undirected multigraph with vertices, edges, and maximum degree (that is, ). As shorthand, we shall write or to denote the edge . We assume without loss of generality that has no isolated vertices (vertices with no incident edges), and so .444Isolated nodes are irrelevant to edge-coloring, so this is fair assumption.
Assume we maintain a partial edge-coloring of . An edge is colored if it is assigned a color in the edge-coloring and otherwise it is uncolored. Let denote the number of uncolored edges in . We say a color is missing at vertex if no edge incident to is colored by . Let be the set of colors missing at .
2.2 Strategy
All of the algorithms in this paper employ the same strategy that we now describe. It is a generalization of a recursive method originally applied to bipartite graphs in [15] and later adapted to general graphs [17, 3]. The strategy can be applied to both simple graphs and multigraphs.
The strategy uses a recursive divide-and-conquer approach. It splits the original graph into two edge-disjoint subgraphs, recursively produces an edge-coloring of each one, and then stitches together the colorings at a reduced cost. The parameter (the maximum degree of a vertex in the graph) is important: The subgraphs will have maximum degree roughly half that of the original graph, and consequently they can be edge-colored more efficiently and with fewer colors.
The strategy is flexible in the number of colors that can be used to edge-color the graph (the available colors). Let be the number of available colors. This paper will only study and , and in particular we treat as a function of , but in principle could be any function of the graph.
The strategy works in four steps: Partition, Recurse, Prune, and Repair. The only freedom lies in the Repair step; the other three steps will be the same in all of our algorithms.
Partition.
Partition the edges of the graph into two edge-disjoint subgraphs so that each subgraph has half of the edges () and the maximum degree of each subgraph is at most half the maximum degree of the original graph (). This can be done in time by the method in Section 2.3.
Recurse.
Recurse to edge-color each subgraph using colors. We require that the two edge-colorings use different sets of colors; if necessary, relabel one of the edge-colorings so that no color is used in both subgraphs.
Combine the edge-colorings by taking their union. As the subgraphs are edge-disjoint and their edge-colorings use disjoint color sets, the union is an edge-coloring of the original graph.
Prune.
At this point, the edge-coloring uses up to colors, which may be more than the allowed colors. (For example, if , the current coloring may use up to colors.) We must eliminate these extra colors.
Let be number of extra colors. Choose the least common colors and uncolor all edges with those colors. Now only colors are used, and the number of uncolored edges is at most .
Repair.
To complete the coloring, we must somehow assign colors to those few uncolored edges without using more than the available colors. There is no prescribed way to do this step. We will use the subroutines mentioned at the start of this section for this purpose.
Finally, if then edge-color the graph using a single color. This serves as the base case of the recursion. The template for this strategy is presented below in pseudocode.
1:procedure Euler-Template()
2:Base Case:
3: If , color every edge by the same color and return
4:Partition
5: Decompose into subgraphs and
6:Recurse
7: {Recursively edge-color and using different sets of colors}
8: Euler-Template
9: Euler-Template
10: { is edge-colored by colors}
11:Prune
12: while more than colors are used do
13: Choose the least common color
14: Uncolor all edges colored by
15: {At most colors are used now and }
16:Repair
17: {Somehow color all the uncolored edges using colors}
18:
Now that the strategy is stated, the Repair step will be the only interesting component of our algorithms. The other steps will not change. As long as the Repair step stays within colors and colors all the uncolored edges, the procedure must output a complete edge-coloring.
The potential of this strategy lies in the fact that only a small number of uncolored edges need to be colored at each step, and so much of the actual work of edge-coloring is done on small graphs with few edges and low maximum degree. Our Repair steps run much faster on these graphs. The efficiency of the Repair step will determine the efficiency of the whole algorithm, since the other non-recursive work done in each iteration can be executed in time.
2.3 Euler Partitions
Before we proceed, let us summarize how a multigraph can be split into two edge-disjoint subgraphs as needed by the Partition step.
An Euler partition is a partition of the edges of a multigraph into a set of edge-disjoint tours555A tour is a walk that does not repeat an edge. such that every odd-degree vertex is the endpoint of exactly one tour, and no even-degree vertex is an endpoint of a tour. Such a partition can be found greedily in time, simply by removing maximal tours of the graph until no edges remain. The edges of the graph can then be split between the subgraphs by traversing each tour and alternately assigning the edges to the two subgraphs. This yields two subgraphs, each having half of the edges (either or ) and maximum degree at most . The entire procedure takes time.
3 Greedy-Euler-Color
Our first application of the strategy is a very simple algorithm that edge-colors a multigraph in colors in time. We state the Repair step; the other steps are unchanged from the template.
The Repair step uses the local coloring routine Greedy-Color, which takes as input an uncolored edge and colors it. Greedy-Color simply checks each of the available colors to find one that is missing at both or . Such a color must exist by pigeonhole principle: There are at least missing colors at each endpoint and colors in total. It colors by that color. The result is a legal partial edge-coloring, i.e. no color is reused at any vertex. This takes time in the worst case.
Greedy-Color is stated here in pseudocode. Recall that is the set of colors missing at vertex .
1:procedure Greedy-Color()
2: for each color do
3: if and then
4: Color by
5: return
The Repair step just applies Greedy-Color to every uncolored edge. The result is a -edge-coloring.
Theorem 1**.**
Greedy-Euler-Color* edge-colors by colors in time.*
The proof is straightforward: The Repair step takes time, and is roughly halved with each recursive call. This yields a recursion tree of depth , where the total work done at each level in the tree is . The details are left as an exercise.
4 Euler-Color
Assume henceforth that is simple. Euler-Color builds a -edge-coloring of in time. Here the Repair step will use a combination of the subroutines Color-One and Color-Many. Both subroutines increase the number of colored edges in a given partial edge-coloring (without using more than colors). They are presented in Sections 7 and 9, respectively.
- •
Color-One colors a given uncolored edge in time.
- •
Color-Many colors of the uncolored edges in time. (Recall that denotes the number of uncolored edges in the graph.)
Notice that Color-Many takes amortized time for each edge it colors. Thus, as long as , Color-Many is more efficient than Color-One in terms of the cost per edge colored. This observation suggests the following Repair step: Use Color-Many while , and then switch to Color-One for the remainder.
1:Repair (Euler-Color)
2: {At most colors are used and }
3:while do
4: Color-Many
5:while do
6: Choose an uncolored edge
7: Color-One
As discussed in the introduction, Euler-Color arises as a small modification to the algorithm of the same name in [17] that runs in time. So what is the difference between this procedure and the original Euler-Color of [17]? They use a similar recursive strategy and two subroutines similar to ours: Recolor (analogous to Color-One) and Parallel-Color (analogous to Color-Many). We prefer our versions of the subroutines, but we could use Recolor and Parallel-Color instead. The only significant difference is that Parallel-Color is not integrated into the recursive strategy. Their Repair step applies Recolor to all uncolored edges. When gets sufficiently small (), the recursive strategy is abandoned and the graph is edge-colored using only Parallel-Color. This difference increases the runtime slightly to . We bring Color-Many into the Repair step to further exploit the tradeoff between these two subroutines, yielding the improved time.
We now analyze the complexity of Euler-Color.
Theorem 2**.**
Euler-Color* edge-colors a simple graph using colors in time.*
Proof.
The correctness of Euler-Color is clear from the strategy, for the Repair step does not terminate until the graph is completely colored and it cannot use more than colors during that step.
Let us analyze the runtime. At the start of the Repair step, there are at most uncolored edges. The Repair step behaves differently depending on whether is much larger or smaller than .
If , then Color-Many is run until the number of uncolored edges is reduced from to . Let us bound the number of repetitions: A constant number of applications of Color-Many decreases by a factor of . Since ,
[TABLE]
Thus it requires repetitions, where each repetition takes time. Afterwards it colors the remaining edges in time using Color-One. Hence the Repair step takes time.
If , then Color-Many is not run at all since . In this case, the Repair step takes time.
Now consider the recursion tree for Euler-Color(). This is a binary tree whose root corresponds to , and the two children of the root correspond to the subgraphs and constructed during the Partition step on . The children of the nodes for and are defined recursively. A leaf corresponds to a subgraph of maximum degree 1. Identify each node with its corresponding subgraph. For a subgraph , let and respectively denote the number of edges and maximum degree of . Every subgraph contains nodes.
Define the cost of to be
[TABLE]
This cost captures (up to a constant) all the time spent on the subgraph , according to our earlier analysis. Thus, the total time for Euler-Color is proportional to the sum of costs of all subgraphs in the recursion tree.
Consider the sum of costs over high-degree subgraphs: the subgraphs with . (We can assume here that , for otherwise there would be no high-degree subgraphs.) These subgraphs have depth at most , since the vertex degrees roughly halve between a subgraph and its child. Moreover, the subgraphs at a given depth partition the edges of , so the sum of their edge counts is exactly . Hence, the total cost of all high-degree subgraphs is at most
[TABLE]
Now consider the total cost of the remaining low-degree subgraphs, which have . Fix such a subgraph , and let and be its children. Observe that
[TABLE]
That is, the cost shrinks by a factor of 4, roughly, from a parent to its child. Even though it does not shrink by a factor of 4 exactly, it is not hard to show that it shrinks by at least a factor of 3, for sufficiently large . Hence, cost decreases geometrically with depth, shrinking by a factor of at least 3 at each level (except possibly near the bottom of the tree, vertex degrees are less than some constant).
Why does this matter? Each subgraph has 2 children, 4 grandchildren, 8 great-grandchildren, etc. So has descendants at a depth levels lower than . But the cost of each descendant is at most . Hence the combined cost of the descendants of decreases as a geometric series: .666A constant number of levels near the bottom of the tree (for which the value is constant) may not follow this geometric trend, but their total cost is negligible.
Therefore, the cost of all low-degree subgraphs is only a constant factor larger than the cost of the “maximal” low-degree subgraphs (those whose parents are high-degree).
In the case that , there are multiple maximal subgraphs, and partition the edges of . Moreover, each maximal subgraph has . Hence, their combined cost is at most .
If , is the only such maximal subgraph, and so the total cost is . Observe that for all . Hence the total cost is . ∎
The trouble with Euler-Color is that Color-Many is complicated, much more so than the rest of the algorithm. Thankfully we can simplify enormously by injecting a little randomness.
5 Random-Euler-Color
We now present Random-Euler-Color, a randomized version of Euler-Color. It also uses colors and runs in time with high probability.
We use a subroutine Random-Color-One, a randomized extension to Color-One, that is presented in Section 8.777 Random-Color-One essentially applies Color-One to an uncolored edge chosen uniformly at random. It also chooses one other variable (internal to Color-One) uniformly at random. These small changes are enough to improve the expected run time.
- •
Random-Color-One colors an uncolored edge in expected time, or time in the worst case.
Notice that the expected time matches the amortized time-per-edge-colored that Color-Many achieves. It also has the same worst-case time bound of Color-One, meaning that Random-Color-One is an effective drop-in replacement for both Color-One and Color-Many.
The Repair step just applies Random-Color-One until the edge-coloring is complete.
1:Repair (Random-Euler-Color)
2: {At most colors are used and }
3:while do
4: Random-Color-One
Now we analyze the expected runtime — but the hard work has already been done! The Repair step of Euler-Color used a combination of Color-One and Color-Many to color the uncolored edges. We notice that Random-Color-One performs as well in expectation as either subroutine. Hence, the Repair step of Random-Euler-Color can be no slower than that of Euler-Color. Indeed, direct analysis of the Repair step leads to the same cost function that appeared in our analysis of Euler-Color:
[TABLE]
By Theorem 2, we obtain a tight bound on the expected runtime of Random-Euler-Color.
Lemma 3**.**
Random-Euler-Color* edge-colors a simple graph by colors in expected time.*
Now that we have established the expected time, we can go further. In fact, time is achieved except with exponentially small probability, and we can show this much stronger claim with a little work.
Theorem 4**.**
Random-Euler-Color* runs in time with probability .*
Proof.
Let be the combined runtime of all calls to Random-Color-One during an execution of Random-Euler-Color on . All other operations in Random-Euler-Color are deterministic and run in time, so it suffices to study .
Random-Color-One is applied many times during Random-Euler-Color to many partially edge-colored subgraphs of . Call them , where has edges, maximum degree , and uncolored edges. Note that these are not random variables. The graphs are determined uniquely by the input graph because the Partition step is deterministic and depends only on the structure of the graph. Although the partial edge-colorings are randomly altered by Random-Color-One, the values of , , and are predictable.
Let be a random variable for the runtime of Random-Color-One on . Since the are deterministically chosen, the are independent. Then . Lemma 3 states that , for a sufficiently large constant .
Recall that Random-Color-One takes time in the worst case, and so (we reuse the constant here, without loss of generality). Hence for . By independence, we have
[TABLE]
We now use the following bound of Bernstein, proved in [6] and communicated in [5].
Theorem** (Bernstein [6]).**
Let be independent random variables, let , and let . Suppose that for all . Then, for ,
[TABLE]
Apply this theorem to . Here and , and we set . We have . Hence,
[TABLE]
The last inequality holds because , by the assumption that there are no isolated nodes in any subgraph. Thus, the runtime of Random-Euler-Color is except with probability . ∎
In light of its strongly concentrated runtime and the simplicity of Color-One compared to Color-Many, Random-Euler-Color is preferable to Euler-Color in almost any context.
This concludes our study of the three major algorithms of this paper. It remains to present the subroutines used by Euler-Color and Random-Euler-Color.
6 Colors, Fans, and Paths
The rest of the paper is devoted to presenting the subroutines Color-One, Color-Many, and Random-Color-One that are used in Sections 4 and 5. This section provides some terminology and tools that we will need to describe them, including the data structures underlying our implementations.
6.1 Colors
Since the remainder of this paper is concerned with edge-coloring in colors, we shall assume the available colors are . We also restrict ourselves to simple graphs.
Let be a simple undirected graph with maximum degree . Let c\colon E\mathrel{\ooalign{\hfil\mapstochar\to\cr}}[d+1] be a partial edge-coloring of . An edge is said to be colored if is defined and uncolored otherwise. Recall that a color is said to be missing at vertex if no edge incident to is colored by . Define M(v)=\{\alpha\in[d+1]\mid\text{\alphav}\} and . Observe that is always nonempty as has at most neighbours and there are colors to choose from.
6.2 Fans
Our subroutines will use a construction called a c-fan (sometimes called a Vizing fan), illustrated in Figure 1.
Definition 5**.**
A c-fan is a sequence such that
- •
* is a color in ,*
- •
* are distinct neighbours of ,*
- •
* is uncolored,*
- •
* is colored for , and*
- •
* is missing at for .*
Vertex is called the center of , and is said to be centered at . The other vertices () are called the leaves of .
The useful property of a c-fan is that we may “rotate” the colors of the fan without making the edge-coloring invalid. Let be a c-fan with for , and let . To shift from means to set for , and to make uncolored. Since is required to be missing at , the function is still a partial edge-coloring after a shift. Note that is unchanged and that is a c-fan after the shift. Shifting a c-fan is shown in Figure 2.
Let us extend the definition of a c-fan by adding a parameter . Intuitively, a c-fan is primed by once it is complete and does not need to be made larger. A primed c-fan is exactly what we need to grow the edge-coloring, as we will see in the next sections.
Definition 6**.**
A primed c-fan is a c-fan with an extra parameter . The color must satisfy one of the following conditions:
* and , or* 2. 2.
* and there is a leaf such that .*
Setting is called priming , and we say is primed by .
6.3 Alternating Paths
We require one more tool to describe our algorithms. For any two colors and , restricting to the edges colored by or yields a subgraph of in which every component is either a path or an even-length cycle. We call each component an -path or an -cycle, as appropriate. We shall not require that and be distinct, and an -path may consist of a single vertex. An -path may also be called an alternating path when and are not specified.
To flip an alternating path means to interchange the colors of its edges. Any alternating path can be flipped in a partially edge-colored graph and the resulting assignment of colors will still be a partial edge-coloring.
Using the data structures in the next section, an alternating path can be flipped in time proportional to its length.
6.4 Data Structures
Our algorithms use the following elementary data structures. Here we diverge from [17] by introducing a dictionary data structure that simplifies our subroutines. See Appendix A for further discussion of this structure.
- •
We represent by storing for each vertex a list of its incident edges. Each edge has a color field to track its color, if any.
- •
We keep a data structure that stores colors missing at each vertex . However, will not store all the colors in , as that could require too much time and space to initialize. Instead contains only the colors in . There must always be some color in because is always nonempty.
We implement as a doubly-linked list containing those colors in together with an array of length . The array contains pointers to the nodes that can be in the list. We can maintain with constant overhead: Every time an edge incident to is colored by , find the list node for (using the array) and remove it from the list. Every time an edge incident to with a color in is uncolored, append the node for that color to the linked list. We can initialize in time.
- •
We also use a dictionary data structure that maps a vertex-color pair to the edge incident to colored by , if there is such an edge. It supports three operations that each take constant time: Search, Insert, and Delete.
can be initialized in time, which is no more than . Our implementation of is unusual because it must achieve this low initialization cost, but it operates by elementary methods. In Appendix A, we describe the implementation of and how to integrate into the recursive algorithms of Section 2. The latter topic merits discussion because can only be initialized once, yet it must work for all the subgraphs in the recursion.
A data structure like was not present in [17]. It allows us to speed up or simplify all of our subroutines, and it is not known how to make a procedure like Random-Color-One function without such a data structure.
In summary, our data structures permit the following operations in constant time for any vertex and color : check whether ; get a color in ; color an edge; uncolor an edge; find the edge incident to colored by . As a corollary, we are able to shift a c-fan in time proportional to its size and flip an alternating path in time proportional to its length.
7 Color-One
Our basic edge-coloring subroutine Color-One is analogous to Recolor in [17] and derived from Vizing’s original work [24].
Color-One first chooses an uncolored edge and a color . It calls a procedure Make-Primed-Fan, which builds a fan primed by a color . It then activates the fan by calling Activate-c-Fan, which uses the fan to color .
1:procedure Color-One()
2: Choose an uncolored edge
3: Choose any
4:
5:
We describe Make-Primed-Fan and Activate-c-Fan in turn.888In most presentations of this type of coloring procedure, the construction of the c-fan and the activation of the fan are not treated as separate components. This bulky presentation will help us when we state Random-Color-One and Color-Many.
Make-Primed-Fan
Make-Primed-Fan creates a primed c-fan around , as follows. Initialize a fan . We add leaves to until we find an opportunity to prime . Leaves are added greedily. Pick a color missing at , the last leaf of . If is missing at , then we can prime by ; this satisfies the first way for to be primed. Otherwise, there is a vertex with colored by . If is already a leaf of , then we can again primes by ; this satisfies the second way for to be primed. If does not already appear in , then appended to as the last leaf. Return as soon as it is primed.
1:procedure Make-Primed-Fan()
2: uncolored
3:
4:
5:
6: while is not primed do
7: Pick any
8: if then
9: Prime by
10: else {}
11: Find neighbour such that
12: if then
13: Prime by
14: else { is not already in }
15: Append to
16:
17: return
Lemma 7**.**
Make-Primed-Fan* returns a primed c-fan in time.*
Proof.
By construction, is a c-fan at all times during Make-Primed-Fan. Each iteration of the loop adds a new leaf to or primes , and no leaf can be added twice; thus the loop repeats at most times before is primed and returned.
Each operation within the loop takes constant time — this is clear for every line except line 10, where we check whether appears already as a leaf of . We can make this operation take constant time by marking each leaf when it is added to and unmarking them all at the end. Hence the procedure takes time. ∎
Activate-c-Fan
Activate-c-Fan accepts a c-fan primed by and uses to extend the coloring. By Definition 6, there are two ways for to be primed by : Either or there is a leaf with (recall that in both cases). Activate-c-Fan handles them differently.
If , then shift from (so that becomes uncolored) and color by . This extends the coloring by one edge, and we return.
Otherwise, is not missing at , but there is some leaf where is colored by . Observe that is missing at and at , by construction of the c-fan.
Consider the -path beginning at . Recall that is missing at and is colored by . Hence, is an endpoint of , with being the first edge of . Path ends at some other vertex (note that is missing exactly one of or ). Flip (i.e. interchange and on its edges). After the flip, is colored by , and is missing at . The flip also affects : If was missing at , now is missing, and vice versa. The set of missing colors does not change for any vertices besides and .
We now act in two cases depending on . The cases are illustrated in Figure 3.
- Case I:
If , then is still missing at . Observe that is a c-fan (this holds even if is a leaf of ). Shift from and color by . 2. Case II:
If , then is no longer missing at (now is missing instead). Since is colored by and is missing at , the sequence is a c-fan. Moreover, must still be missing at because . Shift from and color by .
In either case, the procedure succeeds in extending the edge-coloring by without uncoloring any other vertices.
Activate-c-Fan is given in pseudocode below.
1:procedure Activate-c-Fan()
2: is a c-fan primed by
3: if then
4: { and }
5: Shift from
6: Color by
7: else {}
8: Let be the leaf of with
9: { and }
10: Flip the -path beginning at
11: Let be the other endpoint of
12: if then
13: {}
14: Shift from
15: Color by
16: else
17: {}
18: Shift from
19: Color by
For convenience, let us assume going forward that Activate-c-Fan always flips one -path with an endpoint at . This is indeed the case if Activate-c-Fan reaches line 9. If it instead executes lines 3—5, we can just pretend that the -path beginning at is flipped; it does no harm to assume this because the path has length 0.
Lemma 8**.**
Activate-c-Fan* colors one edge in time, where is the length of the flipped path.*
Proof.
Case analysis of Activate-c-Fan shows that it outputs a legal edge-coloring. Observe that no previously-colored edges are uncolored by Activate-c-Fan, and the first edge of the fan becomes colored. Hence it increases the number of colored edges by one.
The runtime is clear, as Activate-c-Fan takes time for all operations except for flipping the path, which takes time. ∎
Lemmas 7 and 8 complete the analysis of Color-One. Theorem 9 shows that Color-One matches the behaviour promised in Section 4.
Theorem 9**.**
Color-One* colors an uncolored edge in time in the worst case.*
8 Random-Color-One
While Color-One can take time when the flipped path is very long, we might expect better behaviour “on average”. Indeed, it cannot happen that every alternating path induced by an edge-coloring is very long. It turns out that randomization helps a great deal in expectation.
The intuition is this: Let Color-One choose at random from the uncolored edges. Color-One can only flip an alternating path if is an endpoint of the path. Since there are many different edges to choose from, any particular alternating path is unlikely to be chosen.
This intuition is not far off, but it glosses over an important fact: If a vertex is incident to many uncolored edges, it is much more likely to be chosen for Color-One. If happens to be the endpoint of a very long path, Color-One may be slow in expectation. To compensate for this, we also choose at random. The flipped path must use as one of its colors, so more choices for translates to more options for the flipped path. Moreover, if is incident to many uncolored edges, it must also be missing many colors.
In summary, run Color-One with and chosen randomly. We call this randomized procedure Random-Color-One.
1:procedure Random-Color-One()
2: Choose an uncolored edge uniformly at random
3: Choose uniformly at random
4:
5:
Lemma 10**.**
Random-Color-One* colors an uncolored edge. It takes time in expectation and time in the worst case.*
Proof.
The correctness of Random-Color-One follows from Lemmas 7 and 8, as does the worst-case runtime. It remains to show the expected time.
Random-Color-One chooses , , and by a random process. Treat these as random variables and let be a random variable representing the flipped path. Since Random-Color-One runs in time, it is sufficient to show that .
Let be an alternating path in the graph with endpoints and . Since they are endpoints, and must each be missing exactly one of the colors that appear on . Say and are both colors used in . In order for to take the value , we need either and or and .
Since is chosen uniformly at random from the uncolored edges, we have
[TABLE]
and similarly . Since is chosen uniformly at random from ,
[TABLE]
Now, letting range over all alternating paths in , we have
[TABLE]
Observe that every colored edge in contributes to at most different alternating paths in . Hence , and so . ∎
Thus, with this trivial modification to Color-One, the runtime is much improved. It is especially significant because it does as well (in expectation) as the better of Color-One and Color-Many in terms of the time per edge colored, yet it is no more difficult to implement than Color-One. As we showed via Random-Euler-Color in Section 5, Random-Color-One is all we need to edge-color a graph in time with high probability.
9 Color-Many
This section presents Color-Many, a subroutine that colors uncolored edges in a graph in time. In other words, it colors edges at an average cost of time per edge. In that sense, Color-Many serves as a deterministic replacement for Random-Color-One. We used Color-Many as a subroutine in Euler-Color to achieve a runtime of .
Color-Many is our version of Parallel-Color, a procedure presented in [17]. As far as our results are concerned, the differences between Color-Many and Parallel-Color are unimportant—they have the same asymptotic efficiency per edge that they color. Color-Many uses the essential ideas and mechanisms of Parallel-Color, and indeed they are similar in many ways. We offer a more complete and thorough analysis of the procedure and we introduce some new ideas in Color-Many to simplify the presentation and implementation. Although Parallel-Color could be used in place of Color-Many, we believe that Color-Many is preferable.
Despite these improvements, Color-Many is technical and requires some care. Before we begin, we need some additional machinery.
Coloring with u-Fans
We need a second kind of fan called a u-fan. Like a c-fan, a u-fan can be used to color an uncolored edge by a procedure we call Activate-u-Fan.
Definition 11**.**
A u-fan is a sequence where , such that
- •
* are distinct vertices that are all incident to ,*
- •
* is uncolored for , and*
- •
* is a color that is missing at every and not missing at ; that is,*
[TABLE]
Vertex is called the center of , and is said to be centered at . The vertices are called the leaves of .
Note that we require a u-fan to have at least two leaves. We need this property to reliably color an uncolored edge using a u-fan. If a u-fan is reduced to have less than two leaves, we call it degenerate.
Activate-u-Fan takes a u-fan and a color that is missing at . It flips the -path beginning at so that is missing at . If the flipped path ends at one of the leaves, then is no longer missing there, so that leaf is removed from . A leaf of is chosen and is colored by . Then is removed from so that the resulting fan is still a u-fan (possibly a degenerate one).
1:procedure Activate-u-Fan()
2: is a u-fan
3:
4: Flip the -path beginning at
5: Let be the endpoint of
6: if is a leaf of then
7: Remove from
8: Pick any leaf of
9: Color by
10: Remove from
Activate-u-Fan takes time proportional to the length of the flipped path. It always colors an edge and remains a (possibly degenerate) u-fan. Since the colored edge is missing at both endpoints, the partial edge-coloring of the graph remains legal.
Outline of Color-Many
Color-Many is based on a set of disjoint fans that use the same color as their first parameter. We refer to such a set as an -collection. Formally, for a color :
Definition 12**.**
An -collection is a set of vertex-disjoint fans such that every fan is either a primed c-fan or a u-fan . Let denote the set of vertices in all the fans of .
Color-Many builds an -collection around a set of uncolored edges where each edge has one endpoint missing . Then it uses to color a large fraction of those edges. It proceeds in three steps, each requiring time, that work broadly as follows.
- Step 1: Choose
Say a vertex is incomplete if it is incident to an uncolored edge. Let be the set of incomplete vertices. For any color , let . Choose to maximize .
- Step 2: Build an -collection
Build an -collection using the vertices of . The goal is for many vertices of to end up in as the centers of primed c-fans or the leaves of u-fans. Color-Many does this by a procedure called Build-Collection.
- Step 3: Activate the -collection
Activate each fan in using Activate-c-Fan or Activate-u-Fan, as appropriate. After an activation, find any other fans in the collection that have been damaged and either repair them or discard them so that remains an -collection. Color-Many does this by a procedure called Activate-Collection.
Note that edges may be colored in both step 2 and step 3.
1:procedure Color-Many()
2: Choose that maximizes
3:
4: Activate-Collection()
These steps are laid out in detail in the next sections. We shall prove the following theorem.
Theorem 13** (25).**
Color-Many* colors edges in time.*
Step 1: Choose
This step is straightforward.
Lemma 14**.**
There is some color such that , and can be found in time.
Proof.
Observe that
[TABLE]
Choose to be the color missing at the largest number of incomplete vertices. Then .
We can find by counting the number of edges of each color incident to an incomplete vertex (an edge is counted twice if both endpoints are incomplete) and choosing to be the color with the lowest count. Finding takes time. Then can be constructed in time. ∎
Step 2: Build an -Collection
Color-Many calls a procedure Build-Collection to build an -collection of disjoint fans containing vertices of . This -collection shall have the property that each center of a c-fan and each leaf of a u-fan is a vertex of (and the other vertices of are not in ).
Build-Collection creates a set initially containing the vertices of . While is nonempty, Build-Collection removes a vertex from and calls a procedure Make-Collection-Fan, which attempts to build a primed c-fan with as the center.
1:procedure Build-Collection()
2:
3:
4: for do
5: Remove from
6: Choose uncolored incident edge
7:
8: If , add to
Make-Collection-Fan attempts to build a c-fan centered at in the same way as Make-Primed-Fan, with two important differences: First, if a leaf added to the fan already appears in some other fan of the collection, then the two intersecting fans need to be altered because fans must be disjoint in an -collection. This is done by a procedure called Merge-Fans. Second, if a leaf is missing , then the fan is shifted from immediately and is colored by . This is necessary to ensure that a vertex of does not end up as a leaf of a c-fan.
Formally, Make-Collection-Fan works as follows given an uncolored edge with . Initialize a c-fan . Repeatedly, letting be the last leaf of , do the following:
Check whether already belongs to a different fan in . If it does, then and overlap at . Call and return the result. 2. 2.
If then shift from . Now is uncolored and is missing at both endpoints. Color by and discard . If , then remove from . 3. 3.
Otherwise, proceed as in Make-Primed-Fan: Choose a color . If , then prime with and return it. If , let be the vertex with . If already appears in , then prime by and return . Otherwise append to as a leaf.
Merge-Fans accepts a c-fan whose last leaf also lies in the fan . First, it shifts from so that is uncolored. Then it operates in four cases, depending on whether is a c-fan or a u-fan and whether is the center of or a leaf. In all cases, the fan will be discarded (i.e. not included in the -collection). These cases are illustrated in Figure 4.
- Case I:
If is a c-fan and is its center, then is missing at both and . Color by and discard . 2. Case II:
If is a c-fan (with center ) and is a leaf of , then create a u-fan as follows: Shift from . Now and are uncolored and is missing at both and . By the construction of , . Create a new u-fan having as its center and and as its leaves. Add the u-fan to and discard . 3. Case III:
If is a u-fan and is its center, then add as a leaf of . 4. Case IV:
If is a u-fan and is a leaf of , then is missing at both and . Color by . Remove from ; if this causes to be degenerate (i.e. have less than two leaves) then discard .
Analysis of Build-Collection
Let us check the correctness and runtime of Build-Collection.
Lemma 15**.**
* makes an -collection in time.*
Proof.
Build-Collection maintains the invariant that every vertex of is either the center of a c-fan or a leaf of a u-fan. Moreover, cannot be missing at any leaf of a c-fan in . These are ensured by steps 1 and 2 of Make-Collection-Fan.
Let us check that remains an -collection after a call to Make-Collection-Fan. It can terminate in steps 1, 2, or 3.
If it terminates during step 3, then is a primed c-fan created just as in Make-Primed-Fan and it is disjoint from every other fan in the collection. If it terminates because of step 2, then a new edge is colored and is discarded. No other fans are affected in these cases, and hence is an -collection.
If it terminates because of step 1, then is merged with a fan in the collection because they overlap at . Merge-Fans only touches the vertices of and , so no fans are affected except for these two. It either returns a new u-fan to be added to the collection (Case II), adds a new leaf to an existing u-fan (Case III), or colors a new edge (Cases I and IV), leaving in the collection only if it is still a well-formed fan. By inspection of the cases, every fan added to is well-formed and disjoint from all others in . Thus, Build-Collection outputs an -collection.
For the runtime, observe that only the vertices of can ever be the centers of c-fans and at most one c-fan is built around each during Build-Collection. That is, once a vertex of stops being the center of a c-fan, it is never again the center of a c-fan. It takes time to build a c-fan around a center . Hence the total time spent building c-fans is . This accounts for all time spent in steps 2 and 3 of Make-Collection-Fan.
The remaining time is spent on Merge-Fans. Every operation in Merge-Fans takes constant time except for shifting and, in Case II, shifting . In all cases, any shifted fan is always discarded immediately afterwards, and so each c-fan that is built can be shifted only once. The total time for all shifts is therefore bounded by the sum of sizes of all c-fans: . Excluding the time spent on shifts, Merge-Fans takes constant time each time it is called (and it is called at most times). Hence Build-Collection takes time. ∎
Now let us estimate the number of edges colored during Build-Collection and the number of fans in . There is be a balance between these two quantities because some vertices of do not end up in , but that only happens in cases where some edge is colored.
Lemma 16**.**
Let and , respectively, be the number of uncolored edges before and after Build-Collection. Let be the collection output by Build-Collection. Then
[TABLE]
Proof.
Let . There are only a few ways that Build-Collection can affect .
Possibly, could end up in some fan of , either as the center of a c-fan or a leaf of a u-fan. That is, could be in .
If this does not happen, it is because is part of a discarded fan or removed from its fan. These events can occur during the construction of a c-fan (in step 2 of Make-Collection-Fan) or in Cases I and IV of Merge-Fans. However, all three of these scenarios coincide with an uncolored edge being colored. Observe that every time an edge is colored, at most three999The worst case happens in Case IV when is a u-fan with two leaves, one being . The edge is colored and and the two leaves of are discarded. vertices are removed from .
Therefore, at most vertices of do not end up in a fan of . It follows that
[TABLE]
Step 3: Activate the -Collection
Once is constructed, Color-Many calls Activate-Collection to color a large fraction of the uncolored edges in the fans of . Together with the edges colored in step 2, edges will be colored in total.
Activate-Collection works in stages, one for each color other than . Let be the colors of in some fixed order. For , let
[TABLE]
We assume that the algorithm correctly maintains all the sets at all times. This can be handled automatically with constant overhead when coloring and uncoloring edges.
Activate-Collection runs in stages, where the th stage deals only with the fans of . Stage works as follows. While is nonempty, pick a fan and let be the center of . If is a c-fan (primed by ) then call . If is a u-fan (with ) then call . After the activation, discard if it is a c-fan or a degenerate u-fan. Then call Disconnect-Vertex, a procedure that cleans up the damage that may have been caused by the activation.
Activate-Collection is given in pseudocode below.
1:procedure Activate-Collection()
2: for from to do
3: {Stage }
4: while do
5: Pick
6: if is a c-fan primed by then
7:
8: Remove from
9: else { is a u-fan and }
10:
11: if has less than two leaves then
12: Remove from
13: Disconnect-Vertex
Except for the call to Disconnect-Vertex, this procedure doesn’t do anything surprising. It activates each fan using the appropriate function, and then discards it unless it is a u-fan that could be activated again later. The purpose of Disconnect-Vertex is to address two issues.
First, if the alternating path that was flipped during the activation ends at a vertex of some fan , then may no longer be well-formed (i.e. may not adhere to the definition of a u-fan or a primed c-fan) because has changed — specifically, and have been exchanged in . Whenever a fan is malformed for this reason, we say is damaged and that is the damaged vertex of .
A damaged fan must be repaired or discarded before the next activation, for otherwise contains some “fan-like object” that does not satisfy the definition of a fan. Let us formalize this requirement.
- Precondition 1:
is always an -collection before a fan is activated during Activate-Collection. In particular, no fan in is damaged.
Second, the edges of the flipped path may now belong to some larger -path in the graph which could be flipped later during a different activation. If the same edges are in many different flipped paths during stage , the runtime could exceed . We avoid this by isolating every vertex in the flipped path so that it cannot be accessed again during stage .
During stage , say a vertex is disconnected if it lies in an -path whose endpoints are not in .
- Precondition 2:
Before a fan is activated during stage , any vertex that had previously been in a flipped path during stage is disconnected.
Note that Disconnect-Vertex may also flip -paths, and the vertices in those paths must satisfy Precondition 2 as well.
Disconnect-Vertex
The purpose of Disconnect-Vertex is to ensure that these preconditions are satisfied at the top of each iteration. Disconnect-Vertex is given a vertex and it explores the -path containing it. It manipulates the fans containing the endpoints of the path with the twofold goal of repairing those fans if they are damaged (with the endpoint being the damaged vertex) and ensuring that the endpoints of do not lie in fans of .
The procedure works as follows. Let be the -path containing . Until neither endpoint of lies in a fan of , do the following: Choose to be an endpoint of that lies in a fan , and if possible choose so that is damaged (with being the damaged vertex). Then act in three cases.
- Case 1:
If is a c-fan or a u-fan with only two leaves, then discard (i.e. delete it from ). 2. Case 2:
If is a u-fan with at least three leaves and is a leaf of , then remove from . 3. Case 3:
If is a u-fan with at least three leaves and is the center of , then choose a leaf of . If , replace with a different leaf of .
Now we have two subcases depending on whether .
- Case 3a:
If , then must be the damaged vertex of . We have . Color by and remove from . Now is undamaged. 2. Case 3b:
If , then is a valid u-fan. We must have for otherwise would not be an endpoint of . Flip the -path beginning at . Now . Color by and remove from .
Now is colored by or , and so is no longer an endpoint of . Extend by continuing the -path through until it reaches an endpoint.
Disconnect-Vertex is given below in pseudocode.
1:procedure Disconnect-Vertex()
2: Let be the -path containing
3: while an endpoint of lies in a fan of do
4: Let and be the endpoints of
5: if is the damaged vertex of a fan or is not in a fan then
6:
7: else
8:
9: Let be the fan containing
10:Case 1
11: if is a c-fan or a u-fan with two leaves then
12: Remove from
13: else
14:Case 2
15: if is a u-fan and is a leaf of then
16: Remove from
17: else
18:Case 3
19: if is a u-fan and is the center of then
20: Choose a leaf of
21: if then
22: Replace with a different leaf of
23: Remove from
24: if then
25: Case 3a
26: { is damaged as }
27: {}
28: Color by
29: else
30: Case 3b
31: { is not damaged}
32: Flip the -path containing
33: {}
34: Color by
35: { is no longer an endpoint of }
36: Extend by following the -path through
Analysis of Disconnect-Vertex
Let us first establish a few facts about Disconnect-Vertex.
Proposition 17**.**
Consider a fan with center that is activated during stage of Activate-Collection. Let be the -path flipped during the activation and let and be its endpoints, and assume Preconditions 1 and 2 held before the activation of . At all times during Disconnect-Vertex, the following hold.
* contains .* 2. 2.
* is a maximal -path. In particular, never becomes a cycle.* 3. 3.
At most one endpoint of is the damaged vertex of a fan in and no other fan in is damaged.
Proof.
We check these in order.
At the start of Disconnect-Vertex, contains . This can be checked by case analysis of Activate-c-Fan and Activate-u-Fan. Since vertices are never removed from , it remains true. 2. 2.
Initially, is chosen to be the (maximal) -path containing . Suppose is a maximal -path at the start of the loop (at line 4 in Disconnect-Vertex). At the end of the loop, either will be unchanged and will still be maximal (as in Cases 1 and 2), or will have been extended at one endpoint by Case 3. In all cases, will be maximal.
We must check that cannot become a cycle due to Case 3. Case 3 extends through an edge of a u-fan , where is the center of (and an endpoint of ) and is a leaf of . Observe that any leaf of that lies in must be the other endpoint of , since is missing at each leaf. If necessary, the procedure replaces by a different leaf so that is not in . Thus, when is colored to join with the -path containing , it cannot create a cycle. 3. 3.
Before Disconnect-Vertex is called, only the fan containing (if any) can be damaged and only with being the damaged vertex. Indeed, has been altered because was flipped, and so that fan may not satisfy the definition of a u-fan or primed c-fan. We check that all other fans in are still well-formed. The activation of only affected fans containing vertices of (including itself). The fans containing only interior vertices of cannot be made invalid due to the activation of because flipping does not change the set of missing colors at any interior vertex. The fan is discarded immediately unless it is a non-degenerate u-fan after its activation, in which case it is still well-formed. Thus, only the fan containing can be malformed, and only in the sense that is the damaged vertex of that fan.
Now assume inductively that at most one endpoint of is the damaged vertex of a fan in and all other fans are well-formed. If an endpoint of is the damaged vertex of a fan , then algorithm chooses to be that vertex. In Case 1, is discarded and so all fans left in are well-formed. In Case 2, is removed from which repairs , and is no longer in any fan of . In Case 3a, is damaged initially and repaired by coloring an incident edge by ; at this point, no fan can be damaged. After these cases, no fan in can be damaged.
In Case 3b, is not damaged and so no fan in is damaged, for otherwise would have been chosen to be the damaged vertex. However, when the -path containing is flipped, the fan on the other end could be damaged. The damaged vertex of this fan becomes the new endpoint of when is extended through the edge . Thus, there is at most one damaged fan at the end of this case and its damaged vertex must be an endpoint of . ∎
Now we can check that Disconnect-Vertex ensures Preconditions 1 and 2. Establishing Precondition 1 will imply the correctness of Activate-Collection, and Precondition 2 will be useful in measuring its runtime.
Lemma 18**.**
Preconditions 1 and 2 hold before each fan is activated in Activate-Collection.
Proof.
Both preconditions hold before any fan is activated. Assume inductively that the preconditions hold before the activation of a fan .
By Proposition 17, no fan can be damaged or otherwise malformed except for those containing the endpoints of , and neither endpoint of lies in a fan of when Disconnect-Vertex terminates. Clearly Disconnect-Vertex must terminate as each iteration decreases . Therefore Precondition 1 is restored.
Now we check Precondition 2. By Proposition 17, is always maximal -path and it contains all the vertices of the path flipped during the activation of . When the procedure is over, every vertex in is disconnected because the endpoints of are not in fans of .
All other vertices that were disconnected before was activated must still be disconnected. This holds because every edge colored by or that is affected by the activation of and the subsequent call to Disconnect-Vertex becomes an edge in . Hence Precondition 2 is restored. ∎
Lemma 19**.**
The paths traversed by the applications of Disconnect-Vertex during stage are vertex-disjoint.
Proof.
Proceed by induction on . Let be the -path constructed by Disconnect-Vertex after the activation of a fan with center . By Precondition 2, all the vertices in are disconnected before the activation. Since was the center of , was not disconnected before the activation, and so it cannot lie in . At the start of Disconnect-Vertex, is the -path containing . Whenever Disconnect-Vertex extends by coloring an edge (as in Case 3), the -path that forms the extension has an endpoint in a fan of . Hence a path () cannot be traversed during the construction of , and so is disjoint from all previous paths. It follows that are disjoint. ∎
Finally, we measure the runtime of Disconnect-Vertex.
Lemma 20**.**
Disconnect-Vertex* takes time, where is the constructed path.*
Proof.
The runtime is clear as constant time is spent on each vertex of and vertices are never removed from . ∎
Analysis of Activate-Collection
We aim to prove that Activate-Collection runs in time and colors a number of edges that is at least a constant fraction of .
Lemma 21**.**
Activate-Collection* runs in time.*
Proof.
Consider a fan in . If is a c-fan, then it takes time to activate and call Disconnect-Vertex, where is the entire -path formed by Disconnect-Vertex. This follows from Lemma 20 and the fact that the path flipped during the activation of is contained in . If is a u-fan, then the time is just because the activation itself (not including the flipping operation) takes constant time.
Let be the paths explored by Disconnect-Vertex during Activate-Collection. Choose indices such that are the paths constructed during stage . The total time is then
[TABLE]
We have as the c-fans are disjoint and a c-fan can only be activated once. We now show that the sum of the lengths of all paths is .
For , let be the number of edges colored by at the end of stage . Observe that the th stage only modifies the number of edges colored by and — all others are fixed. Indeed, the only operation in stage that involves an edge not colored by or is the shift operation, and shifting a c-fan does not change the number of edges of each color. That means, for each , the number of edges colored by after stage is also . Therefore .
Now consider stage . By Lemma 19, are disjoint. At the end of stage , each path that was built during stage is an -path, and so has at most one more edge colored by than by . That is, if has edges colored by then . Thus,
[TABLE]
Summing this estimate over all rounds gives us
[TABLE]
The last inequality holds because every activation colors a new edge, and so . Therefore, Activate-Collection runs in time. ∎
Now we establish that Activate-Collection does not ignore any fans in .
Lemma 22**.**
* is empty after Activate-Collection.*
Proof.
Activate-Collection runs in stages, where the th stage finishes once is empty. We show that no fan can be added to in later stages. A c-fan cannot be added to in later stages because the color that primes a c-fan never changes. A u-fan can only be added to when its center is the endpoint of a flipped path that interchanges and . However, -paths are only flipped during stage , and so u-fans can only be added to during stage . Thus, remains empty after stage . It follows that are all empty at the end of Activate-Collection. ∎
Next, we compare the number of edges colored by Activate-Collection against the number of vertices removed from .
Lemma 23**.**
In every iteration of Activate-Collection, the number of uncolored edges decreases by and at most vertices of are removed from .
Proof.
Recall that the center of a c-fan is in (but none of the leaves are) and each leaf of a u-fan is in (but the center is not). Activating a fan always causes a new edge to be colored and it removes a vertex of from that fan: either the center of a c-fan or a leaf of a u-fan. If it is a u-fan then another vertex of may be removed if the flipped path ends at a leaf of that fan, and a third vertex of may be removed if the u-fan becomes degenerate and is discarded. Thus, due to the activation, one new edge is colored and decreases by at most 3.
Activate-Collection then calls Disconnect-Vertex, which may color more edges and remove more vertices of . In the first two cases of Disconnect-Vertex, no edges are colored and at most two vertices of are removed from . These cases can happen only twice during Disconnect-Vertex because they cause an endpoint of to not lie in any fan of . Hence, these cases cause to decrease by at most 4. Case 3 can occur many times, but it always colors one edge (either by or by ) and removes one vertex of .
Thus, if new edges are colored during an iteration of Activate-Collection, at most vertices are removed from : Up vertices are lost due the activation of the fan (while new edge is colored) and up to vertices are lost during Disconnect-Vertex (while new edges are colored). ∎
The next corollary counts the number of edges newly colored by Activate-Collection.
Corollary 24**.**
Let and , respectively, be the number of uncolored edges before and after Activate-Collection. Let be the collection output by Build-Collection. Then
[TABLE]
Proof.
By Lemma 22, is empty at the end of Activate-Collection. By Lemma 23, at least one edge is colored for every 7 vertices removed from . ∎
We are now able to wrap up the proof of Theorem 25.
Theorem 25**.**
Color-Many* colors edges in time.*
Proof.
Color-Many runs in time by Lemmas 14, 15, and 21.
Let , , and , respectively, be the number of uncolored edges at the start of Color-Many, after Build-Collection, and after Activate-Collection. Recall that by Lemma 14. By Lemma 16,
[TABLE]
By Corollary 24,
[TABLE]
Hence,
[TABLE]
Therefore, edges are colored by Color-Many. ∎
Appendix A Dictionary Data Structure
Here we describe the implementation of , the dictionary data structure introduced in Section 6.4. Recall that is meant to map a vertex-color pair to the edge incident to colored by , if such an edge exists, and we wish to support Search, Insert, and Delete in constant time.
For this description, treat the vertices of as integers from [math] to . Intuitively, we would like to simply store an array of length where the entry at index contains the edge incident to colored by . This may be too costly in preprocessing as could exceed our desired time complexity of . Instead we use a two-level decomposition of this method which takes time to initialize.
must store key-value pairs, where the keys are drawn from a universe of size and we know that the dictionary contains at most entries at any time (at most one for each endpoint).
Let . Divide the universe into ranges of size at most (specifically, the ranges are , , etc). Initialize an array of length , where the th entry of corresponds to the range . For each index of , store a counter that tracks the number of entries in range .
Then initialize arrays of length . Call these block arrays. An entry of a block array is either empty (null) or it has a pointer to an edge.
If , then is empty (it contains null). Otherwise, contains a pointer to a block array , and for as long as , will act as an array storing the entries in the range . At any time, can only be linked from one location in (but it can change locations over time).
Create a linked list which shall contain the empty (unused) block arrays. Initially all block arrays are in .
The operations are implemented as follows:
- •
Search: Write the index as a sum with and integers.101010Specifically and . If then return null. If , then return .
- •
Insert: Compute and as above. If then set . If , then remove an empty block array from , set , and set . Increment .
Observe that cannot be empty when a block array is removed from , for there are block arrays and at most entries in the dictionary.
- •
Delete: Compute and as above. If , then do nothing. If and , then set and decrement . If now, then set and append to because is empty.
Each operation takes constant time. Initializing the data structure takes time.
A Note About Alternative Implementations
Our implementation is somewhat unconventional, and it would be nice if an out-of-the-box dictionary could be used instead. Our goal is to have constant time operations, and the barrier in our case is just the preprocessing time. We need to be initialized in time. There are alternative solutions available.
Firstly, if , as is often the case, we can simply use an array of length as our dictionary.
Secondly, there are randomized dictionaries that can be initialized in constant time and perform all operations in constant expected amortized time (e.g. generalized cuckoo hashing [14]). If deterministic computation is not a priority, and certainly in the case of Random-Euler-Color, this type of dictionary can be substituted.
In fact, is only truly needed for Random-Color-One. Versions of Color-One and Color-Many exist that do not use at all; this was the case for Recolor and Parallel-Color, the analogous subroutines in [17]. Although is a valuable tool that simplifies their implementations, it is possible to achieve the same deterministic bound for edge-coloring without it.
The Recursive Strategy and
We must be careful in how we manage our data structures with respect to the recursive strategy. Since takes more than time to initialize, we cannot afford to reinitialize for each subgraph during Euler-Color or Random-Euler-Color. If done improperly, different branches of the recursion could run into conflicts by reading and writing to the same locations in , even though they are operation on edge-disjoint subgraphs.
A simple workaround is to populate and depopulate in every Repair step. Before the Repair step begins, insert the color of every edge into ; when it is over, remove every color from . This way, every time a Repair step occurs during the strategy, exactly reflects the current subgraph and its colors. It adds insertions and deletions to every Repair step which does not change the asymptotic runtime. It is also possible to do without this workaround by careful management of the colors.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Gagan Aggarwal, Rajeev Motwani, Devavrat Shah, and An Zhu. Switch scheduling via randomized edge coloring. In 44th Annual IEEE Symposium on Foundations of Computer Science, 2003. Proceedings. , pages 502–512. IEEE, 2003.
- 2[2] Noga Alon. A simple algorithm for edge-coloring bipartite multigraphs. Information Processing Letters , 85(6):301–302, 2003.
- 3[3] Eshrat Arjomandi. An efficient algorithm for colouring the edges of a graph with δ 𝛿 \delta + 1 colours. INFOR: Information Systems and Operational Research , 20(2):82–101, 1982.
- 4[4] Leonid Barenboim and Michael Elkin. Distributed graph coloring: Fundamentals and recent developments. Synthesis Lectures on Distributed Computing Theory , 4(1):1–171, 2013.
- 5[5] George Bennett. Probability inequalities for the sum of independent random variables. Journal of the American Statistical Association , 57(297):33–45, 1962.
- 6[6] S Bernstein. Sur une modification de l’inéqualité de tchebichef. Annals Science Institue Sav. Ukraine Sect. Math. I , pages 38–49, 1924.
- 7[7] Sayan Bhattacharya, Deeparnab Chakrabarty, Monika Henzinger, and Danupon Nanongkai. Dynamic algorithms for graph coloring. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms , pages 1–20. SIAM, 2018.
- 8[8] Sayan Bhattacharya, Fabrizio Grandoni, and David Wajc. Online edge coloring algorithms via the nibble method. In Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms (SODA) , pages 2830–2842. SIAM, 2021.
