Skip to main content

Faster Algorithms for Incremental Topological Ordering

  • Conference paper
Automata, Languages and Programming (ICALP 2008)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 5125))

Included in the following conference series:

Abstract

We present two online algorithms for maintaining a topological order of a directed acyclic graph as arcs are added, and detecting a cycle when one is created. Our first algorithm takes O(m 1/2) amortized time per arc and our second algorithm takes O(n 2.5/m) amortized time per arc, where n is the number of vertices and m is the total number of arcs. For sparse graphs, our O(m 1/2) bound improves the best previous bound by a factor of logn and is tight to within a constant factor for a natural class of algorithms that includes all the existing ones. Our main insight is that the two-way search method of previous algorithms does not require an ordered search, but can be more general, allowing us to avoid the use of heaps (priority queues). Instead, the deterministic version of our algorithm uses (approximate) median-finding; the randomized version of our algorithm uses uniform random sampling. For dense graphs, our O(n 2.5/m) bound improves the best previously published bound by a factor of n 1/4 and a recent bound obtained independently of our work by a factor of logn. Our main insight is that graph search is wasteful when the graph is dense and can be avoided by searching the topological order space instead. Our algorithms extend to the maintenance of strong components, in the same asymptotic time bounds.

This paper combines the best results of [12] and [7]. The former gives two incremental topological ordering algorithms, with amortized time bounds per arc addition of O(m 1/2 + (nlogn)/m 1/2) and O(n 2.5/m). The latter, which was written with knowledge of the former, gives an algorithm with a bound of O(m 1/2).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 149.00
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 199.00
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Ajwani, D., Friedrich, T., Meyer, U.: An O(n 2.75) algorithm for online topological ordering. In: Arge, L., Freivalds, R. (eds.) SWAT 2006. LNCS, vol. 4059, pp. 53–64. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  2. Alpern, B., Hoover, R., Rosen, B.K., Sweeney, P.F., Zadeck, F.K.: Incremental evaluation of computational circuits. In: SODA 1990, pp. 32–42 (1990)

    Google Scholar 

  3. Belik, F.: An efficient deadlock avoidance technique. IEEE Trans. on Comput. 39(7) (1990)

    Google Scholar 

  4. Bender, M.A., Cole, R., Demaine, E.D., Farach-Colton, M., Zito, J.: Two simplified algorithms for maintaining order in a list. In: Möhring, R.H., Raman, R. (eds.) ESA 2002. LNCS, vol. 2461, pp. 152–164. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  5. Blum, M., Floyd, R.W., Pratt, V., Rivest, R.L., Tarjan, R.E.: Time bounds for selection. J. of Comput. and Syst. Sci. 7(4), 448–461 (1973)

    Article  MathSciNet  MATH  Google Scholar 

  6. Dietz, P.F., Sleator, D.D.: Two algorithms for maintaining order in a list. In: STOC 1987, pp. 365–372 (1987)

    Google Scholar 

  7. Haeupler, B., Sen, S., Tarjan, R.E.: Incremental topological ordering and strong component maintenance (2008)

    Google Scholar 

  8. Han, Y., Thorup, M.: Integer sorting in O(n \(\sqrt{\log \log n}\)) expected time and linear space. In: FOCS 2002, pp. 135–144 (2002)

    Google Scholar 

  9. Harary, F., Norman, R.Z., Cartwright, D.: Structural Models : An Introduction to the Theory of Directed Graphs. John Wiley & Sons, Chichester (1965)

    MATH  Google Scholar 

  10. Katriel, I.: On algorithms for online topological ordering and sorting. Technical Report MPI-I-2004-1-003, Max-Planck-Institut für Informatik, Saarbrücken, Germany (2004)

    Google Scholar 

  11. Katriel, I., Bodlaender, H.L.: Online topological ordering. ACM Trans. on Algor. 2(3), 364–379 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  12. Kavitha, T., Mathew, R.: Faster algorithms for online topological ordering (2007)

    Google Scholar 

  13. Knuth, D.E.: The Art of Computer Programming. Fundamental Algorithms, vol. 1. Addison-Wesley, Reading (1973)

    MATH  Google Scholar 

  14. Knuth, D.E., Szwarcfiter, J.L.: A structured program to generate all topological sorting arrangements. Inf. Proc. Lett. 2(6), 153–157 (1974)

    Article  MATH  Google Scholar 

  15. Liu, H.-F., Chao, K.-M.: A tight analysis of the Katriel-Bodlaender algorithm for online topological ordering. Theor. Comput. Sci. 389(1-2), 182–189 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  16. Liu, H.-F., Chao, K.-M.: An Õ(n 2.5)-time algorithm for online topological ordering (2008)

    Google Scholar 

  17. Marchetti-Spaccamela, A., Nanni, U., Rohnert, H.: On-line graph algorithms for incremental compilation. In: van Leeuwen, J. (ed.) WG 1993. LNCS, vol. 790, pp. 70–86. Springer, Heidelberg (1994)

    Chapter  Google Scholar 

  18. Marchetti-Spaccamela, A., Nanni, U., Rohnert, H.: Maintaining a topological order under edge insertions. Inf. Proc. Lett. 59(1), 53–58 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  19. Omohundro, S.M., Lim, C.-C., Bilmes, J.: The Sather language compiler/debugger implementation. Technical Report TR-92-017, International Computer Science Institute, Berkeley (1992)

    Google Scholar 

  20. Pearce, D.J., Kelly, P.H.J.: A dynamic topological sort algorithm for directed acyclic graphs. J. of Exp. Algorithmics 11, 1–7 (2006)

    MathSciNet  MATH  Google Scholar 

  21. Pearce, D.J., Kelly, P.H.J., Hankin, C.: Online cycle detection and difference propagation for pointer analysis. In: SCAM 2003, pp. 3–12 (2003)

    Google Scholar 

  22. Ramalingam, G., Reps, T.W.: On the computational complexity of incremental algorithms. Technical Report CS-TR-1991-1033, University of Wisconsin-Madison (1991)

    Google Scholar 

  23. Ramalingam, G., Reps, T.W.: On competitive on-line algorithms for the dynamic priority-ordering problem. Inf. Proc. Lett. 51(3), 155–161 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  24. Roditty, L., Zwick, U.: Improved dynamic reachability algorithms for directed graphs. In: FOCS 2002, pp. 679–688 (2002)

    Google Scholar 

  25. Roditty, L., Zwick, U.: A fully dynamic reachability algorithm for directed graphs with an almost linear update time. In: STOC 2004, pp. 184–191 (2004)

    Google Scholar 

  26. Schönhage, A., Paterson, M., Pippenger, N.: Finding the median. J. of Comput. and Syst. Sci. 13(2), 184–199 (1976)

    Article  MathSciNet  MATH  Google Scholar 

  27. Shmueli, O.: Dynamic cycle detection. Information Processing Letters 17(4), 185–188 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  28. Tarjan, R.E.: Depth-first search and linear graph algorithms. SIAM J. on Comput. 1(2), 146–160 (1972)

    Article  MathSciNet  MATH  Google Scholar 

  29. Thorup, M.: Integer priority queues with decrease key in constant time and the single source shortest paths problem. J. of Comput. Syst. Sci. 69(3), 330–353 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  30. van Emde Boas, P.: Preserving order in a forest in less than logarithmic time and linear space. Inf. Proc. Lett. 6(3), 80–82 (1977)

    Article  MATH  Google Scholar 

  31. van Emde Boas, P., Kaas, R., Zijlstra, E.: Design and implementation of an efficient priority queue. Mathematical Systems Theory 10, 99–127 (1977)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2008 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Haeupler, B., Kavitha, T., Mathew, R., Sen, S., Tarjan, R.E. (2008). Faster Algorithms for Incremental Topological Ordering. In: Aceto, L., Damgård, I., Goldberg, L.A., Halldórsson, M.M., Ingólfsdóttir, A., Walukiewicz, I. (eds) Automata, Languages and Programming. ICALP 2008. Lecture Notes in Computer Science, vol 5125. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-70575-8_35

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-70575-8_35

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-70574-1

  • Online ISBN: 978-3-540-70575-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics