Acta Informatica

, Volume 44, Issue 5, pp 361–376 | Cite as

A general exhaustive generation algorithm for Gray structures

  • Antonio Bernini
  • Elisabetta Grazzini
  • Elisa Pergola
  • Renzo Pinzani
Original article


Starting from a succession rule for Catalan numbers, we define a procedure for encoding and listing the objects enumerated by these numbers such that two consecutive codes of the list differ only by one digit. The Gray code we obtain can be generalized to all the succession rules with the stability property: each label (k) has in its productions two labels c1 and c2, always in the same position, regardless of k. Because of this link, we define Gray structures as the sets of those combinatorial objects whose construction can be encoded by a succession rule with the stability property. This property is a characteristic that can be found among various succession rules, such as the finite, factorial or transcendental ones. We also indicate an algorithm which is a very slight modification of Walsh’s one, working in O(1) worst-case time per word for generating Gray codes.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bacchelli S., Barcucci E., Grazzini E. and Pergola E. (2004). Exhaustive generation of combinatorial objects by ECO. Acta Inform. 40(8): 585–602 MATHCrossRefGoogle Scholar
  2. 2.
    Bose P., Buss J.F. and Lubiw A. (1998). Pattern matching for permutations. Inform. Process. Lett. 65: 277–283 CrossRefGoogle Scholar
  3. 3.
    Banderier C., Bousquet-Mélou M., Denise A., Flajolet P., Gardy D. and Gouyou-Beauchamps D. (2002). Generating functions for generating trees. Discrete Math. 246: 29–55 MATHCrossRefGoogle Scholar
  4. 4.
    Barcucci E., Del Lungo A. and Pergola E. (1999). Random generation of trees and other combinatorial objects. Theoret. Comput. Sci 218: 219–232 MATHCrossRefGoogle Scholar
  5. 5.
    Barcucci E., Del Lungo A., Pergola E. and Pinzani R. (1999). ECO: a methodology for the enumeration of combinatorial objects,. J. Differ. Equ. Appl. 5: 435–490 MATHCrossRefGoogle Scholar
  6. 6.
    Barcucci E., Del Lungo A., Pergola E. and Pinzani R. (1999). Some combinatorial interpretations of q-analogs of Schröder numbers. Ann. Combin. 3: 171–190 MATHCrossRefGoogle Scholar
  7. 7.
    Baril J. and Vajnovszki V. (2004). Gray code for derangements. Discrete Appl. Math. 140: 207–221 MATHCrossRefGoogle Scholar
  8. 8.
    Bitner J.R., Ehrlich G. and Reingold E.M. (1976). Efficient generation of the binary reflected Gray code and its applications. Commun. ACM 19: 517–521 MATHCrossRefGoogle Scholar
  9. 9.
    Brlek S., Duchi E., Pergola E. and Rinaldi S. (2005). On the equivalence problem for succession rules. Discrete Math. 298: 142–154 MATHCrossRefGoogle Scholar
  10. 10.
    Chung F.R.K., Graham R.L., Hoggat V.E. and Kleiman M. (1978). The number of Baxter permutations. J. Combin. Theory Ser. A 24: 382–394 MATHCrossRefGoogle Scholar
  11. 11.
    Johnson S.M. (1963). Generation of permutations by adjacent transpositions. Math. Comp. 17: 282–285 MATHCrossRefGoogle Scholar
  12. 12.
    Ludman J.E. (1981). Gray code generation for MPSK signals. IEEE Trans. Commun. COM 29: 1519–1522 CrossRefGoogle Scholar
  13. 13.
    Pegola E., Pinzani R. and Rinaldi S. (2002). Approximating algebraic function by means of rational ones. Theoret. Comput. Sci. 270: 643–657 CrossRefGoogle Scholar
  14. 14.
    Ruskey F. and Proskurowski A. (1990). Generating binary trees by transpositions. J. Algorithms 11: 68–84 MATHCrossRefGoogle Scholar
  15. 15.
    Vajnovszki V. (1996). Constant time algorithm for generating binary trees gray codes. Stud. Inform. Control 5(1): 15–21 Google Scholar
  16. 16.
    Vajnovszki V. (2002). Gray visiting Motzkin. Acta Inform. 38: 793–811 MATHCrossRefGoogle Scholar
  17. 17.
    Walsh T. (2003). Generating Gray Codes in O(1) worst-case time per word. LNCS 2731: 73–88 Google Scholar
  18. 18.
    Walsh T. (2001). Gray codes for involutions. J. Combin. Math. Combin. Comput. 36: 95–118 MATHGoogle Scholar
  19. 19.
    West J. (1995). Generating trees and the Catalan and Schröder numbers. Discrete Math. 146: 247–262 MATHCrossRefGoogle Scholar
  20. 20.
    West J. (1996). Generating trees and forbidden subsequences. Discrete Math. 157: 363–374 MATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag 2007

Authors and Affiliations

  • Antonio Bernini
    • 1
  • Elisabetta Grazzini
    • 1
  • Elisa Pergola
    • 1
  • Renzo Pinzani
    • 1
  1. 1.Dipartimento di Sistemi e InformaticaUniversità di FirenzeFirenzeItaly

Personalised recommendations