English

Approximate Triangle Counting via Sampling and Fast Matrix Multiplication

Data Structures and Algorithms 2021-05-18 v2

Abstract

There is a trivial O(n3T)O(\frac{n^3}{T}) time algorithm for approximate triangle counting where TT is the number of triangles in the graph and nn the number of vertices. At the same time, one may count triangles exactly using fast matrix multiplication in time O~(nω)\tilde{O}(n^\omega). Is it possible to get a negative dependency on the number of triangles TT while retaining the nωn^\omega dependency on nn? We answer this question positively by providing an algorithm which runs in time O(nωTω2)poly(no(1)/ϵ)O\big(\frac{n^\omega}{T^{\omega - 2}}\big) \cdot \text{poly}(n^{o(1)}/\epsilon). This is optimal in the sense that as long as the exponent of TT is independent of n,Tn, T, it cannot be improved while retaining the dependency on nn; this as follows from the lower bound of Eden and Rosenbaum [APPROX/RANDOM 2018]. Our algorithm improves upon the state of the art when T=ω(1)T = \omega(1) and T=o(n)T = o(n). We also consider the problem of approximate triangle counting in sparse graphs, parameterizing by the number of edges mm. The best known algorithm runs in time O~(m3/2T)\tilde{O}\big(\frac{m^{3/2}}{T}\big) [Eden et al., SIAM Journal on Computing, 2017]. There is also a well known algorithm for exact triangle counting that runs in time O~(m2ω/(ω+1))\tilde{O}(m^{2\omega/(\omega + 1)}). We again get an algorithm that retains the exponent of mm while running faster on graphs with larger number of triangles. Specifically, our algorithm runs in time O(m2ω/(ω+1)T2(ω1)/(ω+1))poly(no(1)/ϵ)O\Big(\frac{m^{2\omega/(\omega+1)}}{ T^{2(\omega-1)/(\omega+1)}}\Big) \cdot \text{poly}(n^{o(1)}/\epsilon). This is again optimal in the sense that if the exponent of TT is to be constant, it cannot be improved without worsening the dependency on mm. This algorithm improves upon the state of the art when T=ω(1)T = \omega(1) and T=o(m)T = o(\sqrt{m}).

Keywords

Cite

@article{arxiv.2104.08501,
  title  = {Approximate Triangle Counting via Sampling and Fast Matrix Multiplication},
  author = {Jakub Tětek},
  journal= {arXiv preprint arXiv:2104.08501},
  year   = {2021}
}

Comments

Improved presentation, many minor edits, improved comparison to related work

R2 v1 2026-06-24T01:16:22.856Z