Skip to main content
QUICK REVIEW

[Paper Review] Finding All Bounded-Length Simple Cycles in a Directed Graph

Anshul Gupta, Toyotaro Suzumura|arXiv (Cornell University)|May 21, 2021
Algorithms and Data CompressionComputer Science11 references12 citations
TL;DR

This paper presents a new deterministic algorithm for finding all simple cycles of length at most $k$ in directed graphs, leveraging vertex ordering by degree and depth-first search with cycle pruning to achieve $O((c+n)(k-1)d^k)$ time complexity on graphs with nearly uniform degree $d$. The method is highly efficient in practice, scaling to billions of cycles on real-world graphs like web-BerkStan and soc-pokec, and supports effective parallelization for large-scale applications.

ABSTRACT

A new efficient algorithm is presented for finding all simple cycles that satisfy a length constraint in a directed graph. When the number of vertices is non-trivial, most cycle-finding problems are of practical interest for sparse graphs only. We show that for a class of sparse graphs in which the vertex degrees are almost uniform, our algorithm can find all cycles of length less than or equal to $k$ in $O((c+n)(k-1)d^k)$ steps, where $n$ is the number of vertices, $c$ is the total number of cycles discovered, $d$ is the average degree of the graph's vertices, and $k > 1$. While our analysis for the running time addresses only a class of sparse graphs, we provide empirical and experimental evidence of the efficiency of the algorithm for general sparse graphs. This algorithm is a significant improvement over the only other deterministic algorithm for this problem known to us; it also lends itself to massive parallelism. Experimental results of a serial implementation on some large real-world graphs are presented.

Motivation & Objective

  • To address the practical need for finding all simple cycles of length ≤k in large sparse directed graphs, a common requirement in social network, financial, and communication graph analysis.
  • To develop a deterministic, scalable, and efficient algorithm that outperforms existing methods for length-constrained cycle enumeration.
  • To provide theoretical time complexity bounds under uniform degree assumptions and validate performance empirically on diverse real-world graphs.
  • To enable practical deployment through support for vertex reordering and massive parallelism, enhancing scalability on large graphs.

Proposed method

  • The algorithm uses a modified depth-first search (DFS) strategy inspired by Johnson’s algorithm, with vertex blocking and unblocking to avoid redundant cycle searches.
  • Vertices are renumbered in increasing order of total degree to reduce the number of explored paths and improve pruning efficiency.
  • For each vertex $s$, the algorithm performs a cycle search in the subgraph induced by vertices $\{s, s+1, \dots, n\}$, ensuring cycles are discovered only once via the smallest vertex.
  • The search is bounded to paths of length at most $k$, and cycles are collected only when a path returns to the starting vertex $s$ without revisiting any other vertex.
  • The algorithm maintains Blists (backtracking trails) to avoid reprocessing failed paths, ensuring correctness and efficiency.
  • The method is designed to be easily parallelizable, with independent cycle searches per starting vertex, enabling massive parallel execution on large graphs.

Experimental results

Research questions

  • RQ1Can a deterministic algorithm efficiently enumerate all simple cycles of length ≤k in large sparse directed graphs, where the number of cycles may be exponentially large?
  • RQ2How does vertex reordering by degree affect the performance of cycle enumeration algorithms in practice?
  • RQ3What is the theoretical time complexity of the proposed algorithm under the assumption of nearly uniform vertex degrees?
  • RQ4To what extent does the algorithm scale to real-world graphs with non-uniform degree distributions and billions of edges?
  • RQ5Can the algorithm be effectively parallelized to handle extremely large graphs beyond the capacity of serial execution?

Key findings

  • The algorithm successfully detected up to 6.11×10¹¹ cycles of length ≤6 in the soc-pokec graph using a single CPU, completing in under 15 minutes.
  • For $k=5$, sorting vertices by degree reduced running time by a factor of over 100 on the wiki-topcats graph, demonstrating the critical role of vertex ordering.
  • The empirical ratio $T / ((c+n)(k-1)\min(e,d^k))$ decreased with increasing $k$ and $c$, indicating that the algorithm performs better than the theoretical bound in practice.
  • On all test graphs from the SNAP repository, the algorithm’s running time grew sub-linearly with $c$ and $k$, suggesting robustness even with non-uniform degree distributions.
  • The web-BerkStan graph for $k=6$ required over 10 days and was aborted, indicating a practical upper bound on $k$ and graph size for serial execution.
  • The algorithm’s design naturally supports massive parallelism, enabling scalability to even larger graphs in future distributed implementations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.