skip to main content
research-article

A New Approach to Incremental Cycle Detection and Related Problems

Published:08 December 2015Publication History
Skip Abstract Section

Abstract

We consider the problem of detecting a cycle in a directed graph that grows by arc insertions and the related problems of maintaining a topological order and the strong components of such a graph. For these problems, we give two algorithms, one suited to sparse graphs, the other to dense graphs. The former takes O(min {m1/2, n2/3}m) time to insert m arcs into an n-vertex graph; the latter takes O(n2log n) time. Our sparse algorithm is substantially simpler than a previous O(m3/2)-time algorithm; it is also faster on graphs of sufficient density. The time bound of our dense algorithm beats the previously best time bound of O(n5/2) for dense graphs. Our algorithms rely for their efficiency on vertex numberings weakly consistent with topological order: we allow ties. Bounds on the size of the numbers give bounds on running time.

References

  1. Deepak Ajwani and Tobias Friedrich. 2007. Average-case analysis of online topological ordering. In ISAAC (Lecture Notes in Computer Science), Takeshi Tokuyama (Ed.), Vol. 4835. Springer, 464--475. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Deepak Ajwani, Tobias Friedrich, and Ulrich Meyer. 2006. An O(n2.75) algorithm for online topological ordering. In Proceedings of the 10th Scandinavian Workshop on Algorithm Theory (Lecture Notes in Computer Science), Vol. 4059. Springer, 53--64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Deepak Ajwani, Tobias Friedrich, and Ulrich Meyer. 2008. An O(n2.75) algorithm for online topological ordering. ACM Transactions on Algorithms 4, 4, Article 39 (Aug. 2008), 39:1--39:14 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bowen Alpern, Roger Hoover, Barry K. Rosen, Peter F. Sweeney, and F. Kenneth Zadeck. 1990. Incremental evaluation of computational circuits. In Proceedings of the 1st Annual ACM-SIAM Symposium on Discrete Algorithms. 32--42. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Michael A. Bender, Richard Cole, Erik D. Demaine, Martin Farach-Colton, and Jack Zito. 2002. Two simplified algorithms for maintaining order in a list. In Proceedings of the European Symposium on Algorithms. 152--164. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Michael A. Bender, Jeremy T. Fineman, and Seth Gilbert. 2009. A new approach to incremental topological ordering. In Proceedings of the ACM-SIAM Symposium on Discrete Algorithms. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Boris V. Cherkassky, Andrew V. Goldberg, and Craig Silverstein. 1997. Buckets, heaps, lists, and monotone priority queues. In Proceedings of the 8th Annual ACM-SIAM Symposium on Discrete Algorithms. Society for Industrial and Applied Mathematics, Philadelphia, PA, 83--92. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Eric V. Denardo and Bennett L. Fox. 1979. Shortest-route methods: 1. Reaching, pruning, and buckets. Operations Research 27 (1979), 161--186. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Paul F. Dietz and Daniel D. Sleator. 1987. Two algorithms for maintaining order in a list. In Proceedings of the ACM Symposium on the Theory of Computing. 365--372. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Bernhard Haeupler, Telikepalli Kavitha, Rogers Mathew, Siddhartha Sen, and Robert E. Tarjan. 2008. Faster algorithms for incremental topological ordering. In Proceedings of the 35th International Colloquium on Automata, Languages, and Programming. 421--433. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Bernhard Haeupler, Telikepalli Kavitha, Roger Mathew, Siddhartha Sen, and Robert E. Tarjan. 2012. Incremental cycle detection, topological ordering, and strong component maintenance. ACM Transactions on Algorithms 8, 1, Article 3 (Jan. 2012), 3:1--3:33 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Frank Harary, Robert Z. Norman, and Dorwin Cartwright. 1965. Structural Models: An Introduction to the Theory of Directed Graphs. John Wiley & Sons.Google ScholarGoogle Scholar
  13. A. B. Kahn. 1962. Topological sorting of large networks. Communications of the ACM 5, 11 (Nov. 1962), 558--562. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Irit Katriel. 2004. On Algorithms for Online Topological Ordering and Sorting. Technical Report MPI-I-2004-003. Max-Planck-Institut für Informatik, Saarbrücken, Germany.Google ScholarGoogle Scholar
  15. Irit Katriel and Hans L. Bodlaender. 2005. Online topological ordering. In Proceedings of the 16th ACM-SIAM Symposium on Discrete Algorithms. Vancouver, British Columbia, Canada, 443--450. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Irit Katriel and Hans L. Bodlaender. 2006. Online topological ordering. ACM Transactions on Algorithms 2, 3 (July 2006), 364--379. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Donald E. Knuth. 1973. The Art of Computer Programming, Volume 1: Fundamental Algorithms (2nd ed.). Addison Wesley, Reading, MA.Google ScholarGoogle Scholar
  18. Donald E. Knuth. 1998. The Art of Computer Programming, Volume 3: Sorting and Searching (2nd ed.). Addison Wesley Longman Publishing Co., Redwood City, CA, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Donald E. Knuth and Jayme L. Szwarcfiter. 1974. A structured program to generate all topological sorting arrangements. Information Processing Letters 2, 6 (1974), 153--157.Google ScholarGoogle ScholarCross RefCross Ref
  20. Hsiao-Fei Liu and Kun-Mao Chao. 2007. A tight analysis of the Katriel--Bodlaender algorithm for online topological ordering. Theoretical Computer Science 389, 1--2 (2007), 182--189. DOI:http://dx.doi.org/10.1016/j.tcs.2007.08.009 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Alberto Marchetti-Spaccamela, Umberto Nanni, and Hans Rohnert. 1996. Maintaining a topological order under edge insertions. Information Processing Letters 59, 1 (1996), 53--58. DOI:http://dx.doi.org/10.1016/0020-0190(96)00075-0 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. David J. Pearce, Paul H. J. Kelly, and Chris Hankin. 2003. Online cycle detection and difference propagation for pointer analysis. In Proceedings of the 3rd International Workshop on Source Code Analysis and Manipulation. 3--12.Google ScholarGoogle ScholarCross RefCross Ref
  23. David J. Pearce. 2005. Some Directed Graph Problems and Their Application to Pointer Analysis. Ph.D. Dissertation. University of London.Google ScholarGoogle Scholar
  24. David J. Pearce and Paul H. J. Kelly. 2003. Online Algorithms for Topological Order and Strongly Connected Components. Technical Report. Imperial College, London.Google ScholarGoogle Scholar
  25. David J. Pearce and Paul H. J. Kelly. 2004. A dynamic algorithm for topologically sorting directed acyclic graphs. In Proceedings of the 3rd International Workshop on Efficient Experimental Algorithms (Lecture Notes in Computer Science), Vol. 3059. Springer, 383--398.Google ScholarGoogle Scholar
  26. David J. Pearce and Paul H. J. Kelly. 2006. A dynamic topological sort algorithm for directed acyclic graphs. Journal of Experimental Algorithms 11, Article 1.7 (Feb. 2006). Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. David J. Pearce and Paul H. J. Kelly. 2010. A batch algorithm for maintaining a topological order. In Proceedings of the 33rd Australasian Conference on Computer Science (ACSC’10). 79--88. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Liam Roditty and Uri Zwick. 2008. Improved dynamic reachability algorithms for directed graphs. SIAM Journal on Computing 37, 5 (2008), 1455--1471. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Edward Szpilrajn. 1930. Sur l’Extension de l’Ordre Partiel. Fundamenta Mathematicae 16 (1930), 386--389.Google ScholarGoogle ScholarCross RefCross Ref
  30. Robert E. Tarjan. 1972. Depth-first search and linear graph algorithms. SIAM Journal on Computing 1, 2 (1972), 146--160.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Robert E. Tarjan. 1974. Finding dominators in directed graphs. SIAM Journal on Computing 3, 1 (1974), 62--89.Google ScholarGoogle ScholarCross RefCross Ref
  32. Robert E. Tarjan. 1975. Efficiency of a good but not linear set union algorithm. Journal of the Association for Computing Machinery 22, 2 (1975), 215--225. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Robert Endre Tarjan. 1983. Data Structures and Network Algorithms. Society for Industrial and Applied Mathematics, Philadelphia, PA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Robert E. Tarjan and Jan van Leeuwen. 1984. Worst-case analysis of set union algorithms. Journal of the Association for Computing Machinery 31, 2 (March 1984), 245--281. DOI:http://dx.doi.org/10.1145/62.2160 Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. J. W. J. Williams. 1964. Algorithm 232: Heapsort. Communications of the ACM 7, 6 (1964), 347--348.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A New Approach to Incremental Cycle Detection and Related Problems

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM Transactions on Algorithms
        ACM Transactions on Algorithms  Volume 12, Issue 2
        February 2016
        385 pages
        ISSN:1549-6325
        EISSN:1549-6333
        DOI:10.1145/2846106
        Issue’s Table of Contents

        Copyright © 2015 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 8 December 2015
        • Accepted: 1 April 2015
        • Revised: 1 February 2015
        • Received: 1 March 2014
        Published in talg Volume 12, Issue 2

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article
        • Research
        • Refereed

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader