Manuscript Offprint
arXiv:2611.04276Testing Implies Distance Estimation with Polynomial Loss
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
A tester decides whether a graph has a property or is far from having it. A distance estimator asks for more: it must approximately determine how many edges need to be changed. A property is said to be testable if there is a tester with a number of queries bounded independently of the graph's order for each conceivable distance. Similarly, if a property admits an estimator with a number of queries bounded independently of the graph's order, it is said to be estimable.
Fischer and Newman proved that, in the dense graph model, every testable property is also estimable. We show that the passage from testing to estimation requires only a polynomial increase in query complexity. This resolves a long-standing open problem in property testing, previously tackled by Fiat and Ron, by Hoppen, Kohayakawa, Lang, Lefmann, and Stagni, and by Gishboliner, Kushnir, and Shapira.
1 Introduction
We work in the dense graph model, also called the adjacency matrix model. A graph on a vertex set is a function , and we write for the set of such graphs. For , the normalized edit distance between is
A graph property is a collection of graphs closed under isomorphism. Let ; we define
when , and set otherwise. Thus, is the smallest fraction of pairs whose adjacency status must be changed to obtain a graph in on the same vertex set. We say that is -far from if . Graphs of size less than two can be handled separately.
*Trinity College Cambridge, Department of Pure Mathematics and Mathematical Statistics, Centre for Mathematical Sciences, Wilberforce Road, Cambridge CB3 0WA, United Kingdom. Email: gc645@cam.ac.uk
†Cheriton School of Computer Science, University of Waterloo, 200 University Ave W, Waterloo, ON N2L 5Z5, Canada. Email: cjmpseth@uwaterloo.ca
An algorithm receives the order of the input graph and may query whether a given pair of vertices is an edge. An -tester for accepts every graph in with probability at least and rejects every graph that is -far from with probability at least . No requirement is imposed on graphs whose distance lies strictly between 0 and . The property is testable if, for every , such a tester exists with a number of queries bounded independently of .
Throughout the paper, denotes an upper bound on the number of edge queries, valid for every input size. We often use canonical testers, which sample a uniformly random set of vertices and inspect its induced subgraph. The canonization theorem of Goldreich and Trevisan [2] converts a tester making edge queries into a canonical tester sampling vertices. Conversely, inspecting the subgraph induced by vertices uses at most edge queries. These polynomial conversions allow us to pass between the two models without changing whether a bound is polynomial. We nevertheless keep track of the distinction, using for the size of a canonical sample.
Goldreich, Goldwasser and Ron [3] introduced graph property testing in this model, and proved that a broad class of partition properties, including -colourability and properties prescribing a large cut, are testable. Subsequent work established general criteria for testability. In particular, Alon and Shapira [4] proved that every hereditary graph property, meaning one closed under taking induced subgraphs, is testable.
Regularity methods play a central role in these general results. They replace a large graph with a bounded description that preserves enough information to detect violations of the property. The quantitative cost of employing these methods can, however, be very large: Szemerédi's regularity lemma has tower-type bounds, and Gowers [5] showed that such dependence is unavoidable for the lemma itself. This leaves open the possibility that a particular testing problem admits a much better bound through a more direct argument or a weaker approximation theorem. For example, the regularity-based argument of Rödl and Duke [6] for -colourability was followed by polynomial testing bounds obtained without the full regularity lemma [3, 8, 9].
Understanding when such improvements are possible is a central question in graph property testing. Related work of Carenini, Seth and Yoshida [7] gives a quantitative container characterization of one-sided testability, connecting prescribed testing complexity to container-like descriptions. This develops a different route to quantitative testing results, building on the hypergraph container method of Balogh, Morris and Samotij [10] and Saxton and Thomason [11]. Here, we study the quantitative relationship between testing and the stronger task of distance estimation.
1.2 Distance estimation and previous bounds
A tester distinguishes distance zero from distance at least . A distance estimator must approximate the distance on every input. More precisely, an -estimator for outputs a number satisfying
for every graph . We call estimable if it admits such an algorithm with query complexity depending only on . Estimability implies testability, after changing the accuracy by a constant factor.
Parnas, Ron and Rubinfeld [12] initiated the systematic study of tolerant testing and distance approximation. Testing need not imply distance estimation in other models [13]. In the dense graph model, however, Fischer and Newman [14] proved that every testable property is estimable. Their proof uses regularity and incurs a tower-type loss in converting a tester into an estimator. The natural quantitative question is how much of this loss is necessary.
This question was first studied for hereditary properties by Hoppen, Kohayakawa, Lang, Lefmann and Stagni [15] and by Fiat and Ron [16]. In particular, can a hereditary property that is testable with polynomially many queries also be estimated with polynomially many queries? The following formulation asks for a quantitative conversion for arbitrary testing bounds.
Problem 1 (Testing versus estimation). Suppose that a graph property has an -tester using queries. Can its distance be estimated to additive accuracy using poly() queries, for an absolute constant ?
For hereditary properties, earlier bounds are most precisely expressed using induced-removal lemma parameters. At proximity , these are numbers , and such that every -far graph of order at least contains some , with , for which a uniformly random injective map from to induces a copy of with probability at least . Such parameters give a one-sided tester with vertex sample size .
Hoppen, Kohayakawa, Lang, Lefmann and Stagni [15] obtained distance estimators with a doubly exponential bound in terms of these removal parameters. Gishboliner, Kushnir and Shapira [17] improved this to a singly exponential bound.
Theorem 1 (Gishboliner–Kushnir–Shapira [17]). Let be hereditary. For an absolute constant , let be induced-removal parameters at proximity . Then, has an -estimator with query complexity .
Using the same tools, Gishboliner, Kushnir and Shapira also obtained a doubly exponential conversion for general graph properties [17]. Thus, the remaining question was whether a polynomial loss suffices.
1.3 Our main result
We prove that every tester in the dense graph model can be converted into a distance estimator with polynomial loss.
Theorem 2 (Testing implies estimation with polynomial loss). There is an absolute constant with the following property. If has an -tester with edge-query complexity for every , then it has an -estimator with edge-query complexity poly().
In particular, a graph property is testable with poly() queries if and only if its distance can be estimated with poly() queries. The theorem applies to general graph properties and allows the original tester to be adaptive and to have two-sided error.
For natural properties, the explicit dependence on can be absorbed into the testing complexity. Following [17], call unnatural if there exists such that, for every and all sufficiently large , either or every -vertex graph has distance at most from . A property is natural if it is not unnatural. A hereditary property is non-trivial if it contains graphs of arbitrarily large order and omits at least one graph.
Corollary 1. If is natural, or is a non-trivial hereditary property, then the bound in Theorem 2 simplifies to poly() for all sufficiently small .
Indeed, the query lower bounds in [17, Propositions 1.7 and 1.10] give for the edge-query complexity in these cases. The factor in Theorem 2 can therefore be absorbed into the polynomial.
2 Main technical contribution and comparison with previous approaches
2.1 Previous approaches: estimating through partitions
A sufficiently regular partition of a graph, together with the edge densities between its parts, approximately determines the densities of small induced subgraphs. For a hereditary property, the induced removal lemma turns this information into a way of detecting graphs that are far from the property. This suggests estimating distance by searching over modifications of the partition's density values. The search asks how cheaply those values can be changed so that they are compatible with a graph close to the property.
To justify this procedure, one must relate changes in the description to changes in the graph itself. Suppose that the prescribed densities change by on average, weighted by the sizes of the corresponding pairs of parts. One needs to realize the new densities with approximately edge changes while retaining the regularity required for counting. This continuity between editing the description and editing the graph is a key ingredient in the Fischer–Newman argument [14]. The large number of parts required by regularity accounts for its tower-type bounds.
Hoppen et al. [15] used the weaker approximation supplied by the Frieze–Kannan lemma [18], whose partitions have size exponential in a polynomial of the inverse accuracy. Weak regularity still controls the density of each fixed induced graph, but transferring edits while preserving the required approximation is more delicate. Their method combines weakly regular partitions with partitions that have no regularity requirement, leading to a doubly exponential bound. Gishboliner, Kushnir and Shapira [17] established an appropriate continuity statement: a slightly stronger form of weak regularity before editing is enough to retain ordinary weak regularity afterwards. This underlies their improved bounds.
2.2 Our approach
Our proof begins by expressing the distance as the approximate minimum of a single objective function built from the tester. We then show that this minimum is attained approximately by a weighted graph described using short labels on its vertices. Optimizing over these labels is a dense constraint satisfaction problem, whose optimum can be estimated from a small random sample. We overview each of these steps below.
Replacing membership by a penalty. Fix a target accuracy and let . After amplification and canonization, the tester samples vertices and rejects according to a symmetric rule . For an -vertex graph , consider the following rejection rule , where is a uniformly random ordered tuple of distinct vertices. The rule may depend on ; throughout the argument, and its associated rule are fixed. The tester satisfies
For the input graph on , consider . When , this minimum satisfies
For the upper bound, take a closest graph in ; its edit cost is exactly and its penalty is at most . For the lower bound, a graph within distance of has , by the triangle inequality. Every other pays a penalty of at least , which already exceeds the maximum possible distance. Thus the tester supplies all the information about needed by this objective.
We next allow the edges of a candidate graph to have weights in . For a weighted graph , let be the random graph obtained by rounding its edges independently, with edge probabilities given by . Extend the objective by setting
Then,
Consequently, allowing weights does not change the minimum: every weighted objective value is an average of ordinary graph objective values. This exact relaxation makes it possible to approximate candidate graphs by bounded real-valued functions.
Approximating a candidate using short vertex labels. The approximation only needs to preserve two quantities: the edit cost and the rejection probability of the fixed tester. The first is affine in the edge weights:
Thus, its change is measured by correlation with the single function .
To control rejection probability, we compare two weighted graphs by changing the edge probabilities in a sampled graph one at a time. Each change is an edge-weight difference multiplied by a discrete derivative of the tester's rejection rule. The important point is how these changes can be described.
Suppose the changing edge occupies positions 1 and 2 in the sample. Call positions 3, ..., s the anchors. After rounding the other edges, the change, which we call the derivative, is determined by the graph b on the anchors and the two adjacency vectors x, y from the endpoints to the anchors:
where is the graph with these prescribed adjacencies and with the edge 12 set to . In the comparison between two weighted graphs, a vertex may need a different adjacency vector for each of the two endpoint roles. Recording both vectors, and symmetrizing in the endpoints, gives a bounded test of an unordered pair.
In this way we obtain a family of functions on vertex pairs. Each derivative test is specified by bits of common data and bits at each vertex; we also include the cost test . With , the edge-by-edge comparison gives, for sufficiently large ,
This is the counting lemma needed by the proof.
The use of restrictions of the tester is inspired by Dwork and Tankala [19, Definition 3.1 and Lemma 3.2]. Here, the tester observes an induced graph, so its queried pairs share vertices. The endpoint labels retain these shared incidences and make the resulting tests compatible with sampling vertices.
A weak regularity argument now provides the required approximation. Starting from , maintain a sum of signed tests and use its clipped value as the current approximation. Whenever a test distinguishes this approximation from a target weighted graph , add a small signed multiple of that test to the sum. A bounded potential shows that fewer than updates suffice to obtain
where and . This is a form of weak regularity adapted to the tester, following the energy-increment principle of Frieze and Kannan [18] and the boosting perspective of Trevisan, Tulsiani and Vadhan [20].
Combining the descriptions of the tests gives a label at each vertex, drawn from a finite set with . The approximating weighted graph is recovered by a fixed symmetric function :
Thus, the labels describe the approximation relative to the original graph . Common values are included in each label, and is defined for every pair of labels, including pairs whose common values disagree. Every labeling therefore specifies a valid weighted graph, while the boosting argument guarantees that some labeling approximates any given target .
Taking to be a sufficiently small constant multiple of , equation (2) gives
The number of possible labels may be exponential, but their length is polynomial in and .
Estimating the optimum by sampling vertices. For a fixed labeling, both terms of can be written as averages of losses on ordered -tuples of distinct vertices. The rejection term already has this form; for the edit term, average the edge-edit losses over the pairs in the tuple. By equation (3), the loss on a tuple depends only on its induced subgraph in and the labels of its vertices.
It follows that minimizing is a dense -ary constraint satisfaction problem with alphabet . Each vertex is a variable, its possible labels are the alphabet, and each tuple contributes one bounded loss. Sampling a set of vertices restricts this same instance to ; the decoder and the rejection rule remain fixed. This is why labels on vertices are useful.
The subsampling theorem of Bernasconi, Castiglioni, Celli, Farina, and Malavolta [21, Theorem 3.3] approximates the optimum in expectation using a sample whose size is polynomial in the arity, the inverse accuracy, and the logarithm of the alphabet size. The theorem also requires a lower bound on the original instance size, polynomial in the same parameters. Both requirements are satisfied here. Small input graphs can be read in full; for larger graphs, averaging a polynomial number of independent sample optima gives the required success probability.
The sampled optimum can be computed by exhaustive search over labels, using only the edges inside the sampled vertex sets. Combining this estimate with the short-description approximation and equation (1) yields an estimate of with query complexity
. The polynomial dependence on the arity and the logarithmic dependence on the number of labels are both essential: the arity grows with the tester, and the label set is exponentially large. The boosting argument establishes the existence of a suitable description, and the estimator only computes optimum values on its samples.
3 Preliminaries
We first put the tester into a form that can be applied to weighted graphs. The weights let us describe gradual changes to a candidate repair. Independent rounding will then show that introducing weights does not change the optimum of the objective function introduced in Section 2.
For every integer , let , with . For integers , let ; in particular, . Given a set , write for its -element subsets and for its ordered -tuples of pairwise distinct elements. The set consists of the empty tuple. For , write , with . For distinct , write
. All logarithms have base 2. Unless stated otherwise, averages over a finite set are uniform. The empty-set conventions allow a tester with to have no anchors.
Let be a finite set. A graph on is a function . The set of these is . A weighted graph on is a function . The value represents the probability that is an edge. The set of these is . We have that , indeed unweighted graphs are a special case of weighted graphs. Note that when , , and consist of the unique empty function.
For , we use the following shorthands . For , is the random graph in whose edges are sampled independently at random with . If is a graph, . For , the induced weighted graph is .
Let . For functions , let denote expectation over a uniformly random unordered pair , and define , and . Thus, inner products measure average correlation, independently of the order of the graph. Averages indexed by use the same unordered-pair convention; when ordered pairs are needed, we write them as . We use to denote the constant function , and for the indicator of a condition . The distance between graphs is given by
A graph property is a set of graphs closed under isomorphism, and . The distance to is
is -far from if . For graphs with , .
The next proposition replaces the internal operation of the tester by a single rejection rule on a small induced graph. This is useful because we can then study how that rule changes when one sampled edge changes. Amplification makes rejection rare on graphs in the property; this will make the penalty small for a genuine repair. The original input order remains available to the tester, so its rule is allowed to depend on .
We use the canonization theorem of Goldreich and Trevisan [2] in the following functional form.
Proposition 1. Let be a property. Fix and a -tester for that requires at most queries. Then, there exist an integer and, for each , a function , where is the probability of rejecting when the induced graph on the sampled vertices is , such that the following two conditions hold:
(N1) for all and , where
(N2) for every with and , writing with uniform in ,
Proof. Amplify the tester by independent repetitions and a majority vote, so that its rejection probability is at most on members and at least on -far graphs. Apply the canonization theorem [2] to obtain a tester inspecting uniformly sampled vertices, padding to if necessary. Average its decision rule over all permutations of the sampled positions. This does not change the rejection probability on any input graph, and gives (N1). The function is the resulting conditional rejection probability, giving (N2). With the usual finite-randomness convention for a randomized tester, these probabilities are rational.
From now on, and its associated rule are fixed whenever we compare graphs on . In particular, restricting an optimization problem to a smaller vertex set later in the proof will not replace by the tester for that smaller order.
Recall that a function is multilinear if it is affine in each coordinate separately. Such a function treats an edge of weight exactly as an average of an absent edge and a present edge, with weights and . The next fact applies this observation to all edges: a weighted input cannot have a value smaller than every ordinary graph obtained by rounding it.
Fact 1. If is multilinear, then for every . Hence, .
Proof. We round one edge at a time. Affinity in the edge being rounded preserves the expected value at each step, and after all steps we have an ordinary graph. List the pairs , , and write . For , let
Affinity in gives , and therefore . This is a weighted average of values , , so it is at least their minimum. The minimum over exists by compactness.
We now extend the tester by interpreting each edge weight as an independent edge probability. The function is the rejection probability on one weighted sample of size ; the function averages this quantity over all samples in the full graph. Keeping these two levels separate will let us analyze one sampled edge before averaging over the input graph. Define and by
The next fact says that the extension retains relabeling symmetry and is compatible with rounding. Thus we may either round the whole graph and run the tester, or sample first and then round the sampled edges.
Fact 2. The following properties hold:
(a) for , ;
(b) and rej are multilinear;
(c) , and on graphs this rej agrees with that of (N2).
Proof. Each assertion follows because relabeling and taking an induced sample preserve the independent-edge model. More explicitly:
(a) has the law of ; use (N1).
(b) Each summand of is a product of factors affine in distinct coordinates, and rej is an average of composed with coordinate projections.
(c) Fact 1; on graphs .
4 Proofs
4.1 Derivatives of the tester, tests, and the counting lemma
The first step is to identify which features of a candidate repair need to be preserved. There are only two relevant quantities: its expected edit cost and its rejection probability. We will construct a family of pair functions whose correlations control changes in both quantities.
Fix and as in Proposition 1. Let with , and put , the number of pairs inspected in a canonical sample. Recall the definitions of and :
The objective charges for editing the graph and for leaving a graph that the tester is likely to reject. We first observe that the edit part is particularly simple: on a non-edge of , increasing the weight increases the cost, while on an edge of it decreases the cost. The function records exactly these two signs.
Fact 3. The function satisfies the equality . In particular, is affine and for .
Proof. Compute the cost for one pair, then average over pairs and over the rounding. For . So for graphs . Take expectations, using .
The next lemma explains why we can minimize this objective instead of searching only over graphs in . A genuine repair has a small penalty. A graph that remains far from pays more than the largest possible edit distance, while a graph already close to cannot save much on the cost of a genuine repair. Independent rounding also shows that fractional edge weights introduce no better minimum.
Lemma 1. The weighted and unweighted minima agree, i.e., . Further, if , then .
Proof. We first remove the weights using rounding, then compare an arbitrary candidate with a closest genuine repair. By Facts 3 and 2, is multilinear, so Fact 1 gives the equality. For the distance bounds, assume . For the upper bound, take with . By (4), . For the lower bound, let . If , then . If , then by (4). Either way .
The coefficient 2 makes the lower-bound comparison work: a -far graph has penalty at least . With coefficient 1, the soundness guarantee would give a penalty of only , which could be too small to prevent such a graph from undercutting the true distance.
We next isolate the information needed to measure the effect of one sampled edge. Designate its endpoints as positions 1 and 2, and call positions 3, ..., s the anchors. Once the graph on the anchors and the two endpoint-to-anchor adjacency vectors are fixed, the sampled graph is completely determined except for the edge 12. The gadget below simply records this decomposition; it adds no further graph structure.
Definition 1 (Gadget ). For a graph , vectors and integer , let be the graph on given by:
• for every ;
• for every ;
• for every .
So encodes whether position 1 is adjacent to anchor , does the same for position 2, is the graph induced on the anchors, and is the value of the edge .
The derivative below measures how much the tester notices a change to the remaining edge. It can be positive or negative, since adding an edge need not make rejection more likely. This discrete difference is also the coefficient of the edge probability when the other sampled edges have been fixed.
Definition 2 (Derivative of ). The derivative of in the edge 12 at is
To compare two weighted graphs, we will replace the sampled edge probabilities one at a time. At an intermediate stage, some positions use weights from the first graph and others from the second. A vertex can therefore need one adjacency vector when it occupies endpoint position 1 and another when it occupies position 2. We store both vectors in a single color. The extra color marks the anchors themselves, so that a test ignores pairs meeting an anchor.
Let . For each , define the symmetric function by
By (N1), : exchanging positions 1 and 2 is a relabeling. The reason for averaging in is different. The role-dependent expression need not equal when the two vertices have different vectors for their two roles. Averaging these two orientations makes the test a well-defined function of an unordered pair.
A coloring assigns this local information to every vertex. For each and , define the test . Thus a single coloring describes the response to every possible endpoint pair, with the same anchor graph . We allow all colorings; they need not come from actual neighborhoods in one graph. This larger family contains the random colorings used in the counting proof and is easy to encode by vertex labels.
Set
For , define
This seminorm measures the largest average discrepancy visible to any of these tests. A small value of means that the tests have little ability to distinguish from ; it does not assert that every edge weight is close. The cost test is included because its correlation is exactly the change in edit cost.
Every test takes values in . A derivative test is specified by common bits for b and bits per vertex for . The cost test is instead recovered directly from the input edge . This distinction will explain why the decoder later reads both endpoint labels and the original edge.
Example . Consider the rejection rule is a triangle]. There is one anchor, so has no edges and for . Fix an anchor vertex in an ordinary graph , and write for its neighborhood. Give color and every other vertex the color . Then
The test detects changes on pairs inside the neighborhood of . Summing these indicators over counts common neighbors of and : these are exactly the vertices that can complete the changing edge to a triangle. The general derivative tests play the same role for an arbitrary rejection rule.
The counting lemma says that these tests capture everything needed to control the objective. For some intuition towards the proof of the counting lemma, we continue with the triangle example. Let and be two graphs that have a large difference in their rejection probabilities (and for simplicity assume the edge weights are from ). In other words, taking a random sample of 3 vertices, the probability that the induced subgraph is a triangle is significantly different for compared to . We wish to show that there exists for which is large.
To this end, consider a specific ordering of the edge locations between the 3 sampled vertices , and consider interpolating between and by starting with and changing one edge at a time, in the order , until reaching . For the sets for which the rejection rule differs for and , there is some point in the interpolation for which the output of the rejection rule changes. By considering all such sets , there exists a step in the interpolation at which the rejection rule changes for a significant fraction of these sets.
After selecting an anchor graph on a single vertex , we construct using an interpolated version of and to define the labeling . Roughly speaking, the entries in correspond to pairs of vertices for which the output of the rejection rule on the interpolated subgraph changes when flipping the edge . These entries in line up with non-zero entries in , resulting in being large.
More generally, is the canonical sample size and . There are possible edge changes in a sample; bounding each one by the seminorm and summing gives the dependence on .
Lemma 2 (Counting). If then for all ,
Proof. We interpolate between and on one sampled pair at a time. For each step, we express the tester's response as an average of derivative tests. The only normalization loss comes from excluding the anchors as endpoints.
List the pairs of positions of . For and define by if and if , where . Let . Then and .
Fix , . For let be with its value on replaced by , and . Since is affine in and , differ only on ,
By Fact 2(a), we may relabel both the changing pair and the sampled positions without changing the derivative value or the sampling law. Thus we may assume ; each other pair then carries a label saying which function is used on it. Write with , , , and let where for and, say, . The last value is immaterial because the derivative overwrites it. Then
Fix . To realize the derivative by our tests, round the anchor graph once and independently round the two role-dependent adjacency vectors of each non-anchor vertex. Different pairs may share these random bits; we only need the correct distribution for each individual pair.
Let be a random graph on with independent edges, . For each let have independent coordinates with and , all variables independent. Let for , , and , a random element of . For distinct non-anchors , the graph has independent edges with exactly the probabilities of . Hence , so and
while if p or q is an anchor.
The color makes all anchor-incident pairs contribute zero. Our inner product nevertheless averages over all pairs in V, whereas the hybrid step averages only over pairs avoiding the anchors. We now account for this normalization explicitly. Summing over unordered pairs, and using that is a function of the unordered pair,
the sum over ordered pairs of distinct non-anchors. There are of them, and . Averaging over uniform and comparing with (5),
Here is the proportion of ordered pairs avoiding the anchors. Since ,
Every realization of lies in , so , and therefore . Summing over gives . By Fact 3 and , . Add twice the first bound.
4.2 Boosting
The counting lemma reduces the task to making every test correlation small. We do this by repeatedly correcting a correlation that is still too large. The sum of the corrections is allowed to be real-valued; clipping converts it into valid edge probabilities. Keeping the un-clipped sum is useful because it is described by a short list of tests.
Define clip : by , and apply it pointwise to real-valued functions. To track progress, we use a function whose derivative is exactly this clipping operation. Define by
By direct differentiation, , and is 1-Lipschitz. The following two properties explain this choice. The first will make our potential nonnegative; the second bounds the cost of taking an update step:
Indeed, the supremum is attained at , and the inequality follows from
For a target , define the potential , where is the un-clipped sum of the current corrections, by
It is nonnegative by (6) with .
When already takes values in , this potential is . Outside that interval, it remains nonnegative and its derivative with respect to is . This is the residual we can detect using tests. Thus the potential continues to track useful progress even when the un-clipped sum leaves the interval of valid weights.
The next lemma gives a short description of an approximation to any target : fewer than signed tests suffice. The number of vertices and the number of available tests do not enter this bound.
Lemma 3. Let be a finite nonempty family of functions , let and . There exist an integer and such that satisfies .
Proof. If a test sees an error larger than , move a distance in the sign of that test which reduces the error. The resulting decrease in the potential is at least , so only a bounded number of such moves is possible.
Set . Given , let . If , stop. Otherwise some has ; choose with and set . Applying (6) pointwise, with and ,
Also and . After any positive number of updates,
so . The process must therefore stop within this bound. If no update is needed, already has the required properties.
This is gradient descent for the convex potential , restricted to test directions. The step count is independent of .
We now turn the short list of corrections into information stored at vertices. In each step there is common information, i.e., the kind of test, its sign, and possibly its anchor graph, and, for a derivative test, a color for each vertex. We call the common information a symbol. A vertex label stores one symbol and one color for every possible step, padding unused steps by an empty symbol. This is why the label length depends on the number of boosting steps and on , but not on .
Here and below, fix , and use the family constructed in the preceding subsection.
Let . The set of symbols is , and the label set is . A label has components , and .
The decoder must recover an edge weight from the two endpoint labels and the original edge. A genuine boosting description has matching common symbols at every vertex. We nevertheless define the decoder on arbitrary pairs of labels; the later CSP optimization must be allowed to choose any label at any vertex. If the common symbols disagree, keeping the original edge is a convenient way to return a valid weight.
Define the decoder as follows. For and :
• if for some , then ;
• otherwise, let and set
The decoder is symmetric in . For a labeling , write and define by .
In particular, every labeling defines a valid weighted graph, even if its symbols are inconsistent. Consistency is needed only for encoding the specific boosting approximation whose existence we have proved.
The next lemma connects the two descriptions: each boosting approximation can be reconstructed from vertex labels. Its final assertion is what makes sampling possible, since a sampled edge can be decoded without knowing any labels outside its endpoints.
Lemma 4. For every and there is with , where . Moreover depends only on .
Proof. Record the boosting sequence component by component, duplicating each step's common symbol at every vertex and keeping its vertex-dependent color locally. Apply Lemma 3 to get , . In component , give every vertex the symbol and color if . Otherwise ; give every vertex the symbol and give vertex the color . Components get . All symbols agree across vertices, so is in its second case with for every . Thus , the function of Lemma 3. The last claim is the definition of .
We can now restrict the search for a repair to weighted graphs specified by labels. Define
The next proposition says that this restriction loses little: encode a true minimizer of and use the counting lemma to bound the change in its objective value. Arbitrary labelings cannot artificially improve on , because they still decode to genuine weighted graphs.
Proposition 2. For , , and if ,
Proof. The lower bound is immediate from inclusion of the feasible sets; the upper bound follows by approximating one minimizing weighted graph. Since , we have . Let attain and take from Lemma 4 for . Lemma 2 gives . The distance bounds follow from Lemma 1.
Observe that the boosting sequence is never computed by the algorithm. It only proves that a short-description repair of nearly optimal energy exists.
4.3 Estimating the optimum from a sample
The labels have reduced our search to a finite optimization problem. To apply a sampling theorem, we must express its objective as an average of bounded functions of a few vertex labels. The tester term already depends on s vertices. We write the edit term on the same tuples by averaging its pair costs over the K pairs in each tuple.
A dense s-ary constraint satisfaction problem (CSP) consists of variables , a label set , and for each a predicate . For with set , and let . Here a predicate is a score in , so the goal is to maximize the average score. We take whenever using this value. The normalization is , rather than : equivalently, tuples with a repeated vertex have score zero. This convention is responsible for the factor below.
For our graph , a tuple score will be one minus a rescaled local loss. The division by 3 is enough because the edit loss is at most 1 and the rejection penalty at most 2. For and let be . Define the loss and the predicate by , with
The loss depends only on and . Denote this CSP by . In we always restrict this same instance to : the alphabet , decoder , and rejection rule are kept fixed. This restriction need not be the instance one would construct by treating as a new input graph.
Let , the probability that s independent uniformly chosen vertices of V are all distinct. The next lemma verifies that the local losses average to the objective we want, with precisely this normalization factor when losses are converted to CSP scores.
Lemma 5. For every , , with uniform in . Hence
Proof. A fixed pair of positions in a uniform injective tuple is a uniform pair of vertices. Consequently, distributing the edit loss over larger tuples does not change its mean; the rejection term agrees by definition. For uniform and fixed , is a uniform pair, so the -term of the first part has expectation (Fact 3). Averaging over gives . Since here, the second part has expectation . For OPT: and , so ; maximize over .
We use the following external sampling theorem. It controls the optimum after optimizing the labels on the sample, not just the sampled value of a fixed labeling. This distinction matters: the best labeling of a sample can depend on the sample and need not extend to an equally good labeling of the whole graph. The guarantee is in expectation; independent repetition will turn it into the desired probability guarantee.
Theorem 3 (Bernasconi–Castiglioni–Celli–Farina–Malavolta [21, Theorem 3.3]). There are absolute constants such that for every dense k-ary CSP with label set of size and every , if
, and is a uniformly random -subset, then .
The dependence on the label set is only through . This is essential, since is exponential in .
The penalty and label approximation account for a small deterministic error; the sampled CSP optima account for the remaining random error. The threshold ensures that all counting and sampling hypotheses hold. Graphs below that threshold can be read in full at a polynomial query cost.
Proof of Theorem 2. Let , put , and choose as in Proposition 1, so that
Set and . Choose a rational . Then and
For and , Proposition 2 gives
Apply Theorem 3 with , and , where is an absolute constant with and . Let be the resulting sample size and the maximum of the theorem's threshold on , of , of and of (rounded up). By (7), both and are with absolute degrees. Let be the number of independent samples.
We may identify the input vertex set with . The rational choice of , together with the rational values of , makes the finite sample objectives rational, so their optima can be computed by exhaustive search without an additional approximation error.
The algorithm
-
By finite enumeration decide whether ; if so output 1. If output 0.
-
If : query all pairs and output exactly.
-
If : draw independent uniform -subsets and query all pairs inside each. By exhaustive search compute for the CSP restricted to (each predicate depends only on , the function and ). With , output .
Correctness for The sampling theorem bounds the bias of each sampled optimum. Averaging independent copies controls its fluctuation around that mean. We then invert the exact CSP identity from Lemma 5; the lower bound on ensures that this inversion enlarges the error by only a constant factor.
By Theorem 3 and Lemma 5, . The are independent with values in , so and . Chebyshev's inequality gives
So with probability at least , . Since , . By Lemma 5, , so the quantity inside the clip differs from by at most . With (8) the total error is below , and clipping to cannot increase it. For the output is exact.
Query complexity All graph queries are made inside the sampled vertex sets, or inside the whole graph when its order is at most . Searching through labels and evaluating their predicates uses no further graph queries. Thus the number of queries is at most
and substituting proves the theorem with .
For the corollary, the point is that a natural property already requires many queries to test at small proximity. Thus the explicit accuracy parameter in the estimator's bound can be paid for by the tester's own query complexity. We use the definitions of natural and non-trivial hereditary properties from Section 1.
Proof of Corollary 1. For natural properties, [17, Proposition 1.10] gives the edge-query lower bound . For non-trivial hereditary properties, [17, Proposition 1.7] gives this lower bound for the canonical vertex sample size. The Goldreich–Trevisan conversion [2] turns a tester with edge queries into one with sampled vertices, so the same lower bound follows for our edge-query notation. Taking , we obtain for sufficiently small . This also absorbs the in Theorem 2, proving the corollary.
AI disclosure
AI-assisted tools, specifically Quillbot, were utilized only to enhance the exposition's clarity and language. The mathematical arguments were not produced using them. Additionally, the author made use of the optional AI feedback for STOC 2027. The system found a few typos and some formatting errors, which the author personally corrected.
Acknowledgments
This project started while the authors were participating in the 2025 NII International Internship Program. The authors are grateful to the program for its support. G.C. is supported by the CB European PhD Studentship funded by Trinity College, Cambridge, and would like to thank the Isaac Newton Institute for Mathematical Sciences, Cambridge, for support and hospitality during the programme Logical Foundations of Complexity Theory, where part of the work on this paper was undertaken. This work was supported by EPSRC grant EP/Z000580/1.
References
[1] O. Goldreich, Introduction to Property Testing, Cambridge University Press, 2017.
[2] O. Goldreich and L. Trevisan, Three theorems regarding testing graph properties, Random Structures & Algorithms 23 (2003), 23–57.
[3] O. Goldreich, S. Goldwasser and D. Ron, Property testing and its connection to learning and approximation, Journal of the ACM 45 (1998), 653–750.
[4] N. Alon and A. Shapira, A characterization of the (natural) graph properties testable with one-sided error, SIAM Journal on Computing 37 (2008), 1703–1727.
[5] W. T. Gowers, Lower bounds of tower type for Szemerédi's uniformity lemma, Geometric and Functional Analysis 7 (1997), 322–337.
[6] V. Rödl and R. Duke, On graphs with small subgraphs of large chromatic number, Graphs and Combinatorics 1 (1985), 91–96.
[7] G. Carenini, C. Seth and Y. Yoshida, A quantitative container characterization of one-sided testability, 2026, arXiv:2608.01523.
[8] E. Blais and C. Seth, Testing graph properties with the container method, SIAM Journal on Computing 54 6 (2025), 1626-1642.
[9] N. Kushnir and A. Shapira, Towards tight bounds for testing k-colorability, Proceedings of APPROX/RANDOM (2026), 35:1–35:13.
[10] J. Balogh, R. Morris and W. Samotij, Independent sets in hypergraphs, Journal of the American Mathematical Society 28 (2015), 669–709.
[11] D. Saxton and A. Thomason, Hypergraph containers, Inventiones Mathematicae 201 (2015), 925–992.
[12] M. Parnas, D. Ron and R. Rubinfeld, Tolerant property testing and distance approximation, Journal of Computer and System Sciences 72 (2006), 1012–1042.
[13] E. Fischer and L. Fortnow, Tolerant versus intolerant testing for Boolean properties, Theory of Computing 2 (2006), 173–183.
[14] E. Fischer and I. Newman, Testing versus estimation of graph properties, SIAM Journal on Computing 37 (2007), 482–501.
[15] C. Hoppen, Y. Kohayakawa, R. Lang, H. Lefmann and H. Stagni, On the query complexity of estimating the distance to hereditary graph properties, SIAM Journal on Discrete Mathematics 35 (2021), 1238–1251.
[16] N. Fiat and D. Ron, On efficient distance approximation for graph properties, Proceedings of SODA 2021, 1618–1637.
[17] L. Gishboliner, N. Kushnir and A. Shapira, Testing versus estimation of graph properties, revisited, Random Structures & Algorithms 65 (2024), 460–487.
[18] A. Frieze and R. Kannan, Quick approximation to matrices and applications, Combinatorica 19 (1999), 175–220.
[19] C. Dwork and P. Tankala, Efficient and private property testing via indistinguishability, arXiv:2511.03653v2, 2026.
[20] L. Trevisan, M. Tulsiani and S. Vadhan, Regularity, boosting, and efficiently simulating every high-entropy distribution, Proceedings of IEEE CCC, 2009.
[21] M. Bernasconi, M. Castiglioni, A. Celli, G. Farina and G. Malavolta, A subsampling theorem for constraint satisfaction problems with large arity, 2026, arXiv:2608.00203.