Skip to main content

Efficient Coroutine Generation of Constrained Gray Sequences

  • Chapter
Book cover From Object-Orientation to Formal Methods

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

Abstract

We study an interesting family of cooperating coroutines, which is able to generate all patterns of bits that satisfy certain fairly general ordering constraints, changing only one bit at a time. (More precisely, the directed graph of constraints is required to be cycle-free when it is regarded as an undirected graph.) If the coroutines are implemented carefully, they yield an algorithm that needs only a bounded amount of computation per bit change, thereby solving an open problem in the field of combinatorial pattern generation.

dedicated to the memory of Ole-Johan Dahl

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. Clint, M.: Program proving: Coroutines. Acta Informatica 2, 50–63 (1977)

    Article  Google Scholar 

  2. Conway, M.E.: Design of a separable transition-diagram compiler. Communications of the ACM 6, 396–408 (1963)

    Article  MATH  Google Scholar 

  3. Dahl, O.-J., Myhrhaug, B., Nygaard, K.: SIMULA-67 Common Base Language, Publication S-2, 141 pages (Oslo: Norwegian Computing Center, 168); Revised edition, 145 pages, Publication S-22 (1970); Third revised edition, 127 pages, Report number 725 (1982)

    Google Scholar 

  4. Dahl, O.-J., Hoare, C.A.R.: Hierarchical program structures. In: Structured Programming, pp. 175–220. Academic Press, London (1972)

    Google Scholar 

  5. Dahl, O.-J.: Syntaks og Semantikk i Programmeringsspråk. 103 pages. Studentlitteratur, Lund (1972)

    Google Scholar 

  6. Dahl, O.-J.: An approach to correctness proofs of semicoroutines. Research Report in Informatics, Number 13, 20 pages. University of Oslo, Blindern (1977)

    Google Scholar 

  7. Ehrlich, G.: Loopless algorithms for generating permutations, combinations and other combinatorial configurations. Journal of the Association for Computing Machinery 20, 500–513 (1973)

    MATH  MathSciNet  Google Scholar 

  8. Floyd, R.W.: The syntax of programming languages — A survey. IEEE Transactions on Electronic Computers EC-13, 346–353 (1964)

    Article  Google Scholar 

  9. Knuth, D.E.: Fundamental Algorithms. The Art of Computer Programming, vol. 1. Addison–Wesley, Reading (1968); 3rd edn. (1997)

    MATH  Google Scholar 

  10. Knuth, D.E.: Selected Topics in Computer Science, Part II. Lecture Note Series, vol. 2. University of Oslo, Institute of Mathematics, Blindern (1973); See page 3 of the notes entitled Generation of combinatorial patterns: Gray codes

    Google Scholar 

  11. Knuth, D.E.: Structured programming with go to statements. Computing Surveys 6, 261–301 (1974); Reprinted with revisions as Ch. 2. of Literate Programming. Center for the Study of Language and Information, Stanford, California (1992)

    Article  MATH  Google Scholar 

  12. Knuth, D.E.: Generating all n-tuples, Section 7.2.1.1 of The Art of Computer Programming, vol. 4. Addison-Wesley, Reading (in preparation); Preliminary excerpts of this material are available at http://www-cs-faculty.stanford.edu/~knuth/news01.html

  13. Knuth, D.E.: SPIDERS, a program downloadable from the website, http://www-cs-faculty.stanford.edu/~knuth/programs.html

  14. Koda, Y., Ruskey, F.: A Gray code for the ideals of a forest poset. Journal of Algorithms 15, 324–340 (1993)

    Article  MATH  MathSciNet  Google Scholar 

  15. Pruesse, G., Ruskey, F.: Gray codes from antimatroids. Order 10, 239–252 (1993)

    Article  MATH  MathSciNet  Google Scholar 

  16. Ruskey, F.: Combinatorial Generation [preliminary working draft]. Department of Computer Science, University of Victoria, Victoria B.C., Canada (1996)

    Google Scholar 

  17. Squire, M.B.: Gray Codes and Efficient Generation of Combinatorial Structures. Ph.D. dissertation, North Carolina State University, x + 145 pages (1995)

    Google Scholar 

  18. Steiner, G.: An algorithm to generate the ideals of a partial order. Operations Research Letters 5, 317–320 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  19. Vanek, L.I., Marty, R.: Hierarchical coroutines: A method for improved program structure. In: Proceedings of the 4th International Conference on Software Engineering, Munich, pp. 274–285 (1979)

    Google Scholar 

  20. Wang, A., Dahl, O.-J.: Coroutine sequencing in a block-structured environment. BIT 11, 425–449 (1971)

    Article  MATH  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 chapter

Cite this chapter

Knuth, D.E., Ruskey, F. (2004). Efficient Coroutine Generation of Constrained Gray Sequences. In: Owe, O., Krogdahl, S., Lyche, T. (eds) From Object-Orientation to Formal Methods. Lecture Notes in Computer Science, vol 2635. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-39993-3_11

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-39993-3_11

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-21366-6

  • Online ISBN: 978-3-540-39993-3

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics