Skip to main content

A Dynamic Algorithm for Topologically Sorting Directed Acyclic Graphs

  • Conference paper
Experimental and Efficient Algorithms (WEA 2004)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 3059))

Included in the following conference series:

Abstract

We consider how to maintain the topological order of a directed acyclic graph (DAG) in the presence of edge insertions and deletions. We present a new algorithm and, although this has marginally inferior time complexity compared with the best previously known result, we find that its simplicity leads to better performance in practice. In addition, we provide an empirical comparison against three alternatives over a large number of random DAG’s. The results show our algorithm is the best for sparse graphs and, surprisingly, that an alternative with poor theoretical complexity performs marginally better on dense graphs.

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 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
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. Alpern, B., Hoover, R., Rosen, B.K., Sweeney, P.F., Zadeck, F.K.: Incremental evaluation of computational circuits. In: Proc. 1st Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 32–42 (1990)

    Google Scholar 

  2. Baswana, S., Hariharan, R., Sen, S.: Improved algorithms for maintaining transitive closure and all-pairs shortest paths in digraphs under edge deletions. In: Proc. ACM Symposium on Theory of Computing (2002)

    Google Scholar 

  3. Berman, A.M.: Lower And Upper Bounds For Incremental Algorithms. PhD thesis, New Brunswick, New Jersey (1992)

    Google Scholar 

  4. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms. MIT Press, Cambridge (2001)

    MATH  Google Scholar 

  5. Demetrescu, C., Frigioni, D., Marchetti-Spaccamela, A., Nanni, U.: Maintaining shortest paths in digraphs with arbitrary arc weights: An experimental study. In: Proc. Workshop on Algorithm Engineering. LNCS, pp. 218–229 (2000)

    Google Scholar 

  6. Demetrescu, C., Italiano, G.F.: Fully dynamic transitive closure: breaking through the O(n2) barrier. In: Proc. IEEE Symposium on Foundations of Computer Science, pp. 381–389 (2000)

    Google Scholar 

  7. Dietz, P., Sleator, D.: Two algorithms for maintaining order in a list. In: Proc. ACM Symposium on Theory of Computing, pp. 365–372 (1987)

    Google Scholar 

  8. Djidjev, H., Pantziou, G.E., Zaroliagis, C.D.: Improved algorithms for dynamic shortest paths. Algorithmica 28(4), 367–389 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  9. Frigioni, D., Marchetti-Spaccamela, A., Nanni, U.: Fully dynamic shortest paths and negative cycle detection on digraphs with arbitrary arc weights. In: Proc. European Symposium on Algorithms, pp. 320–331 (1998)

    Google Scholar 

  10. Ioannidis, Y., Ramakrishnan, R., Winger, L.: Transitive closure algorithms based on graph traversal. ACM Transactions on Database Systems 18(3), 512–576 (1993)

    Article  Google Scholar 

  11. Italiano, G.F., Eppstein, D., Galil, Z.: Dynamic graph algorithms. In: Algorithms and Theory of Computation Handbook, CRC Press, Boca Raton (1999)

    Google Scholar 

  12. Karp, R.M.: The transitive closure of a random digraph. Random Structures & Algorithms 1(1), 73–94 (1990)

    Article  MATH  MathSciNet  Google Scholar 

  13. Katriel, I.: On algorithms for online topological ordering and sorting. Research Report MPI-I-2004-1-003, Max-Planck-Institut fĂĽr Informatik (2004)

    Google Scholar 

  14. King, V., Sagert, G.: A fully dynamic algorithm for maintaining the transitive closure. In: Proc. ACM Symposium on Theory of Computing, pp. 492–498 (1999)

    Google Scholar 

  15. Marchetti-Spaccamela, A., Nanni, U., Rohnert, H.: Maintaining a topological order under edge insertions. Information Processing Letters 59(1), 53–58 (1996)

    Article  MATH  MathSciNet  Google Scholar 

  16. Pearce, D.J.: Some directed graph algorithms and their application to pointer analysis. PhD thesis, Imperial College, London (2004) (work in progress)

    Google Scholar 

  17. Pearce, D.J., Kelly, P.H.J., Hankin, C.: Online cycle detection and difference propagation for pointer analysis. In: Proc. IEEE workshop on Source Code Analysis and Manipulation (2003)

    Google Scholar 

  18. Ramalingam, G. (ed.): Bounded Incremental Computation. LNCS, vol. 1089. Springer, Heidelberg (1996)

    MATH  Google Scholar 

  19. Ramalingam, G., Reps, T.: On competitive on-line algorithms for the dynamic priority-ordering problem. Information Processing Letters 51(3), 155–161 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  20. Reps, T.: Optimal-time incremental semantic analysis for syntax-directed editors. In: Proc. Symp. on Principles of Programming Languages, pp. 169–176 (1982)

    Google Scholar 

  21. Zhou, J., Müller, M.: Depth-first discovery algorithm for incremental topological sorting of directed acyclic graphs. Information Processing Letters 88(4), 195–200 (2003)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Pearce, D.J., Kelly, P.H.J. (2004). A Dynamic Algorithm for Topologically Sorting Directed Acyclic Graphs. In: Ribeiro, C.C., Martins, S.L. (eds) Experimental and Efficient Algorithms. WEA 2004. Lecture Notes in Computer Science, vol 3059. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24838-5_29

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-24838-5_29

  • Publisher Name: Springer, Berlin, Heidelberg

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

  • Online ISBN: 978-3-540-24838-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics