Precoloring Extension with Demands on Paths
Abstract
Let be a graph with a set of precolored vertices, and let us be given an integer distance parameter and a set of integer demands . The Distance Precoloring Extension with Demands (DPED) problem is to compute a vertex -coloring of such that the following three conditions hold: (i) the resulting coloring respects the colors of the precolored vertices, (ii) the distance of two vertices of the same color is at least , and (iii) the number of vertices colored by color is exactly . This problem is motivated by a program scheduling in commercial broadcast channels with constraints on content repetition and placement, which leads precisely to the DPED problem for paths.
In this paper, we study DPED on paths and present a polynomial time exact algorithm when precolored vertices are restricted to the two ends of the path and devise an approximation algorithm for DPED with an additive approximation factor polynomially bounded by and the number of precolored vertices. Then, we prove that the Distance Precoloring Extension problem on paths, a less restrictive version of DPED without the demand constraints, and then DPED itself, is NP-complete. Motivated by this result, we further study the parameterized complexity of DPED on paths. We establish that the DPED problem on paths is -hard when parameterized by the number of colors and the distance. On the positive side, we devise a fixed parameter tractable (FPT) algorithm for DPED on paths when the number of colors, the distance, and the number of precolored vertices are considered as the parameters. Moreover, we prove that Distance Precoloring Extension is FPT parameterized by the distance. As a byproduct, we also obtain several results for the Distance List Coloring problem on paths.
Keywords and phrases:
precoloring extension, distance coloring, FPT, approximation algorithmsFunding:
Michal Opler: This work was supported by the Czech Science Foundation Grant no. 24-12046S.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Parameterized complexity and exact algorithms ; Theory of computation Problems, reductions and completenessFunding:
This work was co-funded by the European Union under the project Robotics and advanced industrial production (reg. no. CZ.02.01.01/00/22_008/0004590).Acknowledgements:
We would like to thank Václav Blažej, Dušan Knop, Josef Malík and Ondřej Suchý, with whom we held preliminary discussions and obtained several observations relevant to this research.Editors:
Ho-Lin Chen, Wing-Kai Hon, and Meng-Tsung TsaiSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Vertex coloring of graphs is one of the most studied and fundamental problems in structural and algorithmic graph theory. A k-coloring of a given graph partitions its vertices into subsets (color classes) such that there is no edge between two members in the same partition. Graph coloring problems [19] have a rich research history [10, 22, 33, 7], comprising numerous variants and results, due to their significant applications in scheduling [4], resource allocation [26], compiler design [30], computational biology [20], network analysis [3], and geography [14]. We study a particular variant of the vertex coloring problem with three additional constraints. Some of the vertices are already given precolored on input, and the sought coloring must respect these colors. Additionally, we are given required sizes of all color classes (called demands), and finally, we require any two vertices of the same color to lie at a distance of at least from each other. A vertex coloring that satisfies the last condition is called a -distance coloring. Hence, classical vertex colorings are exactly -distance colorings. Alternatively, -distance colorings of a graph correspond to classical vertex colorings of the th power of .
Formally, the problem we consider is stated as follows.
Distance Precoloring Extension with Demands (DPED)
Input: A graph on vertices, a set of colors , a non-negative integer , a partial pre-coloring for some , and a demand function .
Question: Is there a -distance coloring that
extends (i.e., for every ), and
for every , the number of vertices newly colored by color is exactly , i.e., .
We address the problem for paths and disjoint unions of paths. Our research is motivated by a real-world scheduling problem of a television broadcasting company: A commercial block of a daily broadcast consists of slots ( vertices of a path), where some slots have already been allocated the type of commercial (precolored vertices). The commercials are already paid for (the demands are given), and no two commercials of the same type may be allocated close together. The task is thus to find an assignment of commercials to slots (color the vertices) such that no two commercials of the same type are too close (vertices being too close on the path must be colored by distinct colors), and all of the commercials (demands) are used. This original setting leads to a lot of interesting generalizations.
A notable amount of previous research has been done in the direction of the coloring of graphs and most of the problems are proved to be NP-hard depending on the type of the input. There are numerous complexity results for different variants of the coloring problems, for example, in terms of parameters like treewidth [13], distance to cluster and co-cluster [15], number of colors and maximum degree [9], clique modulator [17], or vertex cover [18]. Biró et al. [5] introduced the precoloring extension problem for interval graphs. They proved that the problem is polynomial time solvable when each color is used at most once for precoloring, and NP-complete when they are used twice or more. They also extended the results for graphs with bounded treewidth. They mentioned the problem as a variant of the List Coloring problem [11]. In this problem, each vertex is assigned with a list of colors, and they must be colored with a color from the assigned list. The graph is called L-list colorable if there exists a valid vertex coloring which chooses every color from the assigned lists , and it is called k-choosable if this is possible for any assignment of lists of size at least . List coloring has been studied on trees [6], planar graphs [32], and many other graph classes [29].
Yet another studied variant of coloring, the Equitable Coloring problem [25], requires the difference between the total number of vertices colored with two different colors to be at most one. Hence Coloring with Demands can be seen as a direct generalization of this notion. In practice, it is common to combine multiple constraints for coloring problems in order to address various applications, e.g., Pelsmajer [27] studied the problem of equitable list coloring. In the Distance Coloring problem, monochromatic vertices cannot occur within a given distance from each other. This generalization of coloring has also been studied extensively [28, 2, 1]. As stated earlier, the problem of coloring paths is motivated by scheduling problems and it has been studied for many other variants, including call scheduling [12], nonrepetitive list colourings [16], radio -colorings [8] etc.
In this paper, we study the complexity of DPED when is the union of disjoint paths. We prove that the decision version of the problem is NP-complete when the number of colors, the number of precolored vertices, and the minimum distance between two vertices of the same color are part of the input. This hardness motivates the study of the problem in terms of parameterized complexity. We reduce the problem to the problem of List Coloring with Demands. We show that both problems are W[1]-hard when parameterized by distance and the number of colors. We prove that the hardness holds for the list coloring problem even if we drop the condition of distance coloring. However, the problem admits an FPT algorithm when we drop the demands and consider only the distance, implying that Distance Precoloring Extension on paths is also FPT by distance. Both problems remain NP-complete when the number of colors, the number of precolored vertices, and the distance are considered a part of the input. On the positive side, we prove that DPED is polynomial time solvable on a single path when the precolored vertices appear only at the ends. Further, we show that DPED on path instances is FPT when the number of colors, the distance parameter, and the number of precolored vertices are considered as parameters simultaneously. Then we present an approximation algorithm that runs in time and provides an additive approximate solution with an error of . Finally, we establish the NP-completeness of the problems of Distance List Coloring and Distance Precoloring extension on paths. The relationships between the problems and the results are illustrated in Figure 1. We pose the complexity of the Precoloring Extension with Demands on paths as an interesting open problem.
The paper is organized as follows. Section 2 presents a polynomial time solution for the DPED problem on a path having only its ends precolored. In Section 3 we establish the W[1]-hardness of DPED when the parameters are the number of colors and the distance. Section 4 contains results for special cases, when the problem parameters (number of precolored vertices, number of colors, distance) are in some sense limited: we present an approximation algorithm with small additive error and an exact FPT algorithm. Finally, Section 5 presents dynamic programming algorithm and NP-completeness results for the variant without the demands.
2 Polynomial algorithm for paths with precolored end-vertices
As our first result, we show that Distance Precoloring Extension with Demands can be solved in polynomial time whenever we allow precolored vertices only at the ends of the path. In this setting, we are coloring a path with vertices with a precoloring that assigns colors to some initial segment and some final segment . We say that such an instance of DPED is end-precolored. We describe a greedy algorithm that solves end-precolored instances of DPED in polynomial time, regardless of both the number of colors and the distance parameter.
The algorithm colors the vertices in their left-to-right order along the path, starting with the first uncolored vertex. For each vertex, it computes a set of feasible colors for the current vertex and chooses the one with the highest remaining demand. In case of a tie, the algorithm chooses the color that appears earlier in the precoloring of the final segment of the path. We remark that to compute the set of feasible colors for vertex , it is necessary to exclude not only colors of the previous vertices to the left of but also the precolored endsegment in case is at distance at most from it. The technique is formally described in Algorithm 1.
Theorem 1.
Algorithm 1 solves DPED on end-precolored paths in time where is the number of vertices and is the number of colors.
Proof.
For contradiction, assume that Algorithm 1 fails, that is, there exists a feasible solution to the instance, and the algorithm does not find any. Let us denote the vertices of the path as from left to the right and let be the right precolored segment of . Let the algorithm produce a partial coloring and let be a feasible solution where the index satisfying for all and is the maximum possible. We are going to modify such that we obtain another feasible solution that agrees with even on .
Let and . By alternating -sequence starting at we denote a maximal subsequence of the vertices such that , for odd and for even , the distance of and is at most for every , and no vertex is precolored. Observe that when the algorithm was assigning color to , the remaining demand of the color was at least the remaining demand of the color , and that there is no color in the distance less than of the vertex . Also note that for an alternating -sequence , there can be no vertex of between any and colored by or , as this would break the distance property. Let us distinguish several cases.
First, consider the case when the last element of the sequence is closer than to the right precolored part of . In this case the sequence must contain all occurrences of color and among the vertices from to in . This implies that is an even sequence, as the demand of was at least the demand of . If the vertices from contain neither color nor color , we can freely swap the colors and in . Suppose now the vertices from contain color (or ). If there is no occurrence of or in that is within distance of , then the colors and can be swapped in . If the first occurrence of or in is within distance of , it must be because is colored by , but this contradicts the fact that the algorithm has colored with instead of .
Next, assume that the alternating -sequence starting at has even length and its last element is more than vertices away from the precolored right part of . We can freely swap the colors and at the vertices of as there is no conflict both to the left and right of , thus obtaining a feasible solution with greater index .
It remains to solve the case when has odd length and its last element is more than vertices far from the precolored right part of . The sequence contains one more color than and as the algorithm has chosen the color for (which means the remaining demand of was not greater than ), there must exists alternating -sequence starting at some vertex of odd length, disjoint from , which thus contains one more color than . We may assume that is not within distance to the right precolored part : if this is the case, we either obtain a contradiction if occurs before in and and had the same demand, or we can recolor and without problems. We may now swap the colors and both in and , which does not change the total number of colors used. This produces a feasible solution with greater index .
We obtained the contradiction in all cases, which shows the correctness of the algorithms. The time complexity follows from using a smarter data structure for assigning the available colors: we may dynamically maintain a binary heap containing the set of feasible colors with the key being a combination of the remaining demand with position () and the value stored being the color label.
3 Few colors and small distance
In this section, we focus on solving general instances of DPED when both the number of colors and the distance parameter are not too large. We stress that this additional assumption is very natural, e.g., for the original scheduling motivation.
First, we observe that we can solve DPED in this regime in polynomial time, provided that the number of colors and the distance parameter are constant. The algorithm follows a standard dynamic programming approach for coloring and thus, we provide here only a brief sketch with all the details available in the full version.
Proposition 2.
An instance of DPED on paths can be solved in time where is the number of vertices and is the number of colors.
Proof sketch.
Let be a -distance coloring of an initial segment of the path . The signature of consists of the colors of the rightmost vertices together with the frequencies of individual colors as used by . The algorithm sequentially computes for each all possible signatures of -distance colorings of that, moreover, extend the precoloring . At the end, this suffices to check whether there is a -distance coloring of that extends and the frequencies of colors used equal the demands.
It is only natural to ask whether we can achieve a polynomial runtime in this regime where the degree of the polynomial is independent of both and . We answer this question negatively, under standard theoretical assumptions, by showing that DPED is W[1]-hard with respect to both of these parameters.
Theorem 3.
DPED is W[1]-hard on paths with respect to the number of colors and the distance .
We first show W[1]-hardness of a related coloring problem, namely List Coloring with Demands. We define the problem formally as follows.
List Coloring with Demands (LCD)
Input: A graph on vertices, a set of colors , a function that assigns a list of colors to each vertex, and a demand function .
Question: Is there an -list coloring that satisfies the demands ?
An instance of LCD is a path instance if the graph is a disjoint union of paths. Moreover, a path instance of LCD is non-alternating if there does not exist a color and three consecutive vertices on some path such that and simultaneously .
The LCD problem has already been shown to be W[1]-hard on paths with respect to the number of colors by Gomes, Guedes, and dos Santos [15] albeit under a different name of Number List Coloring. However, the produced instances of LCD therein are very far from having the non-alternating property that is crucial in proving Theorem 3. We devise a novel reduction from a multidimensional version of the subset problem that, moreover, produces non-alternating path instances of LCD. Due to the space constraints, we omit the proof which can be found in the full version.
Theorem 4.
LCD is W[1]-hard with respect to the number of colors even when restricted to non-alternating path instances.
Theorem 3 is obtained through a polynomial-time reduction from LCD on non-alternating path instances. Crucially, both the distance parameter and the number of colors in the produced DPED instance are linear in the number of colors in the original LCD instance.
Proof of Theorem 3.
For technical reasons, we first modify the LCD instance to guarantee that it is a single path, and both of its endpoints have a list identical to its only neighbor . That is achieved by introducing two extra colors and concatenating all paths in arbitrary order with two extra vertices in between consecutive pairs and two extra vertices at the very beginning and end where we add to the list of all vertices and set for each new vertex. Finally, we set where is the total number of paths in . It is easy to see that the modified instance is equivalent. Furthermore, the modified instance remains non-alternating because there are two extra new vertices between any pair of original paths, and the colors are included in the list of every vertex.
From now on, we assume that is a single path with vertices and edges such that for each . Moreover, we have and .
Now, we show that the lists of such a non-alternating LCD path instance can be alternatively represented by lists of forbidden colors for each edge. It is crucial that the instance of LCD is non-alternating, as otherwise, this may not be possible. Moreover, we will also guarantee that any fixed color can be contained in the forbidden sets of at most two consecutive edges.
Claim 5.
We can compute in polynomial time an assignment of color sets to edges such that for every vertex , we have where are the two edges incident to , or if is incident to a single edge . Moreover, there are no three consecutive edges , and such that the intersection is non-empty.
Proof.
We define the assignment inductively along the path. We set and . Recall that we first modified the instance to guarantee that each endpoint of the path has an identical list to its neighbor, i.e., and . For , we let contain a color if and only if and moreover, either (i) , or (ii) . See Figure 2. Clearly, can be computed in polynomial time.
Let us verify the properties of . For the endpoints and , we have and by definition. Now, fix arbitrary and a color . If we have , then neither nor contain by definition and . On the other hand, if , it follows from the non-alternating property that either or . We consider the three possible cases. First, assume that appears in none of the lists , , and . Then either or we have which triggers the condition (i) in the definition of and either way, we get that . Second, assume that appears in the list but not in . In this case, we have by condition (ii) in the definition of and again, we see that . Finally, assume that appears in the list but not in . In this case, we have , which implies by condition (i) in the definition. In all cases, we obtained .
Assume for a contradiction that there are three consecutive edges , and such that the intersection is non-empty and let be an arbitrary color in the intersection. However, observe that in the definition of neither condition (i) nor (ii) holds for and thus, we must have .
With this assignment , we are finally ready to define the path instance of DPED. Let denote the size of the color set and let be an arbitrary enumeration of the colors. We set . We take the graph to be a path of length on vertices in this order along the path. To simplify the exposition, we partition the vertices into two distinct sets. Every vertex for some is a main vertex and we denote it alternatively by . All the remaining vertices are auxiliary. For , and , the vertex is an auxiliary vertex associated to color and we alternatively denote it by . Observe that every two consecutive main vertices and are separated by exactly auxiliary vertices that are grouped into pairs associated to colors in this order. More specifically, the segment between and contains the auxiliary vertices for all and , ordered lexicographically by the pairs . See Figure 3.
Our goal is to define a pre-coloring of all the auxiliary vertices such that there is a one-to-one correspondence between feasible colorings of the main vertices and feasible colorings of the original LCD instance. As a final ingredient, we need to be able to assign extra colors to certain vertices without affecting the rest of the instance. To that end, we set where is a set of auxiliary colors disjoint from . Moreover, we define an auxiliary coloring where for each . Informally, the coloring simply cyclically iterates through the sequence of auxiliary colors along the path, starting with . Clearly, is a proper -distance coloring of .
We define the pre-coloring of every auxiliary vertex. For and , we set
where we additionally define for simplicity.
First, observe that the pre-coloring exactly encodes the assignment of forbidden colors to edges.
Observation 6.
A color appears in the pre-coloring on the segment between main vertices and if and only if .
Moreover, we show that distributes the occurrences of a fixed color at a sufficient distance from each other.
Claim 7.
The pre-coloring does not contain any monochromatic pair of vertices at a distance at most .
Proof.
Assume for a contradiction that does contain such a pair of monochromatic vertices. We have already observed that is a proper -coloring on a disjoint set of auxiliary colors and thus, this pair must use some color . We cannot have for any fixed since the respective conditions in the definition of are mutually exclusive.
For any different with and arbitrary , the distance between and is at most if and only if and . We cannot have by definition of . So the only option left is that for either . But in that case, we have since and simultaneously, since . Thus, we reached a contradiction since does not contain the same color in the sets of three consecutive edges.
To finish the construction, it remains to define the demand function . We set for every original color and we set for every auxiliary color .
Correctness (“only if”).
Suppose that is a yes-instance of LCD and let be an -list coloring that meets the demands. We define a coloring by simply setting for every main vertex and for every auxiliary vertex . The coloring is an extension of by definition, and it meets the demands because the demand functions and are equal when restricted to the color set . Thus, it remains to show that is a proper -distance coloring.
Assume for a contradiction that contains a pair of monochromatic vertices and at a distance at most . At least one of these vertices has to be a main vertex since the colors of all auxiliary vertices are fixed by and there is no such monochromatic pair of pre-colored vertices by Claim 7. First, assume that both and are main vertices. Two main vertices are in distance at most if and only if they are consecutive, i.e., we have without loss of generality and for some . But then they cannot share the same color since , and is a proper list-coloring of . Otherwise, suppose without loss of generality that is a main vertex and is an auxiliary vertex. The coloring can use only the colors from on the main vertices and thus, we have for some . Moreover, the vertex lies either on the segment between and or on the segment between and as those are the only auxiliary vertices at a distance at most from . Observation 6 then implies that we have either or . But we know that by Claim 5. In particular, the color does not appear in the list , which is a contradiction with being a proper list-coloring since .
Correctness (“if”).
Now suppose that is a yes-instance of DPED and let be a witnessing -distance coloring, i.e., extends the pre-coloring and meets the demands given by . We define a coloring by simply restricting to the main vertices, that is we set . First, observe that the range of is indeed only the color set since the demand of any auxiliary color is zero and thus, uses only the colors from on the main vertices. Moreover, we have for every because the main vertices and are at distance in . The demands are also satisfied by because the demand functions and are equal when restricted to the color set .
It remains to check that is an -list coloring, i.e., we have for all . Assume for a contradiction that this does not hold for a vertex with . By Claim 5, the color belongs to at least one of the sets and . Observation 6 implies that the color is used by on some auxiliary vertex from the segment between and . But all these vertices are at a distance at most from and we reach a contradiction with being a proper -distance coloring.
4 Few precolored vertices
In this section, we consider the regime when we are given only a few precolored vertices. We present two effective algorithms for DPED in this regime. We first show that an approximation FPT algorithm with small additive error is possible even in the case of many colors. Afterwards, we present an exact FPT algorithm when the number of colors is small as well.
4.1 Approximation
Next, we show there is an approximation algorithm for DPED with additive error, which is bounded by a polynomial function of the distance parameter and the number of colors. By having additive error we mean that for the set of colors and demands the algorithm produces coloring such that
Theorem 8.
Let us have an instance of DPED on path of length with precolored vertices, and let . There is an approximation algorithm that runs in time and outputs a coloring with an additive error at most .
Proof.
The approximation algorithm is as follows. We ignore all precolored vertices and we run the greedy Algorithm 1 to color the path . Let the precolored vertices be denoted , respectively, along the path , which consists of vertices from left to right. Let . Then we remove the colors in the neighborhood of diameter around each precolored vertex (that is, for the vertices whose distance to some is at most ). The idea is now to reassign the colors to these discolored vertices while introducing only a small additive error.
First we handle all pairs of vertices such that as follows. If , it is easy to find the coloring of the gap between and in a greedy manner. If , we produce -distance coloring of each segment of consecutive gaps of size at most by dynamic programming in time . We may thus further assume that all remaining uncolored gaps between pairs of vertices have . For a precolored vertex , which equals to some , let us denote by left neighborhood of those vertices , where and . Similarly, we define the right neighborhood as vertices where and . We now describe the procedure that colors the diameter neighborhood of each , first the left neighborhood and then the right neighborhood (provided that the respective neighborhood is still uncolored). Observe that if the right neighborhood of and left neighborhood of are both uncolored then they are disjoint as . We split the vertices of the left neighborhood into blocks of size . Let us denote the vertices immediately preceding block as and let the vertices after be denoted as . Here, the vertex is the first vertex of and we choose the coloring of to consist of the precoloring of followed by arbitrarily chosen valid coloring of the rest of . Denote by the color of the vertex of the block .
We proceed by partial modification of the coloring of each block into the block , for . Let the coloring of be, without loss of generality, . For the block , we copy the coloring from , where we remove the occurrence of color , shift the colors to the right, and introduce a new first color to be (that is, an extra color). For the block , we copy the coloring from , where we replace the first color into . Note that by these two steps, we did not create any color conflict for vertices closer than . For we now continue in a similar manner: let the coloring of the block be copied from the block , where we remove the occurrence of the color , shift the colors to the right and set to . The coloring of is copied from , but we set to . Note that the number of blocks is enough to correctly replace all colors such that at the end the coloring of the block is reached and no coloring conflict is created.
After the coloring of the left neighborhood of , we proceed similarly with the right neighborhood (with the difference that the block may now inherit the coloring from the first (greedy) phase. The total running time is clearly . The additive error introduced by this coloring routine is at most the size of all neighborhoods of the precolored vertices , which is .
4.2 Exact algorithm for few colors
We have already seen that DPED is W[1]-hard when parameterized by both the number of colors and the distance, which rules out the existence of an FPT algorithm parameterized by these parameters alone under standard assumptions. We have also seen that an FPT approximation algorithm with additive error is possible if there are few precolored vertices and the distance parameter is small, even for an unbounded number of colors. Here, we build on these results and show that an exact FPT algorithm is possible when the number of colors, the distance parameter, and the number of precolored vertices are all small. In some ways, it can also be seen as an extension of the greedy algorithm from Theorem 1 in the case of few colors and small distance. Our approach exploits an intriguing connection between -distance colorings of paths and regular languages.
A non-deterministic finite automaton (NFA) is a tuple , where is a finite alphabet, is a finite set of states, is an initial state, is the set of final states, and is a transition relation. A word over the alphabet is accepted by if there exists a sequence of states such that is the initial state , is some final state in and we have for every . We denote by the language of all words accepted by .
For a word and a letter , we let denote the number of occurrences of in . We assume that and we define the Parikh image of a word to be the tuple . In other words, the Parikh image of a word captures exactly the number of occurrences of each letter from in . Moreover, for a set of words , we let denote the set of all Parikh images of words in .
It is known that given a small NFA over a small alphabet together with a tuple , it is possible to efficiently decide whether there exists a word in such that .
Theorem 9 ([21, 31]).
Given an NFA with states over the alphabet of size , and a tuple , checking whether can be done in time where .
The main theorem of this section follows by reducing DPED to membership for Parikh images of a regular language given by a small NFA. In order to make the argument easier to follow, we use an intermediate problem that asks whether there exists a word in the regular language with a given Parikh image that, moreover, has predetermined letters in some positions. Let be a relation where is a finite alphabet. We say that a word is -constrained if we have for every .
Constrained Membership for Parikh Languages of NFAs (CMPL)
Input: An NFA over alphabet of size , a tuple and a relation .
Question: Is there a -constrained word such that ?
Theorem 10.
CMPL can be solved in time where is the number states of the NFA , and .
Due to the space constraints, we omit the proof of Theorem 10.
Theorem 11.
DPED can be solved on path instances in time where is the number of colors, is the distance parameter and is the number of precolored vertices.
Proof.
Let be an instance of DPED. As we have observed before, we can assume that is in fact a single path on vertices in this order along the path.
We start by showing that proper -distance colorings of paths form a regular language over . But first, we need some notation. For an alphabet and a positive integer , we let denote the set of all words of length at most over with no repeated letters, including the empty word . Moreover for word and letter , we let be an operation which appends the letter at the end of and then possibly deletes the first letter if already has length .
Now we can define the NFA where if and only if . The language clearly contains exactly those words over that do not contain two occurrences of the same letter at a distance less than from each other. See Figure 4. Therefore, the NFA accepts exactly valid -distance colorings of paths, and we can solve DPED with no precolored vertices by invoking Theorem 9 for the NFA where the tuple encodes the demand function .
Moreover, we can encode the precolored vertices as additional constraints. In particular, we define a set of constraints where if and only if the vertex is precolored and . Additionally, we set where for each . Observe that the mapping where is a bijection between -constrained words with and proper distance -colorings of that extend and satisfy the demands . In other words, is yes-instance of DPED if and only if is a yes-instance of CMPL.
To finish the proof, it remains to invoke the algorithm of Theorem 10 on the produced NFA , the tuple , and the set of constraints . The desired runtime follows since the automaton has states and the alphabet is exactly the set of colors of size .
5 Coloring without demands
In this section, we focus on variants of the two problems (Precoloring Extension and List Coloring) on paths where we no longer specify demands for each color, but we still require vertices at distance at most to receive different colors. We refer to these problems as Distance Precoloring Extension (DPE) and Distance List Coloring (DLC). Due to the space constraints, we defer most proofs from this section to the full version.
We show that DPE is NP-complete on paths by reduction from Precoloring Extension on unit interval graphs [24]. We remark that unit interval graphs are a suitable source of hardness since it is known that unit interval graph are precisely the induced subgraphs of path powers [23]. As a consequence, we obtain the NP-completeness of DPED on paths.
Theorem 12.
DPE is NP-complete even when restricted to paths.
Corollary 13.
DPED is NP-complete even when restricted to paths.
Proof of Corollary 13.
Let be an instance of DPE where is a path with vertices. We construct an instance where is simply obtained by adding isolated vertices (paths of zero length) to and setting for every . Clearly, every -distance coloring of that extends induced the desired -distance coloring of , regardless of the demands. On the other hand, we can extend any -distance coloring of to by coloring exactly of the isolated vertices with each color to satisfy all demands.
Finally, we construct an equivalent instance of DPED on a single path. It suffices to concatenate all the disjoint paths in to a single path while adding auxiliary vertices between each consecutive pair of original paths. These auxiliary vertices are then greedily precolored with new auxiliary colors disjoint from that have zero demands. In this way, the -distance colorings of individual paths from are independent from each other, and the equivalence follows.
In contrast, we show that the problem Distance Precoloring Extension without demands becomes FPT by the distance parameter even for an unbounded number of colors. Recall that Distance Precoloring Extension with Demands is W[1]-hard with respect to by Theorem 3. In fact, we show the existence of an FPT algorithm for the more general problem of Distance List Coloring where the task is to find a list coloring that assigns different colors to every pair of vertices at distance at most .
Theorem 14.
Distance List Coloring can be solved on paths in time where is the number of vertices.
References
- [1] Geir Agnarsson, Raymond Greenlaw, and Magnús M Halldórsson. On powers of chordal graphs and their colorings. Congressus Numerantium, pages 41–66, 2000.
- [2] Geir Agnarsson and Magnús M. Halldórsson. Coloring powers of planar graphs. SIAM J. Discret. Math., 16(4):651–662, 2003. doi:10.1137/S0895480100367950.
- [3] Leonid Barenboim, Michael Elkin, and Fabian Kuhn. Distributed ( + 1)-coloring in linear (in ) time. SIAM J. Comput., 43(1):72–95, 2014. doi:10.1137/12088848X.
- [4] Sayan Bhattacharya, Deeparnab Chakrabarty, Monika Henzinger, and Danupon Nanongkai. Dynamic algorithms for graph coloring. In Artur Czumaj, editor, Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 1–20. SIAM, 2018. doi:10.1137/1.9781611975031.1.
- [5] Miklós Biró, Mihály Hujter, and Zsolt Tuza. Precoloring extension. I. Interval graphs. Discret. Math., 100(1-3):267–279, 1992. doi:10.1016/0012-365X(92)90646-W.
- [6] Hans L. Bodlaender, Carla Groenland, and Hugo Jacob. List colouring trees in logarithmic space. In Shiri Chechik, Gonzalo Navarro, Eva Rotenberg, and Grzegorz Herman, editors, 30th Annual European Symposium on Algorithms, ESA 2022, September 5-9, 2022, Berlin/Potsdam, Germany, volume 244 of LIPIcs, pages 24:1–24:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPICS.ESA.2022.24.
- [7] Hajo Broersma, Petr A. Golovach, Daniël Paulusma, and Jian Song. On coloring graphs without induced forests. In Otfried Cheong, Kyung-Yong Chwa, and Kunsoo Park, editors, Algorithms and Computation – 21st International Symposium, ISAAC 2010, Jeju Island, Korea, December 15-17, 2010, Proceedings, Part II, volume 6507 of Lecture Notes in Computer Science, pages 156–167. Springer, 2010. doi:10.1007/978-3-642-17514-5_14.
- [8] Gary Chartrand, Ladislav Nebesky, and Ping Zhang. Radio k-colorings of paths. Discuss. Math. Graph Theory, 24(1):5–21, 2004. doi:10.7151/DMGT.1209.
- [9] Guilherme de C. M. Gomes, Carlos V. G. C. Lima, and Vinícius Fernandes dos Santos. Parameterized complexity of equitable coloring. Discret. Math. Theor. Comput. Sci., 21(1), 2019. doi:10.23638/DMTCS-21-1-8.
- [10] Marc Demange, Tínaz Ekim, Bernard Ries, and Cerasela Tanasescu. On some applications of the selective graph coloring problem. Eur. J. Oper. Res., 240(2):307–314, 2015. doi:10.1016/J.EJOR.2014.05.011.
- [11] Paul Erdős, Arthur L Rubin, and Herbert Taylor. Choosability in graphs. Congr. Numer, 26(4):125–157, 1979.
- [12] Thomas Erlebach and Klaus Jansen. The complexity of path coloring and call scheduling. Theor. Comput. Sci., 255(1-2):33–50, 2001. doi:10.1016/S0304-3975(99)00152-8.
- [13] Michael R. Fellows, Fedor V. Fomin, Daniel Lokshtanov, Frances A. Rosamond, Saket Saurabh, Stefan Szeider, and Carsten Thomassen. On the complexity of some colorful problems parameterized by treewidth. Inf. Comput., 209(2):143–153, 2011. doi:10.1016/J.IC.2010.11.026.
- [14] Robert Freimer. Generalized map coloring for use in geographical information systems. In Ki-Joune Li, Kia Makki, Niki Pissinou, and Siva Ravada, editors, ACM-GIS 2000, Proceedings of the Eighth ACM Symposium on Advances in Geographic Information Systems, November 10-11, 2000, Washington D.C., USA, pages 167–173. ACM, 2000. doi:10.1145/355274.355299.
- [15] Guilherme C. M. Gomes, Matheus R. Guedes, and Vinícius Fernandes dos Santos. Structural parameterizations for equitable coloring: Complexity, FPT algorithms, and kernelization. Algorithmica, 85(7):1912–1947, 2023. doi:10.1007/S00453-022-01085-W.
- [16] Jaroslaw Grytczuk, Jakub Przybylo, and Xuding Zhu. Nonrepetitive list colourings of paths. Random Struct. Algorithms, 38(1-2):162–173, 2011. doi:10.1002/RSA.20347.
- [17] Gregory Z. Gutin, Diptapriyo Majumdar, Sebastian Ordyniak, and Magnus Wahlström. Parameterized pre-coloring extension and list coloring problems. SIAM J. Discret. Math., 35(1):575–596, 2021. doi:10.1137/20M1323369.
- [18] Lars Jaffke and Bart M. P. Jansen. Fine-grained parameterized complexity analysis of graph coloring problems. Discret. Appl. Math., 327:33–46, 2023. doi:10.1016/j.dam.2022.11.011.
- [19] Tommy R. Jensen and Bjarne Toft. Graph Coloring Problems. Wiley Series in Discrete Mathematics and Optimization. Wiley, 2011.
- [20] Susan Khor. Application of graph colouring to biological networks. IET Systems Biology, 4:185–192, 2010. doi:10.1049/iet-syb.2009.0038.
- [21] Eryk Kopczynski and Anthony Widjaja To. Parikh images of grammars: Complexity and applications. In Proceedings of the 25th Annual IEEE Symposium on Logic in Computer Science, LICS 2010, 11-14 July 2010, Edinburgh, United Kingdom, pages 80–89. IEEE Computer Society, 2010. doi:10.1109/LICS.2010.21.
- [22] Jan Kratochvíl, Zsolt Tuza, and Margit Voigt. New trends in the theory of graph colorings: Choosability and list coloring. In Ronald L. Graham, Jan Kratochvíl, Jaroslav Nešetřil, and Fred S. Roberts, editors, Contemporary Trends in Discrete Mathematics: From DIMACS and DIMATIA to the Future, Proceedings of a DIMACS Workshop, Stirín Castle, Czech Republic, May 19-25, 1997, volume 49 of DIMACS Series in Discrete Mathematics and Theoretical Computer Science, pages 183–197. DIMACS/AMS, 1997. doi:10.1090/dimacs/049/13.
- [23] Min Chih Lin, Dieter Rautenbach, Francisco J. Soulignac, and Jayme Luiz Szwarcfiter. Powers of cycles, powers of paths, and distance graphs. Discret. Appl. Math., 159(7):621–627, 2011. doi:10.1016/J.DAM.2010.03.012.
- [24] Dániel Marx. Precoloring extension on unit interval graphs. Discret. Appl. Math., 154(6):995–1002, 2006. doi:10.1016/j.dam.2005.10.008.
- [25] Walter Meyer. Equitable coloring. The American mathematical monthly, 80(8):920–922, 1973.
- [26] Hiroki Osawa, Akira Suzuki, Takehiro Ito, and Xiao Zhou. Algorithms for coloring reconfiguration under recolorability constraints. In Wen-Lian Hsu, Der-Tsai Lee, and Chung-Shou Liao, editors, 29th International Symposium on Algorithms and Computation, ISAAC 2018, December 16-19, 2018, Jiaoxi, Yilan, Taiwan, volume 123 of LIPIcs, pages 37:1–37:13. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018. doi:10.4230/LIPIcs.ISAAC.2018.37.
- [27] Michael J. Pelsmajer. Equitable list coloring and treewidth. J. Graph Theory, 61(2):127–139, 2009. doi:10.1002/jgt.20373.
- [28] Alexa Sharp. Distance coloring. In Lars Arge, Michael Hoffmann, and Emo Welzl, editors, Algorithms – ESA 2007, 15th Annual European Symposium, Eilat, Israel, October 8-10, 2007, Proceedings, volume 4698 of Lecture Notes in Computer Science, pages 510–521. Springer, 2007. doi:10.1007/978-3-540-75520-3_46.
- [29] Riste Skrekovski. Choosability of -minor-free graphs. Discret. Math., 190(1-3):223–226, 1998. doi:10.1016/S0012-365X(98)00158-7.
- [30] Michael D. Smith, Norman Ramsey, and Glenn H. Holloway. A generalized algorithm for graph-coloring register allocation. In William W. Pugh and Craig Chambers, editors, Proceedings of the ACM SIGPLAN 2004 Conference on Programming Language Design and Implementation 2004, Washington, DC, USA, June 9-11, 2004, pages 277–288. ACM, 2004. doi:10.1145/996841.996875.
- [31] Anthony Widjaja To. Parikh images of regular languages: Complexity and applications. CoRR, 2010. arXiv:1002.1464.
- [32] Margit Voigt. List colourings of planar graphs. Discret. Math., 120(1-3):215–219, 1993. doi:10.1016/0012-365X(93)90579-I.
- [33] D.R. Woodall. List colourings of graphs, pages 269–301. London Mathematical Society Lecture Note Series. Cambridge University Press, 2001.
