Manuscript Offprint
arXiv:2611.04847Real-to-Integer Reduction for All-Pairs Shortest Paths
Abstract
Efficient graph algorithms often use techniques that are specific to integer-valued inputs and do not work for real-valued versions of the problems. Is it a limitation of current techniques, or are the real-valued variants inherently harder? One way to study this question is through real-to-integer reductions. We give (randomized, combinatorial) subcubic real-to-integer reductions for two central graph problems in fine-grained complexity: All-Pairs Shortest Paths and Exact Triangle. That is, we show that if the integer variants of these problems can be solved in truly subcubic time, then the real variants can also be solved in truly subcubic time.
Our work extends and combines techniques from three previous works: (1) our real-to-integer reduction for the 3SUM problem (Fischer, Polak, Schmidt, FOCS 2026), which itself combines the Frank–Tardos theorem from optimization with Freiman's theorem from additive combinatorics; (2) universe reduction for APSP (Fischer, STOC 2026), which we generalize to reals and use to reduce the doubling of the set of edge weights; and (3) the “Fredman's trick meets dominance product” technique (Chan, Vassilevska Williams, Xu, STOC 2023), which is needed to adapt the prior real-to-integer framework from equality constraints to inequalities.
As a corollary, our reduction combined with Yuval's fast Integer APSP algorithm in the real RAM model with multiplication (IPL 1976) shows that the Real APSP Hypothesis is false in this model, which also follows from the very recent breakthrough by Alman and Vassilevska Williams using a very different approach.
AI methodology. We obtained all the results in this paper without any use of AI tools. We used OpenAI's GPT and Google's Deep Review only for final proofreading of the paper.
Contents
1 Introduction 1
1.1 Our Results ..... 1
1.2 Computational Model ..... 3
1.3 Open Problems ..... 3
2 Technical Overview 4
2.1 Real-to-Integer Framework ..... 4
2.2 APSP ..... 6
3 Preliminaries 9
3.1 Notation ..... 9
3.2 Problems ..... 10
4 Real-to-Integer Toolbox 10
4.1 Approximate Reals and Approximate Select-Plus Rank ..... 10
4.2 Potential-Adjusting Reductions and Edge Weight Reduction ..... 11
4.3 Real-to-Integer Reduction for Low-Rank Reals ..... 13
4.4 Listing-to-Decision Reductions for Triangle Problems ..... 15
5 Real-to-Integer Reduction for Exact Triangle 16
5.1 Popular/Unpopular Decomposition ..... 16
5.2 Type 1: Only Popular Edges ..... 18
5.3 Type 2: Popular and Unpopular Edges ..... 19
5.4 Type 3: Only Unpopular Edges ..... 20
6 Real-to-Integer Reduction for APSP 21
7 Doubling Reduction for Real APSP 24
7.1 Low-Rank to Slice-Uniform ..... 25
7.2 Slice-Uniform to Uniform ..... 27
7.3 Uniform to Uniform Regular ..... 32
7.4 Uniform Regular to Uniform Small-Doubling ..... 34
7.5 Putting the Pieces Together ..... 38
7.6 Proof of the BSG Theorem for Approximate Reals ..... 38
The main focus of this paper is another fundamental graph problem, the All-Pairs Shortest Paths (APSP) problem. Given a directed edge-weighted graph , with no negative cycles, the APSP problem asks to compute the length of a shortest path from to for every pair of vertices . APSP is one of the central problems in fine-grained complexity [VWW18, VW18]. The textbook Floyd–Warshall algorithm [Flo62, War62, Roy59] solves it in time , and for a long time, until the very recent -time breakthrough algorithm [AV26], only a subpolynomial improvement was known [Wil18]. This state of affairs led people to study APSP through the lens of subcubic reductions—i.e., reductions that show that a truly subcubic algorithm for one problem yields a truly subcubic algorithm for another problem—and many problems are now known to be equivalent to APSP under such reductions [VWW18, TT98, BDT16, AGV23, BGMW18, NPS25].
For APSP, the difference between integer- and real-valued inputs is less immediately visible, because the best known algorithms (both currently and historically) have the same running times. However, the techniques differ substantially. For instance, the paper of Williams [Wil18] begins with “a succinct exposition of a good algorithm for APSP, at least in the case of reasonable-sized [integer] weights”, which is followed by a much longer description of the full algorithm for real-valued inputs. Also, the recent breakthrough truly subcubic algorithm for integer inputs is deterministic while for reals it is randomized [AV26].
This phenomenon, for APSP and other problems, begs to ask a question:
Are integer-only tricks a necessity or just a convenience?
We remark that this distinction is related, but not equivalent, to the distinction between algorithms whose running time is weakly-polynomial (i.e., it depends polynomially on the bit-length of input numbers) and strongly-polynomial (i.e., it does not depend on the size of input numbers). Often, a strongly-polynomial time algorithm for integers would also work for reals, but this is not always the case (e.g., [BDP08]).
1.1 Our Results
We address the above question in the case of APSP by providing a real-to-integer subcubic reduction.
Throughout the paper denotes the number of nodes and the number of edges of the input graph.
We use the notation to suppress polylogarithmic factors, i.e., .
Theorem 1.1 (Real-to-Integer Reduction for APSP). If Integer APSP, with edge weights from , can be solved in time for some constant , then Real APSP can be solved in time , by a randomized algorithm correct with high probability.
Theorem 1.1 shows that, for APSP, as long as the goal is a truly subcubic running time, anything that can be achieved with integer-only tricks automatically applies to real-valued inputs as well.
Naturally, the implication from Theorem 1.1 is no longer as interesting as it was before the recent work of Alman and Vassilevska Williams [AV26], which shows that both sides of this implication are unconditionally true. Nonetheless, we believe that the extensive techniques behind our proof of Theorem 1.1 bring us closer to understanding the driving question of this paper about the limitations of integer-specific tricks in algorithm design.
Alman and Vassilevska Williams [AV26] propose that now, when we know that the original APSP Hypothesis is false, “one could refocus the hypotheses to be about combinatorial algorithms.” We remark that our reduction from Theorem 1.1 is combinatorial (i.e., it does not use algebraic Strassenesque techniques common to fast matrix multiplication algorithms). Hence, we also establish that the “Combinatorial Real APSP Hypothesis” (asserting that no “combinatorial” algorithm for Real APSP runs in truly subcubic time in the real RAM model) implies the “Combinatorial Integer APSP Hypothesis” (asserting that no “combinatorial” algorithm for Integer APSP runs in truly subcubic time in the Word RAM model).
Subcubic Real APSP. Curiously, in the real RAM model with multiplications (but even without flooring), there is an algorithm that solves Integer APSP in time [Yuv76, CVWX22], where denotes the matrix multiplication exponent. In combination with our real-to-integer reduction from Theorem 1.1, we hence get an algorithm solving Real APSP in truly subcubic time in this model.
Corollary 1.2 (Real APSP Hypothesis Is False in Real RAM Model with Multiplication). There exists a constant , such that Real APSP can be solved in time in the real RAM model with multiplications, by a randomized algorithm correct with high probability.
We note that the recent independent work [AV26], using a very different algorithm, establishes essentially the same theorem but in a more reasonable real RAM model with only comparison and addition (see Section 1.2 for a discussion of computational models for reals).
Exact Triangle. APSP is known to be equivalent under subcubic reductions to the so-called Negative Triangle problem [VWW18], which asks, given an edge-weighted graph, if there exists a triangle (a cycle of length 3) with a negative total weight. A related problem, Exact Triangle is another central problem in fine-grained complexity. It asks if there is a triangle with total weight equal to zero. Negative Triangle (and hence also APSP) reduces to Exact Triangle [VWW13], but there is no known reduction in the opposite direction; Exact Triangle seems to be a genuinely harder problem. Also for this problem we give a real-to-integer reduction:
Theorem 1.3 (Real-to-Integer Reduction for Exact Triangle). If Integer Exact Triangle, with edge weights from , can be solved in time for some constant , then Real Exact Triangle can be solved in time , by a randomized algorithm correct with high probability.
It is not a coincidence that we also prove this result; there is a technical reason why we get it along the way to Theorem 1.1. We elaborate on it in Section 2, but let us briefly explain this reason now: Our starting point is our previous real-to-integer reduction for the 3SUM problem [FPS26], the first such self-reduction in fine-grained complexity. To extend our 3SUM framework to APSP, we need to account for the two main differences between these two problems: first, 3SUM is an arithmetic/convolution problem while APSP is a graph/matrix problem; second, 3SUM is about equality constraints and APSP is about inequalities. The Exact Triangle problem is a graph/matrix problem about equality constraints, so it is a natural warm-up that lets us understand how to deal with the first difference without yet having to worry about the second one.
1.2 Computational Model
When working with real-valued inputs, one has to be careful about the choice of computational model. Obviously one cannot just work with the word RAM, which is the standard choice (for problems with integral inputs) in fine-grained complexity, because it lacks the ability to express real numbers. Its analog for reals, the real RAM model, quickly becomes unreasonably powerful if we allow for arbitrary arithmetic operations on infinite-precision numbers in constant time. For instance, flooring allows solving PSPACE-complete problems in polynomial time [HS74, Sch79]. Even without flooring, multiplication itself allows solving APSP with integer edge weights in the matrix multiplication time [Yuv76]. For our reductions to be meaningful, we want to state them in a model as weak as possible.
All our reductions work in the comparison-addition model, which is the word RAM model augmented with only two real-valued operations: comparisons and additions. Actually, they even work in the so-called realistic comparison-addition model [FPS26, Section 1.1], where the cost of evaluating a comparison of the form , where 's are arbitrary non-zero integer coefficients and 's are input reals, is , and real addition can be performed only symbolically. A benefit of working with this model is that any algorithm for real-valued inputs can be efficiently simulated in the word RAM model on inputs that happen to be integral. In other words, trivial integer-to-real reductions do work with this model choice, and, combined with our real-to-integer reductions, they give fine-grained, subcubic equivalences of the real and integer variants of APSP and Exact Triangle. See [FPS26, Section 1.1] and [CVWX22, Appendix A in the full version] for a deeper discussion of computational models for reals.
1.3 Open Problems
A natural direction for future research is to make our real-to-integer reduction more efficient. Ideally, one would like an -time algorithm for Integer APSP to imply an -time algorithm for Real APSP, but already improving the savings from to would be interesting. Let us mention that, if one does not insist on the reduction being combinatorial, then it is already possible to improve to by using Matoušek's fast algebraic dominance product algorithm [Mat91] in the proof of Lemma 6.1.
In general, there are many fundamental problems for which the fastest known algorithms for reals are slower than what we can achieve with integer-specific techniques, e.g., linear programming [Dan65, Kha79] or maximum flow [Orl13, CKL+25]. Can we replace these techniques with more general ones, which also handle reals, possibly via real-to-integer reductions?
2 Technical Overview
In this section we give a high-level overview of our results. They can be seen as a conceptual and technical extension of the real-to-integer framework from our earlier paper on the 3SUM problem [FPS26]. This extension concerns two orthogonal directions: from the arithmetic setting to graphs, and from equality constraints to inequality constraints . The transition from arithmetic to graph problems is technically tedious, but the transition from equalities to inequalities is the actual challenge. There are two concrete obstacles, namely two integer-specific tricks that need to be replaced with alternatives for reals (to be discussed soon), and overcoming them is the key technical contribution of our paper.
2.1 Real-to-Integer Framework
Before we can get to these new obstacles, it is instructive to understand the key ideas behind our earlier real-to-integer framework. For simplicity, focus on the 3SUM problem, which asks to detect whether a given set contains a solution to the equation . In [FPS26], we show that this problem can be reduced from real-valued inputs to integer-valued inputs, in terms of subquadratic-time algorithms.
The starting point of that work is the Frank–Tardos theorem from optimization, which can be stated as follows:
Theorem 2.1 (Frank–Tardos [FT87]). There is an algorithm that, given reals , runs in polynomial time and computes integers such that
Suppose we apply this theorem to the reals in our input set . Then the theorem supplies integers that can be directly used as substitutes for these reals; indeed, there is a real solution if and only if there is an integer solution . While this is a fascinating starting point, the problem is that running the Frank–Tardos theorem is too slow: the algorithm runs in polynomial time with some large exponent, and even if this exponent could be improved, it is unconditionally impossible to achieve subquadratic time. (For details, see [FPS26].)
Therefore, instead of applying the Frank–Tardos theorem directly, [FPS26] proceeds differently. Here we describe this approach at a very high level, omitting many technical details without mentioning them. The approach can be summarized in the following steps:
- Rounding: Find an appropriate scale and round all reals to integer multiples of . Of course, we cannot actually round reals—this operation is not supported in the real RAM model—so we instead work with the usual weights but with -approximate equalities. But, for simplicity, let us pretend in this overview that we can round.
The scale is chosen in such a way that the number of solutions after the rounding is close to the maximum , say . This has an advantage and a disadvantage: the advantage
Strictly speaking, after rounding the number of solutions could even be as large as . For this reason, in [FPS26] we work with the Convolution 3SUM problem where the goal is to detect a solution for which additionally . This restriction gives a naive upper bound of on the number of solutions. This technicality shall not concern us here.
is that we have introduced additive structure by rounding at this coarse-grained scale, and we will soon exploit that structure. The disadvantage is that we have introduced many false positive solutions, and in order to distinguish a true solution from these false positives, we are forced to list all rounded solutions.
-
Popular/unpopular decomposition: While the rounding has introduced a lot of additive structure globally, this does not mean that every item is affected by this structure locally. We therefore partition the elements into popular and unpopular ones, depending on their local additive structure. Concretely, we say that an element is popular if it participates in many solutions of the form (after the rounding). The idea behind this decomposition is that the popular entries can be replaced by integers: via some involved additive combinatorics machinery, one can cover the popular entries by the subset sums of a set X of size at most (a so-called subset sum cover). Then we can apply the Frank-Tardos theorem to X instead of A, which runs in time .
-
Listing rounded solutions: We now list all rounded solutions. Of course, replacing only the popular items by integers would not be fully sufficient, as in a solution not all items need to be popular. We are left with three cases:
3.1. All-popular solutions: First, consider solutions where all three items are popular. These can now be listed, by replacing popular reals with their integer representatives, and then using the integer algorithm (by basic tricks from fine-grained complexity, any detection algorithm can be turned into a listing algorithm). To keep this step efficient, we rely crucially on the guarantee from Step 1 that the number of rounded solutions is at most .
3.2. Partially popular solutions: Second, consider solutions where some item is popular and some other item is unpopular. We cannot detect these solutions by a reduction to integers. Instead, we use a technical argument (a version of the “Fredman’s trick meets dominance product” technique from [CVWX23]), exploiting both that solutions involving popular items can be efficiently listed (due to their structure), and that there are not many solutions involving unpopular items (due to their missing structure).
3.3. All-unpopular solutions: It remains to list solutions containing three unpopular items. To do so, we simply remove all popular items and iterate, starting over in Step 1. This is clearly correct, but not necessarily efficient, as we now have to worry about the number of iterations. In particular, if the number of iterations is then already listing the all-popular solutions across all iterations becomes too expensive. The insight is that, since there are many rounded solutions, at least , and since every unpopular item participates in few, a large fraction of items must be popular. We thus reduce the size of A considerably with each iteration, leading only to iterations in total.
This is an oversimplification. In fact, in [FPS26] we need to consider a third category, quasi-popular items. This is for technical reasons that we ignore here.
Due to the same technical issue discussed in Footnote 3, here we only consider the solutions that also satisfy , in fact.
2.2 APSP
Let us finally come back to APSP. A seminal result in fine-grained complexity is that APSP is equivalent (in terms of subcubic algorithms) to the Negative Triangle problem, asking whether a given tripartite graph contains a triangle with a negative total edge weight,
A closely related problem is Exact Triangle, where the goal is instead to decide if there is a triangle with the total weight equal to zero,
That is, Exact Triangle can be seen as a variant of 3SUM where the items have to be placed on the edges of a triangle, and Negative Triangle can be seen as the variant with “<” instead of “=”.
An adaptation of the real-to-integer reduction should therefore be implemented in two steps: (1) from 3SUM to Exact Triangle, i.e., from an arithmetic to a graph problem, and (2) from Exact Triangle to Negative Triangle, i.e., from “=” to “<”. These two steps yield separate challenges. The first one is simpler; at least conceptually, the approach from before can work (though there are technical issues). The second one is much more challenging, and in the following overview we only focus on the two concrete obstacles that need to be overcome.
Problem 1: Additive Hashing. We start with the bigger of the two problems. An important aspect of the real-to-integer framework that we have not highlighted before is the following: the integers resulting from the Frank–Tardos theorem are huge! Even when applied in the elaborate way described above, through additive combinatorics and subset sum covers, we call the Frank–Tardos theorem with and thus the resulting integers have magnitude . In particular, performing any arithmetic operation on these numbers takes time . We can certainly not afford to lose this extra factor in the running time, since the saving in the aforementioned reduction is less than .
For this reason, an important intermediate step, after we have applied Frank–Tardos but before we list integer solutions, is to reduce the size of these integers; in other words, we perform a universe reduction. For 3SUM this is simple: all we need is a hash function that maps arbitrarily large integers to a small universe, say , and that is additive in the sense that if and only if (with good probability). Many families of additive hash functions are known, e.g., for a randomly chosen prime (and then working with equality modulo ).
If we want to apply the same approach for Negative Triangle, we would need a hash function satisfying the analogous property that if and only if (with good probability). However, such a hash function to a small universe cannot exist!⁶ This forces us to take a different route which, we believe, is of independent conceptual interest.
⁶To see this, consider the set and suppose that there is a hash function satisfying this property. We sketch the argument assuming that the property holds deterministically, but it can be extended to the randomized guarantee. Since , each value is positive/zero/negative if and only if is positive/zero/negative. Moreover, we clearly have for all , and thus . Similarly, . Iterating this, we must have that ; i.e., the range of is exponential in .
Solution 1: Doubling Reduction. As we are looking for a universe reduction for Negative Triangle (i.e., APSP) from exponential to polynomial weights, perhaps a natural starting point is Fischer's recent universe reduction from polynomially-bounded to linear weights [Fis26]. Let us take a step back to describe some ideas behind that work. Instead of directly using a hash function to reduce the universe size, it suggests a detour in three steps: (i) first, round the integers so that the set of weights admits some weak structure, (ii) then amplify this weak structure into much stronger structure called low doubling, (iii) and only then hash the weights to a small universe. Steps (i) and (iii) are similar to our setup here, but the crucial step is to apply the doubling reduction in between. Intuitively, when the weights are structured in this sense we circumvent the counterexamples showing that the desired hash functions cannot exist in general. To define low doubling for an integer set , let denote its sumset. The doubling is defined as the ratio . Fischer's doubling reduction essentially allows for the following trade-off: the weights can be transformed to have arbitrarily small doubling , at the cost of an overhead of in the running time. In particular, can be an arbitrarily small polynomial.
Unfortunately, the doubling reduction is long and involved. It consists of five steps, four of which need to be reproved for our setting of approximate reals (recall that we always work with reals represented up to ). In Section 7 we work through these four steps, and along the way also reprove a version of the famous Balog-Szemerédi-Gowers (BSG) theorem for approximate reals. But with the doubling reduction in place, we can repair the approach from before as follows. We replace the second step of the real-to-integer framework (Section 2.1) with the following more elaborate version:
2.1. Decompose the weights into popular and unpopular ones. Our goal in the following steps is to replace the popular ones by small integers.
2.2. Run the doubling reduction on the popular weights. This allows us to assume that the popular weights have doubling for some arbitrarily small . It still remains to replace them by small integers.
2.3. Apply Freiman's theorem from additive combinatorics to obtain a small subset sum cover of the popular weights. One can achieve that has size . Then use the Frank-Tardos theorem, applied to , to replace the popular weights by integers of size .
Thus, the resulting integers are still exponentially large, and performing operations on them takes time . However, the new freedom, due to the doubling reduction, is that we can pick arbitrarily small, independent of the other parameters of the reduction. In particular, when setting sufficiently small in terms of we can make sure that the total overhead due to the large weights becomes, say, , and so the real-to-integer reduction stays efficient. This resolves the first problem.
There are two remaining technical issues worth commenting on. First, if Step 2.2 runs in time , and we repeat this step over the iterations, why does this not cancel all of our improvements, given that is chosen to be much smaller than ? The insight is
The structure amplification in the doubling reduction even accomplishes slightly more: It allows us to simplify the overall reduction by removing the need for a separate step like Step 3.2 (Section 2.1), the partially popular case. These solutions can now also be detected by a reduction to integers.
that every popular edge appears in the doubling reduction in at most one iteration. Thus, analyzing the running time in terms of the number of edges rather than vertices shows that the total time remains subcubic.
Second, how can we implement Freiman’s theorem from additive combinatorics? This problem has been considered by Randolph and Węgrzycki [RW24]; however, their algorithm has an FPT-dependence on the doubling which is prohibitively slow for us. Luckily, as a side product of our earlier work [FPS26], we already have a weaker “Poor Man’s” version of the theorem which can be implemented sufficiently fast.
Problem 2: Scaling. The second problem concerns the standard “scaling trick” that is used to reduce from Negative Triangle to Exact Triangle, i.e., from “<” to “=” constraints. More specifically, this trick allows us to reduce the Negative Triangle problem to few instances of Exact Triangle, where each instance is promised to only contain nonnegative triangles. It essentially works by determining the weight of the most negative triangle bit-by-bit. However, for infinite-precision reals, such a bit trick clearly cannot work. The same problem has occurred in [CVWX22], where the goal was to reduce from APSP via Exact Triangle to the All-Edges Sparse Triangle problem; their solution was to circumvent the detour via Exact Triangle altogether. Unfortunately, this is not an option for us.
Concretely in our setting, the scaling trick is still necessary for many technical arguments under the hood. For instance, the doubling reduction is built on various heavy/light tricks, which reduce some weights to have low doubling, but for other weights they simply enumerate all zero-weight triangles involving these weights. Hence, without the scaling trick we could potentially miss some negative triangles.
Solution 2: Fredman’s Trick meets Dominance Product. Our solution is as follows. Suppose that we still follow our framework from before; in each iteration, which negative triangles do we miss? We can ignore triangles consisting of only unpopular edges as they will be dealt with in future iterations, so only focus on triangles involving at least some popular edge. If such a triangle is just barely negative in the sense that
then the rounding will actually turn this triangle into a zero-weight triangle, and therefore our real-to-integer reduction will correctly take care of it. This only leaves the very negative triangles of weight less than . To deal with these, we follow the “Fredman’s trick meets dominance product” technique due to Chan, Vassilevska W., and Xu [CVWX23], developed as a follow-up to [CVWX22]. The idea is roughly as follows. Each popular edge, say , is part of many zero-weight triangles. Thus, when sampling a vertex , with good probability we have that
Then, the condition that is a negative triangle can be expressed as
or, equivalently,
Algorithm 1: Real-to-integer reduction for Negative Triangle
Input: A tripartite graph with real edge weights Output: Is there a negative triangle in ?
1 while has more than triangles do 2 | Choose such that there are triangles of weight 3 | Partition into popular and unpopular edges, call a triangle popular if it has a popular edge 4 | Find popular triangles of weight by “Fredman’s trick meets dominance product”; return YES if there is any 5 | Apply the doubling reduction, preserving popular triangles of weight 6 | Apply the real-to-integer framework to replace popular edges by integers (Freiman’s theorem, subset sum covers, Frank-Tardos theorem) 7 | List all integer non-positive triangles; return YES if any has negative original weight 8 | Remove all popular edges from 9 | List the remaining triangles; return YES if any has negative weight 10 return NO
This elementary rearrangement is sometimes called “Fredman’s trick” [Fre76]. Note that the left-hand side only depends on and and the right-hand side only depends on and (assuming that is fixed). The problem of detecting a negative triangle therefore reduces to deciding if there is a triangle in a tripartite graph, where the edge weight in one prescribed edge part is larger than that in another edge part. This is an instance of the so-called dominance product problem, which is known to be computable in subcubic time [Mat91]. In this way, detecting the very negative triangle only leads to an overall subcubic overhead.
The full real-to-integer reduction ended up being quite technical. See the pseudocode in Algorithm 1 for a high-level summary.
3 Preliminaries
3.1 Notation
For integer , we write , and . We write if . We let denote the disjoint union of two sets and (i.e., the union when both sets are disjoint). We similarly define disjoint unions of matrices as follows. Suppose that are matrices where at each position or is equal to the dummy symbol . Then we denote by the matrix obtained from by replacing the -entries by the respective entries in .
We say that an event happens with high probability if it happens with probability at least , where is the input size and where is a constant which we can choose as large as required.
Earlier we claimed that our reduction is combinatorial and avoids algebraic techniques, but Matoušek’s algorithm for dominance product relies on fast matrix multiplication. In the actual reduction we instead use the hypothetically fast integer APSP algorithm in place of Matoušek’s algorithm; this makes the reduction slightly more lossy but combinatorial.
3.2 Problems
Problem 3.1 (Integer APSP). Given a directed graph with integer edge weights and no negative cycles, compute the length of a shortest path from to for every pair of vertices .
Problem 3.2 (Real APSP). Given a directed graph with real edge weights and no negative cycles, compute the length of a shortest path from to for every pair of vertices .
Using a standard chain of reductions [VWW18], it is well-known that the existence of an algorithm in truly subcubic time for Integer APSP is equivalent to the existence of an algorithm in truly subcubic time for Integer Negative Triangle. In the same paper, Vassilevska Williams and Williams give another reduction from APSP to Negative Triangle that avoids a binary search on the space of possible triangle weights and hence also works for real numbers. Therefore, also Real APSP and Real Negative Triangle are subcubically equivalent. In all our reductions we exclusively work with Negative Triangle instead of APSP.
Problem 3.3 (Integer Negative Triangle). Given three matrices , decide if there exist such that .
Problem 3.4 (Real Negative Triangle). Given three matrices , decide if there exist such that .
Exact Triangle is defined the same way with equalities in place of inequalities.
Problem 3.5 (Integer Exact Triangle). Given three matrices , decide if there exist such that .
Problem 3.6 (Real Exact Triangle). Given three matrices , decide if there exist such that .
For the integer variants we throughout assume that the weights are from the universe . Throughout the paper we also allow integer and real instances of any of the defined problem to contain missing values replaced by a dummy symbol . To simplify notation, we use suitable conventions such as for or , wherever necessary. Entries equal to could also be simulated by sufficiently large numbers.
4 Real-to-Integer Toolbox
In this section, we develop and recap some necessary tools for real-to-integer reductions as well as APSP in general. We start with some preliminary definitions concerning rounded reals and select-plus rank (Section 4.1). Next, we state the edge weight reduction for APSP that we use, in the spirit of a universe reduction (Section 4.2). Then, we recap our real-to-integer reduction tools and prove the precise primitive used for Exact Triangle and APSP (Section 4.3). Finally, we state listing-to-decision reductions (Section 4.4).
4.1 Approximate Reals and Approximate Select-Plus Rank
Approximate Reals. Morally, our algorithm works by rounding real numbers to an appropriate scale to create structure and then uses that structure. However, the restricted Real RAM model does not allow for a rounding operation, since that would already allow for unreasonably efficient algorithms (e.g., [HS74, Sch79]). Nonetheless, we can carry out the rounding symbolically. The operation we would like to be able to perform is rounding a real to its nearest integer multiple of some scale . Instead, we can keep track of and separately, and whenever we perform a comparison of two reals that should be rounded, we instead check that (via two comparisons and ). Note that this is not exactly the same operation as comparing rounded numbers, but performs a similar role in the sense that it allows us to compare numbers on a coarser scale.
We write to denote . For two sets , we say that is a -cover of if . In other words, for every there should be a with . For , a set is -spaced if for every pair of distinct elements .
We denote by the size of a minimum -cover of . Note that such a minimum -cover of size is easy to compute in time by a simple greedy algorithm: Indeed, just sort and sweep over its elements in increasing order. For every encountered and currently uncovered number , we add to the -cover and skip all numbers less than or equal to .
Observation 4.1 (Computing Minimum -Covers). Given and a set , we can compute in time a -cover of of size . Additionally, the set is -spaced and hence for every there is at most one element with .
Select-Plus Rank for Approximate Reals. For , the -approximate select-plus rank (or just -approximate rank) of a matrix is the smallest integer such that there are matrices and satisfying the following: For all with there is a such that:
When is a matrix such that , we call a -approximate rank- decomposition of . Whenever we say that a matrix has -approximate rank at most , we assume that we also have access to a -approximate rank- decomposition of .
We first observe that the -approximate rank of a matrix is not very sensitive to the choice of , i.e., when we scale by a constant factor, the rank also only changes by a constant factor.
Observation 4.2. If a matrix has -approximate rank at most , then it also has -approximate rank at most for any . We can compute it in time .
Proof. Let be the -approximate rank- decomposition of . To construct a -approximate rank- decomposition, simply replace each with entries . Do the same for and replace with entries . Finally, update by finding the correct new entry among the newly created entries. This also dominates the running time.
4.2 Potential-Adjusting Reductions and Edge Weight Reduction
To make it easier to keep track of how our reductions manipulate the graph and the number of triangles of certain weights, we reuse the definition of a potential-adjusting reduction, defined in [Fis26]. Informally, a potential-adjusting reduction is a reduction that allows us to delete edges and to add node weights in a way such that all triangles of weight 0 (up to in our case) are kept track of. Moreover, every triangle that survives the reduction will keep its weight (the value of ) unchanged. We use the following two definitions.
Definition 4.3 (Potential Adjustment). Let be instances of Real Exact Triangle of the same size . We say that is a potential adjustment of if there are potential functions such that:
Definition 4.4 (-Approximate Potential-Adjusting Reduction). A -approximate potential-adjusting reduction in time is an algorithm that runs in time and takes as input a parameter as well as a Real Exact Triangle instance of size and outputs a pair where
• is a set of potential adjustments of , and
• is a set of triples of size ,
such that each -approximate triangle in appears in or as a -approximate triangle in an instance in .
We use the following edge weight reduction to an approximately uniform and approximately low doubling weight set for matrices of bounded approximate rank. The statement (and reduction chain in the proof) mostly mirrors its exact version in [Fis26] (some of which already mirror reductions from [AFJ+25] in a rectangular setting). Our approach inherently only works for the corresponding -approximate definitions, which means we have to reprove the weight reduction for this setting. This is mostly a tedious but natural transfer to corresponding approximate versions of each argument in the chain. The proof of Lemma 4.5 can be found in Section 7. It also includes a port of the algorithmic version of the famous BSG theorem [BS94, Gow01, CL15], to a version for approximate reals, see Theorem 7.6.
Recall that for and a set , we denote by the size of the minimum -cover, that is, the minimum number of width- intervals necessary to cover all of .
Lemma 4.5 (Reduction to Approximately Uniform and Low-Doubling Weights). Let , and let be an Exact Triangle instance where one of the matrices has -approximate rank at most r.
There is a -approximate potential-adjusting reduction to instances where for each instance the set of weights satisfies:
• (Approximate Uniformity) , and
• (Approximate Low-Doubling) .
The reduction runs in time
4.3 Real-to-Integer Reduction for Low-Rank Reals
In this subsection, we first list the necessary real-to-integer toolbox, which we reuse from [FPS26].
Definition 4.6 (Subset Sum Cover). Let . pair , where and , is called a -approximate subset sum cover of if it satisfies for each . We call the rank of the subset sum cover.
Theorem 4.7 (Poor Man's Freiman's Theorem [FPS26, Theorem 3.10]). Let , , and let be a set satisfying the -approximate doubling condition . Then there is a -approximate subset sum cover of with rank . It can be computed in time .
The next lemma is also already proven in [FPS26], except for the third property. Since the hash function in the proof is monotone except for a random offset independent of the function argument, property (iii) follows immediately from property (ii). The proof internally uses the Frank-Tardos theorem [FT87].
Lemma 4.8 (Hashing Reals to Integers [FPS26, Lemma 3.9]). Let and let be a set with a -approximate subset sum cover of rank . There is a randomized algorithm that runs in time and computes a function such that:
(i) For all with , we have .
(ii) For all with , we have .
(iii) For all with , we have .
The next lemma is the main goal of this subsection. It combines the previously cited tools and is the single way in which we use them in the main proof. The lemma shows that if at least one input matrix has low -approximate rank, we can convert the edge weights to integers.
Lemma 4.9 (Real-to-Integer Reduction for Low-Rank Reals). Let , let be a parameter, and let such that:
-
at least one of , and has -approximate rank at most , and
-
the number of -approximate exact triangles in is at most .
Then there is an algorithm that reports a set of triangles , and outputs triples of integer matrices such that:
(i) , and the number of exact triangles in any is at most ,
(ii) any -approximate exact triangle in is in or an exact triangle in some ,
(iii) any negative triangle in some instance satisfies .
The reduction runs in time
Proof. Assume that we are given a -approximate rank- decomposition of , otherwise exchange the matrices appropriately. First, we use Observation 4.2 to turn it into a -approximate rank decomposition of rank for . Initialize . For each shift , run the following steps on , where for non- entries. Subtracting appropriately in the low-rank decomposition gives a -approximate rank- decomposition of . Then apply the edge weight reduction to approximately uniform and small doubling weights (Lemma 4.5) at scale to . This returns a pair of potential-adjusted instances and some exceptional triangles . Insert into every triangle whose original weight satisfies .
Next, we process the instances . Let denote the set of entries in the three matrices . This set satisfies and . Compute the greedy minimum -cover of , of size (with Observation 4.1) and for write for the unique with . The greedy construction gives and places its centers more than apart. Thus , and therefore
Apply Poor Man's Freiman's theorem to to compute a -approximate subset sum cover of rank , which is also a -approximate subset sum cover.
For , perform the following steps: Hash the reals in to integers with Lemma 4.8 at scale , and let denote the resulting hash function. Replace all occurrences in , and of a real with the integer , and add the resulting integer instance to the output. In the end, return together with the integer instances.
Correctness. Consider a -approximate exact triangle in the original instance with weight . Focus on the shift satisfying . For this shift, the triangle is either in , in which case it is added to , or it satisfies
for at least one instance by the guarantee of the -approximate potential-adjusting reduction. Then
since for all . For any , it also satisfies
with constant probability by Lemma 4.8, property (i), making an exact integer triangle in the reduced instance. After independent repetitions, a union bound over the at most triangles shows that every -approximate exact triangle outside appears as an exact triangle in at least one integer instance with high probability, proving property (ii).
We also need to argue that we do not get too many integer exact triangles, that is, property (i). First, every triangle in is -approximate in the original instance, so . Next, use property (ii) of the real-to-integer hash function (Lemma 4.8), which states that any integer triangle with
for some , also satisfies
Since for all , we must also have
Potential adjustments preserve this triangle weight; undoing the shift only adds . Thus the original weight has magnitude at most . There are at most such triangles.
We prove the third property about negative triangles in a similar way. Consider and some such that
Then
so the original weight is less than , proving property (iii).
Running Time. The edge weight reduction (Lemma 4.5) runs in time per shift, which also bounds the number of exceptional triangles that we enumerate. Computing and the map takes time per instance. Poor Man's Freiman's theorem (Theorem 4.7) takes time per instance. Finally, hashing each instance to integers (Lemma 4.8) takes time per instance. There are shifts and we repeat times. In total, the running time becomes
as claimed.
4.4 Listing-to-Decision Reductions for Triangle Problems
We use the following standard listing-to-decision reductions for the triangle problems of interest, Exact Triangle and Negative Triangle, due to Vassilevska Williams and Williams [VWW18]. They show that an algorithm that solves the problem in subcubic time can also be used to list a subcubic number of solutions in subcubic time.
Lemma 4.10 (Listing-to-Decision for Integer Exact Triangle, [VWW18]). If Integer Exact Triangle can be decided in time for some constant , then one can also list up to solutions in time .
Lemma 4.11 (Listing-to-Decision for Integer Negative Triangle, [VWW18]). If Integer Negative Triangle can be decided in time for some constant , then one can also list up to solutions in time .
5 Real-to-Integer Reduction for Exact Triangle
In this section we prove Theorem 1.3 and develop almost all remaining parts to prove our real-to-integer reduction for APSP (Theorem 1.1).
5.1 Popular/Unpopular Decomposition
The initial setup of the algorithm is more or less exactly the same as for 3SUM [FPS26]; the adaptations to triangles instead of 3SUM solutions are mainly concerned with the different number of possible solutions.
We call a triple a -approximate triangle (or -approximate solution) if .
Lemma 5.1 (Approximation Threshold). Let be matrices and let . There is a randomized algorithm that runs in time and either detects an Exact Triangle solution (in which case there are at least exact solutions), decides that the number of -approximate solutions is at most , or computes a threshold such that:
(i) the number of -approximate solutions is at most , and
(ii) the number of -approximate solutions is at least .
Proof. Consider a sequence of length of numbers equal to the absolute weight of all triangles for all triples , sorted in increasing order (where -values are considered the largest values). We aim to find one triple whose rank in this sorted order is between and . After having found such a triple we can return one of the three possible answers: If , we have found an Exact Triangle solution. In this case, the rank of the selected triple also guarantees at least exact solutions. If one of , , and equals , then so does their sum and we can conclude that the number of -approximate solutions is at most . If none of these cases apply, we set . Since the rank of is at least , there must be at least triples with
All of these triples form -approximate solutions. On the other hand, there are at most triples with
and only those triples can form -approximate solutions since .
To find we apply a sketching technique. Let and sample triples uniformly at random. Among them, pick the one for which is -th smallest. Equivalently, we choose uniformly random positions in the sorted order, and commit to the -th smallest position among the samples. For each sample, the probability that it has rank below is exactly . Therefore, the expected number of samples below this rank is . By Chernoff's bound it follows that with high probability there are fewer than samples below rank and the lower bound on the -approximate solutions follows. Similarly, the expected number of samples below rank is , and by Chernoff's bound with high probability there are at least 1.5R such samples. Thus, the upper bound on the -approximate solutions holds too.
Lemma 5.2 (Popular/Unpopular Decomposition). Let be matrices, , and let . There is a randomized algorithm that runs in time and partitions the edge set into popular and unpopular edges such that:
(i) Each popular edge is in at least -approximate solutions.
(ii) There are at most -approximate solutions involving unpopular edges.
Proof. We first describe a simple deterministic but slow solution: Initially, treat every edge as popular. For each edge that is contained in fewer than -approximate solutions, we mark it as unpopular. After this process ends, the first property holds by construction. By definition, each unpopular edge is involved in at most -approximate solutions. Summing over all edges proves property (ii).
Since we cannot afford to compute the number of triangles exactly, we implement the above idea with estimated counts. For each -edge , sample uniformly random values and count how many such triples form a -approximate solution . ( and are symmetric.) We can then simply scale the sample count to get an additive approximation of the number of solutions involving this edge within error . Chernoff's bound shows that the approximation works with high probability.
Now simply use the estimated counts to run the above described algorithm but mark an edge as unpopular if its estimated number of -approximate solutions is less than the threshold . After the algorithm, each popular edge is still in at least -approximate solutions. Summing over all edges shows that the number of -approximate solutions involving unpopular edges is at most
Now, we are left with only 3 types of solutions:
-
Solutions with only popular edges.
-
solutions with at least one popular edge and at least one unpopular edge, and
-
solutions with only unpopular edges.
We show how to detect any solutions of types 1 and 2 in Sections 5.2 and 5.3 respectively. In Section 5.4, we show how to deal with solutions of type 3 and complete the proof of Theorem 1.3.
Combining the lower bound on the number of -approximate solutions from the choice of (Lemma 5.1) and the upper bound on the number of -approximate solutions involving unpopular elements, we can observe the following.
Observation 5.3 (Number of Approximate Solutions). Assume that L is larger than K by a sufficiently large constant factor. Then:
(i) the number of -approximate solutions of type 1 is at least ,
(ii) the number of -approximate solutions of types 2 and 3 is at most .
Recall the definition of the -approximate rank of a matrix. We prove that after applying our decomposition into popular and unpopular edges, the popular edges must have low rank.
Lemma 5.4 (Popular Instances Have Low Rank). Let , , and be matrices where each -edge with is in at least -approximate solutions. Then, we can compute a -approximate rank- decomposition of in time .
Proof. Initialize the -approximate rank- decomposition such that and contain only 0 and contains only entries. The algorithm runs in iterations. In an iteration , we sample uniformly at random. Now, for any such that is a -approximate solution, we set
Finally, we return as our decomposition.
Correctness. Suppose is sampled in iteration . For all for which is a -approximate solution, that is,
we have
Therefore, is assigned correctly.
It remains to show that after iterations, every was assigned at least once. Since every is in at least -approximate solutions, every iteration assigns with probability at least . Hence after iterations, every was assigned at least once with high probability and we return a correct -approximate rank- decomposition of .
Running Time. Each iteration can easily be implemented in time . The running time therefore follows from the number of iterations.
5.2 Type 1: Only Popular Edges
Lemma 5.5 (Type-1 Solutions). Assume Integer Exact Triangle is in time . Then there is an algorithm that detects any solution with only popular edges in time
Proof. First set the unpopular entries of to , keeping and unchanged. By the definition of (Lemma 5.2) and Lemma 5.4, we can compute a -approximate rank- decomposition for , which we can easily turn into a -approximate rank- decomposition with Observation 4.2. Now also set the unpopular entries of and to . There are only edges left.
We apply a standard high degree/low degree split. For some parameter to be determined later, call a node light if and heavy otherwise. We enumerate all triangles involving at least one light node by iterating over all light nodes and all pairs of adjacent edges. The total number of enumerated triangles is
The remaining triangles to consider consist of only heavy nodes, of which there are at most . Restrict the graph (and the matrices , , and ) by removing all light nodes. Hence, we can assume that the matrices , , and have at most rows and columns. We can also restrict the -approximate rank- decomposition accordingly.
Also, by the choice of (Lemma 5.1), there are at most -approximate triangles. Hence, we can apply the reduction to integer listing (Lemma 4.9) at scale with a parameter to be specified later to reduce to instances of listing up to solutions to Integer Exact Triangle with integer weights in . We solve all of these instances using the listing-to-decision reduction (Lemma 4.10). Check the original real weight of every triangle in the returned set and every listed integer triangle, and return an exact solution if one is found.
Running Time. Computing the rank-decomposition takes time . Enumerating all triangles involving light nodes takes time . Applying the reduction to integer listing (Lemma 4.9) takes time . Finally, listing all integer exact triangles (Lemma 4.10) takes time per instance. In total, the time is hence
Set and use and hence and to bound the running time by
By choosing sufficiently small, the second term dominates the third and we arrive at the final running time
5.3 Type 2: Popular and Unpopular Edges
Lemma 5.6 (Type-2 Solutions). Assume Integer Exact Triangle is in time . Then there is an algorithm that detects any solution with at least one popular and at least one unpopular edge in time
Proof. Without loss of generality suppose that we look for triangles that have a popular edge in . By exchanging the roles of , , and , we can cover all cases of where the popular edge lies. Hence, we can set any entry in to if it is not in . By the definition of (Lemma 5.2) and Lemma 5.4, we can compute a -approximate rank- decomposition for . Refine it to scale using Observation 4.2, keeping rank . Then run the following steps separately on and , where and retain only unpopular entries. Each instance contains an unpopular edge in every triangle and inherits the decomposition of .
There are only 2 -approximate triangles with an unpopular edge (Observation 5.3). Hence, we can apply the reduction to integer listing (Lemma 4.9) at scale with a parameter to be specified later to reduce to instances of listing up to solutions to Integer Exact Triangle with integer weights in . We solve all of these instances using the listing-to-decision reduction (Lemma 4.10). Check the original real weight of every triangle in the returned set and every listed integer triangle, and return an exact solution if one is found.
Running Time. Computing the rank-decomposition takes time . The reduction to integer listing (Lemma 4.9) takes time . Listing all integer solutions (Lemma 4.10) takes time per instance. In total, the running time is
In contrast to type-1 solutions (Lemma 5.5), we set sufficiently small such that dominates . The final running time then becomes
5.4 Type 3: Only Unpopular Edges
Proof of Theorem 1.3. We proceed in iterations. In one iteration, we first compute a threshold (or directly detect a solution and return YES) (Lemma 5.1). Then, we compute the partition into popular and unpopular edges (Lemma 5.2). Next, we check for solutions involving at least one edge in (Lemmas 5.5 and 5.6). After that, we can remove all edges in by setting the corresponding matrix entries to . Finally, when Lemma 5.1 reports that there are at most -approximate solutions, we list them in time with the listing-to-decision reduction (Lemma 4.10), by first replacing non- entries in the real instance by the integer 0.
Denote by I the number of iterations and the set of popular edges in iteration i. We can bound the final running time by
It remains to bound . To do so, remember that the number of -approximate solutions involving only popular edges is at least (Observation 5.3). But in any graph with edges, the number of triangles is at most , by a simple heavy/light-degree split with threshold
. Therefore, if denotes the set of popular edges, then , which implies . Thus, the number of iterations is at most . With this bound, the running time bound simplifies to
By choosing large enough, we can ensure that the second term dominates the third. The running time becomes
For a small enough choice of , this becomes , which is truly subcubic.
6 Real-to-Integer Reduction for APSP
For Real APSP, at first glance it seems hard to generalize the approach from Section 5 to negative triangles since the threshold choice and popularity only bound the number of triangles summing to up to ; the number of negative triangles is unbounded. However, there is a simple fix that allows us to reuse basically the full previous reduction. Namely, if there exists a very negative triangle, that is, a triple satisfying
in an instance of sufficiently low approximate rank, then a negative triangle is simple to detect. Indeed, we can afford to iterate over the inner dimension of the approximate-rank decomposition and can then find a negative triangle using Fredman's trick and dominance product in truly subcubic time. The next lemma formalizes this idea. This step allows us to assume in the following that every negative triangle must also be a -approximate exact triangle. Therefore, all other steps from Section 5 apply.
Lemma 6.1 (Detecting Very Negative Triangles In Low-Rank Instances). Assume that Integer APSP is in time . Let , and let be a Real Negative Triangle instance, along with a -approximate rank- decomposition of . There is an algorithm running in time that either outputs a negative triangle in or reports that every triangle has weight at least .
Proof. Take the given -approximate rank- decomposition of , and use Observation 4.2 to turn it into a -approximate rank--decomposition. For all , define
Indeed, there can be at most triangles involving a vertex of degree at most . On the other hand, there can be at most vertices of degree at least , which form only triples.
We aim to compute a dominance product defined by
Once we have computed , we check if there are such that and , and find a witness for the dominance product in linear time. Then, we output the triangle and stop the algorithm. If no witness is found for any , we report that every triangle has weight at least .
To compute , we use the fast algorithm for Integer APSP: First, since computing by definition requires only comparisons of matrix entries, we can simply replace all real entries by integers (by sorting all entries in and and assigning integers in a way that keeps the order). Then, negate the entries in to compute the integer min-plus product
Finally, the dominance product outputs can be inferred by setting if and only if . (Of course, we may also compute each dominance product unconditionally in time using Matoušek's algorithm [Mat91]; however, we prefer our conditional statement since this leads to a combinatorial reduction.)
Correctness. Suppose there is a triangle with weight less than and let . Then
So and the triangle will be detected in the dominance product. On the other hand, for any with and , we have
and thus . Therefore, if the algorithm outputs , it must be negative.
Running Time. There are iterations. In each iteration we compute a single dominance product via a single invocation of the fast Integer APSP algorithm, in time . The total running time hence becomes , as claimed.
Equipped with the previous lemma and everything from Sections 4 and 5, we can immediately prove Theorem 1.1.
Proof of Theorem 1.1. Suppose we are given an instance of Real Negative Triangle and suppose there is an algorithm for Integer APSP and hence Integer Negative Triangle that runs in time . We proceed in iterations in the same way as in the proof of Theorem 1.3. First invoke Lemma 5.1, and suppose that it returns a scale (we discuss the exceptional outcomes later). Then compute with Lemma 5.2.
Let retain only the popular entries of . On , compute a -approximate rank- decomposition of using Lemma 5.4, and refine it to scale using Observation 4.2. The important difference comes here: Before listing all -approximate exact triangles with at least one edge in , we first invoke Lemma 6.1 at scale . Do the same with the roles of the three matrices exchanged to cover every possible position of a popular edge. If a call reports a negative triangle, we are done. Otherwise, every triangle with at least one popular edge has weight at least . It suffices to list the -approximate exact triangles with a popular edge and check their original weights. The remaining proof is the same as for Exact Triangle; we discuss the remaining steps below.
Only Popular Edges. For solutions involving only popular edges, our approach is the same as in Lemma 5.5. Restrict all matrices to popular entries by setting all other entries to . By the choice of (Lemma 5.1), the number of -approximate exact triangles is bounded by . Since, in addition, we detected very negative triangles with Lemma 6.1, the number of triangles with is bounded by . Whenever a reduction reports exceptional triangles or a listing algorithm returns triangles, we check their original real weights and stop if one is negative.
We apply the reduction to Integer Exact Triangle listing (Lemma 4.9) at scale with some parameter . By property (ii), every negative triangle in the remaining real instance is in or becomes an integer exact triangle, since its weight lies in . Focus on one resulting integer instance . By Lemma 4.9, property (iii), any triangle in the integer instance with weight
must also satisfy
in the real instance. Therefore, there are at most negative triangles in the integer instance. By Lemma 4.9, property (i), there are also at most zero-weight triangles. Thus, there are at most nonpositive integer triangles. Finally, we can list all such triangles with the listing-to-decision reduction for Integer Negative Triangle (Lemma 4.11), after subtracting 1 from all entries in, say, .
Every step runs in exactly the same time as for Exact Triangle in Lemma 5.5, so the running time analysis is identical.
Popular and Unpopular Edges. Now, we consider triangles with at least one popular edge and at least one unpopular edge, as in Lemma 5.6. Suppose without loss of generality that we look for triangles where the -entry is popular, and restrict accordingly. As in Lemma 5.6, run the following steps separately on and , where and retain only unpopular entries, so that every triangle in either instance has an unpopular edge. Both instances inherit the previously computed -approximate rank- decomposition of . By unpopularity (Observation 5.3), the number of -approximate exact triangles with at least one unpopular entry is bounded by . By our additional detection of very negative triangles with Lemma 6.1, the number of triangles with is hence also bounded by .
Now, we again apply the reduction to Integer Exact Triangle listing (Lemma 4.9) at scale with some parameter and focus on one resulting integer instance . Like in the previous case, we can use Lemma 4.9, properties (i) and (iii), to bound the number of triangles satisfying
by . Finally, we list all such triangles with the listing-to-decision reduction for Integer Negative Triangle (Lemma 4.11), after subtracting 1 from all entries in, say, .
Every step runs in exactly the same time as for Exact Triangle in Lemma 5.6, so the running time analysis is identical.
Iteration and Running Time. The iterating step, which is discussed in Section 5.4, stays basically unchanged from Exact Triangle. Thus the same bound applies, and these rounds also fit within iterations. Once Lemma 5.1 reports that there are at most -approximate solutions, we list all such solutions with the listing-to-decision reduction (Lemma 4.11) by first replacing non- entries with, say, .
The only remaining case is when Lemma 5.1 ever reports that there are exact solutions in the original instance. In this event, we proceed as before, but with . This choice only affects the all-popular case, where we can no longer upper bound the number of -approximate triangles by ; however, the all-popular case can now be solved by one call to Lemma 6.1 (since for every negative triangle is considered “very negative”).
The running time analysis is almost identical; the only difference is the additional running time caused by Lemma 6.1. Since we have to choose different values for and , let us perform the calculations. Similarly to the proof of Theorem 1.3, the running time is bounded by
By choosing large enough, we can ensure that the second term dominates the third. The running time becomes
For a small enough choice of , this becomes , which is truly subcubic.
7 Doubling Reduction for Real APSP
In this section, we prove the edge weight reduction (Lemma 4.5), which allows us to transform any approximately low-rank matrix into an approximately uniform and low-doubling matrix with a potential-adjusting reduction. Except for the -approximate part, the same chain of reductions was already carried out by Fischer [Fis26] for the purpose of a universe reduction for APSP. Many intermediate steps are in turn based on a chain of reductions for APSP with a truly sublinear number of distinct edge weights per node [AFJ+25]. We mostly have to follow the same reductions and proofs as in [Fis26] in the approximate real setting. For our use cases, some steps can be slightly shortened or presented in a slightly less general way; whenever possible, we take the opportunity to do so. However, there are no big conceptual differences.
7.1 Low-Rank to Slice-Uniform
Let and . We call a matrix -slice-uniform if the non- entries of either each row or each column in have a -cover of size at most . An instance is called -slice-uniform if at least one of , and is -slice-uniform.
Lemma 7.1 (Reduction from Approximately Low-Rank to Approximately Slice-Uniform Instances). For any , there is a potential-adjusting reduction from a Real Exact Triangle -approximate rank- instance to -slice-uniform instances. It runs in time
Proof. Assume we are given a -approximate rank- decomposition of the matrix , otherwise simply rotate the instance. Furthermore, we may assume that for some , and for all and , we have
that is, each inner dimension of the rank decomposition is selected the same number of times per row up to factors of (see [Fis26, Lemmas 3.5 and 4.4] for the corresponding unchanged arguments of this assumption).
Let be the set of exceptional triples, and let be the set of -slice-uniform potential adjustments of . Consider the algorithm that enumerates . In iteration , we ensure that each -approximate exact triangle with is either inserted into or still present in an instance in .
- (Heavy/Light Setup) Define matrices and of size by
Note that this way for all pairs with , the condition implies . For the remainder of this algorithm, we classify the non- entries of as either light or heavy. We call a non- entry light if
and heavy otherwise.
Creating and and classifying entries as either heavy or light takes time across all iterations.
- (Light Edges) We enumerate all triples with for which is light as follows. Enumerate all pairs . If there exists a light edge with , enumerate all rows with . There are at most such rows, since each satisfies and is light. We insert each such triple into .
This step correctly deals with all -approximate solutions involving light edges in time across all iterations.
- (Heavy Edges) We distinguish two cases depending on the number of heavy edges:
3.1. (Few Heavy Edges) If there are at most heavy edges, we can enumerate all relevant triples by brute force as follows. Enumerate all heavy pairs , and enumerate all columns with . Each enumerated triple that forms a -approximate exact triangle is inserted into .
This clearly takes care of all heavy triples. By the initial regularity assumptions of the rank decomposition, for each , there are at most columns with . Hence, the running time of this step is and thus across all iterations.
3.2. (Many Heavy Edges) The final case is that there are more than heavy pairs. Let be the matrix restricted to the heavy pairs (all other entries are set to ). We take care of the full instance using potential-adjustments and afterwards globally remove all heavy entries from . Construct matrices and by
By definition, is a potential-adjusting restriction of and retains all heavy exact triangle solutions. Furthermore, is -slice-uniform. To see this, in each column greedily select the leftmost uncovered heavy value and cover all heavy values in by four intervals of width . The selected values are more than apart, so their neighborhoods are disjoint. Each neighborhood contains more than entries of , hence there are at most selections and at most cover intervals. Then, we trivially reduce to instances that are -slice-uniform and insert these instances in .
This way we have dealt with all triangles where is heavy. Therefore, we can safely assign all heavy entries to for all future iterations. Regarding the running time, constructing the slice-uniform instances takes near-linear time in the output and adds instances to . Since there are at least heavy edges and we remove them globally after the iteration, we execute this step at most times in total. Therefore, across all iterations, the running time of this step is bounded by and .
The correctness and running time of the reduction are already analyzed per step. In total, the running time is bounded by , as claimed. With the initial regularity assumption, the number of created instances is bounded by .
7.2 Slice-Uniform to Uniform
Call an instance -uniform if the set of all non- entries of , , and satisfies .
Lemma 7.2 (Reduction from Approximately Slice-Uniform to Approximately Uniform Instances). For any , there is a potential-adjusting reduction from a Real Exact Triangle instance in which one matrix is -slice-uniform to instances which are -uniform. The reduction runs in time
Before we prove Lemma 7.2, we establish two convenient lemmas. Denote by the set of approximately s-popular sums, consisting of elements with at least s pairs that satisfy .
Lemma 7.3 (Approximating Approximately Popular Sums). Given sets , , and , there is an algorithm that computes a set such that:
(i) is a -cover for ,
(ii) for all , we have ,
(iii) for all , there are at most two with .
The algorithm runs in randomized time .
Proof. We first sample a multiset made up of independent uniformly random elements from for some . Define the candidate set . Let consist of all centers for which at least 1.5 pairs satisfy . Next, scan in increasing order. Remove a center if its current predecessor and successor both exist and satisfy . Finally, we return .
Correctness. The final deletion step clearly guarantees property (iii). At the same time, we only delete elements which cannot have been necessary for property (i). We thus continue proving properties (i) and (ii) pretending that we did not delete any elements from .
For property (i), consider any sum . There are at least 2s pairs with . By Chernoff's bound, we have sampled at least 1.5R such pairs in S with high probability. Let a and b be the smallest and largest sampled sums in . Both and belong to Q, and their width-2 intervals contain all these sampled sums, so both enter P. Since and this interval has length at most 2 , at least one of these centers is within of z. A union bound over at most possible sums z proves property (i).
Similarly, consider any for which there are at most choices of with . Chernoff's bound again shows that there will be at most 1.1R such pairs sampled in with high probability. Therefore, conditioned on this event, itself is not in . Since , a union bound over this fixed set of at most possible centers proves property (ii).
Running Time. The multiset has size and . Sorting the sampled sums and the candidates allows us to compute all sample counts by a linear sweep. The final deletions take one linear scan over the sorted centers. The running time is .
Lemma 7.4 (Popular Sum Decomposition). Let , let be -spaced sets of size at most , and let . Then there exist an integer and partitions
satisfying the following two properties:
(i) There are sets of size and shifts such that is a -cover for (for all ), and there are sets of size and shifts such that is a -cover for (for all ).
(ii) , and .
Moreover, there is an algorithm that, given the sets , computes the partitions along with the sets and the shifts in randomized time .
Proof. We show how to construct the partitions of the sets and the and ; the other part is symmetric. Fix a constant such that all and are -spaced. Every interval of width then contains at most elements of any one of these sets. Consider the algorithm that runs the following steps for :
-
Apply Lemma 7.3 with parameter . For each , it computes a set that is a -cover of and each covers sums from at least pairs in .
-
If , pick for all and stop the algorithm.
-
Otherwise, pick some for which there are at least many such that . Choose . We call an index good if and bad otherwise. For each bad , choose and arbitrarily. For each good , instead pick an arbitrary cover center . Then, pick
that is, as the set of elements in that are covered by a number in . Afterwards, remove from and continue with the next iteration.
Correctness. All properties are trivially satisfied after the algorithm terminates except for , which we show in the following. Consider iteration and suppose we chose index . Let be a good index. We claim that has size at least . For each fixed , the spacing of allows at most elements with . Thus each covered element of accounts for at most of the representing pairs. Indeed by the choice of , we have that
Thus, the size of each good set is decreased by and there are at least good indices. So we reduce by in each step, while initially we have . The bound on the number of iterations follows.
Running Time. In a single iteration, we run Lemma 7.3 a total of times with a running time of each. Step 2 takes time . Step 3 is simple to implement in time . With iterations in total, the running time is , recalling that is fixed.
Proof of Lemma 7.2. By rotating or transposing, we can assume without loss of generality that is -slice-uniform and the set of entries of each row of satisfies .
Outer Regularization. We start with a preprocessing step that allows us to assume afterwards that each element in the -cover covers roughly the same number of elements in each row of and column of . To this end, we partition into matrices where we include in the matrix all entries for which there are between and entries in its row with . Similarly, we partition into according to the number of approximately equal column entries. We are left with instances for .
For the remainder of the proof, fix one such instance and write and for simplicity of notation. For each , compute the greedy minimum -cover for the -th row of and also compute the greedy minimum -cover for the entries of the -th column of for each . Let and and note that for each row of , we have that . The same claim holds for columns of with . We finally argue that we may also assume that in the following. Indeed, if , we can enumerate all solutions in the instance efficiently as follows. Enumerate all pairs , enumerate all of the at most elements , and enumerate all with . Insert all enumerated triangles into .
We take care of all -approximate exact triangles in this step if the assumptions are not met. Indeed, if is a -approximate exact triangle, then , and because , we have also . Therefore, this step is correct. For the running time, notice that there are only many elements per row to enumerate. For each cover element, there are only constantly many elements to enumerate that would complete a -approximate exact triangle. Each such covers at most values . The total time to enumerate everything is hence bounded by
Uniformization. Recall that and have size at most . Run Lemma 7.4 on them for some parameter to be determined later. Let denote the number of parts in each returned partition. We call a -approximate exact triangle -exceptional if is covered by some , and -exceptional if is covered by some , and ordinary otherwise.
The running time of this setup is bounded by the running time of Lemma 7.4, that is, .
- (Exceptional Triangles) We will explicitly enumerate all exceptional -approximate exact triangles. We describe how to enumerate all -exceptional -approximate exact triangles and omit the analogous proof for -exceptional triangles (including exchanging the roles of and ). First, apply Lemma 7.3 for all to obtain a set that is a -cover for where each element in covers sums from at least pairs in up to and each element is covered by at most 2 numbers in . We then call such a triangle popular if for some and unpopular otherwise. We solve both cases separately.
1.1. (Popular Triangles) In this case, we simply use that the number of pairs supporting popular exceptional triangles is bounded. If , any one of its centers covers sums from at least pairs in an interval of width . Partition this interval into six intervals of width ; one contains sums from at least pairs. Any sum in this subinterval belongs to . Therefore, we know by definition of (property (ii) of Lemma 7.4) that the number of nonempty is at most . For each such pair, we enumerate all possible and store the triangle in .
The running time of this step is clearly bounded by .
1.2. (Unpopular Triangles) We enumerate all pairs where is not covered by up to . We enumerate all and test if a suitable exists that satisfies . If it does, we list all with and insert into .
For the running time, suppose that where , for some and , and no satisfies . This implies that . On the other hand, since is not covered by up to , fewer than pairs satisfy . Otherwise, one half of this width-6 interval would contain sums from at least pairs; any one of those sums would belong to and hence have a cover center in within of . Notice that for each pair we list values and in total at most many pairs . For each such pair we enumerate at most values of . The time for this step is hence bounded by
- (Ordinary Triangles) Enumerate all pairs . Define matrices , and as
We can assume that each triangle appears in only one instance since each number is only covered by one element of a -cover (Observation 4.1). Moreover, the value of the triangle is unchanged since all and cancel:
Now, we can verify that and are -uniform: The set of all non- entries in is covered by the -cover , by Lemma 7.4, property (i). Similarly, all non- entries in are covered by the -cover . Since each matrix has a -cover of size at most and hence a -cover of size at most , by splitting each covering interval into two.
Let be another parameter to be determined later. In the following, we modify to also become -uniform to make the whole instance uniform. Define the set
We can compute in time , represented as a union of intervals. Each membership query in can then be answered in time . We call a pair popular if and unpopular otherwise. We solve both cases separately.
2.1. (Popular Entries) Let be the restriction of to the popular entries with all unpopular entries replaced by . To bound its cover size, take a maximal subset whose points are more than apart. The intervals of width around points of are disjoint, and each contains negated sums from at least pairs, so . By maximality, is a -cover of ; splitting each interval into two gives a -cover. Observe that
and therefore also has a -cover of size . Hence, the instance is -uniform. We can trivially reduce this further to instances that are -uniform, which we store in .
There are possible choices for , so the total running time of this step is .
2.2. (Unpopular Entries) In this case, we enumerate all unpopular pairs . By the definition of , fewer than pairs satisfy . We enumerate all and test whether there is satisfying this condition. If there is, we list all with and insert into .
For correctness, every -approximate exact triangle in this instance has representatives and with and . Together with , this gives , so we certainly list and thus include into .
For the running time, notice that for each pair , we list values of and in total at most pairs . For each such pair, we enumerate at most values of . The total time of this step is hence bounded by
This completes the algorithm description and correctness arguments.
Running Time. The initial preprocessing runs in time and creates only many instances. Every other contribution has been analyzed before and leads in total to a running time bound of
Setting and , the bound simplifies to , as claimed. The number of created instances with this choice of parameters is bounded by .
7.3 Uniform to Uniform Regular
Call a matrix -regular if there is no such that there are more than entries with in the same row or column of . We say that an instance is -regular, if all three matrices are -regular. In other words, if we consider a -cover of the entries in an arbitrary row or column of , no element covers more than many entries.
Lemma 7.5 (Reduction from Approximately Low-Rank to Approximately Uniform and Regular Instances). For any , , there is a potential-adjusting reduction from a Real Exact Triangle instance where one matrix has -approximate rank-r to instances that are -uniform and -regular. The reduction runs in time
Proof. We use the exact same proof as in [Fis26] modulo the approximate versions of rank, slice-uniform, uniform, and regular.
- (Low-Rank to Slice-Uniform) Run the potential-adjusting reduction from Lemma 7.1 with some parameter to transform the low-rank instance into -slice-uniform instances. Denote the output by .
This step runs in time .
- (Slice-Uniform to Uniform) We further reduce each of the obtained instances into -uniform instances by running Lemma 7.2 with some parameter . Let be the union of all and the union of all .
This reduction is still potential-adjusting and runs in time .
- (Uniform to Uniform Regular) We reduce the instances in further to regular instances . Set initially . In this reduction step we will miss some -approximate exact triangles, but we ensure that each such triangle is present in one of the instances , , or that we will construct. We will guarantee that these remaining instances have low approximate rank, so we will maintain low--approximate-rank decompositions of , , and . Initially, we set every entry of these matrices equal to and start with a trivial -approximate rank-0 decomposition.
Enumerate the instances . Since they are obtained from potential-adjusting reductions, we also know potential adjustments and such that
for all entries. Let be a parameter determined later. Let be the greedy minimum -cover of the entries of the -th row of , with , and let be the corresponding cover for the -th column. In each cover the centers are more than apart, so every non- entry belongs to a unique cover interval, which we call its bucket. We call an entry row-heavy if the element with covers more than a fraction of the entries of the -th row, that is, . Similarly, we call an entry column-heavy if its center satisfies . Otherwise, we call light. Let
denote the partition of the entries of into row-heavy, column-heavy, and light entries. Entries that are both row-heavy and column-heavy are assigned arbitrarily to either part. Do the same for and . We proceed in two substeps.
3.1. (Light Entries) Each row or column bucket contains at most light entries. An interval of width intersects at most two consecutive cover intervals, since their centers are more than apart. In each row, split the light entries of every bucket into groups of size at most . Do the same independently for columns, and partition according to the pairs of groups. This gives matrices that are -regular. Hence, we can transform the subinstance into instances that are -uniform and -regular in a potential-adjusting way. We insert all of these instances into .
This step clearly runs in time .
3.2. (Heavy Entries) Focus on the row-heavy entries of for now. For each such entry , we will update and now also update its rank decomposition. Let consist of the centers whose buckets contain more than entries of the -th row of . Since these buckets are disjoint, . This set -covers the -th row of . Therefore, we can trivially compute a -approximate rank- decomposition of . We adjust this decomposition by
which leads to a -approximate rank decomposition of the same rank of the restriction of A to the row-heavy entries of . Indeed, for each row-heavy entry , we have
We perform the same update-procedure for the column-heavy entries to update . We do the same symmetrically for and . This step runs in time .
- (Recursion) Finally, we recurse on the three instances , , and , which is possible since we have maintained approximate rank decompositions of the three matrices , , and . Denote the recursive outputs by , , and . We return .
This completes the algorithm description. Each step runs in the same time bound as the corresponding step in [Fis26, Lemma 4.10]. Therefore, the recursion analysis as well as the rank of subinstances is identical to [Fis26]. The same is true for the choice of parameters . Thus, we omit further details here.
7.4 Uniform Regular to Uniform Small-Doubling
Theorem 7.6 (BSG Covering for Approximate Reals). Let . Let be -spaced sets of size each, let have size at most , and let . Then, there are subsets and such that
(i) for all ,
(ii) where .
The sets , and can be computed in randomized time .
We defer the proof of Theorem 7.6 to Section 7.6.
In this section, we will need some more lemmas corresponding to statements from additive combinatorics but for -approximate reals. Therefore, let us introduce some notation and preliminary statements first to transfer the exact statements easily to the approximate setting. When is clear from context, define for any set the set , that is, the set of numbers in rounded down to an integer multiple of . (For , define )
Lemma 7.7. Let and . Then, we have
Proof. Notice that any pair of numbers that are rounded to the same number satisfy . Thus, the rounded values themselves form a -cover of . On the other hand, for any satisfying the rounded numbers and differ by at most 1. Consequently, each interval in a -cover of contains points from at most three rounding bins. This shows for any set that
Lemma 7.8. Let and . Then, we have
Proof. Let and . Simple calculations yield
and
This shows that the number in corresponds to at most 4 numbers in and vice versa. Hence, we get
Lemma 7.9 (Ruzsa's Triangle Inequality for Approximate Reals). Let . All finite sets satisfy
Proof. The proof is a simple corollary of the exact version of Ruzsa's Triangle Inequality [Ruz96], essentially the same statement with replaced by and without an additional constant. Assume . We have
where we used Ruzsa's Triangle Inequality for the step . All other steps are applications of Lemmas 7.7 and 7.8.
Finally, we prove the goal of this section, the reduction from approximately uniform and regular instances to approximately uniform and low-doubling instances. We say that a -uniform instance is -doubling if the set of edge weights in , and satisfies that .
Lemma 7.10 (Reduction from Approx. Uniform Regular to Approx. Uniform Low-Doubling Instances). Let and . There is a potential-adjusting reduction from a Real Exact Triangle Instance that is -uniform and -regular to instances that are -uniform and -doubling. It runs in time
Proof. Denote by the greedy minimum -cover of the set of entries of the instance; its centers are more than apart. By uniformity, we know that . We apply BSG Covering (Theorem 7.6) with input sets , tolerance , size parameter , and some parameter to be determined later. This results in sets and . Since each interval of width is covered by four intervals of width , the returned sets satisfy and . For each -approximate exact triangle with representatives , we have . Therefore, its representative pair is either in the structured part (if for some ) or in the remainder if . We deal with both types of triangles separately.
- (Remainder) We explicitly list all -approximate exact triangles in the remainder. Enumerate all pairs and enumerate all . Then, enumerate all with and all with . We store all triangles enumerated this way in .
Clearly, we enumerate all triangles in the remainder. For the running time, recall that the instance is -regular, hence for a fixed and , there are at most valid choices of , and similarly for and . Therefore, the running time is bounded by
- (Structured Part) Enumerate all . First discard from every center whose interval of width contains no entry of , and do the same for and . We compute the set by brute-force and construct the matrices
This way, each -approximate exact triangle in the structured part appears in some instance . We further distinguish two cases.
2.1. (Sparse Case: or ) In this case, one of the matrices or is sparse. Suppose . Then, all entries in are covered by a -cover of size at most and each element in the cover covers at most a -fraction of the entries, by regularity. Hence, can contain at most non- entries. We can therefore solve the instance by brute-force and place all triangles in in time across all iterations.
2.2. (Dense Case: and ) Let be the set of weights in and let . The set
is a -cover of . Moreover, every center in is within of a weight in , by the removal of unused centers. Expanding each interval in a minimum -cover of to width therefore covers . Each expanded interval contains at most two centers, since these are more than apart. Thus . We will bound relative to .
First, note that we can bound the approximate doubling of using Ruzsa's triangle inequality for approximate reals (Lemma 7.9) by
Symmetrically, . Since , it follows that
Let . By Lemmas 7.7 and 7.8, we have . The Plüennecke–Ruzsa inequality gives
where are nonnegative integers and denotes the -fold sumset. Every element of lies within of an element of , as each term from contributes less than of rounding error. Consequently, . Since -covers , we obtain
We pick such that has approximate doubling at most . Therefore, the whole instance is -doubling and -uniform, as desired, and we place it in .
The arguments in this step are just existential, so the total running time across all iterations is bounded by .
This completes the description of the reduction, which is clearly potential-adjusting with . For the running time, the initial BSG Covering takes time . The remaining steps are analyzed before. In total, the running time is bounded by
7.5 Putting the Pieces Together
Lemma 4.5 (Reduction to Approximately Uniform and Low-Doubling Weights). Let , and let be an Exact Triangle instance where one of the matrices has -approximate rank at most r.
There is a -approximate potential-adjusting reduction to instances where for each instance the set of weights satisfies:
• (Approximate Uniformity) , and
• (Approximate Low-Doubling) .
The reduction runs in time
Proof of Lemma 4.5. First, apply Lemma 7.5 with to get instances. For each resulting instance, run Lemma 7.10 with parameter . This results in a total of . instances that are -uniform and -doubling, as claimed. The total running time is
7.6 Proof of the BSG Theorem for Approximate Reals
We follow the proof and exposition by Chan and Lewenstein [CL15]. The proof is based on a graph lemma, which Chan and Lewenstein prove in their paper. For the purpose of our proof, we can simply reuse it without any difference. As they do, we prove the BSG Theorem in the single set version first and then use that to prove Theorem 7.6.
Lemma 7.11 (Graph Lemma [CL15, Lemma 7.1]). Let and let be sets of size each. Given a bipartite graph , with , there exist and such that
(i) for every , there are length-3 paths from to , and
The sets can be computed in randomized time .
Lemma 7.12 (Single-Set BSG for Approximate Reals). Let and let be -spaced sets of size each. Let be of size and suppose that .
Then, there are and such that
(i) and
(ii) .
Proof. Fix a constant such that and are -spaced. Consider the bipartite graph with and as its two sides and edges given by . Let and be the sets given by the graph lemma (Lemma 7.11). We claim that these sets satisfy both claimed properties. Property (ii) immediately follows from Lemma 7.11, property (ii), so we focus on proving the first property.
Let be a -cover of the set of size . Let be the greedy minimum -cover of , whose centers are more than apart. We analyze the following algorithm to bound the size of :
for each do
take the lexicographically smallest with
for each length-3 path in do
mark every triple with
-
,
-
, and
-
end
end
By property (i) of Lemma 7.11, the innermost step is executed at least times. Since , , and are all edges in and by the definition of , at least one triple is marked in each iteration. Next, we argue that each element in is marked times, bounding the number of total marks by . This then immediately implies
and since is a -cover of , we have , property (i).
To prove the claim, consider that is marked by some path of length 3 via . By adding the conditions on and and subtracting the condition on , we get
and . Hence, there can be at most choices for leading to being marked. Each choice of in turn uniquely determines . Furthermore, we know that and . The spacing gives options each for and for a fixed choice of . Thus can be marked at most times.
Theorem 7.6 (BSG Covering for Approximate Reals). Let . Let be -spaced sets of size each, let have size at most , and let . Then, there are subsets and such that
(i) for all ,
(ii) where .
The sets , and can be computed in randomized time .
Proof of Theorem 7.6. If , simply return , , and leave all other sets empty. We repeatedly apply Lemma 7.12 to extract the sets as follows.
We initialize the set as
Then we run iterations , where we fix the sets and in iteration . Initially, they are all empty.
In an iteration , we first check if for some constant determined later and in this case simply return with . Otherwise, we apply Lemma 7.12 on and with the current graph and to receive sets and . Afterwards, we remove from and continue with the next iteration.
Correctness. Notice that the set of sums represented by has a -cover of size at most , namely , which is still valid even after removing elements from . Hence we can apply Lemma 7.12. The bounds on and are clearly satisfied. All that remains to show is that the algorithm terminates after iterations. Let denote the set in iteration . Using Lemma 7.12, property (ii), we can bound its size by
Following the analysis in [CL15], this implies
By iterating, we get and can hence choose a to terminate in the correct number of iterations.
The running time analysis is analogous to the analysis in [CL15].
References
[AFJ+25] Amir Abboud, Nick Fischer, Ce Jin, Virginia Vassilevska Williams, and Zoe Xi. All-pairs shortest paths with few weights per node. In 57th Annual ACM Symposium on Theory of Computing (STOC 2025), pages 1956–1964. ACM, 2025. doi:10.1145/3717823.3718240.
[AGM97] Noga Alon, Zvi Galil, and Oded Margalit. On the exponent of the all pairs shortest path problem. J. Comput. Syst. Sci., 54(2):255–262, 1997. Announced at FOCS 1991. doi:10.1006/JCSS.1997.1388.
[AGV23] Amir Abboud, Fabrizio Grandoni, and Virginia Vassilevska Williams. Subcubic equivalences between graph centrality problems, APSP, and diameter. ACM Trans. Algorithms, 19(1):3:1–3:30, 2023. Announced at SODA 2015. doi:10.1145/3563393.
[AMOT90] Ravindra K. Ahuja, Kurt Mehlhorn, James B. Orlin, and Robert Endre Tarjan. Faster algorithms for the shortest path problem. J. ACM, 37(2):213–223, 1990. doi:10.1145/77600.77615.
[AV26] Josh Alman and Virginia Vassilevska Williams. Truly subquadratic 3SUM and truly subcubic APSP via triangles in sparse lopsided graphs. CoRR, abs/2610.06783, 2026. arXiv:2610.06783, doi:10.48550/ARXIV.2610.06783.
[BDP08] Ilya Baran, Erik D. Demaine, and Mihai Pătrascu. Subquadratic algorithms for 3SUM. Algorithmica, 50(4):584–596, 2008. Announced at WADS 2005. doi:10.1007/S00453-007-9036-3.
[BDT16] Arturs Backurs, Nishanth Dikkala, and Christos Tzamos. Tight hardness results for maximum weight rectangles. In 43rd International Colloquium on Automata, Languages, and Programming, ICALP 2016, volume 55 of LIPIcs, pages 81:1–81:13. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPICS.ICALP.2016.81.
[BGMW18] Karl Bringmann, Pawel Gawrychowski, Shay Mozes, and Oren Weimann. Tree edit distance cannot be computed in strongly subcubic time (unless APSP can). In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, pages 1190–1206. SIAM, 2018. doi:10.1137/1.9781611975031.77.
[BNW25] Aaron Bernstein, Danupon Nanongkai, and Christian Wulff-Nilsen. Negative-weight single-source shortest paths in near-linear time. J. ACM, 72(4):23:1–23:34, 2025. Announced at FOCS 2022. doi:10.1145/3742890.
[BS94] Antal Balog and Endre Szemerédi. A statistical theorem of set addition. Combinatorica, 14:263–268, 1994. URL: https://doi.org/10.1007/BF01212974.
[CHM90] Joseph Cheriyan, Torben Hagerup, and Kurt Mehlhorn. Can a maximum flow be computed on o(nm) time? In Automata, Languages and Programming, 17th International Colloquium, ICALP 1990, volume 443 of Lecture Notes in Computer Science, pages 235–248. Springer, 1990. doi:10.1007/BFB0032035.
[CKL+25] Li Chen, Rasmus Kyng, Yang P. Liu, Richard Peng, Maximilian Probst Gutenberg, and Sushant Sachdeva. Maximum flow and minimum-cost flow in almost-linear time. J. ACM, 72(3):19:1–19:103, 2025. Announced at FOCS 2022. doi:10.1145/3728631.
[CL15] Timothy M. Chan and Moshe Lewenstein. Clustered integer 3SUM via additive combinatorics. In 47th Annual ACM Symposium on Theory of Computing (STOC 2015), pages 31–40. ACM, 2015. doi:10.1145/2746539.2746568.
[CVWX22] Timothy M. Chan, Virginia Vassilevska Williams, and Yinzhan Xu. Hardness for triangle problems under even more believable hypotheses: reductions from real APSP, real 3SUM, and OV. In 54th Annual ACM Symposium on Theory of Computing (STOC 2022), pages 1501–1514. ACM, 2022. doi:10.1145/3519935.3520032.
[CVWX23] Timothy M. Chan, Virginia Vassilevska Williams, and Yinzhan Xu. Fredman's trick meets dominance product: Fine-grained complexity of unweighted APSP, 3SUM counting, and more. In 55th Annual ACM Symposium on Theory of Computing (STOC 2023), pages 419–432. ACM, 2023. doi:10.1145/3564246.3585237.
[Dan65] George Bernard Dantzig. Linear programming and extensions. Princeton university press, 1965.
[FF56] Lester R. Ford and Delbert R. Fulkerson. Maximal flow through a network. Canadian journal of Mathematics, 8:399–404, 1956.
[Fin24] Jeremy T. Fineman. Single-source shortest paths with negative real weights in time. In Proceedings of the 56th Annual ACM Symposium on Theory of Computing, STOC 2024, pages 3–14. ACM, 2024. doi:10.1145/3618260.3649614.
[Fis26] Nick Fischer. Universe reduction for APSP: Equivalence of three fine-grained hypotheses. In Proceedings of the 58th Annual ACM Symposium on Theory of Computing (STOC 2026), pages 922–932. ACM, 2026. doi:10.1145/3798129.3800806.
[Flo62] Robert W. Floyd. Algorithm 97: Shortest path. Commun. ACM, 5(6):345, 1962. doi:10.1145/367766.368168.
[FPS26] Nick Fischer, Adam Polak, and Jonas Schmidt. 3SUM is really hard: A real-to-integer reduction. In 67th IEEE Annual Symposium on Foundations of Computer Science (FOCS 2026), 2026. To appear.
[Fre76] Michael L. Fredman. New bounds on the complexity of the shortest path problem. SIAM J. Comput., 5(1):83–89, 1976. doi:10.1137/0205006.
[FT87] András Frank and Éva Tardos. An application of simultaneous diophantine approximation in combinatorial optimization. Comb., 7(1):49–65, 1987. doi:10.1007/BF02579200.
[Gab85] Harold N. Gabow. Scaling algorithms for network problems. J. Comput. Syst. Sci., 31(2):148–168, 1985. Announced at FOCS 1983. doi:10.1016/0022-0000(85)90039-X.
[Gow01] Timothy W. Gowers. A new proof of Szemerédi’s theorem. GAFA Geometric And Functional Analysis, 11:465–588, 2001. doi:10.1007/s00039-001-0332-9.
[GR98] Andrew V. Goldberg and Satish Rao. Beyond the flow decomposition barrier. J. ACM, 45(5):783–797, 1998. Announced FOCS 1997. doi:10.1145/290179.290181.
[HS74] Juris Hartmanis and Janos Simon. On the power of multiplication in random access machines. In 15th Annual Symposium on Switching and Automata Theory (SWAT 1974), pages 13–23. IEEE Computer Society, 1974. doi:10.1109/SWAT.1974.20.
[Kha79] Leonid G. Khachiyan. A polynomial algorithm in linear programming. Doklady Akademii Nauk SSSR, 244(5):1093–1096, 1979.
[Mat91] Jiří Matoušek. Computing dominances in . Inf. Process. Lett., 38(5):277–278, 1991. doi:10.1016/0020-0190(91)90071-0.
[NPS+25] Jakob Nogler, Adam Polak, Barna Saha, Virginia Vassilevska Williams, Yinzhan Xu, and Christopher Ye. Faster weighted and unweighted tree edit distance and APSP equivalence. In Proceedings of the 57th Annual ACM Symposium on Theory of Computing, STOC 2025, pages 2167–2178. ACM, 2025. doi:10.1145/3717823.3718116.
[Orl13] James B. Orlin. Max flows in O(nm) time, or better. In Symposium on Theory of Computing Conference, STOC'13, pages 765–774. ACM, 2013. doi:10.1145/2488608.2488705.
[Roy59] Bernard Roy. Transitivité et connexité. C. R. Acad. Sci. Paris, 249:216–218, 1959.
[Ruz96] Imre Z. Ruzsa. Sums of finite sets. In Number Theory: New York Seminar 1991–1995, pages 281–293. Springer US, 1996. doi:10.1007/978-1-4612-2418-1_21.
[RW24] Tim Randolph and Karol Węgrzycki. Parameterized algorithms on integer sets with small doubling: Integer programming, subset sum and k-sum. In Timothy M. Chan, Johannes Fischer, John Iacono, and Grzegorz Herman, editors, 32nd Annual European Symposium on Algorithms, ESA 2024, Royal Holloway, London, United Kingdom, September 2-4, 2024, volume 308 of LIPIcs, pages 96:1–96:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2024. URL: https://doi.org/10.4230/LIPIcs.ESA.2024.96, doi:10.4230/LIPICS.ESA.2024.96.
[Sch79] Arnold Schönhage. On the power of random access machines. In Automata, Languages and Programming, 6th Colloquium, 1979, Proceedings, volume 71 of Lecture Notes in Computer Science, pages 520–529. Springer, 1979. doi:10.1007/3-540-09510-1_42.
[TT98] Hisao Tamaki and Takeshi Tokuyama. Algorithms for the maximum subarray problem based on matrix multiplication. In Proceedings of the Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 1998, pages 446–452. ACM/SIAM, 1998. URL: http://dl.acm.org/citation.cfm?id=314613.314823.
[vEB75] Peter van Emde Boas. Preserving order in a forest in less than logarithmic time. In 16th Annual Symposium on Foundations of Computer Science, FOCS 1975, pages 75–84. IEEE Computer Society, 1975. doi:10.1109/SFCS.1975.26.
[VW18] Virginia Vassilevska Williams. On some fine-grained questions in algorithms and complexity. In Proceedings of the International Congress of Mathematicians (ICM 2018), pages 3447–3487, 2018. doi:10.1142/9789813272880_0188.
[VWW13] Virginia Vassilevska Williams and Ryan Williams. Finding, minimizing, and counting weighted subgraphs. SIAM J. Comput., 42(3):831–854, 2013. Announced at STOC 2009. doi:10.1137/09076619X.
[VWW18] Virginia Vassilevska Williams and R. Ryan Williams. Subcubic equivalences between path, matrix, and triangle problems. J. ACM, 65(5):27:1–27:38, 2018. Announced at FOCS 2010. doi:10.1145/3186893.
[War62] Stephen Warshall. A theorem on Boolean matrices. J. ACM, 9(1):11–12, 1962. doi: 10.1145/321105.321107.
[Wil18] R. Ryan Williams. Faster all-pairs shortest paths via circuit complexity. SIAM J. Comput., 47(5):1965–1985, 2018. Announced at STOC 2014. doi:10.1137/15M1024524.
[Yuv76] Gideon Yuval. An algorithm for finding all shortest paths using infinite-precision multiplications. Inf. Process. Lett., 4(6):155–156, 1976. doi:10.1016/0020-0190(76)90085-5.