arXiv ScienceSearch

arXiv · 2609.15848

Scalable Triangle Counting: The Threshold Algorithm

Abstract

We study one-pass triangle counting on random-order edge streams. We present a remarkably simple algorithm---read edges from the stream until $Q$ triangles are observed in the prefix, then output $Q\,(m/S)^3$ where $S$ is the stopping length---and prove that, when the maximum number of triangles incident to any edge satisfies $η\le T^{2/3}$, this is a $(1\pm\varepsilon)$-approximation of $T$ with probability $1-δ$ using $O(\varepsilon^{-2}\log(1/δ)\, m/T^{1/3})$ memory. Crucially, the algorithm does not need any a priori estimate of $T$, in sharp contrast with state-of-the-art sampling-rate based algorithms (McGregor and Vorotnikova, PODS 2020; Tsourakakis et al., KDD 2009). It also does not need a prescribed memory budget: the stopping rule self-selects the prefix length and can return an estimate before reading the entire stream. The proof rests on a Schudy--Sviridenko concentration argument for an independent-edge-sampling estimator, coupled to the without-replacement prefix produced by the algorithm. On six real temporal streams, the algorithm's stopping prefix follows the predicted cube-root scaling and achieves at most $6\%$ error at a $10\%$ prefix, without using $T$. At a fixed stored-edge budget, variance-reduced reservoir samplers are often more accurate, but only after reading the entire stream. On a separate, much larger, $1.8\times10^9$-edge graph, the threshold algorithm reads $0.46\%$ of the stream and returns $3.8\%$ error, while the strongest reservoir baselines do not finish a pass within the wall-clock cap.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Asaf Etgar, Anna Gilbert, Quanquan C. Liu, Andrew McGregor. 2026-09-14. Scalable Triangle Counting: The Threshold Algorithm. https://arxiv.org/abs/2609.15848

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Online Flexible Busy Time Scheduling on Heterogeneous Machines

We study the online busy time scheduling model on heterogeneous machines. In our setting, jobs with uniform processing time arrive online with a deadline that becomes known to the algorithm at the job's arrival time. An algorithm has access to machines, each with different associated capacities and costs. The goal is to schedule jobs on machines by their deadline, so that the total cost incurred by the scheduling algorithm is minimized. While busy time scheduling has been well-studied, relatively little is known when machines are heterogeneous (i.e., have different costs and capacities), despite this natural theoretical generalization being the most practical model for clients using cloud computing services. We make significant progress in understanding this model by designing a deterministic online algorithm with competitive ratio 8(2p-1)/p < 16 when all jobs have uniform processing time p. A randomized version of this algorithm is 4(2p-1)/(p \ln 2)-competitive against an oblivious adversary. For unit-processing-time jobs, we give lower bounds of 4 and e (where e is Euler's number) on the competitive ratio of deterministic and randomized online algorithms, respectively. For unit-processing-time jobs with agreeable deadlines, we provide a deterministic 2-competitive online algorithm and a matching lower bound.

cs.DS

The Binary Tree Mechanism is Optimal for Differentially Private Continual Counting

Private continual counting is a fundamental problem in differential privacy: given a binary stream of length $n$, where each $1$ corresponds to the contribution of one individual, the goal is to release all running counts while protecting the privacy of each individual. For fixed privacy parameters, the standard binary tree mechanism achieves expected $\ell_\infty$ error $O(\log^{3/2} n)$ under approximate differential privacy and $O(\log^2 n)$ under pure differential privacy. Whether these dependences on the stream length are necessary has remained a central open problem. For fixed $\varepsilon\in(0,1)$, we prove a lower bound of $Ω(\log^{3/2} n)$ under approximate DP with sufficiently small fixed $δ>0$, and a lower bound of $Ω(\log^2 n)$ under pure DP. These bounds establish the optimality of the binary tree mechanism in both settings. The bounds hold for arbitrary mechanisms, even when the entire stream is available in advance. Both proofs use the same decomposition and accumulation of residual noise along a tree. As a consequence of the approximate-DP bound, we also obtain a largest-possible separation between hereditary discrepancy and private $\ell_\infty$ error for linear queries, showing that the known general upper bound in terms of hereditary discrepancy has the optimal dependence on the number of queries.

cs.DS

Directed Hamiltonian-Cycle Parity in $O^*((3/2)^n)$ Deterministic Time and Polynomial Space

We give a deterministic algorithm that computes the parity of the number of Hamiltonian cycles in an $n$-vertex directed graph in $O(n^4(3/2)^n)$ time and $O(n^2)$ bits of working space, improving the $O^*(φ^n)$ bound of Björklund and Husfeldt. Their local-degree formula reduces the problem to a weighted sum over solutions of structured quadratic equations. We cover the corresponding ternary state space by binary subcubes, each inducing an affine system. The Kuang--Wang cover can be regenerated within the target bound; canonical ownership resolves its overlaps, while self-loop conditional expectations bound every affine solution visit. Rollback elimination shares the work across cover prefixes. The same cover gives a Las Vegas algorithm listing all $L$ solutions of $m$ affine product constraints in $N$ Boolean variables in expected time $\operatorname{poly}(N,m)((3/2)^m+L)$ and polynomial space. Finally, we show that complete enumeration can require $Ω((3/2)^n)$ visits even on strongly connected digraphs after an optimal self-loop choice. This is a limitation of the enumeration method, not a general lower bound for Hamiltonian-cycle parity.

cs.DS