Finding Paths and Cycles in Graphs
A polynomial time algorithm which detects all paths and cycles of all lengths in form of vertex pairs (start, finish).
💡 Research Summary
The paper tackles the classic yet computationally demanding problem of identifying every possible path and cycle in a graph, presenting a polynomial‑time algorithm that reports the existence of such structures for all vertex pairs (start, finish). After outlining the importance of comprehensive path and cycle detection in domains ranging from communication network design to biological pathway analysis, the authors formalize the problem: given a directed or undirected graph G = (V, E), determine for each ordered pair (s, t) whether there exists a path of any length up to |V|, and for each vertex s whether a cycle that includes s exists.
The core of the proposed method combines binary matrix exponentiation with a dynamic‑programming (DP) closure. First, the adjacency matrix A is repeatedly squared in a logarithmic fashion, producing matrices A, A², A⁴, …, A^{2^{⌈log₂|V|⌉}}. Because the matrices are treated as Boolean (OR‑plus) rather than arithmetic, each entry (i, j) in A^k indicates whether a walk of exactly k edges connects i to j. By taking the Boolean OR of all these powers, the algorithm obtains a matrix that encodes the existence of walks of any length up to |V|.
Next, a DP table P (initially equal to A) is iteratively updated using the rule P ← P ∨ (P·A) for |V| iterations. This step is equivalent to computing the transitive closure of the graph, but performed in a way that simultaneously tracks the presence of cycles: whenever a diagonal entry P
Comments & Academic Discussion
Loading comments...
Leave a Comment