Abstract
Sawada and Williams in [SODA 2018] and [ACM Trans. Alg. 2020] gave algorithms for constructing Hamiltonian paths and cycles in the Sigma-Tau graph, thereby solving a problem of Nijenhuis and Wilf that had been open for over 40 years. The Sigma-Tau graph is the directed graph whose vertex set consists of all permutations of n, and there is a directed edge from \(\pi \) to \(\pi '\) if \(\pi '\) can be obtained from \(\pi \) either by a cyclic left-shift (sigma) or by exchanging the first two entries (tau). We improve the existing algorithms from \(\mathcal{O}(n)\) time per permutation to \(\mathcal{O}(1)\) time per permutation. Moreover, our algorithms require only \(\mathcal{O}(1)\) extra space. The result is the first combinatorial generation algorithm for n-permutations that is optimal in both time and space, and lists the objects in a Gray code order using only two types of changes. The simple C code (\(\sim \)50 lines) can be found at https://github.com/fmasillo/sigma-tau.
G. Navarro—Funded in part by Basal Funds FB0001, ANID, Chile.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Bader, D.A., Moret, B.M.E., Yan, M.: A linear-time algorithm for computing inversion distance between signed permutations with an experimental study. J. Comput. Biol. 8(5), 483–491 (2001)
Bafna, V., Pevzner, P.A.: Genome rearrangements and sorting by reversals. In: Proceedings of the 34th Annual Symposium on Foundations of Computer Science (FOCS 1993), pp. 148–157. IEEE Computer Society (1993)
Bafna, V., Pevzner, P.A.: Sorting by transpositions. SIAM J. Discret. Math. 11(2), 224–240 (1998)
Bass, D.W., Sudborough, I.H.: On the shuffle-exchange permutation network. In: Proceedings of the 1997 International Symposium on Parallel Architectures, Algorithms and Networks (I-SPAN 1997), pp. 165–171. IEEE (1997)
Boucher, C., Cenzato, D., Lipták, Z., Rossi, M., Sciortino, M.: r-indexing the eBWT. In: Lecroq, T., Touzet, H. (eds.) SPIRE 2021. LNCS, vol. 12944, pp. 3–12. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-86692-1_1
Cameron, B., Sawada, J., Therese, W., Williams, A.: Hamiltonicity of k-sided pancake networks with fixed-spin: efficient generation, ranking, and optimality. Algorithmica 85(3), 717–744 (2023)
Cerbai, G., Ferrari, L.S.: Permutation patterns in genome rearrangement problems: The reversal model. Discret. Appl. Math. 279, 34–48 (2020)
Compton, R.C., Gill Williamson, S.: Doubly adjacent gray codes for the symmetric group. Linear Multilinear Algebra 35(3–4), 237–293 (1993)
Egan, G.: Superpermutations (2018). http://www.gregegan.net/SCIENCE/Superpermutations/Superpermutations.html
Ehrlich, G.: Loopless algorithms for generating permutations, combinations, and other combinatorial configurations. J. ACM 20(3), 500–513 (1973)
Engen, M., Vatter, V.: Containing all permutations. Am. Math. Mon. 128(1), 4–24 (2020)
Feng, J., Zhu, D.: Faster algorithms for sorting by transpositions and sorting by block interchanges. ACM Trans. Algorithms 3(3), 25 (2007)
Ferragina, P., Manzini, G.: Indexing compressed text. J. ACM 52, 552–581 (2005)
Fertin, G., Labarre, A., Rusu, I., Tannier, E., Vialette, S.: Combinatorics of Genome Rearrangements. Computational Molecular Biology, MIT Press, Cambridge (2009)
Fischer, J., Mäkinen, V., Navarro, G.: Faster entropy-bounded compressed suffix trees. Theoret. Comput. Sci. 410(51), 5354–5364 (2009)
Gagie, T., Navarro, G., Prezza, N.: Fully-functional suffix trees and optimal text searching in BWT-runs bounded space. J. ACM 67(1), article 2 (2020)
Gagie, T., Navarro, G., Prezza, N.: Optimal-time text indexing in BWT-runs bounded space. In: Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2018), pp. 1459–1477 (2018)
Ganapathi, P., Chowdhury, R.: A unified framework to discover permutation generation algorithms. Comput. J. 66(3), 603–614 (2023)
Grossi, R., Vitter, J.S.: Compressed suffix arrays and suffix trees with applications to text indexing and string matching. SIAM J. Comput. 35(2), 378–407 (2005)
Hannenhalli, S., Pevzner, P.A.: Transforming cabbage into turnip: polynomial algorithm for sorting signed permutations by reversals. In: Proceedings of the 27th Annual ACM Symposium on Theory of Computing (STOC 1995), pp. 178–189. ACM (1995)
Hartman, T., Shamir, R.: A simpler and faster 1.5-approximation algorithm for sorting by transpositions. Inf. Comput. 204(2), 275–290 (2006)
Hindenburg, C.F.: Sammlung combinatorisch-analytischer Abhandlungen, vol. 1. ben Gerhard Fleischer dem Jungern (1796)
Holroyd, A.E., Ruskey, F., Williams, A.: Shorthand universal cycles for permutations. Algorithmica 64, 215–245 (2012)
Knuth, D.E.: The Art of Computer Programming, Volume 4, Fascicle 2: Generating All Tuples and Permutations (Art of Computer Programming). Addison-Wesley Professional (2005)
Mäkinen, V., Navarro, G.: Succinct suffix arrays based on run-length encoding. Nord. J. Comput. 12(1), 40–66 (2005)
Munro, J.I., Raman, R., Raman, V., Rao, S.S.: Succinct representations of permutations and functions. Theoret. Comput. Sci. 438, 74–88 (2012)
Mütze, T.: Combinatorial gray codes–an updated survey. Electron. J. Combin. 30(3-DS26) (2023)
OEIS Foundation Inc.: Sequence A055881 in the On-line Encyclopedia of Integer Sequences. https://oeis.org/A055881. Accessed 2 June 2023
Rankin, R.A.: A campanological problem in group theory. In: Mathematical Proceedings of the Cambridge Philosophical Society, vol. 44, pp. 17–25. Cambridge University Press (1948)
Ruskey, F., Williams, A.: The coolest way to generate combinations. Discret. Math. 309(17), 5305–5320 (2009)
Ruskey, F., Williams, A.: An explicit universal cycle for the \((n-1)\)-permutations of an \(n\)-set. ACM Trans. Algorithms (TALG) 6(3), 1–12 (2010)
Rytter, W., Zuba, W.: Syntactic view of sigma-tau generation of permutations. Theor. Comput. Sci. 882, 49–62 (2021)
Savage, C.D.: A survey of combinatorial Gray codes. SIAM Rev. 39(4), 605–629 (1997)
Sawada, J., Williams, A.: A Hamilton path for the Sigma-Tau problem. In: Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2018), pp. 568–575. SIAM (2018)
Sawada, J., Williams, A.: Solving the Sigma-Tau problem. ACM Trans. Algorithms 16(1), 11:1–11:17 (2020)
Sawada, J., Williams, A.: Constructing the first (and coolest) fixed-content universal cycle. Algorithmica 85, 1–32 (2022)
Sedgewick, R.: Permutation generation methods. ACM Comput. Surv. (CSUR) 9(2), 137–164 (1977)
Swan, R.G.: A simple proof of Rankin’s campanological theorem. Am. Math. Mon. 106(2), 159–161 (1999)
Williams, A.: Loopless generation of multiset permutations using a constant number of variables by prefix shifts. In: Proceedings of the 20th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2009), pp. 987–996. SIAM (2009)
Williams, A.: O(1)-time unsorting by prefix-reversals in a boustrophedon linked list. In: Boldi, P., Gargano, L. (eds.) FUN 2010. LNCS, vol. 6099, pp. 368–379. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-13122-6_35
Williams, A.: Hamiltonicity of the Cayley digraph on the symmetric group generated by \(\sigma =(1 \; 2 \ldots \; n)\) and \(\tau =(1 \; 2)\). CoRR abs/1307.2549 (2013)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Lipták, Z., Masillo, F., Navarro, G., Williams, A. (2023). Constant Time and Space Updates for the Sigma-Tau Problem. In: Nardini, F.M., Pisanti, N., Venturini, R. (eds) String Processing and Information Retrieval. SPIRE 2023. Lecture Notes in Computer Science, vol 14240. Springer, Cham. https://doi.org/10.1007/978-3-031-43980-3_26
Download citation
DOI: https://doi.org/10.1007/978-3-031-43980-3_26
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-43979-7
Online ISBN: 978-3-031-43980-3
eBook Packages: Computer ScienceComputer Science (R0)