English

Testable algorithms for approximately counting edges and triangles in sublinear time and space

Data Structures and Algorithms 2025-09-25 v1

Abstract

We consider the fundamental problems of approximately counting the numbers of edges and triangles in a graph in sublinear time. Previous algorithms for these tasks are significantly more efficient under a promise that the arboricity of the graph is bounded by some parameter α\overline{\alpha}. However, when this promise is violated, the estimates given by these algorithms are no longer guaranteed to be correct. For the triangle counting task, we give an algorithm that requires no promise on the input graph GG, and computes a (1±ϵ)(1\pm \epsilon)-approximation for the number of triangles tt in GG in time O(mα(G)t+mt2/3)O^*\left( \frac{m\cdot \alpha(G)}{t} + \frac{m}{t^{2/3}} \right), where α(G)\alpha(G) is the arboricity of the graph. The algorithm can be used on any graph GG (no prior knowledge the arboricity α(G)\alpha(G) is required), and the algorithm adapts its run-time on the fly based on the graph GG. We accomplish this by trying a sequence of candidate values α~\tilde{\alpha} for α(G)\alpha(G) and using a novel algorithm in the framework of testable algorithms. This ensures that wrong candidates α~\tilde{\alpha} cannot lead to incorrect estimates: as long as the advice is incorrect, the algorithm detects it and continues with a new candidate. Once the algorithm accepts the candidate, its output is guaranteed to be correct with high probability. We prove that this approach preserves - up to an additive overhead - the dramatic efficiency gains obtainable when good arboricity bounds are known in advance, while ensuring robustness against misleading advice. We further complement this result with a lower bound, showing that such an overhead is unavoidable whenever the advice may be faulty. We further demonstrate implications of our results for triangle counting in the streaming model.

Keywords

Cite

@article{arxiv.2509.20351,
  title  = {Testable algorithms for approximately counting edges and triangles in sublinear time and space},
  author = {Talya Eden and Ronitt Rubinfeld and Arsen Vasilyan},
  journal= {arXiv preprint arXiv:2509.20351},
  year   = {2025}
}
R2 v1 2026-07-01T05:54:34.122Z