English

Incremental Cycle Detection, Topological Ordering, and Strong Component Maintenance

Data Structures and Algorithms 2011-05-13 v1

Abstract

We present two on-line algorithms for maintaining a topological order of a directed nn-vertex acyclic graph as arcs are added, and detecting a cycle when one is created. Our first algorithm handles mm arc additions in O(m3/2)O(m^{3/2}) time. For sparse graphs (m/n=O(1)m/n = O(1)), this bound improves the best previous bound by a logarithmic factor, and is tight to within a constant factor among algorithms satisfying a natural {\em locality} property. Our second algorithm handles an arbitrary sequence of arc additions in O(n5/2)O(n^{5/2}) time. For sufficiently dense graphs, this bound improves the best previous bound by a polynomial factor. Our bound may be far from tight: we show that the algorithm can take Ω(n222lgn)\Omega(n^2 2^{\sqrt{2\lg n}}) time by relating its performance to a generalization of the kk-levels problem of combinatorial geometry. A completely different algorithm running in Θ(n2logn)\Theta(n^2 \log n) time was given recently by Bender, Fineman, and Gilbert. We extend both of our algorithms to the maintenance of strong components, without affecting the asymptotic time bounds.

Keywords

Cite

@article{arxiv.1105.2397,
  title  = {Incremental Cycle Detection, Topological Ordering, and Strong Component Maintenance},
  author = {Bernhard Haeupler and Telikepalli Kavitha and Rogers Mathew and Siddhartha Sen and Robert Endre Tarjan},
  journal= {arXiv preprint arXiv:1105.2397},
  year   = {2011}
}

Comments

31 pages

R2 v1 2026-06-21T18:06:10.330Z