 # Optimal Distributed Coloring Algorithms for Planar Graphs in the LOCAL model

In this paper, we consider distributed coloring for planar graphs with a small number of colors. We present an optimal (up to a constant factor) O(n) time algorithm for 6-coloring planar graphs. Our algorithm is based on a novel technique that in a nutshell detects small structures that can be easily colored given a proper coloring of the rest of the vertices and removes them from the graph until the graph contains a small enough number of edges. We believe this technique might be of independent interest. In addition, we present a lower bound for 4-coloring planar graphs that essentially shows that any algorithm (deterministic or randomized) for 4-coloring planar graphs requires Ω(n) rounds. We therefore completely resolve the problems of 4-coloring and 6-coloring for planar graphs in the LOCAL model.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Given a graph and a positive integer , the -coloring problem asks for an assignment of colors (integers from ) to the vertices of such that no two adjacent vertices in are assigned the same color. We study this problem in the distributed LOCAL model of computation. In this model, a communication network is represented by a graph where each vertex corresponds to a processor and each edge to a communication line. The vertices communicate by sending messages over these edges in a synchronous manner, that is, they communicate in discrete rounds. In each such round, each vertex receives the messages that were sent to it in the previous round, preforms some local computation and sends messages to some of its neighbors (where there is no limit on the size of the messages and on the local computation time). The running time of an algorithm in this model is equal to the number of communication rounds that the algorithm requires in the worst case. The CONGEST model is very similar to the LOCAL model but the size of the messages is bounded (usually by some small poly-log). Our algorithms can also be tweaked to work in the CONGEST model.

Vertex coloring is one of the most fundamental and well-studied problems in the area of distributed computing with a long history dating back to the 80’s. Algorithms for vertex coloring have numerous applications in the design of other distributed algorithms, scheduling in networks and many other problems. Perhaps the most common form of distributed coloring is the -coloring problem111As usual, is the maximum degree in the graph. In the centralized setting, computing -coloring can be easily done in linear time, by simply iterating over the vertices in an arbitrary order and coloring the current vertex with a color not yet used by one of its neighbors (it should be noted that such a color must exist as the maximum degree is ). Computing -coloring in the distributed setting is much trickier. In the deterministic approach, several algorithms with running time of have been developed [6, 15, 11, 12] culminating with sublinear in time algorithms (see recent breakthrough results [3, 10])222As usual, (respectively, ) is the number of vertices (resp., edges) in the graph.. The term is necessary as Linial  showed that even 3-coloring a ring requires round. The situation for the randomized algorithms is much more optimistic. The first randomized -coloring can be tracked back to the MIS [16, 1]. This trigged a series of works culminating with the recent breakthroughs of Harris, Schneider, and Su  who presented a randomized -coloring with time, and Chang, Li and Pettie  who presented a randomized -coloring with time (where is the deterministic complexity of (deg+1)-list coloring on -vertex graphs).

Obtaining coloring with fewer colors is a desirable property that is crucial to the efficiency of many applications that use coloring. All the above mentioned algorithms use -coloring even if is very large and even if it is possible to use fewer colors. Much less is known for general graphs when we restrict the algorithm to use less than colors.

In this paper, we focus on distributed coloring planar graphs with a small number of colors (independent of ). In the sequential centralized setting it is well known that a planar graph can be colored using 4 colors in polynomial time (e.g. ), however no near linear time algorithm is known for this problem. If we allow 5 colors then linear time algorithms exist (see e.g. ).

Coloring planar graphs was also studied in the PRAM model, where the computation is partitioned among polynomial number of processors and the processors can communicate through a shared memory. Goldberg et al.  presented a deterministic time algorithm for -coloring planar graphs in the PRAM model of computation. Although the use of PRAM model, this algorithm can be easily converted to an algorithm that runs in a distributed model of computation. However, this approach fails when restricting the algorithm to use less than 7 colors, as it strongly relies on the fact that at least a constant fraction of the vertices are of degree at most 6 in any planar graph. Barenboim and Elkin  generalized this algorithm to graphs of bounded arboricity and devised a deterministic algorithm for -coloring graphs of arboricity at most that has running time of (where the parameter is an arbitrary small positive constant).

Goldberg et al.  also presented a different deterministic algorithm for 5-coloring planar graphs (where the embedding of the graph is given) in the PRAM model. This algorithm finds a -coloring in time. In contrast to the previous algorithm, this algorithm is based on iterative contraction of vertices, and so requires the maintenance of a virtual graph composing of super nodes where each of them corresponds to a contraction of several vertices in the original graph that might be at distance from each other. In a distributed model of computation, maintaining such a graph requires rounds. Hagerup et al.  gave a similar algorithm for -coloring planar graphs that does not require an embedding of the graph to be given as an input. However, this algorithm is also based on vertex contraction. Krzysztof  gave another -coloring algorithm in the PRAM model. However, it also requires time in a distributed model of computation.

If we want to use less than colors in the distributed setting for planar graphs, it seems that no non-trivial (that requires time) algorithm is known.

A well known result by Linial  states that coloring trees with a constant number of colors requires time . Since trees are planar graphs, it follows that any algorithm that finds a coloring of planar graphs with a constant number of colors requires time.

In this paper we present an optimal (up to constant factor) algorithm for 6-coloring planar graphs (and with less colors for related families). More specifically, we obtain a deterministic time algorithm for 6-coloring planar graphs, which matches the lower bound of Linial . Our algorithm is based on a novel technique that removes small structures (that can be later easily colored) from the graph until the graph contains a small number of edges. We believe that our techniques may be of independent interest. In addition, we present a lower bound for 4-coloring planar graphs that essentially shows that any algorithm (deterministic or randomized) for -coloring planar graphs requires rounds. We therefore completely resolve the problems of 4-coloring and 6-coloring for planar graphs in the LOCAL model.

## 2 Preliminaries

We denote by the set of all non-negative integers and by the set of all positive integers. For a graph , we respectively denote by and the vertex set and edge set of . The degree of a vertex in a graph is denoted by . Given a graph and a set , we denote by the induced graph on . A simple cycle in a graph is a sequence of distinct vertices from such that for all and . Given a simple cycle in a graph , we respectively denote by and the vertex set and edge set of (i.e. and ). The length of , denoted by , is defined to be , and its degree in , denoted by , is defined to be .

For a positive integer , a proper -coloring of a graph is a mapping from the set of vertices to the set of colors such that no two adjacent vertices in are assigned the same color. A partial proper -coloring of a graph is a mapping from the set of vertices to the set such that the restriction of to the set of colored vertices is a proper -coloring of .

We will need Brooks’ Theorem :

###### Theorem 2.1 (Brooks’ Theorem).

Every connected graph with maximum degree has a proper -coloring unless

is either isomorphic to a complete graph or to a cycle graph of odd length.

We will also need the following well known claim, which is a folklore (see e.g.  for a proof):

###### Claim 2.1.

For any integer and any planar graph , if does not contain any simple cycle of length then .

The rest of the paper is organized as follows. In Section 3 we present the notion of removable cycle that is crucial for our algorithm. In Section 4, as a warmup, we present an time algorithm for 4-coloring of triangle-free planar graphs. In Section 5, we present our main result of time algorithm for 6-coloring of planar graphs. Finally, in Section 6 we present our lower bound technique showing that any 4-coloring algorithm of planar graphs requires time, and any 3-coloring algorithm of outerplanar graphs requires time.

## 3 Removable Cycles

###### Definition 3.1 (Removable Cycle).

A simple cycle in a graph is removable if is neither isomorphic to a complete graph nor to a cycle graph of odd length.

The next lemma shows that if is a removable cycle in a graph with , and is a partial proper -coloring of in which is not colored, then one can -color the vertices of in such a way that this extended coloring remains a partial proper -coloring of .

###### Lemma 3.1.

For any graph , any removable cycle in with and any partial proper -coloring of such that for all , there exists a partial proper -coloring of such that for all and for all .

###### Proof.

