Skip to main content

Constant Time and Space Updates for the Sigma-Tau Problem

  • Conference paper
  • First Online:
String Processing and Information Retrieval (SPIRE 2023)

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 74.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    His pancake flip order dates to the 1700 s [22] (see [6]) and is loopless in a BLL [40].

  2. 2.

    Note that this definition differs from ascent, which is not taken circularly.

References

  1. 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)

    Article  MATH  Google Scholar 

  2. 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)

    Google Scholar 

  3. Bafna, V., Pevzner, P.A.: Sorting by transpositions. SIAM J. Discret. Math. 11(2), 224–240 (1998)

    Article  MathSciNet  MATH  Google Scholar 

  4. 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)

    Google Scholar 

  5. 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

    Chapter  MATH  Google Scholar 

  6. 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)

    Article  MathSciNet  MATH  Google Scholar 

  7. Cerbai, G., Ferrari, L.S.: Permutation patterns in genome rearrangement problems: The reversal model. Discret. Appl. Math. 279, 34–48 (2020)

    Article  MathSciNet  MATH  Google Scholar 

  8. Compton, R.C., Gill Williamson, S.: Doubly adjacent gray codes for the symmetric group. Linear Multilinear Algebra 35(3–4), 237–293 (1993)

    Article  MathSciNet  MATH  Google Scholar 

  9. Egan, G.: Superpermutations (2018). http://www.gregegan.net/SCIENCE/Superpermutations/Superpermutations.html

  10. Ehrlich, G.: Loopless algorithms for generating permutations, combinations, and other combinatorial configurations. J. ACM 20(3), 500–513 (1973)

    Article  MathSciNet  MATH  Google Scholar 

  11. Engen, M., Vatter, V.: Containing all permutations. Am. Math. Mon. 128(1), 4–24 (2020)

    Article  MathSciNet  MATH  Google Scholar 

  12. Feng, J., Zhu, D.: Faster algorithms for sorting by transpositions and sorting by block interchanges. ACM Trans. Algorithms 3(3), 25 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  13. Ferragina, P., Manzini, G.: Indexing compressed text. J. ACM 52, 552–581 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  14. Fertin, G., Labarre, A., Rusu, I., Tannier, E., Vialette, S.: Combinatorics of Genome Rearrangements. Computational Molecular Biology, MIT Press, Cambridge (2009)

    Book  MATH  Google Scholar 

  15. Fischer, J., Mäkinen, V., Navarro, G.: Faster entropy-bounded compressed suffix trees. Theoret. Comput. Sci. 410(51), 5354–5364 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  16. 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)

    Google Scholar 

  17. 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)

    Google Scholar 

  18. Ganapathi, P., Chowdhury, R.: A unified framework to discover permutation generation algorithms. Comput. J. 66(3), 603–614 (2023)

    Article  MathSciNet  Google Scholar 

  19. 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)

    Article  MathSciNet  MATH  Google Scholar 

  20. 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)

    Google Scholar 

  21. Hartman, T., Shamir, R.: A simpler and faster 1.5-approximation algorithm for sorting by transpositions. Inf. Comput. 204(2), 275–290 (2006)

    Google Scholar 

  22. Hindenburg, C.F.: Sammlung combinatorisch-analytischer Abhandlungen, vol. 1. ben Gerhard Fleischer dem Jungern (1796)

    Google Scholar 

  23. Holroyd, A.E., Ruskey, F., Williams, A.: Shorthand universal cycles for permutations. Algorithmica 64, 215–245 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  24. 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)

    Google Scholar 

  25. Mäkinen, V., Navarro, G.: Succinct suffix arrays based on run-length encoding. Nord. J. Comput. 12(1), 40–66 (2005)

    MathSciNet  MATH  Google Scholar 

  26. Munro, J.I., Raman, R., Raman, V., Rao, S.S.: Succinct representations of permutations and functions. Theoret. Comput. Sci. 438, 74–88 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  27. Mütze, T.: Combinatorial gray codes–an updated survey. Electron. J. Combin. 30(3-DS26) (2023)

    Google Scholar 

  28. OEIS Foundation Inc.: Sequence A055881 in the On-line Encyclopedia of Integer Sequences. https://oeis.org/A055881. Accessed 2 June 2023

  29. 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)

    Google Scholar 

  30. Ruskey, F., Williams, A.: The coolest way to generate combinations. Discret. Math. 309(17), 5305–5320 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  31. 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)

    Article  MathSciNet  MATH  Google Scholar 

  32. Rytter, W., Zuba, W.: Syntactic view of sigma-tau generation of permutations. Theor. Comput. Sci. 882, 49–62 (2021)

    Article  MathSciNet  MATH  Google Scholar 

  33. Savage, C.D.: A survey of combinatorial Gray codes. SIAM Rev. 39(4), 605–629 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  34. 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)

    Google Scholar 

  35. Sawada, J., Williams, A.: Solving the Sigma-Tau problem. ACM Trans. Algorithms 16(1), 11:1–11:17 (2020)

    Google Scholar 

  36. Sawada, J., Williams, A.: Constructing the first (and coolest) fixed-content universal cycle. Algorithmica 85, 1–32 (2022)

    MathSciNet  MATH  Google Scholar 

  37. Sedgewick, R.: Permutation generation methods. ACM Comput. Surv. (CSUR) 9(2), 137–164 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  38. Swan, R.G.: A simple proof of Rankin’s campanological theorem. Am. Math. Mon. 106(2), 159–161 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  39. 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)

    Google Scholar 

  40. 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

    Chapter  Google Scholar 

  41. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Francesco Masillo .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics