×

Uniformly generating derangements with fixed number of cycles in polynomial time. (English) Zbl 07829467

Summary: We study the uniform sampling of permutations without fixed points, i.e., derangements, that can be decomposed into \(m\) disjoint cycles. Since the number of cycles in a random derangement tends towards the standard distribution, rejection sampling may take exponential time when \(m\) largely deviates from the mean of \(\Theta(\log n)\). We propose an algorithm for generating a uniformly random derangement of \(n\) items with \(m\) cycles in \(O(n^{2.5}\log n)\) time complexity using dynamic programming with an assumption that all arithmetic operations can be done in time \(O(1)\). Taking into account the arithmetic operations on large integers, the running time becomes \(O(n^{3.5}\log^3 n)\). Our algorithm uses permutation types to structure our uniform generation of derangements.

MSC:

05A05 Permutations, words, matrices
68R05 Combinatorics in computer science
90C39 Dynamic programming
11B73 Bell and Stirling numbers

References:

[1] Pierre Rémond de Montmort. Essay [sic] d’analyse sur les jeux de hazard. Jacques Quillau, 1713.
[2] Conrado Martínez, Alois Panholzer, and Helmut Prodinger. Generating random derangements. In 2008 Proceedings of the Fifth Workshop on Analytic Algorithmics and Combinatorics (ANALCO), pages 234-240. SIAM, 2008. · Zbl 1429.68160
[3] Kenji Mikawa and Ken Tanaka. Linear-time generation of uniform random derange-ments encoded in cycle notation. Discrete Applied Mathematics, 217:722-728, 2017. · Zbl 1358.05010
[4] J Ricardo G Mendonça. Efficient generation of random derangements with the expected distribution of cycle lengths. Computational and Applied Mathematics, 39(3):1-15, 2020. · Zbl 1463.05005
[5] Sandra Sattolo. An algorithm to generate a random cyclic permutation. Information processing letters, 22(6):315-317, 1986.
[6] Philippe Flajolet and Michele Soria. Gaussian limiting distributions for the number of components in combinatorial structures. Journal of Combinatorial Theory, Series A, 53(2):165-182, 1990. · Zbl 0691.60035
[7] Wendy Myrvold and Frank Ruskey. Ranking and unranking permutations in linear time. Information Processing Letters, 79(6):281-284, 2001. · Zbl 1032.68670
[8] Kenji Mikawa and Ken Tanaka. Efficient linear-time ranking and unranking of de-rangements. Information Processing Letters, 179:106288, 2023. · Zbl 1531.05008
[9] Louis Comtet. Advanced Combinatorics: The art of finite and infinite expansions. Springer Science & Business Media, 2012.
[10] John Riordan. An introduction to combinatorial analysis. Princeton University Press, 2014.
[11] W.J. Ewens. The sampling theory of selectively neutral alleles. Theoretical Popula-tion Biology, 3(1):87-112, 1972. · Zbl 0245.92009
[12] Poly H. da Silva, Arash Jamshidpey, and Simon Tavar. The feller coupling for random derangements. Stochastic Processes and their Applications, 150:1139-1164, 2022. · Zbl 1494.60011
[13] Nattawut Phetmak. Random derangement with fixed number of cycles. In The 23rd Thailand-Japan Conference on Discrete and Computational Geometry, Graphs, and Games (JCDCGGG’20+1), pages 34-35, 2021.
[14] Henry Bottomley. Entry A060540 in The On-Line Encyclopedia of Integer Sequences. http://oeis.org/A060540. Accessed: 2021-12-21.
[15] Charalambos A Charalambides. Enumerative combinatorics. CRC Press, 2002. · Zbl 1001.05001
[16] Albert Nijenhuis and Herbert S Wilf. Combinatorial algorithms: for computers and calculators. Elsevier, 2014.
[17] Jörg Arndt. Matters Computational: ideas, algorithms, source code. Springer Science & Business Media, 2010.
[18] David Harvey and Joris Van Der Hoeven. Integer multiplication in time o (n log n). Annals of Mathematics, 193(2):563-617, 2021. · Zbl 1480.11162
[19] Makoto Matsumoto and Takuji Nishimura. Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation (TOMACS), 8(1):3-30, 1998. · Zbl 0917.65005
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. In some cases that data have been complemented/enhanced by data from zbMATH Open. This attempts to reflect the references listed in the original paper as accurately as possible without claiming completeness or a perfect matching.