## Internet Mathematics

- Internet Math.
- Volume 8, Number 1-2 (2012), 161-185.

### Efficient Triangle Counting in Large Graphs via Degree-Based Vertex Partitioning

Mihail N. Kolountzakis, Gary L. Miller, Richard Peng, and Charalampos E. Tsourakakis

#### Abstract

The number of triangles is a computationally expensive graph statistic frequently used in complex network analysis (e.g., transitivity ratio), in various random graph models (e.g., exponential random graph model), and in important real-world applications such as spam detection, uncovering the hidden thematic structures in the Web, and link recommendation. Counting triangles in graphs with millions and billions of edges requires algorithms that run fast, use little space, provide accurate estimates of the number of triangles, and preferably are parallelizable. In this paper we present an efficient triangle-counting approximation algorithm that can be adapted to the semistreaming model. Its key idea is to combine the sampling algorithm of Tsourakakis, and the partitioning of the set of vertices into high- and low-degree subsets as in Alon, treating each set appropriately. From a mathematical perspective, we present a simplified proof of Tsourakakis, “Counting Triangles Using Projections,” that uses the powerful Kim–Vu concentration inequality based on the Hajnal–Szemerédi theorem. Furthermore, we improve bounds of existing triple-sampling techniques based on a theorem of Ahlswede and Katona. We obtain a running time $O(m + \frac{m^{3 / 2} \log n} {t\epsilon^2})$ and an $(1 ±\epsilon)$ approximation, where $n$ is the number of vertices, $m$ is the number of edges, and $\Delta$ is the maximum number of triangles in which any single edge is contained. Furthermore, we show how this algorithm can be adapted to the semistreaming model with space usage $O(m^{1/2} \log n + \frac{m^{3 / 2} \log n} {t\epsilon^2} )$ and a constant number of passes (three) over the graph stream. We apply our methods to various networks with several millions of edges and we obtain excellent results, outperforming existing triangle-counting methods. Finally, we propose a random-projection-based method for triangle counting and provide a sufficient condition to obtain an estimate with low variance.

#### Article information

**Source**

Internet Math., Volume 8, Number 1-2 (2012), 161-185.

**Dates**

First available in Project Euclid: 14 June 2012

**Permanent link to this document**

https://projecteuclid.org/euclid.im/1339678186

**Mathematical Reviews number (MathSciNet)**

MR2900492

**Zentralblatt MATH identifier**

1245.05120

#### Citation

Kolountzakis, Mihail N.; Miller, Gary L.; Peng, Richard; Tsourakakis, Charalampos E. Efficient Triangle Counting in Large Graphs via Degree-Based Vertex Partitioning. Internet Math. 8 (2012), no. 1-2, 161--185. https://projecteuclid.org/euclid.im/1339678186