Let and be some removable cycle in with . Let be a partial proper -coloring of such that for all . For each , we denote by the set that contains the color of each colored neighbor of (that is, and ), and by the vertex that comes after in the cyclic order of (i.e. for all and ). If for all , then we must have and so there exists a set of colors COL such that for all . Since each vertex must have at least one colored neighbor for each color in COL, we get that each vertex has at least colored neighbors. Since the vertices in are not colored, it must be that each vertex has at most neighbors in . Since is a removable cycle in , the graph is neither isomorphic to a complete graph nor to a cycle graph of odd length. Moreover, we have for all , and so the maximum degree of is at most . It follows from Brooks’ theorem  that can be properly colored using at most colors and so we can properly color it by using the palette which is a proper extension of .

Now, if there exists a vertex for which , then there exists a color such that and . Let , and for each (note that ). We start by assigning the color (which is a proper extension of as ). Next, we properly color each of the vertices in

(in this order) by finding each time a color that no neighbor of the current vertex use (always possible since each of these vertices has at least one uncolored vertex at the moment of its coloration). Finally, we are left with coloring

, that is, itself. Note that currently has at least two neighbors colored ( so has at least one neighbor not in colored and in addition we colored in as well). Therefore, there is a free color (that is, a color that no neighbor of uses) to assign to .

## 4 Finding a 4-coloring of triangle-free planar graphs

We assume that the communication network is a triangle-free planar graph on vertices where each vertex has a unique identifier taken from (for some constant integer ). At the beginning each vertex knows only the value of and its own identifier.

The very rough idea of the algorithm is to partition the vertices of the graph into disjoint subsets that will later be -colored iteratively one after the other. More precisely, the algorithm partitions the set of vertices into sets of vertices (for some ) such that the following occurs (in our algorithm below these sets are the sets with vertices with the same label ). For every , assuming the vertices in the set are already properly colored (and no other vertex is yet colored), we can efficiently assign colors to the set of vertices such that the previous coloring together with the new coloring forms a proper coloring. Given these sets of vertices, the algorithm simply iterates the sets of vertices from to and color the current set of vertices given the coloring of vertices from previous sets.

To this end, each vertex executes in parallel the following algorithm:

We say that a vertex is active at some point of the algorithm’s execution if at that point, or inactive otherwise. We claim that by the end of the algorithm all the vertices must be inactive. For this, we start by showing the following lemma:

###### Lemma 4.1.

For each , if and respectively denote the sets of all the vertices that were active at the start of the outer loop’s -th iteration and at its end, then .

###### Proof.

Let and be the sets of all vertices of degree less than and greater than in , respectively. Since each vertex who becomes inactive at some point of the algorithm’s execution remains inactive until the end, it is enough to show that at least of the vertices in become inactive by the end of the -th iteration. This is clearly the case when as each vertex in who remained active after step 1, must become inactive by the end of step 2. So it remains to show that this is also the case when . Let be the set of all vertices that remained active at the end of the first step of the ’th iteration. We divide the edges of the graph into two disjoint subsets and where contains all the edges in that are incident to some vertex in , and contains all the other edges. Since is a triangle-free planar graph, we have (by setting in Claim 2.1). It follows that and so . This implies that , and so . We conclude that .

Now, let be the subgraph induced by the edges in , that is the graph whose set of vertices is all vertices in such that is incident to at least one edge in , and whose set of edges is . Since is a subgraph of it must also be a triangle-free planar graph. Moreover, cannot contain a simple cycle of length . To see this, recall that contains only vertices whose degree in is at most . So if contains a cycle of at length at most 4 it must be a removable cycle (as is a triangle free graph). However, the algorithm already removed in the first step of the ’th iteration, all vertices that are contained in removable cycle of length 4. It follows by Claim 2.1 that . It follows that contains at most edges. Now, let be the set of all vertices of degree less than in . We have and so . Note that in the first step of the ’th iteration, the algorithm inactivates vertices (by definition of ) and in the second step it inactivates vertices. Overall, the algorithm inactivates in the ’th iteration vertices. It follows that , as required.

We conclude the following lemma:

###### Lemma 4.2.

By the end of the algorithm all vertices are inactive.

###### Proof.

By Lemma 4.1, it easily follows that the number of vertices that remained active after iterations is at most . Note that the algorithm invokes iterations therefore after the last iteration the number of vertices that remain active is . Hence, no vertex remain active by the end of the algorithm.

Let and let . The above algorithm partitions the vertices of the graph into disjoint subsets where each contains all the vertices with . Roughly speaking, our goal now is to go over the sets in a reverse order (that is, , , , ,…,, ) and color the vertices of the current set given the previous 4-coloring of all vertices belonging to previous sets. We claim that the algorithm can always assign colors to the vertices in the current set in such a way that the coloring of all colored vertices so far (i.e., vertices from the current set and from previous sets) forms a proper coloring. To see this, we distinguish between two cases. The first case is when the current set is of the form and the second case is when the current set is of the form for some . Consider the first case, note that by construction the degree of all the vertices in in the induced graph of the set of vertices (the vertices from all previous and current sets) is less than 4. Therefore, we can always find a free color for every vertex in from the palette , and we can synchronize between the different vertices in this set by partitioning it into several disjoint independent sets.

Consider now the second case where the current set is of the form . Recall that all the vertices in belong to a removable cycle in the induced graph of the set of vertices . Our goal is to use Lemma 3.1 to color all these vertices. This by itself is not trivial as the cycles might overlap (by either sharing a common vertex or by being connected by an edge). A first attempt to solve this issue is to partition the cycles into sets such that in each one of them there are no two overlapping cycles. The problem with this approach is that when two (or more) cycles and overlap by sharing a vertex, we have to first color one of them, say , but then when getting to color some of its vertices are already colored and so we cannot use Lemma 3.1 to color . To overcome this, we loosely speaking do the following. We look at the following super graph of removable cycles. Each removable cycle is a node in the super graph and each two nodes in the super graph have an edge if their corresponding cycles overlap. We first color the nodes in the super graph and then we partition the vertices of as follows. Let be the set of colors used in the super graph (we will later show that is constant). Each original vertex from picks the cycle with the maximal color in which it participates in. We order these sets as follows: the first set of vertices is the vertices of that picked a cycle of minimum color , the second set are the vertices that picked a a cycle of color and so on. We then color the vertices in this order, that is, first color the vertices in and then the vertices in and so on. The key observation here is as follows. Consider a vertex belonging to for some . Let be the removable cycle participates in of the maximal color, note that by construction this color is . We claim that all vertices of belong to sets of the form for some and therefore when coloring the vertices and in particular, we can always assign colors to vertices .

We next define the super graph of cycles more formally. Given a set of vertices , we define to be the set containing all the vertices whose distance in from some vertex with identifier in is at most . For each , we denote by the graph whose nodes and edges are and , respectively.

###### Lemma 4.3.

For each , the maximum degree of the graph is less than .

###### Proof.

Let and . The degree of in is equal to the size of the set . In other words, the neighbors of are nodes that represent cycles in that either have a common vertex with the cycle that represents or there is an edge such that one endpoint of this edge is in and the other in . It is not hard to verify that the size of this set is bounded by the size of .

Let , let be the cycle that represents and be the cycle that represents. By definition, we have or there is an edge such that and . Since both cycles and are of length 4, it is not hard to verify that the distance between and in the induced graph of is at most 5. Moreover, all vertices of belong to . We get that the distance between and in the induced graph is at most . Note that the maximum degree in is at most 4. Straight forward calculations show that for a vertex in a graph of degree at most there could at most vertices at distance at most from it (we didn’t try optimize constants). Hence there could be at most such vertices in the set .

For each , we want to compute a proper -coloring of the graph so that each vertex with knows the value of . This can be done in by executing in parallel a -coloring algorithm (e.g. ) on the graph . Next, we want to compute a proper coloring of the graph so that each vertex with knows the value of . This can be done in rounds by simulating in parallel a -coloring algorithm for each on the graph .

