Let be either a graph or a digraph. An acyclic -coloring of is an assignment of colors to the vertices in , so that the vertices of each color induce an acyclic subgraph of . Note that the vertex sets partition . An equivalent condition on the -coloring is that no cycle in is monochromatic. (In the case of digraphs is a directed cycle.) The least such that admits an acyclic -coloring is called the arborocity of if is a graph , and is called the dichromatic number of if is a digraph . In both cases, the problem of deciding if has an acyclic -coloring is NP-complete, for any fixed . In this paper we study the effect of restrictions on the girth and the degrees in . For digraphs, we define the directed girth to be the minimum length of a directed cycle, if one exists, and leave it undefined otherwise; and we take the degree of a vertex to be the sum of its in-degree and out-degree.
We focus on a combination of girth and degree constraints, and we look at the two opposite ends of the spectrum: small girth with high degree on the one hand, and large girth with small degree on the other. For the former problem, graphs of high degree and small girth are typified by complete graphs and the arboricity of complete graphs is trivial, but digraphs of high degree and small directed girth are typified by tournaments, and the dichromatic number of tournaments is already a hard problem: even just deciding acyclic two-colorability of a tournament is known to be NP-complete  (see also ). We prove that for random acyclically -colorable tournaments we can recover the unknown acyclic -coloring in deterministic linear time, with high probability over the choices of . (Such a coloring is unique with high probability, as long as is a constant.) This underscores the fact that the NP-completeness does not come from random instances. We placed this discussion in the last section, as it is quite technical.
For the latter problem, we consider graphs and digraphs of low degree and high girth. It is known that in the context of classical graph colorings, for each and there exists a such that deciding -colorability of graphs with girth at least and all degrees at most is NP-complete ). We offer a simple proof of this fact to illustrate our techniques, and then prove an analogous result for acyclic colorings. For both graphs and digraphs, we consider the special cases of separately, as we can offer simpler proofs and/or better bounds. In any case, even at this opposite end of the scale, the arboricity and the dichromatic number remain mostly NP-complete.
Our NP-completeness constructions depend on gadgets constructed from graphs and digraphs with high girth and high arboricity or dichromatic number. There are well known constructions of graphs and digraphs with high girth and high chromatic and dichromatic numbers [6, 3]. As far as we were able to determine, there does not appear to be such a result for arboricity, so we provide a short proof. The proof depends on a general result for high girth relational systems from ; in fact the same result implies the corresponding results for the chromatic and dichromatic numbers as well.
To highlight the gap for digraphs between the largest acyclic induced subgraph and the largest acyclic induced subgraph that can be found in polynomial time, we prove that even for digraphs (without digons) that have an acyclic -coloring, and hence must have acyclic subgraphs of size , it is hard to find one of size greater than (Theorem 4.2).
2 Graphs and Digraphs with High Girth and Low Degrees
The following prototype result for ordinary -coloring of undirected graphs is known . We offer an easy proof to illustrate our technique.
There exists a function such that given , the -colorability of a graph of girth at least , and of maximum degree at most , is NP-complete.
Proof. We shall reduce from the problem of -colorability. Given a graph , we shall construct a graph with maximum degree at most and girth at least that is -colorable if and only if is -colorable. The first step is to replace each vertex with a binary tree having leaves, and place each edge of between the -th leaf of and the -th leaf of . The resulting graph has maximum degree three. In the second step we shall replace each edge of every tree by a gadget designed to ensure that the girth of the resulting graph is at least and that all vertices that were leaves of any one obtain the same colour in any -colouring of . This ensures that is -colourable if and only if is -colourable. The maximum degree of is then three times the maximum degree of the gadget , so . It remains to construct : it is well known that for any and there exists a graph which is not -colorable and has girth at least  (for a constructive proof see ). We may assume that contains an edge such that is -colorable. We let to be the graph , and replace each edge of every by a copy of , identifying with and with . Since the girth of was at least , each path joining and in has at least vertices, and the girth of the entire graph is at least . Any -colouring of assigned the same color to and in each copy of , since otherwise would have been -colorable.
The same technique can be applied to acyclic coloring problems. We start with discussing the computational complexity of arboricity of graphs of high girth and low degree, and prove that it remains NP-complete. We begin with the special case of .
There is a function such that given , the problem of acyclic two-coloring a graph of girth at least , and of maximum degree at most , is NP-complete.
Proof. Fix . In this case we reduce from the not-all-equal -satisfiability problem with three occurences of each variable, which is NP-complete by Feder and Ford . An instance of this problem is a set of variables with binary values, and a set of clauses each consisting of variables. The question is if values can be chosen so that no clause has all variables of the same value. (This is also known as the two-colorability problem for -uniform hypergraphs .) Given such an instance, we replace each clause by a disjoint cycle of vertices, one corresponding to each variable. Clearly, in every acyclic two-colouring each of these cycles will receive both colours. We need to ensure that all three occurences of a variable are given the same value. We shall add for every variable a simple claw with the three leaves identified with the three occurences of . The resulting graph has maximum degree three. For this construction we shall similarly use a gadget to replace each edge of every claw ; the gadget will ensure that the final graph has girth at least and have the same color on the three occurences of each variable, in every acyclic two-colouring of . This guarantees that is acyclically two-colorable if and only if the original instance is satisfiable. We construct from a graph that has girth at least that does not admit an acyclic -coloring, but contains an edge such that is acyclically -colorable. We then replace each edge of each by a copy of , identifying with and with . The construction of such a graph is discussed in the next section.
The general result is the following.
There exists a function such that given , the problem of acyclic -coloring a graph of girth at least , and maximum degree at most , is NP-complete.
Proof. Here we combine both of the previous tricks. We again reduce from the problem of graph -colorability. Thus let be an instance. We again replace each vertex by a binary tree with leaves. We will use two gadgets, and with the following properties:
has vertices such that any acyclic -coloring of assigns the same color to and ;
has vertices such that any acyclic -coloring of assigns different colors to and ;
has girth at least and contains no path with fewer than vertices between and ; and
has girth at least .
Each edge of each will be replaced by identifying with and with , and each edge of will similarly be replaced by a copy of between the corresponding leaves of and . The resulting graph has girth at least because every cycle in is either inside a copy of some , or passes through some . Clearly, is acyclically -colorable if and only if is -colorable in the usual sense. The degrees of are maximized by three times the maximum degree of any in .
It remains to explain how to construct . Let be a graph of girth that is not acyclically -colorable but has an edge such that is acyclically -colorable. (These graphs are constructed in the next section.) Let and let be obtained from by subdividing the edge by a new vertex . We also take and . Then it is easy to verify that satisfy the required properties. Indeed, in any acyclic -coloring of , the vertices must obtain the same colour, otherwise would also be acyclically -colorable. The same argument holds for and and , and therefore and must obtain different colors. Any path between and in contains at least vertices, otherwise would contain a cycle shorter than .
We are ready to tackle the desired result for the dichromatic number.
There exists a function such that given , the problem of acyclically -coloring a digraph of directed girth at least , and of in-degrees and out-degrees at most , is NP-complete.
Proof. The proof is similar to the undirected case above. We again reduce from graph -colorability. Let be an instance, and replace each vertex by an oriented binary tree with leaves. The tree is first rooted at a non-leaf vertex, then oriented away from the root. We will use two digraph gadgets, with the following properties:
has vertices such that any acyclic -coloring of assigns the same color to and ;
has vertices such that any acyclic -coloring of assigns different colors to and ;
has directed girth at least and contains no directed path with fewer than vertices from to ; and
has directed girth at least .
Each directed edge of each will be replaced by identifying with and with , and each directed edge of will similarly be replaced by a copy of between the corresponding leaves of and . The resulting graph has directed girth at least because every directed cycle in is either inside a copy of some , or passes through some . Clearly, is acyclically -colorable if and only if is -colorable in the usual sense. The in- and out-degrees of are maximized by three times the maximum in- and out-degree of any in .
In this case there is again a simpler construction when .
Given , the problem of acyclic 2-coloring a digraph of directed girth at least and of in-degrees and out-degrees at most , is NP-complete.
Proof. We proceed as in Theorem 2.2, reducing from the not-all-equal -satisfiability problem with three occurences of each variable , replacing each clause with a disjoint directed -cycle. To ensure that the three occurences of a variable in clauses have the same value, we consider for each variable a separate digraph whose vertices are partitioned into sets with of size one, an independent set of size three and each for inducing a directed -cycle. In addition, we include all edges from to , and to . In any acyclic two-coloring of , each for must have both colors, so the colors in must all be different from the color in , and hence the same. The three elements of can thus be identified with the three occurences of .
3 High Girth Graphs and Digraphs
In this section we discuss the existence of high-girth graphs and digraphs without acyclic -colorings. For ordinary graph -colorings, we have the following well-known result of .
For any , there exists a graph with girth at least which is not -colorable.
For dichromatic number we have the following theorem .
For any , there exists a digraph with directed girth at least which is not acyclically -colorable.
A very general version of such results is proved in  (Theorem 5). The proof in  is probabilistic but there is a constructive proof in . We refer the reader to  for the definition of a constraint satisfaction problem, the girth of an instance, and equivalence of problems. We explain below the special case sufficient for our applications here.
For every constraint satisfaction problem , any instance of , and any integer , there exists an instance , equivalent to , with girth at least .
The -valued not-all-equal -satisfiability problem is an example of a constraint satisfaction problem. Here an instance is a set of variables each taking one of possible values, and a set of constraints , each consisting of exactly variables. The solution of an instance is an assignment of values to the variables such that no constraint has all its variables assigned the same value. (This can also be viewed as the -coloring problem of -uniform hypergraphs; cf. the special case in the proof of Theorem 2.2.) In this case, the girth of an instance is the smallest set of variables such that any two consecutive (subscripts modulo ) occur together in some constraint . We say that an instance is equivalent to an instance if has a solution if and only if has a solution. There obviously are instances without a solution, for example variables and all constraints imposed on each subset of size . (If each variable is assigned one of values, some variables will have the same value, so has no solution.) We obtain the following corollary of the theorem.
For any , there exists an instance of -valued not-all-equal -satisfiability problem with girth at least , which has no solution.
We can transform the instance into a digraph by taking a vertex for each variable and form a directed -cycle on any set of variables occurring in a constraint . Clearly, this digraph has directed girth at least . We obtain a new proof of Theorem 3.2.
By replacing each constraint with an undirected -cycle, we similarly conclude the following useful fact.
For any , there exists a graph with girth at least which is not acyclically -colorable.
The digraph from Theorem 3.2 may be assumed to contain an edge such that is acyclically -colorable, e.g., by assuming that is minimal with respect to inclusion. A similar remark applies to the graph from Theorem 3.5.
The obvious question is whether a more explicit construction for and can be given, thus avoiding randomization [6, 9] or a more complex construction . For example, in the case , a random tournament as in Theorem 5.2 of size suffices for , yet it remains hard to find and . Our construction below gives of size polynomial in for fixed, or polynomial in for fixed.
For every , , there exists a digraph with the following properties.
has at most vertices;
moreover, if , then has at most
can be constructed in time linear in the number of vertices;
does not have an acyclic -coloring;
for each edge , the graph does have an acyclic -coloring; and
has directed girth .
This gives the bound in Theorem 2.3.
Proof. We fix , and let be a -cycle, satisfying all conditions. For with , write with and .
Let and . Define as the disjoint union of copies of and copies of , for a total of copies, with all edges joining each such copy to the next, or the last one to first one.
We prove the last three conditions by induction on . The first copies need at least colors, avoiding at most only colors. The last copies need at least colors, avoiding at most only colors. By the definition of at most colors are avoided by at least one copy, so some color appears in all the copies, and this gives a cycle of color of length across all the copies. This proves condition (4).
For condition (5), suppose the removed edge is inside the th copy . Then can be colored with only colors ( colors), giving one more color than in the definition of for a total of avoided colors across all the copies, so no color appears in all the copies, and there is no cycle across all the copies that gives the same color in all copies. This proves condition (5) in this case.
If the removed edge is joins say then color and with only (or ) colors by condition (5), avoiding one more color in each of , with only color avoided in both cases. Assign color to . This gives us again avoided colors, but including color in all copies does not gives a cycle of length of color , since the cycle would have to go through edge . This proves condition (5).
For condition (6), note that all cycles either go through only one copy and are thus inductively of length at least , or go through all the copies and must thus be of length at least .
For conditions (1, 2), note that each step of the induction has and .
We now prove a hardness of approximation result.
Let be a constant. Given a complete bipartite graph with , let be the digraph obtained from by orienting the edges in either direction independently with equal probability . Then with probability approaching 1 as goes to infinity, for every two subsets having , the digraph induced by contains a cycle.
Proof. Say and choose ordered in at most ways. If induces an acyclic subgraph consistent with these ordering, then the order of the neighbors of a vertex , for some such order, will have first the edges incoming to from , then the outgoing edges from to . This can happen in ways out of possible choices for the edes joining . Multiplying resulting probability over all choices of from choices of subsets gives probability of there being acyclic at most
which tends to zero as goes to infinity.
Noga Alon informed us that the known relatively recent explicit construction for bipartite Ramsey graphs  will give a derandomization of this lemma. Indeed, if induces an acyclic digraph with a corresponding linear order , then the middle vertices of in are respectively. Say the edge joining goes in the direction . Then there are edges going from vertices below in to vertices above in . (The other case is symmetric, from below in to above in if the direction is ). We can define a biparite graph from by including only edges from to . Then we just saw that we would have either a bipartite clique or a biparite independent set with vertices in each side, . The bipartite Ramsey construction in  guarantees this does not happen even with .
Feige and Kilian  proved that it is NP-hard to find an independent set of size greater than (thus hard to color) in a graph that is colorable with colors, for any . As a result, it is equally hard to find a large acyclic subgraph in a digraph, since we could replace the edges of with digons (girth 2), so that acyclic sugraphs in the resulting digraph correspond to independent sets in .
Fix . It is NP-hard to find an acyclic induced subgraph of size greater that (thus hard to find an acyclic coloring) in an -vertex digraph without digons, i.e., of girth at least 3, that has an acyclic -coloring with .
Proof. Let be an instance of the NP-hard question of Feige and Killian. For each vertex , let be a set with . For each edge , join with the random bipartite digraph as in the lemma (which can be derandomized). This gives a digraph with vertices that has an acyclic -coloring with , by copying each color of a into the corresponding .
However, an acyclic induced subgraph can only meet sets in at least vertices if the corresponding form an independent set, by the lemma. Therefore there will only be found such large intersections by the result of Feige and Killian, giving us vertices of , plus small intersections, of size at most for the remaining , for a total
5 Random Tournaments
We begin with two simple observations to introduce random tournaments, as in .
Every tournament on vertices contains a transitive subtournament on vertices, and therefore has an acyclic coloring.
Proof. Greedily select a vertex from of outdegree at least , remove and its in neighbors from to obtain of size at least . This halving can be done times. The chosen vertices will form a transitive tournament. For the acyclic coloring, select and remove greedily transitive tournaments from , each of size at least , until we reach a tournament of size at most , and we use at most these many colors for .
Random tournaments essentially match the preceding bound
With high probability, a tournament on vertices only contains a transitive subtournament on vertices, and therefore only has an an acyclic -coloring.
Proof. Selecting a sequence of distinct vertices of can be done in at most ways. The probability that such a sequence will give the ordering of a transitive tournament is at most for . The ratio tends to 0 as goes to infinity.
We now define a random model for acyclic -colorable tournaments on vertices. Consider integers with . To define , first consider disjoint sets of vertices with , and impose on each a transitive (acyclic) tournament. Finally, orient each edge joining vertices in two different independently with probability in either direction.
The tournaments so generated have an acyclic -coloring, obtained by assigning color to the vertices in . We consider the problem of acyclic -coloring such a when the vertices of are given in arbitrary order, and the and are not given. We give a deterministic algorithm that finds such a coloring with probability arbitrarily close to 1. If is fixed, the algorithm runs in time , linear in the size of the input .
The algorithm runs in three phases, which we describe below.
The first phase starts with the tournament with and , and operates in rounds. At the beginning of the th round, we have .
We define for some constant . Given a tournament and a vertex in , we define
as the difference between the out-degree and the in-degree of in . Note that if . Consider the Chernoff bounds for equal to the sum of independent Bernoulli random veriables, with .
we have that
The probability that this holds for all in is at most times the bound. Let be the vertex that maximizes , say the quantity within the absolute value is nonnegative. Then with . Let be the largest of the in , and let be the starting vertex of the transitive tournament . Then
with probability at least .
The algorithm seeks to determine given the vertex . For , and , the probability that is a directed 3-cycle in either direction is , unless , in which case the probability is zero. Let be the number of s that form such a directed 3-cycle with and . Then if , and if . Then
where the factor of is needed to account for the fact that could be any vertex in . With probability times this much this holds for all .
Suppose . With probability at least vertices have , and vertices have and .
Thus for as long as , we have , and and the algorithm can determine and test the bounds to determine . This works with probability at least
Suppose the th round starts with . Let . With probability at least , if the largest has , then we find with , and reduce the problem to .
The last round of the first phase takes to . We let and for this . Note that after phase one is over, we have with and defined similarly with . When phase one no longer applies, .
In particular, if , then and and the rest of the problem can be solved in time.
We may assume since otherwise the problem can be solved in linear time avoiding the th round.
Finding takes time, linear in the size of the input . This yields a total running time of over at most rounds. The probability bound for the first phase is with .
For constant, we can find an acyclic -coloring of on vertices in time , linear in the size of the input, with probability as above.
After the first phase is over, we have . The second phase first identifies all sets in with that could be the least elements of an . The number of possible such sets is at most .
First must be a transitive tournament. Suppose of size is the bottom of an . Let be plus all the elements above all of .
We claim that . Otherwise choose with contained in . The sets are joined by edges joining different colors, thus the probability that they will all be oriented upwards is at most . There are at most possible choices of , so with probability at least the claim follows.
Suppose for ssome sufficiently large constant . The algorithm repeatedly chooses sets that define transitive (acyclic) tournaments within . The sets are considered in nonincresasing order of . We claim that with high probability, we will have for one of the sets , so we choose such a and discard all later that intersect , with . The algorithm ends when there are no more with .
The second phase correctly selects the remaining with , with probability at least . for and sufficiently large. The running time is bounded by .
Proof. It only remains to show that all chosen are , with probability at least . If not, meets at least two . Let , where , with . Order the in decresasing order of , and let be such that and .
Let . The can be partitioned into two sets into one of the two cases or , and one of these two partitions has corresponding sizes at least .
Once the edges within with have been oriented, the probability that a vertex in with will fit in some order among is or over . The vertices in and at most vertices in (since ) can be chosen in at most ways, giving the probability bound
for and sufficiently large. Summing over all gives the bound .
The third phase starts with a resultant and possible sets with , so . Each has choices of , for a total of choices for the sets to be selected, giving running time .
The third phase seems the most expensive, since the running time is exponential in versus quasi-polynomial in the second phase, and polynomial in the first phase. We can avoid the third phase by approximating the bound on color classes with the bound from Theorem 5.1, for an approximation factor of .
-  J. Bang-Jensen, F. Havet, Finding good 2-partitions of digraphs I. Hereditary properties, J. Theoretical Computer Science (TCS), Elsevier, 636 (2016) 88–94.
-  B. Barak, A. Rao, R. Shaltiel, and A. Wigderson, 2-source dispers for entopy, and Ramsey graphs beating the Frankl-Wilson construction, Ann. Math. 176 (2012) 1483–1543.
-  D. Bokal, G. Fijavž, P.M. Kayll and B. Mohar, The circular chromatic number of a digraph, J. Graph Theory 46 (2004), 227–240.
-  R.L. Brooks, On coloring the nodes of a network, Proc. Cambridge Philos. Soc. 37 (1941) 194–197.
-  T. Emden-Weinert, S. Hougardy, and B. Kreuter, Uniquely colourable graphs and the hardness of colouring graphs of large girth, Combinatorics, Probability and Computing 7 (1998), 375–386.
-  P. Erdős, Graph theory and probability, Canadian J. of Math. 11 (1959), 34–38.
-  P. Erdős and L. Moser, A Problem on tournaments, Canad. Math. Bull. 7 (1964), 351–-356.
-  T. Feder and D. Ford, Classification of bipartite boolean constraint satisfaction through delta-matroid intersection. SIAM J. Discrete Math. 20–2 (2006) 372–394.
-  T. Feder and M. Vardi, The computational structure of monotone monadic SNP and constraint satisfaction: a study through Datalog and group theory. SIAM J. Comput. 28 (1998) 57–104.
-  U. Feige and J. Kilian. Zero-knowledge and chromatic number. Proceedings of the 11th Annual Conference on Computational Complexity (1996).
-  J. Fox, L. Gishboliner, A. Shapira, and R. Yuster, The removal lemma for tournaments (2017), manuscript.
-  Michael R. Garey and David S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, W. H. Freeman & Co., New York, NY, USA, 1979.
-  R.M. Karp, Reducibility among combinatorial problems, in Complexity of Computer Computations, 1972.
-  G. Kun, Constraints, MMSNP and expander relational structures, Combinatorica 33–3 (2013), 335–347.
-  L. Lovász, On chromatic number of finite set-systems, Acta Math. Acad. Sci. Hungar. 19 (1968), 59–67.
-  C. St. J. A. Nash-Williams, Decomposition of finite graphs into forests. Journal of the London Mathematical Society. 39 (1964).