Efficient Enumeration of Ordered Trees with k Leaves (Extended Abstract)

  • Katsuhisa Yamanaka
  • Yota Otachi
  • Shin-ichi Nakano
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5431)


In this paper, we give a simple algorithm to generate all ordered trees with exactly n vertices including exactly k leaves. The best known algorithm generates such trees in O(n − k) time for each, while our algorithm generates such trees in O(1) time for each in worst case.


graph algorithm ordered tree enumeration family tree 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Avis, D., Fukuda, K.: Reverse search for enumeration. Discrete Appl. Math. 65(1-3), 21–46 (1996)MathSciNetCrossRefMATHGoogle Scholar
  2. 2.
    Beyer, T., Hedetniemi, S.M.: Constant time generation of rooted trees. SIAM J. Comput. 9(4), 706–712 (1980)MathSciNetCrossRefMATHGoogle Scholar
  3. 3.
    Fenner, T.I., Loizou, G.: A binary tree representation and related algorithms for generating integer partitions. The Computer J. 23(4), 332–337 (1980)MathSciNetCrossRefMATHGoogle Scholar
  4. 4.
    Goldberg, L.: Efficient algorithms for listing combinatorial structures. Cambridge University Press, New York (1993)CrossRefMATHGoogle Scholar
  5. 5.
    Kikuchi, Y., Tanaka, H., Nakano, S., Shibata, Y.: How to obtain the complete list of caterpillars. In: Warnow, T.J., Zhu, B. (eds.) COCOON 2003. LNCS, vol. 2697, pp. 329–338. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  6. 6.
    Knuth, D.: The art of computer programming. Generating all tuples and permutations, vol. 4, fascicle 2. Addison-Wesley, Reading (2005)MATHGoogle Scholar
  7. 7.
    Knuth, D.E.: The art of computer programming. Generating all trees, history of combinatorial generation, vol. 4, fascicle 4. Addison-Wesley, Reading (2006)Google Scholar
  8. 8.
    Korsh, J.F., LaFollette, P.: Multiset permutations and loopless generation of ordered trees with specified degree sequence. Journal of Algorithms 34(2), 309–336 (2000)MathSciNetCrossRefMATHGoogle Scholar
  9. 9.
    Korsh, J.F., LaFollette, P.: Loopless generation of trees with specified degrees. The Computer Journal 45(3), 364–372 (2002)CrossRefMATHGoogle Scholar
  10. 10.
    Kreher, D.L., Stinson, D.R.: Combinatorial algorithms. CRC Press, Boca Raton (1998)MATHGoogle Scholar
  11. 11.
    Li, G., Ruskey, F.: The advantages of forward thinking in generating rooted and free trees. In: Proc. 10th Annual ACM-SIAM Symp. on Discrete Algorithms (SODA 1999), pp. 939–940 (1999)Google Scholar
  12. 12.
    Li, Z., Nakano, S.: Efficient generation of plane triangulations without repetitions. In: Orejas, F., Spirakis, P.G., van Leeuwen, J. (eds.) ICALP 2001. LNCS, vol. 2076, pp. 433–443. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  13. 13.
    McKay, B.D.: Isomorph-free exhaustive generation. J. Algorithms 26(2), 306–324 (1998)MathSciNetCrossRefMATHGoogle Scholar
  14. 14.
    Muramatsu, T., Nakano, S.: A random generation of plane trees with exactly k leaves. IEICE Transaction on Fundamentals J90-A(12), 940–947 (2007) (in Japanese)Google Scholar
  15. 15.
    Nakano, S.: Efficient generation of plane trees. Inf. Process. Lett. 84(3), 167–172 (2002)MathSciNetCrossRefMATHGoogle Scholar
  16. 16.
    Nakano, S.: Efficient generation of triconnected plane triangulations. Comput. Geom. Theory and Appl. 27(2), 109–122 (2004)MathSciNetCrossRefMATHGoogle Scholar
  17. 17.
    Nakano, S., Uno, T.: Constant time generation of trees with specified diameter. In: Hromkovič, J., Nagl, M., Westfechtel, B. (eds.) WG 2004. LNCS, vol. 3353, pp. 33–45. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  18. 18.
    Nakano, S., Uno, T.: Generating colored trees. In: Kratsch, D. (ed.) WG 2005. LNCS, vol. 3787, pp. 249–260. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  19. 19.
    Pallo, J.: Generating trees with n nodes and m leaves. International Journal of Computer Mathematics 21(2), 133–144 (1987)MathSciNetCrossRefMATHGoogle Scholar
  20. 20.
    Read, R.C.: Every one a winner or how to avoid isomorphism search. Annuals of Discrete Mathematics 2, 107–120 (1978)CrossRefMATHGoogle Scholar
  21. 21.
    Reingold, E.M., Nievergelt, J., Deo, N.: Combinatorial Algorithms. Prentice-Hall, Englewood Cliffs (1977)MATHGoogle Scholar
  22. 22.
    Ruskey, F., van Baronaigien, D.R.: Fast recursive algorithms for generating combinatorial objects. Congressus Numerantium 41, 53–62 (1984)MathSciNetMATHGoogle Scholar
  23. 23.
    Sawada, J.: Generating rooted and free plane trees. ACM Transactions on Algorithms 2(1), 1–13 (2006)MathSciNetCrossRefMATHGoogle Scholar
  24. 24.
    Stanley, R.P.: Enumerative combinatorics, vol. 2. Cambridge University Press, Cambridge (1999)CrossRefMATHGoogle Scholar
  25. 25.
    Wilf, H.S.: Combinatorial algorithms: An update. SIAM, Philadelphia (1989)CrossRefMATHGoogle Scholar
  26. 26.
    Wright, R.A., Richmond, B., Odlyzko, A., McKay, B.D.: Constant time generation of free trees. SIAM J. Comput. 15(2), 540–548 (1986)MathSciNetCrossRefMATHGoogle Scholar
  27. 27.
    Yamanaka, K., Kawano, S., Kikuchi, Y., Nakano, S.: Constant time generation of integer partitions. IEICE Trans. Fundamentals E90-A(5), 888–895 (2007)CrossRefGoogle Scholar
  28. 28.
    Yamanaka, K., Nakano, S.: Listing all plane graphs. In: Nakano, S.-i., Rahman, M. S. (eds.) WALCOM 2008. LNCS, vol. 4921, pp. 210–221. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  29. 29.
    Zaks, S., Richards, D.: Generating trees and other combinatorial objects lexicographically. SIAM J. Comput. 8(1), 73–81 (1979)MathSciNetCrossRefMATHGoogle Scholar
  30. 30.
    Zoghbi, A., Stojmenović, I.: Fast algorithms for generating integer partitions. Int. J. Comput. Math. 70, 319–332 (1998)MathSciNetCrossRefMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Katsuhisa Yamanaka
    • 1
  • Yota Otachi
    • 2
  • Shin-ichi Nakano
    • 2
  1. 1.Graduate School of Information SystemsThe University of Electro-CommunicationsTokyoJapan
  2. 2.Department of Computer ScienceGunma UniversityGunmaJapan

Personalised recommendations