The simulation can be done as follows. First we show that we can assign each node in an integer identifier that is polynomial in . If was the underling graph, then it is possible to map each key to an ID in the range (as the ID of each vertex is in the range and each key consists of 4 vertices in the original graph). This way, we get a graph of maximum degree (by Lemma 4.3) and maximum ID , and so we can find a proper -coloring in . But, the underling graph is and so we have to simulate this algorithm by forwarding each message of this algorithm to all the corresponding vertices in the graph (for example, each node in can be simulated by the vertex with the highest identifier in the cycle that represents). This increases the running time by a constant factor (as the length of each cycle in is of constant length).

The following algorithms are executed by each vertex . Algorithm 2 assigns a color to every as explained above. Note that these are not the final colors of the vertices but rather colors that are supposed to be used to partition the vertices in each into a small number of sets such that each such set can be colored simultaneously in parallel. Algorithm 3 then assigns each vertex the final color.

Now, in order to find a -coloring of the whole graph each vertex executes in parallel the following algorithm:

We say that a set of vertices is properly colored at some round , if in the start of this round we have for every vertex , and for every two adjacent vertices and in . We also say that a set of vertices is not colored at some round , if in the start of this round we have for every vertex . For each vertex , we assume here that and refer to the values that obtained after line 3. For each , we let denote the set of all vertices with .

The next lemma shows that when a vertex wants to pick a color in line 3 then a free color is always available, that is, it can pick a color from that is not yet used by any of its neighbors in , and that the resulting coloring by the end of step is proper.

###### Lemma 4.4.

For all , if at the start of the -th iteration of the loop at line 3, we have that is properly colored and is not colored, then by the end of step of the -th iteration of this same loop, we get that is properly colored and is not colored.

###### Proof.

Let . Assume that in the start of the -th iteration of the loop at line 3, we have that is properly colored and that is not colored. Let . There must be some iteration of the loop at line 3 in which detects that the condition at line 3 holds. As the set is equal to the set of all vertices that were active at the moment when became inactive in algorithm 1, we get that the degree of in the graph is less than , and so it can be adjacent to at most colored neighbors. It follows that can always find a color at line 3 which is different from all of its colored neighbors. It is left to show that by the end of step , we have for every two adjacent vertices and in . Let and be two adjacent vertices in . Since they are adjacent, we must have that and so we can assume with out loss of generality that . This means that is colored before and so when is colored it must be with a color different from .

Next, we show that it is always possible to find the required coloring at line 3. We start with the following lemma:

###### Lemma 4.5.

For any and , if and then at the start of the -th iteration of the loop in line 3 during the -th iteration of the loop in line 3 we must have for every vertex whose ID belongs to .

###### Proof.

Let and with and . Let be the set of all vertices whose ID belongs to , and for each such vertex , denote by the value of at the start of the -th iteration of the loop in line 3 during the -th iteration of the loop in line 3. Assume towards a contradiction that there is a vertex with . We claim that . To see this, note that as then is a removable cycle that was picked by some vertex in the ’th iteration of Algorithm 1. This means, that all the vertices whose ID in were active in the ’th iteration of Algorithm 1. Moreover, all these vertices belonged to a removable cycle in the ’th iteration of Algorithm 1 and therefore by construction for all , that is, . Since we assume that , it must be that . This means that the set did not contain the pair , as otherwise wouldn’t have picked as .

Since contains and , it must be that no vertex in whose distance from is at most had its key equal to at line 3 as would have collected it.

However, we claim that could have got only from a vertex whose distance from is at most , which is a contradiction. To see this, note that must have been picked as by a vertex whose ID belongs to in Algorithm 1. In other words, both and belong to the removable cycle that represents. As the removable cycle is of length 4, then the distance from to is at most , contradiction.

Our next goal is to show that by the end of the algorithm all vertices are colored and more over the coloring of all vertices is a proper coloring.

###### Lemma 4.6.

For all , if at the start of the second step of the -th iteration of the loop at line 3, we have that is properly colored and is not colored, then by the end of step of the -th iteration of this same loop, we get that is properly colored and is not colored.

###### Proof.

