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
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Clint, M.: Program proving: Coroutines. Acta Informatica 2, 50–63 (1977)
Conway, M.E.: Design of a separable transition-diagram compiler. Communications of the ACM 6, 396–408 (1963)
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)
Dahl, O.-J., Hoare, C.A.R.: Hierarchical program structures. In: Structured Programming, pp. 175–220. Academic Press, London (1972)
Dahl, O.-J.: Syntaks og Semantikk i Programmeringsspråk. 103 pages. Studentlitteratur, Lund (1972)
Dahl, O.-J.: An approach to correctness proofs of semicoroutines. Research Report in Informatics, Number 13, 20 pages. University of Oslo, Blindern (1977)
Ehrlich, G.: Loopless algorithms for generating permutations, combinations and other combinatorial configurations. Journal of the Association for Computing Machinery 20, 500–513 (1973)
Floyd, R.W.: The syntax of programming languages — A survey. IEEE Transactions on Electronic Computers EC-13, 346–353 (1964)
Knuth, D.E.: Fundamental Algorithms. The Art of Computer Programming, vol. 1. Addison–Wesley, Reading (1968); 3rd edn. (1997)
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
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)
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
Knuth, D.E.: SPIDERS, a program downloadable from the website, http://www-cs-faculty.stanford.edu/~knuth/programs.html
Koda, Y., Ruskey, F.: A Gray code for the ideals of a forest poset. Journal of Algorithms 15, 324–340 (1993)
Pruesse, G., Ruskey, F.: Gray codes from antimatroids. Order 10, 239–252 (1993)
Ruskey, F.: Combinatorial Generation [preliminary working draft]. Department of Computer Science, University of Victoria, Victoria B.C., Canada (1996)
Squire, M.B.: Gray Codes and Efficient Generation of Combinatorial Structures. Ph.D. dissertation, North Carolina State University, x + 145 pages (1995)
Steiner, G.: An algorithm to generate the ideals of a partial order. Operations Research Letters 5, 317–320 (1986)
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)
Wang, A., Dahl, O.-J.: Coroutine sequencing in a block-structured environment. BIT 11, 425–449 (1971)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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