Manuscript Offprint
arXiv:2610.31489Near-Optimal Bounds for Testing k-Colorability
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.
Abstract
We study the sample complexity of testing k-colorability in the dense graph model. A graph is -far from being k-colorable if at least edge deletions are required to make it k-colorable. We prove that, for every integer , a uniformly random induced subgraph on
vertices is non-k-colorable with probability at least 2/3 whenever the original graph is -far from k-colorable. The proof introduces a trial coloring process based on nested palette systems and iteratively selected pivots. This yields an upper bound of , which is no worse than the previous state of the art throughout the nonvacuous parameter range, and is an improvement whenever is superpolynomial in k. Moreover, for every fixed k, our bound matches the known lower bound, thereby establishing the optimal dependence on and, to the best of our knowledge, achieving this optimal dependence for the first time.
1 Introduction
Deciding whether a graph satisfies is NP-complete for every fixed [16, 15]; under the Exponential Time Hypothesis it cannot be decided in time [17], where is the number of vertices; nevertheless, extensive researches have shown that for every fixed it can be decided in exponential but sub- time: for there is an algorithm running in time [10], for one running in time [24], and for every fixed there is such that -colorability can be decided by a randomized algorithm in time [25]. In fact, for arbitrary and there are -vertex graphs of chromatic number in which every set of vertices induces a 3-colorable graph [11]. This lack of local witnesses is what makes the global condition hard to detect, and it is what makes testing -colorability nontrivial. However, a body of work has shown that if there is a substantial gap between and a -colorable graph (that is, a constant fraction of 's edges has to be deleted before it becomes -colorable), then even a random small induced subgraph of is non--colorable with constant probability, where the size of the subgraph depends only on and and not on .
A graph on vertices is -far from being -colorable if at least of its edges have to be removed to make it -colorable, and the sample complexity of -colorability is the smallest such that, for every -far , a uniformly random -vertex induced subgraph of is non--colorable with probability at least . The quantity is an important parameter in property testing in the dense graph model [13, 14, 12].
Bollobás, Erdős, Simonovits and Szemerédi [9] showed for , and Rödl and Duke [20] for every fixed the existence of a constant such that any graph having sufficiently many vertices that is -far from being -colorable has an induced subgraph with no more than vertices that is non-k-colorable; both proofs used Szemerédi's regularity lemma [23]. Their proofs can be reorganized to show that a random sample of (which is independent of ) vertices succeeds with constant probability. Goldreich, Goldwasser and Ron [13] abandoned regularity altogether and, by constructively extending partitions of the graph, obtained the polynomial bound for and for . Alon and Krivelevich [1] improved the bound to for and for by growing a tree of colorings of the sample, and they also proved the lower bound . Sohler [22] then obtained , by reducing the problem to the satisfiability of a constraint satisfaction problem.
More recently, Blais and Seth [7, 8] obtained by introducing the container method of extremal combinatorics [18, 6, 21] into property testing. Kushnir and Shapira [19] refined this analysis, removing a factor of and thereby attaining , which was the previous state of the art, and complemented it with the lower bound , conjecturing that is the truth. In this paper, we prove an upper bound of (Theorem 1.1 below). Compared with the proofs of [7, 8, 19], what this proof shares with them is that it rests on a condition at one particular time point: if that condition fails at every time point (i.e., every state is still large), the reconstruction step yields a coloring with fewer than monochromatic edges, which is impossible for an -far graph; and, as in those works, a union bound over all possible time points then completes the argument. The algorithmic mechanism, however, is different. We introduce a palette system and define a trial coloring process based on it. The use of palettes and lists of available colors is classical in graph coloring; see, for example, work on bounded-palette list coloring and palette sparsification [3, 2, 5, 4].
Theorem 1.1. For every integer and every , under the nonempty-graph convention above,
with an absolute implied constant. More explicitly, choose
and set
Then every n-vertex graph that is -far from being k-colorable has a non-k-colorable induced subgraph on q uniformly sampled vertices with probability at least 2/3.
Comparing with the former upper bound of of Kushnir and Shapira [19], by the conclusion of Lemma 3.2 below, the new bound is no worse than the previous one throughout the nonvacuous parameter range, since implies . Moreover, it is a strict improvement whenever is superpolynomial in . Also, if is fixed, our upper bound is equal to the existing best lower bound of , which shows that the sample complexity (treating as constant) is .
Our proof also applies when . Thus, a formulation valid for all integers is .
A graph is called -far from being -colorable if at least edges must be deleted from in order to obtain a -colorable graph. The sample complexity is the smallest positive integer with the following property: for every -far graph , a uniformly random -vertex induced subgraph is non--colorable with probability at least . If , we sample all vertices.
For a map , let denote the set of monochromatic edges, that is, edges with . Thus is the number of monochromatic edges under .
A palette system assigns to each vertex a set , and empty palettes are allowed. Define
For , set
The label count of P is
We write if for every vertex .
For positive integers r, let
be the number of ordered -tuples of distinct elements from an -element set. We set when .
3 Distance characterization
Lemma 3.1. A graph G is -far from being k-colorable if and only if every map satisfies
Proof. For a fixed map c, deleting all monochromatic edges makes c a proper k-coloring. Conversely, if deleting an edge set makes c proper, then that edge set contains every monochromatic edge of c. Hence the minimum number of deletions needed to obtain a k-colorable graph is
which proves the claim.
Lemma 3.2. If there exists an n-vertex -far graph with , then
Proof. Color every vertex independently and uniformly from [k]. Every edge is monochromatic with probability 1/k, and therefore
Thus some map satisfies . By Lemma 3.1, every map has at least monochromatic edges. Hence
3
□
4 A reconstruction lemma
Our aim is to construct a k-coloring with relatively few monochromatic edges. We do this by coloring the vertices in several stages. When coloring a new stage, we only need to count monochromatic edges joining its vertices to vertices in the same stage or in earlier stages. The general strategy is therefore to color the vertices from easy to difficult: vertices with large palette degrees are harder to handle and are deferred to later stages. At a given stage, vertices deferred to later stages are temporarily ignored. This is reflected in the construction below by emptying the palettes of these “more difficult” vertices. To control the total number of monochromatic edges, we assign each vertex a time at which its color is easiest to handle. The running minimum records these best available thresholds.
Lemma 4.1. Let be palette systems with for every . Suppose that for every and every there is a color such that , where , and suppose
Let
If
then there is a map with
Proof. Let be the first index attaining . Then since . Define
Thus and .
Let be the record indices of the running minimum, so that is the next strict decrease after . Then
If r = 1, the list contains only and the intermediate layers below are empty.
Partition into
First color , assigning to each vertex a witness color of degree at most . Since , counting all possible neighbors gives at most monochromatic edges inside this part.
Next add the remaining layers in reverse order. For a vertex in , use a witness color in of degree at most . Every already colored vertex uses a color belonging to its palette at time , by nestedness. Hence this vertex creates at most new monochromatic edges to previously colored vertices. Finally color arbitrarily, charging at most edges per vertex.
Using (4), the total number of monochromatic edges is at most
With , summation by parts gives
Together with , we have reached the conclusion that there is a way to color the graph as required.
5 The trial coloring process
The trial coloring process calculates palettes and chooses pivots using colors . Two features of this process are crucial. First, it only removes colors from palettes and never adds any. Second, it is dynamic: each operation is based on the current palette system, rather than on the initial graph alone.
Fix a total order on for tie-breaking. Given , initialize for every vertex , and choose no pivots. Let . At the beginning of round , a vertex is active if . If some vertex of has an empty palette, or if no unchosen vertex of remains, the process stops. Otherwise:
- Choose maximizing , breaking ties by the fixed total order, and set
- Form the cap palette by setting whenever and , and otherwise setting . Thus
- Given a prescribed color , if , the process stops. If , set , delete from the palette of every neighbor of , and leave all other palettes equal to their values in .
6 Analysis of the trial coloring process
6.1 Process invariants
Lemma 6.1. For every completed run:
-
, and every has a color with ; moreover .
-
On every run completing T rounds,
- If has a proper coloring , then, whenever round is reached, the prescribed choice is legal. If , it completes rounds and preserves in the palette of every throughout; in particular for all .
Proof. For the first assertion, caps only empty entire palettes and never add labels. If , then by (6). Choose attaining this minimum. Since was not emptied, , and hence
The bounds on are immediate from its definition and .
For the second assertion, since ,
Choose distinct neighbors carrying color in their palettes. At the end of the round, each such vertex has lost the label : it is either emptied by the cap or loses in the neighbor update. Therefore
Summing over rounds and telescoping yields (7), since .
For the third assertion, let be a proper coloring of . We prove inductively that, after each round, remains in the palette of every ; moreover, each selected pivot has the singleton palette , and no neighbor of carries in its palette. These assertions hold initially, with the pivot assertions vacuous.
Suppose they hold before round . Every vertex of is active. If and , then an unchosen vertex remains, so is defined. Every unchosen is a candidate in the maximization defining , and consequently
Thus the cap does not empty its palette and preserves . For an earlier pivot , the inductive assertions give
so its singleton palette is also preserved by the cap. In particular, , making the prescribed color choice legal.
The update deletes only from neighbors of . Properness of ensures that no such neighbor in loses its prescribed color. The pivot receives the singleton palette , and all its neighbors lose that color. And the assertions for earlier pivots remain valid. This completes the induction and proves that the run completes rounds.
6.2 The missing-cap lemma
Lemma 6.2. Let
Every run completing T rounds has some with
Consequently, if and is k-colorable, then the proper-coloring run contains all of A in the cap at that time.
Proof. By Lemma 3.2, whenever a relevant graph exists we have . Hence
so all right-hand sides in (8) are positive.
Assume for contradiction that (8) fails for every t. Then
so . Lemma 6.1 supplies all the other hypotheses of Lemma 4.1, including (7). Therefore some coloring satisfies
contradicting Lemma 3.1. The final statement follows from the last part of Lemma 6.1.
6.3 Deletion stability
Lemma 6.3. Suppose that a run executed on A has first t pivots . If
then running on with the same successive color choices produces the same first t pivots, thresholds, caps, and palette updates.
Proof. The main idea is that the choices of pivots and the cap palettes do not change. Induct on the rounds. The initial palettes are independent of the sample set. If the first rounds agree, the current palettes agree pointwise. The original pivot remains a candidate in , and every other candidate in was also a candidate in . Thus its maximality and the fixed tie-breaking order are unchanged. The cap and update depend only on the current palettes, the pivot, and the chosen color. Since the original run completed rounds, the same pointwise equality also prevents the restricted run from stopping earlier.
7 Sampling upper bound
The main idea is that, for each k-colorable induced subgraph on q vertices, only a small part of the sample—the pivots—is essential. The other vertices are not independent of the pivot choices, but by handling carefully, followed by a union bound, allows us to control this dependence and obtain a probability bound similar to that for uniform random sampling.
For each , partition the positions deterministically into 2t nonempty blocks whose sizes differ by at most one.
Our counting argument encodes each colorable sample by one of a small number of descriptions. We first record what such a description is.
Definition 7.1 (Description). A description is a tuple
consisting of the following data:
-
an integer ;
-
a t-element set of block indices of the deterministic partition of into 2t blocks used in the construction of ;
-
a color string ;
-
an ordered tuple of distinct vertices of G, with a equal to the total size of the blocks in W;
-
an ordered tuple of distinct vertices of G, with .
The tuple is retained if are pairwise distinct and, on replaying the process from with the color string , the process completes rounds and its true cap satisfies
For a retained description we write
We now show in Proposition 7.2 that every colorable sample S gives rise to at least one retained description, and that each retained description determines at most one sample. There are then only few possible descriptions, and each one is realized by a q-tuple with exponentially small probability.
Proposition 7.2. With T and as above, let
For every -far graph G, a uniformly random q-vertex induced subgraph is non-k-colorable with probability at least 2/3. Consequently,
Proof. If , we sample all vertices. Since , an -far graph cannot itself be -colorable, so the success probability is one.
Get a retained description from a k-colorable S
Assume , and equivalently sample a uniformly random ordered tuple of distinct vertices. Suppose is k-colorable and fix a proper coloring . Run the trial coloring process with and choose . By Lemma 6.1, since , the run completes rounds and preserves in every cap. Lemma 6.2 gives some and such that
The pivots occupy at most blocks. Choose a -subset containing those blocks, adding arbitrary blocks if necessary. Let be the sample vertices in the blocks indexed by , and put . Write
Then . By Lemma 6.3, replaying the first rounds from with the same color string produces the same cap . The ordered -part corresponding to is obtained from by listing its vertices in increasing order of their sample positions (their relative position is the same as in the ordered tuple ), and are obtained in the same way from . Once and are fixed, the correspondence between the ordered -tuples and is a bijection.
Consequently,
is a retained description in the sense of Definition 7.1: the replay from with the color string yields the cap , and (14) gives both and . Hence every colorable sample admits at least one retained description (there may be multiple possible choices of , , ).
Recover S from the retained description
Conversely, the sample S itself is recovered from a retained description as follows: by W and the block partition we know which of the q sample positions belong to the u-part and which to the v-part, the two tuples are listed in increasing order of their positions, and the vertices of the two tuples are pairwise distinct. Hence a retained description determines at most one ordered sample.
Counting the number of retained descriptions
The ordered v-part of a retained description must consist of distinct vertices of : in the v-positions of the sample we have placed vertices that avoid the true missing set , and no vertex may appear in both the u-part and the v-part. Since , there are exactly available vertices, and hence at most choices for the ordered v-part.
For fixed t, W, i, the block-size estimate gives
where . We first give a common upper bound. For fixed , the numbers and are fixed, but the replayed cap and its missing-set size may depend on the ordered -tuple. Let be the set of ordered -tuples whose replay is retained, and write for the missing-set size produced by . For each such tuple, .
Conditioned on a particular ordered u-tuple, the remaining positions are filled uniformly by an ordered b-tuple from . Thus, writing temporarily, the fraction of these completions that avoid the missing set is
(16)
The displayed product is used only when ; otherwise the fraction is zero and the same bound holds. The condition ensures that the entire missing set lies in . The penultimate inequality uses and .
For fixed , let denote the number of retained descriptions. Summing separately over the ordered -tuples, rather than treating as a constant, gives
Here we used and .
There are at most choices for and choices for the color string. Every colorable sample yields at least one retained description, even though its proper coloring may depend on the sample. Summing the preceding bound over all strings and block choices therefore gives, by (12),
Thus the induced subgraph is non-k-colorable with probability at least 2/3. Finally, , , and , proving (13).
8 Concluding remarks
The core of the proof is to introduce a process that naturally simulates k-coloring, where we call a vertex “bad” if we are unwilling to handle its coloring. On the one hand, if a subgraph S is k-colorable, then this process can proceed. On the other hand, if only few “bad” vertices appear while the process proceeds, then the original graph is -close to being k-colorable. Moreover, a coloring process in which many such “bad” vertices appear occurs with very low probability if the subgraph S is k-colorable. Together these three observations yield the bound
without invoking the regularity lemma or the container method.
Statement on AI usage
The author had early discussions with ChatGPT about how to approach the palette system. The author then conceived how palettes could be used within the proof and wrote out the complete argument. ChatGPT was subsequently used to edit the author's first draft of the proof into a form conforming to standard conventions of mathematical exposition. After this, the author reviewed the draft in full and polished the exposition to obtain the final version of this paper. The author takes full responsibility for all content in this paper.
References
[1] N. Alon and M. Krivelevich. Testing k-colorability. SIAM Journal on Discrete Mathematics 15(2):211–227, 2002. doi:10.1137/S0895480199358655.
[2] S. Assadi, Y. Chen, and S. Khanna. Sublinear algorithms for vertex coloring. In Proc. 30th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2019), pp. 767–786, 2019. doi:10.1137/1.9781611975482.48.
[3] M. Bonamy and R. J. Kang. List colouring with a bounded palette. Journal of Graph Theory 84(1):93–103, 2017. doi:10.1002/jgt.22013.
[4] A. Czumaj, P. Peng, R. Shi, and C. Sohler. Streaming hypergraph coloring via palette sparsification. arXiv:2608.19623, 2026. https://arxiv.org/abs/2608.19623.
[5] S. M. Ferdous, R. Neff, B. Peng, S. Shuvo, M. Minutoli, S. Mukherjee, K. Kowalski, M. Becchi, and M. Halappanavar. Picasso: Memory-efficient graph coloring using palettes with applications in quantum computing. arXiv:2401.06713, 2024. https://arxiv.org/abs/2401.06713.
[6] J. Balogh, R. Morris, and W. Samotij. Independent sets in hypergraphs. Journal of the American Mathematical Society 28(3):669–709, 2015.
[7] E. Blais and C. Seth. Testing graph properties with the container method. In Proc. 64th IEEE Annual Symposium on Foundations of Computer Science (FOCS 2023), pp. 1939–1951; journal version: SIAM Journal on Computing 54(6):1626–1642, 2025; arXiv:2308.03289.
[8] E. Blais and C. Seth. New graph and hypergraph container lemmas with applications in property testing. In Proc. 56th ACM Symposium on Theory of Computing (STOC 2024), pp. 1793–1804; arXiv:2403.18777.
[9] B. Bollobás, P. Erdős, M. Simonovits, and E. Szemerédi. Extremal graphs without large forbidden subgraphs. Annals of Discrete Mathematics 3:29–41, 1978. doi:10.1016/S0167-5060(08)70495-3.
[10] R. Beigel and D. Eppstein. 3-coloring in time . Journal of Algorithms 54(2):168–204, 2005. doi:10.1016/j.jalgor.2004.06.008.
[11] P. Erdős. On circuits and subgraphs of chromatic graphs. Mathematika 9:170–175, 1962. doi:10.1112/S0025579300003260.
[12] O. Goldreich. Introduction to Property Testing. Cambridge University Press, 2017. doi:10.1017/9781108135252; ISBN 978-1-107-19405-2.
[13] O. Goldreich, S. Goldwasser, and D. Ron. Property testing and its connection to learning and approximation. Journal of the ACM 45(4):653–750, 1998.
[14] O. Goldreich and L. Trevisan. Three theorems regarding testing graph properties. Random Structures & Algorithms 23(1):23–57, 2003.
[15] M. R. Garey, D. S. Johnson, and L. Stockmeyer. Some simplified NP-complete graph problems. Theoretical Computer Science 1(3):237–267, 1976. doi:10.1016/0304-3975(76)90059-1.
[16] R. M. Karp. Reducibility among combinatorial problems. In R. E. Miller and J. W. Thatcher, editors, Complexity of Computer Computations, pp. 85–103. Plenum Press, New York, 1972. doi:10.1007/978-1-4684-2001-2_9.
[17] R. Impagliazzo, R. Paturi, and F. Zane. Which problems have strongly exponential complexity? Journal of Computer and System Sciences 63(4):512–530, 2001. doi:10.1006/jcss.2001.1774.
[18] D. J. Kleitman and K. J. Winston. On the number of graphs without 4-cycles. Discrete Mathematics 41(2):167–172, 1982.
[19] N. Kushnir and A. Shapira. Towards tight bounds for testing k-colorability. In Approximation, Randomization, and Combinatorial Optimization (APPROX/RANDOM 2026), LIPIcs, vol. 392, pp. 35:1–35:13, 2026. https://doi.org/10.4230/LIPIcs.APROX/RANDOM.2026.35.
[20] V. Rödl and R. A. Duke. On graphs with small subgraphs of large chromatic number. Graphs and Combinatorics 1(1):91–96, 1985. doi:10.1007/BF02582932.
[21] D. Saxton and A. Thomason. Hypergraph containers. Inventions Mathematicae 201(3):925–992, 2015.
[22] C. Sohler. Almost optimal canonical property testers for satisfiability. In Proc. 53rd IEEE Annual Symposium on Foundations of Computer Science (FOCS 2012), pp. 541–550. doi:10.1109/FOCS.2012.59.
[23] E. Szemerédi. Regular partitions of graphs. In Problèmes Combinatoires et Théorie des Graphes (Orsay, 1976), Colloques Internationaux du CNRS 260, pp. 399–401, CNRS, 1978.
[24] P. Wu, H. Gu, H. Jiang, Z. Shao, and J. Xu. A faster algorithm for the 4-coloring problem. In Proc. 32nd Annual European Symposium on Algorithms (ESA 2024), LIPIcs, vol. 308, pp. 103:1–103:18, 2024. doi:10.4230/LIPIcs.ESA.2024.103.
[25] O. Zamir. k-coloring is faster than computing the chromatic number. arXiv:2607.25973, 2026.