Let and . There must be some iteration of the loop at line 3 in which detects that the condition at line 3 holds. As the set is equal to the set of all vertices that were active at the moment when the vertex became inactive, we get that the vertices whose ID in induce a removable cycle of degree in . Since by Lemma 4.5 this cycle is not colored, we get from Lemma 3.1 that it is always possible to find a proper -coloring of which is consistent with the vertices that are already colored. It is left to show that by the end of step , we have for every two adjacent vertices and in . Let and be two such vertices. We distinguish between two cases: and . We claim that in the first case we must have . Indeed, assume towards a contradiction that . Since , we must have which is impossible as and are adjacent in . It follows that and since each vertex encodes this graph in the same way, they must compute the same -coloring of it (as they are using the same deterministic algorithm) and so their colors will be different. In the second case, we can assume without loss of generality that . This means that is colored before and so when is colored it must be with a color which is different from the color of .

By definition, we have for all , and so we can conclude the following:

###### Corollary 4.1.

For all , if is properly colored at the start of the -th iteration of the loop at line 3, then is properly colored at the end of the -th iteration of this loop.

Since and we get that is properly -colored by the end of the algorithm. The following simple lemma shows that the running time of the algorithm is .

###### Lemma 4.7.

The total number of communication rounds of the algorithm is .

###### Proof.

Each iteration of the outer loop in algorithm 1 and 3 requires a constant number of communication rounds and so each of them requires communication rounds in total. Algorithm 2 requires communication rounds.

## 5 Finding a 6-coloring of planar graphs

The general framework of the 6-coloring algorithm is similar to the algorithm given in the previous section. Similarly, the algorithm consists of three parts. The first part, given in Algorithm 4, partitions the vertices into disjoint sets for each (for some to be fixed later on). This is done by iteratively removing vertices that are part of some removable cycle or that are of degree less than . The second part, given in Algorithm 5, assigns each vertex a color . Similarly to the previous section this colors are not the final colors but are rather used to synchronize between the different vertices in each . Finally, Algorithm 6 assigns each vertex its final color.

We start by giving some technical lemmas that will be used in our analysis later on and then give the formal pseudo code of Algorithms 4, 5 and 6. The next auxiliary lemma will be crucial in our analysis:

###### Lemma 5.1.

For any graph and any two different, not edge-disjoint, simple cycles and in , if does not contain any removable cycle of length at most , then the graph is isomorphic to a complete graph.

The proof of the lemma is a quite technical. We first prove the following claim:

###### Claim 5.1.

For any graph and any two different, not edge-disjoint, simple cycles and in , if does not contain any removable cycle of length at most , then both and are isomorphic to a complete graph.

###### Proof.

Let and be two different, not edge-disjoint, simple cycles in a graph , and assume that does not contain any removable cycle of length at most . For each , let be the cycle graph .

For convenience, we only prove the claim for (as the proof for is symmetric). Clearly, if is even, then is isomorphic to a complete graph as does not contain any removable cycle of length . So it is left to show that is isomorphic to a complete graph when is odd. To this end, we consider separately the cases and .

If , then every edge in must also be in . This means that contains two different cycles and , and so it cannot be isomorphic to a cycle graph. It follows that must be isomorphic to a complete graph as does not contain any removable cycle of length .

If , then there exist a vertex . Let be the connected component of in . Clearly, (as and are not edge-disjoint and so also not vertex-disjoint) which implies that is a connected proper subgraph of (that is, is a subgraph of such that ). Now, is a connected proper subgraph of a cycle graph, and so it must be isomorphic to a path graph. Let be the number of vertices in . Note that . Let be the simple path that is isomorphic to.

We say that a vertex is an intersection point of with if either or . We claim that there exist two different intersection points of with . Indeed, if , then has two different neighbors and in (since ), and these neighbors also belong to as is the maximal connected component of in . Otherwise, , and so . Since is a cycle graph with vertices, each one of the vertices in has a neighbor in , and this neighbor also belongs to as is the maximal connected component of in . Denote these neighbors by and (where is the neighbor of