When recursion is better than iteration: A linear-time algorithm for directed acyclicity with few error vertices - Lokshtanov, Daniel; Ramanujan, M.S.; Saurabh, Saket (Journal of combinatorial theory. Series B, 2026)
Planarity, bipartiteness and (directed) acyclicity are basic graph properties with classic linear-time recognition algorithms. However, the problems of testing whether a given graph has k vertices whose deletion makes it planar, bipartite or a directed acyclic graph (DAG) are all fundamental NP-complete problems when k is part of the input. As a result, a significant amount of research has been devoted to understanding whether, for every fixed k, these problems admit a polynomial-time algorithm (where the exponent in the polynomial is independent of k) and in particular, whether they admit linear-time algorithms. While we now know that for every fixed k, we can test in linear time whether a graph is k vertices away from being planar or bipartite, the best known algorithms in the case of directed acyclicity are the algorithm of Garey and Tarjan [IPL 1978], which runs in time O(nk−1⋅m) and the algorithm of Chen, Liu, Lu, O'Sullivan and Razgon [JACM 2008], which runs in time O(k!⋅4k⋅k4⋅n⋅m), where n and m are the number of vertices and arcs in the input digraph, respectively. In other words, it has remained open whether it is possible to recognize in linear time, a graph that is two vertices away from being acyclic. In this paper, we settle this question by giving an algorithm that decides whether a given graph is k vertices away from being acyclic, in time O(k!⋅4k⋅k5⋅(n+m)). That is, for every fixed k, our algorithm runs in time O(m+n), thus mirroring the case for planarity and bipartiteness. We obtain our algorithm by introducing a general methodology that shaves off a factor of n from certain algorithms that use the powerful technique of iterative compression. The two main features of our methodology are: (i) This is the first generic technique for designing linear-time FPT algorithms for directed cut problems and (ii) it can be used in combination with future improvements in algorithms for the so-called compression version of other well-studied cut problems such as Multicut and Directed Subset Feedback Vertex Set.