Skip to main content

Edge-disjoint spanning trees and depth-first search


This paper presents an algorithm for finding two edge-disjoint spanning trees rooted at a fixed vertex of a directed graph. The algorithm uses depthfirst search and an efficient method for computing disjoint set unions. It requires O ((e, n)) time and O(e) space to analyze a graph with n vertices and e edges, where α (e, n) is a very slowly growing function related to a functional inverse of Ackermann's function.

This is a preview of subscription content, access via your institution.


  1. 1.

    Aho, A. V., Hopcroft, J. E., Ullman, J. D.: On finding lowest common ancestors in trees. Proceedings of the Fifth Annual ACM Symposium on Theory of Computing, Austin (Tex.) 1973, p. 253–256

  2. 2.

    Aho, A. V., Ullman, J. D.: The theory of parsing, translation and compiling, Vol. II: Compiling. Englewood Cliffs (N. J.): Prentrice Hall 1972

    Google Scholar 

  3. 3.

    Chase, S. M.: An implemented graph algorithm for winning Shannon switching games. Comm. ACM 15, 253–256 (1972)

    Google Scholar 

  4. 4.

    Edmonds, J.: Minimum partition of a matroid into independent subsets. J. of Research of the Nat. Bur. of Standards, 69B 67–72 (1965)

    Google Scholar 

  5. 5.

    Edmonds, J.: On Lehman's switching game and a theorem of Tutte and Nash-Williams. J. of Research of the Nat. Bur. of Standarts, 69B 73–77 (1965)

    Google Scholar 

  6. 6.

    Edmonds, J.: Submodular functions, matroids, and certain polyhedra. Calgary Int. Conf. on Combinatorial Structures and their Applications 1969. New York: Gordon and Breach 1969, p. 69–87

    Google Scholar 

  7. 7.

    Edmonds, J.: Edge-disjoint branchings. Combinatorial algorithms. In: Rustin, R. (ed.): Combinatorial algorithms. New York (N.Y.): Algorithmics Press 1972, p. 91–96

    Google Scholar 

  8. 8.

    Hopcroft, J., Ullman, J.: Set merging algorithms. SIAM J. Computing 2, 294–303 (1973)

    Google Scholar 

  9. 9.

    Kameda, T., Toida, S.: Efficient algorithms for determining an extremal tree of a graph. Proc. 14th Annual IEEE Symp. on Switching and Automata Theory 1973

  10. 10.

    Kishi, G., Kajitani, Y.: Maximally distant trees and principal partition of a linear graph. IEEE Trans, on Circuit Theory, CT-16 323–330 (1969)

    Google Scholar 

  11. 11.

    Knuth, D.: The art of computer programming, Vol. 1: Fundamental Algorithms. Reading (Mass.): Addison-Wesley 1968, p. 315–346

    Google Scholar 

  12. 12.

    Knuth, D.: The art of computer programming, Vol. 3: Sorting and Searching. Reading (Mass.): Addison-Wesley 1973, p. 150–152

    Google Scholar 

  13. 13.

    Knuth, D.: Private communication, 1973

  14. 14.

    Lawler, E. L.: Matroid intersection algorithms. Electronics Research Laboratory, University of California, Berkeley, California Memorandum No. ERL — M333, 1971

    Google Scholar 

  15. 15.

    Lehman, A.: A solution to the Shannon switching game. SIAM J. Appl. Math. 12, 687–725 (1964)

    Google Scholar 

  16. 16.

    Nash-Williams, C. St. J. A.: Edge-disjoint spanning trees of finite graphs. J. London Math. Soc. 36, 445–450 (1961)

    Google Scholar 

  17. 17.

    Nash-Williams, C. St. J. A.: Decomposition of finite graphs into forests. J. London Math. Soc. 39, 12 (1964)

    Google Scholar 

  18. 18.

    Ohtsuki, T., Ishizaki, Y., Watanabe, H.: Topological degrees of freedom and mixed analysis of electrical networks. IEEE Trans, on Circuit Theory, CT-17 491–499 (1970)

    Google Scholar 

  19. 19.

    Tarjan, R.: Depth-first search and linear graph algorithms. SIAM J. Computing 1, 146–160 (1972)

    Google Scholar 

  20. 20.

    Tarjan, R.: Efficiency of a good but not linear set union algorithm. J. ACM 22, 215–225 (1975)

    Google Scholar 

  21. 21.

    Tarjan, R.: Finding dominators in directed graphs. SIAM J. Computing 3, 62–89 (1974)

    Google Scholar 

  22. 22.

    Tarjan, R.: Testing flow graph reducibility. J. Computer and System 9, 355–365 (1974)

    Google Scholar 

  23. 23.

    Tarjan, R.: A new algorithm for finding weak components. Information Processing Letters 3, 13–15 (1974)

    Google Scholar 

  24. 24.

    Tarjan, R.: A good algorithm for edge-disjoint branchings. Information Processing Letters 3, 51–53 (1974)

    Google Scholar 

  25. 25.

    Tarjan, R.: Unpublished notes. Computer Science Division, University of California, Berkeley, California, 1974

    Google Scholar 

  26. 26.

    Tutte, W. T.: On the problem of decomposing a graph into n connected factors. J. London Math. Soc. 3, 221–230 (1961)

    Google Scholar 

Download references

Author information



Additional information

This work was partially supported by the National Science Foundation Grant GJ-3S604X, and by a Miller Research Fellowship, at the University of California, Berkeley; and by the National Science Foundation, Grant MCS 72-03752 A03, at Stanford University.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Tarjan, R.E. Edge-disjoint spanning trees and depth-first search. Acta Informatica 6, 171–185 (1976).

Download citation


  • Information System
  • Operating System
  • Data Structure
  • Communication Network
  • Information Theory