論文翻訳: Ranking and unranking permutations in linear time
Wendy Myrvold1, Frank Ruskey*,2
Department of Computer Science, University of Victoria, Victoria, B.C. V8W 3P6, Canada
Received 17 April 2000; received in revised form 31 October 2000
Communicated by F.Y.L. Chin
Abstract
Keywords: 順列 Permutation; ランク Ranking; アンランク Unranking, アルゴリズム Algorithms; 組み合わせ問題 Combinatorial problems
Table of Contents
この問題に対する従来のアプローチは、まず順列の順序を定義し、次のその順序に対するランク関数とアンランク関数を見つけることである。例えば辞書式順序 (lexicographic order) での順列のランクは、単に辞書式順序でその順列に先行する順列の数に過ぎない。辞書式順序のランク関数とアンランク関数の単純な実装では
順列
辞書式順序で順列をランクやアンランクするより洗練されたアルゴリズムは中間ステップとして逆転ベクトルを計算する。ランクの最初のステップは順列の逆転ベクトルを決定することである。残念ながら素朴な実装では
辞書式順序で順列をランク付けする問題全体は、順列の版点数を計算する問題と密接に絡み合っており、この計算を線形時間で行うには、それが可能だとしても、大きなブレイクスルーが必要であるように思われる。我々の新しいアルゴリズムは順列が辞書式順序になっていることを要求しないことで線形時間を達成している。
我々の順列ランクアルゴリズムは、例えば Steinhaus-Johnson-Trotter 順序などで公開されているが、これらは辞書的アルゴリズムに比べて実行時間の利点を提供しない。これらのアルゴリズムの説明については Reingold, Nievergelt, Deo [9] や Kreher と Stinson [6] を参照。
この問題に対する我々のアプローチは 2 つの点で以前のアプローチとは異なる。まず、順列の順序を選択してからそれに対応するランクアルゴリズムとアンランクアルゴリズムを見つけるのではなく、順序はアンランクアルゴリズムによって定義され、それは特に説明が簡単ではない。二つ目の違いは、まずアンランクアルゴリズムが開発され、それからランクアルゴリズムが導き出されることである。従来はまずランクアルゴリズムが開発されてからアンランクアルゴリズムが開発されてきた。さらに、我々が知っている他のすべてのケースでは、アンランクアルゴリズムはランクアルゴリズムより複雑だが ─ ここはそうではない!
- *共著者. E-mail アドレス: wendym@csr.uvic.ca (W. Myrvold), fruskey@csr.uvic.ca (F. Ruskey).
- 1研究の一部は NSERC 助成金 OGP0041927 の支援を受けている。
- 2研究の一部は NSERC 助成金 OGP0003379 の支援を受けている。
1. ランクとアンランク
このセクションではランクとアンランク順序について少し異なる 2 つのアプローチを紹介する。最初のアプローチ (rank1 と unrank1) はよりシンプルなコードである。二つ目のアプローチ (rank2 と unrank2) は順列のランクによる順序付けが理解しやすいために含まれている。。
我々の着想は、ランダムな順列を生成するための標準的なアルゴリズム [8, 4, 1] である。配列
| 1. | |
|
| 2. | |
|
ここで
このアルゴリズムは
順列をアンランクするにはまず
| 1. | |
|
| 2. | |
|
| 3. | |
|
| 4. | |
|
| 5. | |
|
| 6. | |
|
この関数が機能する理由は明らかだろう。上で言及した議論を使うこともできるし、次のように直接議論することもできる。我々は
ランク付けするにはまず
| 1. | |
|
| 2. | |
|
| 3. | |
|
| 4. | |
|
| 5. | |
|
| 6. | |
|
| 7. | |
|
これらのアルゴリズムは明らかに
ここで、最初のアルゴリズムとは異なるが、同じ基本原理に基づく別のアンランクアルゴリズムを紹介する。このアルゴリズムでは、順列は異なる順序で発生し、最初のアルゴリズムによって生成される順序よりも記述しやすい順序となる。unrank2 を呼び出す前に、
| 1. | |
|
| 2. | |
|
| 3. | |
|
| 4. | |
|
| 5. | |
|
| 6. | |
|
| 7. | |
|
| 1. | |
|
| 2. | |
|
| 3. | |
|
| 4. | |
|
| 5. | |
|
| 6. | |
|
| 7. | |
|
2. 可能な拡張
ランダムな順列を生成するアルゴリズムが
References
- G. de Balbine, Note on random permutations, Math. of Comput. 21 (1967) 710–712.
- F. Critani, M. Dall’Aglio, G. Di Biase, Ranking and unranking permutations with applications, in: Innovation in Mathematics (Rovaniemi, 1997), Comput. Mech., Southampton, 1997, pp. 99–106.
- P.F. Dietz, Optimal algorithms for list indexing and subset rank, in: Workshop on Algorithms and Data Structures (WADS), Lecture Notes in Comput. Sci., Vol. 382, Springer, Berlin, 1989, pp. 39–46.
- R. Durstenfeld, Algorithm 235: Random permutation, Comm. ACM(1964) 420.
- D.E. Knuth, The Art of Computer Programming, Vol. 3: Sorting and Searching, 2nd edn., Addison-Wesley, Reading, MA, 2000 (first published in 1973).
- D.L. Kreher, D.R. Stinson, Combinatorial Algorithms: Generation, Enumeration, and Search, CRC Press, Rockville, MD, 1999.
- J. Liebehenschel, Ranking and unranking of lexicographically ordered words: An average-case analysis, J. Automat. Languages Combinatorics 2 (1997) 227–268.
- L.E. Moses, R.V. Oakland, Tables of Random Permutations, Stanford University Press, Stanford, CA, 1963.
- E.M. Reingold, J. Nievergelt, N. Deo, Combinatorial Algorithms: Theory and Practice, Prentice-Hall, Englewood Cliffs, NJ, 1977.
- F. Ruskey, M. Jiang, A. Weston, The Hamiltonicity of directed
- Cayley graphs (or: A tale of backtracking), Discrete Appl. Math. 57 (1) (1995) 75–83. - F. Ruskey, C. Savage, Hamilton cycles that extend transposition matchings in Cayley graphs of
, SIAM J. Discrete Math. 6 (1) (1993) 152–166. - C.B. Tompkins, Machine attacks on problems whose variables are permutations, in: Numerical Analysis, Proceedings of Symposia in Applied Mathematics, Vol. 6, American Mathematical Society, Providence, RI, 1956.
翻訳抄
順列を識別する一意な整数を計算する「ランク」と、順列のランクに基づいて並びを生成する「アンランク」を効率的に行うアルゴリズムを提案する 2001 年の論文。従来の方法では
- MYRVOLD, Wendy; RUSKEY, Frank. Ranking and unranking permutations in linear time. Information Processing Letters, 2001, 79.6: 281-284.

