×

Efficient generation of random derangements with the expected distribution of cycle lengths. (English) Zbl 1463.05005

Summary: We show how to generate random derangements efficiently by two different techniques: random restricted transpositions and sequential importance sampling. The algorithm employing restricted transpositions can also be used to generate random fixed-point-free involutions only, a. k. a. random perfect matchings on the complete graph. Our data indicate that the algorithms generate random samples with the expected distribution of cycle lengths, which we derive, and for relatively small samples, which can actually be very large in absolute numbers, we argue that they generate samples indistinguishable from the uniform distribution. Both algorithms are simple to understand and implement and possess a performance comparable to or better than those of currently known methods. Simulations suggest that the mixing time of the algorithm based on random restricted transpositions (in the total variance distance with respect to the distribution of cycle lengths) is \(O(n^a\log n^2)\) with \(a \simeq \frac{1}{2}\) and \(n\) the length of the derangement. We prove that the sequential importance sampling algorithm generates random derangements in \(O(n)\) time with probability \(O(1/n)\) of failing.

MSC:

05A05 Permutations, words, matrices
60J20 Applications of Markov chains and discrete-time Markov processes on general state spaces (social mobility, learning theory, industrial processes, etc.)
65C20 Probabilistic models, generic numerical methods in probability and statistics
68R05 Combinatorics in computer science

Software:

Mathematica

References:

