We consider the problem of counting 4-cycles ($C_4$) in a general undirected graph $G$ of $n$ vertices and $m$ edges (in bipartite graphs, 4-cycles are also often referred to as $\textit{butterflies}$). There have been a number of previous algorithms for this problem; some of these are based on fast matrix multiplication, which is attractive theoretically but not practical, and some of these are based on randomized hash tables. We develop a new simpler algorithm for counting $C_4$, which has several practical improvements over previous algorithms; for example, it is fully deterministic and avoids any expensive arithmetic in its inner loops. The algorithm can also be adapted to count 4-cycles incident to each vertex and edge. Our algorithm runs in $O(m\bar\delta(G))$ time and $O(n)$ space, where $\bar \delta(G) \leq O(\sqrt{m})$ is the $\textit{average degeneracy}$ parameter introduced by Burkhardt, Faber & Harris (2020).
翻译:我们考虑在一般的非方向图形中计算4周期(C_4美元)的问题(在两边的图表中,4周期也常常被称为$\textit{butflies}$ ) 。 这个问题以前有一些算法; 其中一些算法基于快速矩阵乘法, 它在理论上具有吸引力, 但并不实用, 其中一些是以随机散列表格为基础的。 我们为计算$C_ 4美元制定了一个新的更简单的算法, 它比以前的算法有几项实际改进; 例如, 它完全具有确定性, 避免了内部循环中任何昂贵的算术。 算法也可以根据每个顶端和边缘来计算4周期事件。 我们的算法运行在$O( m\bar\delta(G)) 时间和$O(n), 其中, $\bar\ delta(G)\ leq O(sq) (sqrt{m) $, 它比以前的算法有几种实际改进; 例如, 它完全具有确定性, 避免了内部循环中任何昂贵的算术。 该算法也可以根据每个顶值来计算4周期事件和边缘值(20美元) 。 我们的参数运行运行运行运行用$(m) 。</s>