Triangle Counting
#
Problem Specification#
Input, an undirected graph.
#
Output, the total number of triangles in . Each unordered triangle is counted once.
#
Algorithm ImplementationsIn GBBS we implement the triangle counting algorithm described by Shun and Tangwongsan [1]. This algorithm parallelizes Latapy's \emph{compact-forward} algorithm [2], which creates a directed graph where an edge is kept in iff . Although triangle counting can be done directly on the undirected graph in the same work and depth asymptotically, directing the edges helps reduce work, and ensures that every triangle is counted exactly once. More details can be found in Section 6.4 of [3].
The code for our implemenation is available here.
#
Cost BoundsOur implementation runs in work and depth. More details can be found in Section 6.4 of [3].
#
Compiling and RunningThe benchmark can be compiled by running:
It can then be run on a test input graph in the uncompressed format as follows:
It can then be run on a test input graph in the compressed format as follows:
#
References[1] Julian Shun and Kanat Tangwongsan
Multicore Triangle Computations Without Tuning
Proceedings of the IEEE International Conference on Data Engineering (ICDE), pp. 149-160, 2015.
[2] Matthieu Latapy
Main-memory Triangle Computations for Very Large (Sparse (Power-law)) Graphs
Theor. Comput. Sci., 407(1-3), pp. 458-473, 2008
[3] Laxman Dhulipala, Guy Blelloch, and Julian Shun
Theoretically Efficient Parallel Graph Algorithms Can Be Fast and Scalable
Proceedings of the ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pp. 393-404, 2018.