[1] Akl, SG, A new algorithm for generating derangements, BIT Numer Math, 20, 1, 2-7 (1989) · Zbl 0432.68048
[2] Aldous, D.; Diaconis, P., Shuffling cards and stopping times, Am Math Mon, 93, 5, 333-348 (1986) · Zbl 0603.60006
[3] Arratia, R.; Barbour, AD; Tavaré, S., Logarithmic combinatorial structures: a probabilistic approach (2003), Zürich: EMS, Zürich · Zbl 1040.60001
[4] Bacher, A.; Bodini, O.; Hwang, H-K; Tsai, T-H, Generating random permutations by coin tossing: classical algorithms, new analysis, and modern implementation, ACM Trans Algorithms, 13, 2, 24 (2017) · Zbl 1445.68104
[5] Baril, JL; Vajnovszki, V., Gray code for derangements, Discret Appl Math, 140, 1-3, 207-221 (2004) · Zbl 1044.05002
[6] Beichl, I.; Sullivan, F., Approximating the permanent via importance sampling with application to the dimer covering problem, J Comput Phys, 149, 1, 128-147 (1999) · Zbl 0927.65065
[7] Blumberg O (2012) Cutoff for the transposition walk on permutations with one-sided restrictions. arXiv:1202.4797 [math.PR]
[8] Brualdi, RA; Ryser, RJ, Combinatorial matrix theory (1991), Cambridge: Cambridge University Press, Cambridge · Zbl 0746.05002
[9] Charalambides, CA, Enumerative combinatorics (2002), Boca Raton: Chapman & Hall/CRC, Boca Raton · Zbl 1001.05001
[10] Chen, Y.; Diaconis, P.; Holmes, SP; Liu, JS, Sequential Monte Carlo methods for statistical analysis of tables, J Am Stat Assoc, 100, 469, 109-120 (2005) · Zbl 1117.62310
[11] Chung F, Diaconis P, Graham R (2019) Permanental generating functions and sequential importance sampling. Adv Appl Math. 10.1016/j.aam.2019.05.004(in press) · Zbl 1464.62363
[12] Diaconis, P., Group representations in probability and statistics (1988), Hayward: IMS, Hayward · Zbl 0695.60012
[13] Diaconis, PW; Holmes, SP, Matchings and phylogenetic trees, Proc Natl Acad Sci USA, 95, 25, 14600-14602 (1998) · Zbl 0908.92023
[14] Diaconis, P.; Holmes, S., Random walks on trees and matchings, Electron J Probab, 7, 6 (2002) · Zbl 1007.60071
[15] Diaconis P, Kolesnik B (2019) Randomized sequential importance sampling for estimating the number of perfect matchings in bipartite graphs. arXiv:1907.02333 [math.PR]
[16] Diaconis, P.; Shahshahani, M., Generating a random permutation by random transpositions, Z Wahrsch Verw Gebiete, 57, 2, 159-179 (1981) · Zbl 0485.60006
[17] Diaconis, P.; Graham, RL; Holmes, SP; de Gunst, M.; Klaassen, C.; Van der Vaart, A., Statistical problems involving permutations with restricted positions, State of the art in probability and statistics: Festschrift for Willem R. van Zwet, 195-222 (2001), Beachwood: IMS, Beachwood · Zbl 1373.62176
[18] Dyer, M.; Müller, H., Counting perfect matchings and the switch chain, SIAM J Discret Math, 33, 3, 1146-1174 (2019) · Zbl 1432.05053
[19] Dyer, M.; Jerrum, M.; Müller, H., On the switch Markov chain for perfect matchings, J ACM, 64, 2, 12 (2017) · Zbl 1426.60097
[20] Flajolet, P.; Soria, M., Gaussian limiting distributions for the number of components in combinatorial structures, J Comb Theor Ser A, 53, 2, 165-182 (1990) · Zbl 0691.60035
[21] Gries, D.; Xue, J., Generating a random cyclic permutation, BIT Numer Math, 28, 3, 569-572 (1988) · Zbl 0656.68076
[22] Hanlon, P., A random walk on the rook placements on a Ferrer’s board, Electron J Comb, 3, 2, 26 (1996) · Zbl 0851.05100
[23] Korsh, JF; LaFollette, PS, Constant time generation of derangements, Inf Process Lett, 90, 4, 181-186 (2004) · Zbl 1171.05301
[24] Kuznetsov, NY, Computing the permanent by importance sampling method, Cybern Syst Anal, 32, 6, 749-755 (1996) · Zbl 1034.68523
[25] Lovász, L.; Plummer, MD, Matching theory. Corrected reprint (2009), Providence: AMS, Providence
[26] Martínez C, Panholzer A, Prodinger H (2008) Generating random derangements. In: Sedgewick R, Szpankowski W (eds) Proceedings of the fifth workshop on analytic algorithmics and combinatorics—ANALCO. SIAM, Philadelphia, pp 234-240 · Zbl 1429.68160
[27] Ozel E (2017) The number of \(k\)-cycles in a family of restricted permutations. arXiv:1710.07885 [math.PR]
[28] Panholzer, A.; Prodinger, H.; Riedel, M., Measuring post-quickselect disorder, J Iran Stat Soc, 3, 2, 219-249 (2004) · Zbl 1513.68038
[29] Prodinger, H., On the analysis of an algorithm to generate a random cyclic permutation, Ars Comb, 65, 75-78 (2002) · Zbl 1072.05503
[30] Rasmussen, LE, Approximating the permanent: a simple approach, Random Struct Algorithms, 5, 2, 349-361 (1994) · Zbl 0795.05089
[31] Sattolo, S., An algorithm to generate a random cyclic permutation, Inf Process Lett, 22, 6, 315-317 (1986)
[32] Sedgewick, R., Permutation generation methods, Comput Surv, 9, 2, 137-164 (1977) · Zbl 0358.05003
[33] Smith, A., Comparison theory for Markov chains on different state spaces and application to random walk on derangements, J Theor Probab, 28, 4, 1406-1430 (2015) · Zbl 1330.60085
[34] Vigna S (2019) xoshiro/xoroshiro generators and the PRNG shootout. http://xoshiro.di.unimi.it/. Accessed 15 Dec 2019
[35] Wilson, MC, Random and exhaustive generation of permutations and cycles, Ann Comb, 12, 4, 509-520 (2009) · Zbl 1231.68281
[36] Wolfram Research, Inc. (2018) Mathematica, Version 11.3. Champaign
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.