Witness-Sensitive Detection of Induced Diamonds
Abstract
We provide a fast witness-sensitive algorithm for detecting an induced diamond (a minus an edge) in an -vertex graph containing induced diamonds. Our algorithm runs in time with high probability, improving upon the prior state of the art (witness-oblivious) algorithm that runs in time [Vassilevska Williams, Wang, Williams, Yu, SODA 2014] whenever , where is the matrix multiplication exponent.
Our key insight is that the size of a clique containing one of the triangles of an induced diamond plays a crucial role in detecting such a diamond. We say that a diamond is -heavy if this size is at least , and we provide a fast detection algorithm for -heavy diamonds in time. When there are no -heavy diamonds, we provide a different fast detection algorithm in time, where denotes the time to multiply an matrix by a matrix, which is conditionally optimal for .
Our main technical contribution is in designing a refinement framework for sampling vectors, which allows sampling vertices for detecting diamonds in a manner that is adaptive to the structure of graphs with no -heavy diamonds. We establish that our technique is of a wide applicability, by showing how it also allows for faster witness-sensitive algorithms for -SUM and for a special case of -cycles.
Keywords and phrases:
Induced diamond detection, Witness-sensitive algorithms, Matrix multiplication, Subgraph detection, Fine-grained complexityCategory:
Track A: Algorithms, Complexity and GamesFunding:
Keren Censor-Hillel: The research is supported in part by the Israel Science Foundation (grant 529/23).Copyright and License:
Nathan Wallheimer; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Graph algorithms analysis ; Theory of computation Design and analysis of algorithmsEditors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele PuppisSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
The problem of detecting a fixed subgraph within a host graph is a cornerstone task of theoretical computer science, with broad applications ranging from social network analysis [39, 41, 52] and computational biology [6, 23, 50] to machine learning [51, 15, 14].
While detecting a pattern on vertices is easily solvable in time, extensive work has been devoted to obtaining faster algorithms. In some cases, when a barrier prevents improving the state-of-the-art worst-case complexity, witness-sensitive algorithms become a significant paradigm: these are algorithms that do not improve upon the general case, e.g., if an input instance has only a single copy of hidden in it, but they do run much faster on instances that have more copies of . Distinguishing between graphs that contain copies of and -free graphs has been studied in various models, such as property testing [33, 8, 32, 7, 31], sublinear algorithms [49, 37, 4, 27, 10, 30, 13, 11], streaming [3, 43, 12, 36], and more.
In the standard word-RAM model, the baseline approach for exploiting multiple copies is uniform sampling. This is because if we sample vertices and check if they induce , then in expectation samples are sufficient. For triangles, this approach was pushed further by [53], who improved this running time to by reducing the problem to multiplying matrices of size , also providing a approximation for . Here, is the matrix multiplication exponent [5]. This was further improved by [17] to time, which is the time to multiply an matrix by an matrix. Improving upon this complexity is shown in [17] to hit the barrier of a conditional lower bound. Witness-sensitive algorithms go beyond triangles: In [17], the approach for triangles is shown to generalize, providing a approximation for the number of -cycles in time. In [18], witness-sensitive algorithms are given for -clique detection, -sum, and more.
In this work, we address the complexity of detecting an induced diamond, which is a -clique minus an edge and is one of the simplest non-trivial patterns beyond cycles and cliques [38, 29, 55]. The state of the art for diamond detection runs in time [55], and a faster algorithm would imply faster triangle detection, which is a long-standing open problem [35, 46, 54].
One can directly use the known approaches to obtain witness-sensitive induced diamond detection: Naïve sampling would give time, and a reduction to -clique detection would give time [18]. We ask:
Is there a faster witness-sensitive algorithm for induced diamond detection?
We answer this question affirmatively by presenting an algorithm that runs faster as the number of induced diamonds increases. Our algorithm improves upon the state of the art already for .
Our key insight is to categorize induced diamonds based on their -heaviness, a new notion that captures whether three of the four vertices of the induced diamond are part of a clique of size . By designing different algorithms for detecting -heavy induced diamonds and for detecting -light ones, we are able to obtain our improvement.
Prior witness-sensitive algorithms define sampling vectors that are used to sample vertices from a -partite graph derived from the input. The main technical novelty in our approach lies in a refinement framework for these vectors, allowing us to sample in a way that leverages the structure of a graph with only -light diamonds.
Our refinement technique is not limited to induced diamonds, but rather applies to other patterns as well: we obtain faster witness-sensitive algorithms for 4-SUM and for a special case of induced -cycles.
1.1 Our Contribution
Our main result is a witness-sensitive algorithm for detecting an induced diamond in that runs faster as the number of induced diamonds increases. Here, is a graph with vertices and induced diamonds.
Theorem 1.1 (Simplified).
There is a randomized algorithm that, given a graph with vertices and induced diamonds, finds an induced diamond in time .
For , our algorithm improves upon the prior running time [55]. To achieve this, we design two different algorithms to detect -heavy and -light induced diamonds, and then combine them.
We say that an induced diamond is -heavy if three of its vertices (that form a triangle) are contained in a clique of size at least . Otherwise, we say that the induced diamond is -light. We use to denote the maximum integer such that there exists at least one -heavy induced diamond in . Our algorithm for -heavy induced diamonds is as follows:
Theorem 1.2 (-Heavy Diamonds).
There is a randomized algorithm that finds an induced diamond in time w.h.p.
Notably, this is subquadratic in for .
Our algorithm for -light induced diamonds is as follows:
Theorem 1.3 (-Light Diamonds).
There exists an algorithm that given an -vertex graph , detects an induced diamond in w.h.p., running in time .
To obtain Theorem 1.1, we combine Theorems 1.3 and 1.2. Applying the standard approximation for , where [34, 56], to Theorem 1.3 yields the simpler expression . For values of where this bound exceeds , we instead use the time algorithm of [55]. Figure 1 illustrates the running times of our algorithms for various values of and .
We also show that for , our algorithm from Theorem 1.3 is conditionally optimal, following the same construction as in [17] for triangles.
Theorem 1.4 (Sensitive Lower Bound).
For every , every randomized algorithm that finds an induced diamond in an -vertex graph that has at least diamonds requires time under the Unbalanced Triangle Detection Hypothesis. The lower bound holds even for graphs with no -cliques.
A consequence of this theorem, which we find interesting, is that the parameter separates the complexities of triangle detection and diamond detection even for small values of , assuming . Previously, it was known that diamond detection and triangle detection belong to the same complexity classes when measured in terms of or the number of edges [55]. However, when considering the number of witnesses , [17] showed that witness-sensitive triangle detection can be done in time for every . In contrast, our theorem implies a higher lower bound of for diamond detection when .
1.2 Technical Overview
There are essentially two existing approaches for diamond detection. We review them to determine their witness sensitivity:
-
(a)
Neighborhood structural analysis. The approaches of [38, 29] and the algorithm of
[55, Theorem 5.1] exploit a structural property that is specific to induced diamonds: a graph is diamond-free if and only if every vertex neighborhood is a -free graph (i.e., a disjoint union of cliques). This includes an -time algorithm [29] and an -time algorithm [55]. Notably, both algorithms operate by searching for a Deg3 vertex, namely a vertex whose neighborhood contains an induced . Moreover, unlike the second approach, these algorithms are deterministic. -
(b)
Algebraic substructure counting. The algorithm of [55, Theorem 1.1] operates by computing counts of smaller structures and relating them to the diamond count. It utilizes polynomial identity testing to distinguish between zero and non-zero counts. This approach is versatile, applying to all induced subgraphs on 4 vertices, and results in a randomized running time of .
Naïve attempt: Making known detection algorithms witness-sensitive.
To construct a witness-sensitive algorithm, a straightforward strategy would be to sample a small number of vertices uniformly at random and check if any of them participates in a diamond. However, the existing algorithms lack an efficient procedure for checking if a small subset of vertices is incident to a diamond. Instead, they rely on identifying a Deg3 vertex. Therefore, our first attempt modifies the sampling strategy: we sample a small set of vertices and specifically check if any of them participates in a diamond as a Deg3 vertex.
This strategy is feasible because the algorithm of [55, Theorem 5.1] can be adapted to efficiently check if a subset of vertices contains a Deg3 vertex. This check runs in time . By combining this with a hitting set argument, we derive an algorithm sensitive to the number of Deg3 vertices, denoted as .
Challenge 1.
The first issue is that the above algorithm is not truly witness-sensitive with respect to the total number of diamonds . It is possible for to be very large while remains constant, resulting in no speedup when is large. This phenomenon occurs when diamonds cluster heavily around the same diagonal edge. Consider a diagonal edge that forms triangles with a set of independent vertices . Every pair of non-adjacent vertices in creates a diamond with as the diagonal edge. The number of diamonds is , yet as only and are Deg3 vertices. Thus, an algorithm that is sensitive to may perform poorly on this example even though is large.
Challenge 2.
The above challenge is further complicated by the fact that graphs with large but small may be structured very differently (see Figure 2). In contrast to the case where is an independent set of vertices, consider a clique-like extreme: Aside from a single vertex (say, ), the remaining vertices form a clique. Here, the density of edges in prevents the formation of diamonds among the clique members. The number of diamonds is still large, yet .
Our approach: pinpointing heaviness.
The spectrum between the above two extremes for large and small actually serves as a hint for us for how to look at the structure of graphs in order to quickly detect induced diamonds. As mentioned earlier, we define the notion of -heaviness of a diamond, which says that three of its vertices are contained in a clique of size . We define to be the size of the largest clique in the graph containing a diagonal edge of some diamond. Note that in the independent-set extreme example and in the clique-like extreme example .
This notion is our first step toward overcoming Challenge 2: it enables a “win-win” approach that quickly detects an induced diamond either when there are -heavy diamonds or when there are -light diamonds. For Challenge 1, we note that (i) our algorithm for detecting -heavy diamonds is independent of , and (ii) our algorithm for detecting -light diamonds uses the above algorithm for finding a Deg3 vertex when is large, while its main technical novelty of sampling vector refinement lies in the case where is small. This way, our final algorithm is faster as increases as desired, regardless of .
1.2.1 Detecting -Heavy Diamonds
Our first algorithm detects an -heavy induced diamond with a running time that improves as increases. At a high level, we are looking for an edge that is contained in two different maximal cliques, as such an edge implies an induced diamond. Intuitively, one might expect that the presence of an -heavy diamond would make detection easier via sampling. However, we must be careful: there may be only one such special edge in the graph, making it hard to sample directly.
Concretely, we use the aforementioned edge-based characterization of diamond-free graphs: is diamond-free if and only if every edge of is contained in exactly one maximal clique [19, Lemma 7]. We call an edge that lies in two or more maximal cliques a violating edge, since its existence implies an induced diamond. For an edge , we can test whether it is violating in time by computing and checking whether is a clique: is violating if and only if is not a clique. This yields a simple time algorithm for induced diamond detection. While this can be improved upon as mentioned earlier [29, 55], this approach does not benefit from the fact that there is an -heavy diamond.
We strengthen this characterization as follows to leverage the existence of an -heavy diamond. We know that there exists a violating edge that lies in a clique of size at least , called an -heavy violating edge. Is finding such an edge any easier? We cannot sample edges and expect to hit an -heavy violating edge with good probability, since there may be only one such edge (see Figure 2(a)). Luckily, an -heavy violating edge implies the existence of many other edges that are easier to find, and we can use them to find the violating edge itself, as follows. Given an -heavy violating edge that lies in a clique of size at least , we refer to every edge in as an -heavy revealing edge. While there might be only one -heavy violating edge, it implies at least distinct -heavy revealing edges (the edges in ). Therefore, we can sample edges and expect to hit an -heavy revealing edge with good probability. We then use it to find the violating edge .
Given this observation, our goal is to (1) sample a small set of vertices that induces a small set of edges containing an -heavy revealing edge w.h.p., and (2) efficiently test whether an edge is -heavy revealing. We provide a simple procedure to test whether an edge is revealing in time: first check whether is a clique (if not, is already violating); if it is, search for a neighbor connected to two vertices in . To avoid processing large cliques, we only test edges such that . That is, we run the same algorithm in a round-robin fashion with different values of until one of them detects an induced diamond. Specifically, we run the algorithm for values of for , where the -th iteration samples edges, and tests only edges with . In what follows, we analyze the -th iteration for which . This iteration is guaranteed to find an -heavy revealing edge w.h.p. and its running time is the fastest among all iterations that find such an edge.
To obtain , we select a random subset of vertices. Then, using fast matrix multiplication, we compute for every with both endpoints in in time, where we add an edge to if . Clearly, the size of is at most the square of the size of . So far, we explained how to find in time, and how to process it in time .
We improve upon the above processing time via two modifications. First, we modify the algorithm so that after processing an edge , it removes from all edges with both endpoints in . Note that this never removes an edge that is a revealing edge, for the following reason. Let be such a removed edge and consider its set . If , then is revealing if and only if is revealing, so testing in addition to is redundant. If , then is itself a violating edge, which means that is a revealing edge and the algorithm would terminate when processing .
Second, we provide an improved analysis that shows that the algorithm stops after processing edges, which is better than the trivial bound of . To see why, let be the -th edge that is processed, and consider the auxiliary bipartite graphs with parts and , in which the clique is connected to the vertex if and only if . We show that if contains a cycle of length at most , then the algorithm stops while processing the first edges. To illustrate this, suppose that contains a -cycle while does not. Then shares two vertices with some previous clique , meaning that is a violating edge and every edge in is -revealing. Therefore, when processing , the algorithm determines its revealing edge and stops, without processing any further edge. For -cycles, the argument is more complex but similar. Classical bounds on edge count in unbalanced bipartite graphs with no -cycle or -cycle [45, 47] imply that for , the graph contains a cycle of length at most .111Note that showing that either has no short cycle or we encounter a diamond does not seem to generalize to larger cycles (which would yield a better bound), as an -cycle does not necessarily imply a diamond. Therefore, the algorithm processes at most edges. To summarize, we find the set in time and process only edges from , each in time, for a total time of .
1.2.2 Detecting -Light Diamonds
Our second algorithm targets the regime where many induced diamonds are -light. Our starting point is the sampling framework of [53, 17, 18] that takes a -vertex subgraph detection algorithm and converts it into a witness-sensitive algorithm. We describe how it works for induced diamond detection, the algorithm needed to use it, why this is hard, and finally our main technical novelty for obtaining the required algorithm.
The Sampling Framework
In the framework, we assign a random coloring and search for colorful patterns, i.e., patterns whose vertices have distinct colors. This consists of two steps: (1) sampling induced subgraphs, and (2) searching for colorful induced diamonds in each one.
The sampling step uses the color classes to sample vertices with different probabilities. Specifically, each sampled subgraph is obtained by sampling vertices of color with probability for . We refer to the sampling probabilities as a sampling vector denoted by , and we denote the sampled subgraph by . To obtain our collection of induced subgraphs, we consider all sampling vectors in and sample one subgraph for each . Note that the sampling vectors are independent of the underlying pattern we want to find. The key guarantee of the framework is that if contains induced diamonds, then there exists a good such that contains a colorful induced diamond with probability and , where is the weight of .
The second step is to search for a colorful induced diamond in . Assume that is the promised good sampling vector. To illustrate the potential speedup and challenges, consider two extreme cases, depending on whether is the balanced vector for , or an unbalanced vector, such as . For , the graph has vertices, so faster colorful induced diamond detection on sounds plausible. For the unbalanced case, things are more complicated. For , the graph has vertices and possibly edges, so is not sparser than .
Colorful Induced Diamond Detection.
Our task is thus to find an algorithm for colorful induced diamond detection that runs faster on unbalanced graphs than on itself.
Note that no colorful induced diamond detection algorithm was previously known and, moreover, detecting an ordered-colorful induced diamond (with predetermined colors for the vertices of its missing edge) is as hard as -clique detection [42].
We observe, perhaps somewhat surprisingly, that colorful induced diamond detection is still possible. However, it is not fast on unbalanced graphs. To this end, we adapt the algorithm of [55], which detects induced diamonds, to detect colorful induced diamonds (and, more generally, this applies to any nontrivial four-vertex induced subgraph that is neither a clique nor an independent set). Also note that combined with [24, Theorem 1.1], this yields a time algorithm for approximate counting of any nontrivial four-vertex induced subgraph, which is the first application of [24] to induced subgraph counting.
The Challenge.
The above colorful induced diamond detection algorithm is not sufficient for obtaining a fast witness-sensitive induced diamond detection algorithm, and in fact it does not yield any speedup. The issue is that the algorithm is not fast on unbalanced graphs. To see why, we analyze its running time on each sampled graph and show that it is , where is the ratio between the weight of and its smallest coordinate. Therefore, running the algorithm on takes time , which is not faster than running [55] directly on .
This limitation is not merely an artifact of our analysis but is inherent to the framework itself, as illustrated by the construction in Figure 2(a), where every induced diamond contains the same triplet . If these vertices receive distinct colors (say have colors respectively), then for any sampled graph with , the probability that all three appear is . Unless , the sampled graph is unlikely to contain any colorful induced diamond. However, if , then , so no speedup is possible.
Main New Technique: A Refined Analysis that Yields a Speedup
We show that a refined analysis of the sampling framework does yield a speedup when many induced diamonds are -light. Previously, we argued that in the worst case, every induced diamond might contain the same triplet of vertices, e.g., in Figure 2(a), and therefore the only good sampling vector was . In this case, however, the three repeated vertices lie in a large clique, so there exists an -heavy diamond. Specifically, let be the common neighborhood of , and let . If are the three vertices in all induced diamonds, then is a clique, and every diamond is heavy. In this case, we use the -heavy diamond detection algorithm. On the other hand, for sufficiently small that is a function of , the -light diamond detection algorithm is faster. We do not know for which to switch between the two algorithms222Since rectangular matrix multiplication has no closed-form expression, we cannot find, for every , the value of for which the two running times are equal. but we do not need this information; rather, we simply run both algorithms in parallel and stop when one of them detects an induced diamond. To illustrate when the -light diamond algorithm is faster, assume that there is no -heavy diamond for for some constant . Then is not a clique, and by Turán’s theorem there are many non-edges in , specifically at least non-edges, so there must be at least vertices in that are endpoints of non-edges, proving that no vertex in is “too” important. Therefore, we can hope to find a good sampling vector that is more balanced than . Specifically, we show that hits an induced diamond with probability. This illustrates how having no -heavy diamonds simplifies the family of graphs we have to deal with. Yet, we still need to handle general graphs with no -heavy diamonds, and we cannot assume that there are only two Deg3 vertices as in the above example. To get our speedup, we show that either , i.e., there are many Deg3 vertices, or that hits a colorful induced diamond with probability, where in both cases we obtain a running time of . To prove that hits a colorful induced diamond with probability , our main technical contribution deviates from the black-box use of the sampling framework. Specifically, we show that we can combine the framework (which is oblivious to ) with structural properties implied by -lightness to obtain a faster algorithm. Our proof gradually refines the sampling vector from to by extending its dimension (i.e., the number of coordinates) in a very subtle manner.
Refined Analysis.
We consider the graph with a random coloring , and the set of (-light) colorful induced diamonds , containing elements. We construct a sequence of hypergraphs, starting from 1-partite and ending with 4-partite:
Each is -partite and uses the same hyperedge set , where each hyperedge corresponds to a colorful induced diamond. In , each hyperedge is a single element from the product space , so sampling each element with probability hits a hyperedge with probability . As previously mentioned, [17, 18] implies that there exists a sampling vector with that hits a hyperedge with probability . To refine the guarantee, we define a sequence of sampling vectors as in Figure 3:
The first vector is , which samples each element in with probability . The first refinement is straightforward: view as a bipartite graph with vertex sets and and edges. For , let be the set of vertices in with degree in . This lets us control degrees on the -side. We say that is heavy if the number of edges incident to it is at least . At least one set must be heavy; otherwise, the total number of edges is less than . If there exists a heavy with , then and we are in the easy case. Otherwise, all heavy have . We fix one such and set with and . The choice of implies that . To refine into , we use a general refinement theorem that does not use the additional structure of -light diamonds. Refining into is the key step that uses the promise that there are no -heavy diamonds, as previously explained. We generalize the intuition from the running example with only two Deg3 vertices by refining into , with , where we note that because , we have . This keeps two coordinates small, instead of just one small one, thereby decreasing the quantity that governs the running time of the algorithm. This comes at the cost of increasing the weight of the sampling vector by a factor of , i.e., .
1.3 Additional Results
Our novel refinement framework yields two additional results.
First, we obtain an improved running time for detecting induced -cycles when many are -light, i.e., no two vertices of the -cycle lie in an -clique. The algorithm runs in time , where is the number of -light induced -cycles. This requires different ideas, as induced--free graphs have different structure than diamond-free graphs. However, exploiting that every vertex in a -cycle has the same role, we achieve the same running time.
Second, we obtain a faster witness-sensitive algorithm for 4-SUM detection when the number of solutions is at most . We reach time for 4-SUM detection and approximate counting. For 4-SUM detection, there are three important regimes: the sparse regime with , the medium regime with , and the dense regime with . Our algorithm is the first non-trivial witness-sensitive algorithm for 4-SUM in the sparse regime. In the medium regime, it improves upon the previous best algorithm that takes time. In the dense regime, the naïve algorithm that samples four uniform numbers and checks if they sum to zero is the fastest, taking time, which is also sublinear when . To get the -time algorithm for 4-SUM, we use the property that any three numbers participate in at most one solution, which allows us to refine the sampling vector similarly to the induced-diamond and cycle cases, rather than using a black-box refinement theorem.
Finally, we employ the sampling framework in combination with the structural analysis approach to obtain a combinatorial witness-sensitive algorithm for diamond detection:
Theorem 1.5.
Let be an -vertex graph with at least diamonds, where . There is a combinatorial algorithm that w.h.p. runs in time and finds an induced diamond in .
We supplement this with a conditional lower bound against combinatorial algorithms, showing the result is tight up to polylogarithmic factors.
Theorem 1.6 (Combinatorial Diamond Detection Lower Bound).
For every , every combinatorial randomized algorithm that finds an induced diamond in an -vertex graph that has at least diamonds requires time under the Combinatorial Boolean Matrix Multiplication Conjecture.
1.4 Related Work
When is the -clique, the problem is solvable in time for any partition , where denotes the exponent of multiplying an matrix by an matrix [35, 46, 29]. In the sparse regime, -clique detection can be solved in time, where denotes the arboricity of [20]. For other patterns such as paths and cycles, the color-coding technique yields time [9].
We focus on induced subgraphs: given and , determine if contains as an induced subgraph. Generally, detecting an -vertex induced pattern reduces to -clique detection on a graph with vertices and edges [46]. Significant attention has been devoted to -vertex patterns [38, 29, 55, 21, 22, 1]. Our primary interest lies in induced diamond detection. Kloks, Kratsch, and Müller [38] characterized diamond-free graphs locally: is diamond-free if and only if for every vertex , the induced subgraph on contains no induced path on three vertices (). This characterization suggests a naïve algorithm: for each , check if contains an induced . This runs in per vertex, or total. We refer to vertices whose neighborhoods contain an induced as Deg3 vertices. Eisenbrand and Grandoni [29] improved this to by distinguishing between high- and low-degree vertices. Subsequently, Vassilevska Williams, Wang, Williams, and Yu [55] provided a deterministic algorithm running in time, which remains the state-of-the-art. Recently, Abboud, Akmal, and Fischer [1] introduced a purely combinatorial algorithm for induced -cycle detection running in time, without using fast matrix multiplication techniques. This shows a separation between induced -cycle detection and triangle detection under the standard Boolean matrix multiplication conjecture; see [22] for more details.
In property testing, the goal is to read only bits from the input, independent of input size, to determine whether a graph is -free or -far from being -free (meaning at least an -fraction of its edges must be removed to make it -free) [33, 8, 32, 7, 31]. Such an algorithm is called an -tester, and properties admitting such testers are called testable. Alon, Fischer, Krivelevich, and Szegedy [8] proved that having a fixed pattern as an (induced) subgraph is testable. Further work studies the dependency in , and in particular for which properties the complexity is polynomial in .
In the sublinear model, the goal is to detect using queries (degree, neighbor, pair, and sometimes random edge queries) in sublinear time [49, 37, 4, 27, 10, 30, 13, 28]. Assadi, Kapralov, and Khanna [11] provided an algorithm for detecting and approximately counting a fixed subgraph (induced or non-induced). For any four-vertex pattern containing a -cycle, they achieve query complexity and runtime , where is the number of copies of in . The algorithm samples two random edges and checks if the graph induced on their endpoints contains . However, for induced diamonds, achieving query complexity is impossible when ; distinguishing a complete graph from a complete graph minus one edge (which contains induced diamonds) requires degree queries. Without using random edge queries, Eden, Levi, Ron, and Rubinfeld [28] showed how to obtain query complexity and runtime of . Analogous questions have been explored in the distributed setting; see [16] for a recent survey, and [40, 44, 48] for specific results on induced subgraph detection.
Roadmap
We begin with some preliminaries in Section 2. In Section 3, we present our algorithm for -heavy diamonds and prove Theorem 1.2. Due to space constraints, the algorithm for -light diamonds and the proof of Theorem 1.3, the combinatorial algorithm for witness-sensitive diamond detection (Theorem 1.5), as well as results for other -vertex patterns and for -SUM , are deferred to the full version of the paper.
2 Preliminaries
Unless stated otherwise, throughout the paper by a diamond we mean an induced diamond. A diamond’s vertices have degree either 2 or 3; we call these Deg2 and Deg3 vertices, respectively (a vertex can be both). We use and to denote the number of induced diamonds, the number of vertices that are part of an induced diamond, and the number of Deg3 vertices in , respectively. We say that an induced diamond is -heavy if three of its vertices are contained in a clique of size at least ; otherwise, it is called -light. We use to denote the largest integer such that contains an -heavy induced diamond. Given a four-coloring of the vertices of , we say that an induced diamond is colorful if all its vertices have different colors.
The following result will be used as a black-box in multiple sections across the paper. Its proof is deferred to the full version of the paper.
Theorem 2.1 (IsvInDiamond).
There is an algorithm IsvInDiamond that, given a graph and a vertex , either returns a diamond containing or reports that is not incident to a diamond. The algorithm runs in time.
Graph Theory Notation.
We use to denote disjoint union of vertex sets. For every vertex in a graph , we use to denote the set of its neighbors in . For an edge , we use to denote the set of common neighbors of and , and .
Matrix Multiplication.
We use to denote the time complexity of multiplying two matrices of sizes and . This running time is also denoted by , where is the matrix multiplication exponent. The function is symmetric, meaning that for every permutation we have . The following appears in [2, 18].
Claim 2.2.
For which may depend on , we have:
Claim 2.3.
, for , where .
The constant arises as follows. Here and is the largest value satisfying [5]. Since is convex, the line through the points and gives a linear upper bound on for .
Probabilistic Tools.
Theorem 2.4 (Chernoff Bound [26]).
Let be independent random variables with values in and . For , and we have
Lemma 2.5 (Second Moment Method).
Let be a non-negative integral random variable. Then
Lemma 2.6 (Reverse Markov’s inequality [25, (1.6.4)]).
Let be a random variable with support contained in . Then, for we have .
All logarithms in this paper are base 2.
3 Detecting -Heavy Diamonds
In this section we prove the following theorem: See 1.2 Recall that is the largest such that there is an -heavy induced diamond in , i.e., a diamond with three vertices contained in the same clique of size . Instead of working with , we prove this for any :
Theorem 3.1.
There is a randomized algorithm that finds an induced diamond in time w.h.p., assuming has an -heavy induced diamond and no -heavy induced diamond.
Proof of Theorem 1.2 Using Theorem 3.1.
For each , start one copy of . Run these copies in round-robin, stopping when a diamond is found. Let , so . By definition, has a -heavy diamond but no -heavy diamond, so the assumptions of Theorem 3.1 hold for . Thus finds a diamond w.h.p. in time
and round-robin adds only overhead.
The main structural observation behind our algorithm is that in a diamond-free graph, every edge lies in exactly one maximal clique:
Observation 3.2.
If two cliques satisfy and , then some vertex in belongs to an induced diamond.
Proof of Observation 3.2.
Let be two distinct vertices. Since , we may assume without loss of generality that contains a vertex . Let be a vertex whose partition contains , i.e., . Then is an induced diamond, since it is a clique whose only missing edge is .
This observation also follows from [19, Lemma 7]: a graph is diamond-free if and only if every edge lies in a unique maximal clique.
Roadmap.
The next paragraphs contain the notation and definitions used in the algorithm. The first part of the algorithm includes finding a set of edges , computed using fast matrix multiplication. The second part of the algorithm (Section 3.1) explains how to process this set of edges efficiently.
Preliminaries and Definitions.
For every edge , we use to denote the set of common neighbors of and , together with and themselves. We refer to an edge that lies in two distinct maximal cliques as a violating edge. When is not diamond-free, it contains at least one violating edge, and if contains an -heavy induced diamond, then there must be a violating edge that lies in a clique of size at least . The other direction is also true: if has a violating edge that lies in two maximal cliques , then has a -heavy induced diamond: Consider an edge inside two maximal cliques , and let . Let be any vertex in . Then is an induced diamond, since the only missing edge is , and lies in , proving the existence of a -heavy induced diamond. We say that an edge is revealing if it lies in a maximal clique that contains a violating edge. We restrict our attention to violating and revealing edges that are part of a clique of size at least , referred to as -violating edges and -revealing edges, respectively. Both -violating and -revealing edges are part of at least triangles.
Our algorithm consists of two steps: finding a set of edges that contains at least one -revealing edge w.h.p. and processing these edges one by one until we either find an induced diamond or exhaust all edges in . We next explain how to find the set .
Finding .
Given a subset of vertices , define a subset of edges by
In words, this is the set of all edges with both endpoints in whose common neighborhood has size in . Computing for every edge in the exact number of triangles it is in, i.e., , can be done using fast matrix multiplication in time . We show that if we sample randomly, then w.h.p. contains at least one -violating edge.
Lemma 3.3.
Let be a random subset of vertices where each vertex is included independently with probability . If has an -heavy induced diamond and no -heavy induced diamond, then w.h.p. contains at least one -revealing edge. The randomness is only over the choice of .
Proof of Lemma 3.3.
Let be an -heavy induced diamond with missing edge , where the vertices belong to the same maximal clique whose size is in . Therefore, is an -violating edge.
Assume that , and let be two distinct vertices in this set. We show that the edge belongs to and is -revealing. If is violating, then it is also -violating since it lies in , and therefore also -revealing and we are done. Otherwise, is a maximal clique that must contain . Therefore contains the violating edge , making -revealing. Note that , otherwise is -violating, contradicting the assumption that there are no -heavy diamonds in .
To see that w.h.p., let be the random variable that counts the number of vertices from that are included in . We have , so by Chernoff’s inequality , which completes the proof.
3.1 Processing Edges in
For brevity, we write instead of . Below the algorithm is presented.
We give an overview of the algorithm.
Part 1.
We check whether is a clique. If not, is violating and we have found an induced diamond. This takes time, since edges in satisfy .
Part 2.
We check whether some vertex has at least two neighbors in . If so, letting be two such neighbors, the vertex together with and an endpoint of not adjacent to forms an induced diamond. This step runs in time: we initialize a counter for each , and increment it for each edge between and , stopping when any counter reaches . Processing edges within takes time, and we process at most edges with exactly one endpoint in before either finding a diamond or exhausting all such edges.
Part 3.
Computing takes time, so removing all edges in
with both endpoints in takes time.
This completes the description of the algorithm.
We now prove its correctness and analyze its running time.
Lemma 3.4.
If contains an -revealing edge and has no -heavy induced diamond, then finds a vertex in an induced diamond. Its running time is .
Theorem 3.1 follows from Lemma 3.3 and Lemma 3.4. To prove the correctness of Algorithm 1, we prove the following two claims:
Claim 3.5.
If is an -violating edge or an -revealing edge, then Part 1 or Part 2 of Algorithm 1 finds a vertex in an induced diamond.
Proof of Claim 3.5.
If is an -violating edge, then is not a clique, and therefore we find an induced diamond in Part 1 of the algorithm. We prove the claim for -revealing edges. Let be an -revealing edge in , which lies in a maximal clique together with an -violating edge . Let be the set computed in Part 1 of the algorithm. If , then is not a clique, and we would have found an induced diamond in Part 1 of the algorithm. Assume that . Since is violating, it is also in a different maximal clique . Let , so . Moreover, has two neighbors in , namely and , proving the claim.
Claim 3.6.
No -revealing edge is removed from during Part 3 of Algorithm 1.
Proof of Claim 3.6.
Let be an -revealing edge in , lying in a maximal clique together with an -violating edge . Suppose we remove from after processing edge . Then , otherwise it would not be removed. If , then is -violating, so processing finds an induced diamond by Claim 3.5. If , then is -revealing because contains the -violating edge . Then Claim 3.5 applies to . The correctness of Algorithm 1 follows from Claims 3.5 and 3.6. We analyze the total running time of processing all edges in . Consider the set of edges in processed by the algorithm , in the order they were processed. Define , and let . We define an auxiliary bipartite graph . We add an edge between a clique and a vertex if . The following two lemmas are the main ingredients in the runtime analysis.
Lemma 3.7.
If contains a -cycle or a -cycle, then the algorithm detects an induced diamond, no later than when processing edge .
Lemma 3.8.
If has no -cycle, and , then
Proof of Lemma 3.4 Using Lemma 3.7 and Lemma 3.8.
The maximum number of cliques that the algorithm processes before the auxiliary graph contains a -cycle is bounded by by Lemma 3.8. Since the algorithm finds an induced diamond as soon as contains a -cycle by Lemma 3.7, the algorithm processes at most edges, and since each edge requires time, the total running time is as required.
We prove the two lemmas.
Proof of Lemma 3.7.
A -cycle in corresponds to two cliques and two vertices . This means that is an edge that lies in two distinct maximal cliques, making it a violating edge, and an -violating edge since both and have size in . After processing the first edge among , say , the algorithm learns that is an -revealing edge, and terminates by Claim 3.5.
We prove that if contains a -cycle, then the algorithm detects an induced diamond. We first show that if contains a -cycle, then has an induced diamond, and then explain why this diamond implies the rest of the lemma. Assume that contains a -cycle as a subgraph (see Figure 5).
Let , be a -cycle in , where , and , for every . We use to denote the endpoints of . We show that is an -revealing edge, and therefore by Claim 3.5 the algorithm finds an induced diamond while processing . We consider two cases, based on whether or not:
-
If , then is a violating edge; both in and . Thus, is an -revealing edge.
-
If , then it is not a neighbor of say , but it has two neighbors , thus is an -violating edge, and is an -revealing edge.
We prove Lemma 3.8. We need one more theorem from extremal combinatorics that bounds the number of edges in an unbalanced bipartite graph that does not contain a -cycle as a subgraph.
Theorem 3.9 ([45, Theorem 1]).
.
In words, any bipartite graph with parts of sizes and and at least edges contains a -cycle as a subgraph. Using Theorem 3.9, we show that if has no -cycle, then it must be sparse.
Proof of Lemma 3.8.
We use for , and for . Since every clique in is of size at least , it is incident to at least edges in , so , implying that . We plug this into Theorem 3.9, obtaining that if has no -cycle, then
Since , we can replace by . We get
Assume that , since otherwise the lemma holds trivially.
By rearranging, we obtain:
By plugging this back into , we obtain , which concludes the proof.
References
- [1] Amir Abboud, Shyan Akmal, and Nick Fischer. A truly subcubic combinatorial algorithm for induced 4-cycle detection. In Proceedings of the 2026 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 3562–3599. SIAM, 2026. doi:10.1137/1.9781611978971.130.
- [2] Amir Abboud, Karl Bringmann, Nick Fischer, and Marvin Künnemann. The time complexity of fully sparse matrix multiplication. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 4670–4703. SIAM, 2024. doi:10.1137/1.9781611977912.167.
- [3] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Graph sketches: sparsification, spanners, and subgraphs. In Proceedings of the 31st ACM SIGMOD-SIGACT-SIGAI symposium on Principles of Database Systems, pages 5–14, 2012. doi:10.1145/2213556.2213560.
- [4] Maryam Aliakbarpour, Amartya Shankha Biswas, Themis Gouleakis, John Peebles, Ronitt Rubinfeld, and Anak Yodpinyanee. Sublinear-time algorithms for counting star subgraphs via edge sampling. Algorithmica, 80:668–697, 2018. doi:10.1007/S00453-017-0287-3.
- [5] Josh Alman, Ran Duan, Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. More asymmetry yields faster matrix multiplication. In Proceedings of the 2025 ACM-SIAM Symposium on Discrete Algorithms, SODA 2025, page to appear. SIAM, 2025.
- [6] N. Alon, Phuong Dao, I. Hajirasouliha, F. Hormozdiari, and S. C. Sahinalp. Biomolecular network motif counting and discovery by color coding. Bioinformatics, 24:i241–i249, 2008.
- [7] N. Alon and J. Fox. Easily testable graph properties. Combinatorics, Probability and Computing, 24:646–657, 2015. doi:10.1017/S0963548314000765.
- [8] Noga Alon, Eldar Fischer, Michael Krivelevich, and Mario Szegedy. Efficient testing of large graphs. Combinatorica, 20(4):451–476, 2000. doi:10.1007/S004930070001.
- [9] Noga Alon, Raphael Yuster, and Uri Zwick. Color-coding. Journal of the ACM (JACM), 42(4):844–856, 1995. doi:10.1145/210332.210337.
- [10] Sepehr Assadi, Michael Kapralov, and Sanjeev Khanna. A simple sublinear-time algorithm for counting arbitrary subgraphs via edge sampling. arXiv preprint arXiv:1811.07780, 2018. arXiv:1811.07780.
- [11] Sepehr Assadi, Michael Kapralov, and Sanjeev Khanna. A simple sublinear-time algorithm for counting arbitrary subgraphs via edge sampling. In Avrim Blum, editor, 10th Innovations in Theoretical Computer Science Conference, ITCS 2019, January 10-12, 2019, San Diego, California, USA, volume 124 of LIPIcs, pages 6:1–6:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.ITCS.2019.6.
- [12] Suman K. Bera and Amit Chakrabarti. Towards Tighter Space Bounds for Counting Triangles and Other Substructures in Graph Streams. In 34th Symposium on Theoretical Aspects of Computer Science (STACS 2017), volume 66 of Leibniz International Proceedings in Informatics (LIPIcs), pages 11:1–11:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPIcs.STACS.2017.11.
- [13] Amartya Shankha Biswas, T. Eden, and R. Rubinfeld. Towards a decomposition-optimal algorithm for counting and sampling arbitrary motifs in sublinear time. ArXiv, abs/2107.06582, 2021. arXiv:2107.06582.
- [14] Antoine Bordes, Sumit Chopra, and Jason Weston. Question answering with subgraph embeddings. In Alessandro Moschitti, Bo Pang, and Walter Daelemans, editors, Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, EMNLP 2014, October 25-29, 2014, Doha, Qatar, A meeting of SIGDAT, a Special Interest Group of the ACL, pages 615–620. ACL, 2014. doi:10.3115/V1/D14-1067.
- [15] Giorgos Bouritsas, Fabrizio Frasca, S. Zafeiriou, and M. Bronstein. Improving graph neural network expressivity via subgraph isomorphism counting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 45:657–668, 2020.
- [16] Keren Censor-Hillel. Distributed subgraph finding: progress and challenges. arXiv preprint arXiv:2203.06597, 2022. doi:10.48550/arXiv.2203.06597.
- [17] Keren Censor-Hillel, Tomer Even, and Virginia Vassilevska Williams. Fast approximate counting of cycles. In 51st International Colloquium on Automata, Languages, and Programming, ICALP 2024, July 8-12, 2024, Tallinn, Estonia, volume 297 of LIPIcs, pages 37:1–37:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.ICALP.2024.37.
- [18] Keren Censor-Hillel, Tomer Even, and Virginia Vassilevska Williams. Output-sensitive approximate counting via a measure-bounded hyperedge oracle, or: How asymmetry helps estimate k-clique counts faster. CoRR, abs/2503.21655, 2025. doi:10.48550/arXiv.2503.21655.
- [19] Nina Chiarelli, Berenice Martínez-Barona, Martin Milanič, Jérôme Monnot, and Peter Muršič. Strong cliques in diamond-free graphs. Theoretical Computer Science, 858:49–63, 2021. doi:10.1016/J.TCS.2020.12.001.
- [20] Norishige Chiba and Takao Nishizeki. Arboricity and subgraph listing algorithms. SIAM J. Comput., 14(1):210–223, 1985. doi:10.1137/0214017.
- [21] Mina Dalirrooyfard, Thuy Duong Vuong, and Virginia Vassilevska Williams. Graph pattern detection: Hardness for all induced patterns and faster non-induced cycles. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, pages 1167–1178, 2019. doi:10.1145/3313276.3316329.
- [22] Mina Dalirrooyfard and V. V. Williams. Induced cycles and paths are harder than you think. 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 531–542, 2022.
- [23] Phuong Dao, Kendric Wang, Colin Collins, Martin Ester, Anna Lapuk, and S Cenk Sahinalp. Optimally discriminative subnetwork markers predict response to chemotherapy. Bioinformatics, 27(13):i205–i213, 2011.
- [24] Holger Dell, John Lapinskas, and Kitty Meeks. Approximately counting and sampling small witnesses using a colorful decision oracle. SIAM J. Comput., 51(4):849–899, 2022. doi:10.1137/19M130604X.
- [25] Benjamin Doerr and Frank Neumann. Theory of Evolutionary Computation: Recent Developments in Discrete Optimization. Springer Nature, 2019.
- [26] Devdatt P Dubhashi and Alessandro Panconesi. Concentration of measure for the analysis of randomized algorithms. Cambridge University Press, 2009.
- [27] Talya Eden, Amit Levi, Dana Ron, and C Seshadhri. Approximately counting triangles in sublinear time. SIAM Journal on Computing, 46(5):1603–1646, 2017. doi:10.1137/15M1054389.
- [28] Talya Eden, Reut Levi, Dana Ron, and Ronitt Rubinfeld. Approximately counting and sampling hamiltonian motifs in sublinear time. In Proceedings of the 57th Annual ACM Symposium on Theory of Computing, pages 1043–1054, 2025. doi:10.1145/3717823.3718160.
- [29] Friedrich Eisenbrand and Fabrizio Grandoni. On the complexity of fixed parameter clique and dominating set. Theoretical Computer Science, 326(1-3):57–67, 2004. doi:10.1016/J.TCS.2004.05.009.
- [30] Hendrik Fichtenberger, Mingze Gao, and Pan Peng. Sampling arbitrary subgraphs exactly uniformly in sublinear time. ArXiv, abs/2005.01861, 2020. arXiv:2005.01861.
- [31] Lior Gishboliner and A. Shapira. Deterministic vs non-deterministic graph property testing. Israel Journal of Mathematics, 204:397–416, 2013.
- [32] Goldreich and Ron. Property testing in bounded degree graphs. Algorithmica, 32(2):302–343, February 2002. doi:10.1007/S00453-001-0078-7.
- [33] Oded Goldreich, Shari Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. Journal of the ACM (JACM), 45(4):653–750, 1998. doi:10.1145/285055.285060.
- [34] Xiaohan Huang and Victor Y Pan. Fast rectangular matrix multiplication and applications. Journal of complexity, 14(2):257–299, 1998. doi:10.1006/JCOM.1998.0476.
- [35] Alon Itai and Michael Rodeh. Finding a minimum circuit in a graph. In Proceedings of the ninth annual ACM symposium on Theory of computing, pages 1–10, 1977.
- [36] John Kallaugher, Andrew McGregor, Eric Price, and Sofya Vorotnikova. The complexity of counting cycles in the adjacency list streaming model. In Proceedings of the 38th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, pages 119–133, 2019. doi:10.1145/3294052.3319706.
- [37] Tali Kaufman, Michael Krivelevich, and Dana Ron. Tight bounds for testing bipartiteness in general graphs. SIAM Journal on computing, 33(6):1441–1483, 2004. doi:10.1137/S0097539703436424.
- [38] Ton Kloks, Dieter Kratsch, and Haiko Müller. Finding and counting small induced subgraphs efficiently. Information Processing Letters, 74(3-4):115–121, 2000. doi:10.1016/S0020-0190(00)00047-8.
- [39] Michihiro Kuramochi and G. Karypis. Frequent subgraph discovery. Proceedings 2001 IEEE International Conference on Data Mining, pages 313–320, 2001.
- [40] François Le Gall and Masayuki Miyamoto. Lower Bounds for Induced Cycle Detection in Distributed Computing. In 32nd International Symposium on Algorithms and Computation (ISAAC 2021), volume 212 of Leibniz International Proceedings in Informatics (LIPIcs), pages 58:1–58:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.ISAAC.2021.58.
- [41] Xin Liu, Haojie Pan, Mutian He, Yangqiu Song, and Xin Jiang. Neural subgraph isomorphism counting. Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2019.
- [42] Dániel Marx. Can you beat treewidth? In 51th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2010, pages 169–179. IEEE Computer Society, 2010.
- [43] Andrew McGregor, Sofya Vorotnikova, and Hoa T Vu. Better algorithms for counting triangles in data streams. In Proceedings of the 35th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, pages 401–411, 2016. doi:10.1145/2902251.2902283.
- [44] Masayuki Miyamoto. Distributed complexity of p_k-freeness: Decision and certification. In Ho-Lin Chen, Wing-Kai Hon, and Meng-Tsung Tsai, editors, 36th International Symposium on Algorithms and Computation, ISAAC 2025, Tainan, Taiwan, December 7-10, 2025, 2025. doi:10.4230/LIPIcs.ISAAC.2025.51.
- [45] Assaf Naor and Jacques Verstraëte. A note on bipartite graphs without 2k-cycles. Combinatorics, Probability and Computing, 14(5-6):845–849, 2005.
- [46] Jaroslav Nešetřil and Svatopluk Poljak. On the complexity of the subgraph problem. Comment. Math. Univ. Carol., 26(2):415–419, 1985.
- [47] Stefan Neuwirth. The size of bipartite graphs with girth eight. arXiv preprint, 2001. arXiv:math/0102210.
- [48] Amir Nikabadi and Janne Korhonen. Beyond distributed subgraph detection: Induced subgraphs, multicolored problems and graph parameters. In 25th International Conference on Principles of Distributed Systems, volume 217, 2022.
- [49] Michal Parnas and Dana Ron. Testing the diameter of graphs. Random Structures & Algorithms, 20(2):165–183, 2002. doi:10.1002/RSA.10013.
- [50] Syed Asad Rahman, Matthew Bashton, Gemma L Holliday, Rainer Schrader, and Janet M Thornton. Small molecule subgraph detector (smsd) toolkit. Journal of cheminformatics, 1:1–13, 2009.
- [51] Qingyun Sun, Jianxin Li, Hao Peng, Jia Wu, Yuanxing Ning, Philip S Yu, and Lifang He. Sugar: Subgraph neural network with reinforcement pooling and self-supervised mutual information mechanism. In Proceedings of the web conference 2021, pages 2081–2091, 2021. doi:10.1145/3442381.3449822.
- [52] Charalampos Tsourakakis. The k-clique densest subgraph problem. In Proceedings of the 24th international conference on world wide web, pages 1122–1132, 2015. doi:10.1145/2736277.2741098.
- [53] Jakub Tětek. Approximate Triangle Counting via Sampling and Fast Matrix Multiplication. In 49th International Colloquium on Automata, Languages, and Programming (ICALP 2022), volume 229 of Leibniz International Proceedings in Informatics (LIPIcs), pages 107:1–107:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPIcs.ICALP.2022.107.
- [54] Virginia Vassilevska Williams and R. Ryan Williams. Subcubic equivalences between path, matrix, and triangle problems. J. ACM, 65(5):27:1–27:38, 2018. doi:10.1145/3186893.
- [55] Virginia Vassilevska Williams, Joshua R Wang, Ryan Williams, and Huacheng Yu. Finding four-node subgraphs in triangle time. In Proceedings of the twenty-sixth annual ACM-SIAM symposium on discrete algorithms, pages 1671–1680. SIAM, 2014.
- [56] Uri Zwick. All pairs shortest paths using bridging sets and rectangular matrix multiplication. Journal of the ACM (JACM), 49(3):289–317, 2002. doi:10.1145/567112.567114.
Appendix A Obtaining the Exact Running Time in Therorem 1.1
In this subsection, we explain how to obtain the exact running time in Theorem 1.1 from the two bounds given by Theorem 1.2 and Theorem 1.3, which are restated below for convenience. See 1.2 See 1.3
We use the standard linear approximation for rectangular matrix multiplication: Let and . We use , and to denote the running times of the heavy and light algorithms, respectively, as functions of , , and . Our goal is to get an upper bound on the running time of the form which depends only on and , without any dependence on . Thus, for every , we find the worst-case value of that maximizes the running time of the faster of the two algorithms. We have
We want to find such that . First, note that if then the running time of the heavy algorithm is at most , while the running time of the light algorithm is always at least . Thus, is never larger than , which means that the dominant term in is , and we can ignore the other two terms. We thus get:
Substituting this value of into gives the exponent . Thus, the running time of the best of the two algorithms is . This also shows that if for , the running time .
Here, we used simplified bounds for rectangular matrix multiplication, and thus the first value of for which the running time is faster than is not tight. We show by a simpler calculation that the running time is faster than for every , where .
For any such that and , the light algorithm already improves upon the bound. Therefore, we can assume that , and thus the heavy algorithm takes time , obtaining when , and . This completes the proof of Theorem 1.1.
