Document

# Finding and Counting Permutations via CSPs

## File

LIPIcs.IPEC.2019.1.pdf
• Filesize: 0.52 MB
• 16 pages

## Acknowledgements

An earlier version of the paper contained a mistake in the analysis of the algorithm for Theorem 2. We thank Günter Rote for pointing out the error. This work was prompted by the Dagstuhl Seminar 18451 "Genomics, Pattern Avoidance, and Statistical Mechanics". The second author thanks the organizers for the invitation and the participants for interesting discussions.

## Cite As

Benjamin Aram Berendsohn, László Kozma, and Dániel Marx. Finding and Counting Permutations via CSPs. In 14th International Symposium on Parameterized and Exact Computation (IPEC 2019). Leibniz International Proceedings in Informatics (LIPIcs), Volume 148, pp. 1:1-1:16, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2019)
https://doi.org/10.4230/LIPIcs.IPEC.2019.1

## Abstract

Permutation patterns and pattern avoidance have been intensively studied in combinatorics and computer science, going back at least to the seminal work of Knuth on stack-sorting (1968). Perhaps the most natural algorithmic question in this area is deciding whether a given permutation of length n contains a given pattern of length k. In this work we give two new algorithms for this well-studied problem, one whose running time is n^{k/4 + o(k)}, and a polynomial-space algorithm whose running time is the better of O(1.6181^n) and O(n^{k/2 + 1}). These results improve the earlier best bounds of n^{0.47k + o(k)} and O(1.79^n) due to Ahal and Rabinovich (2000) resp. Bruner and Lackner (2012) and are the fastest algorithms for the problem when k in Omega(log{n}). We show that both our new algorithms and the previous exponential-time algorithms in the literature can be viewed through the unifying lens of constraint-satisfaction. Our algorithms can also count, within the same running time, the number of occurrences of a pattern. We show that this result is close to optimal: solving the counting problem in time f(k) * n^{o(k/log{k})} would contradict the exponential-time hypothesis (ETH). For some special classes of patterns we obtain improved running times. We further prove that 3-increasing and 3-decreasing permutations can, in some sense, embed arbitrary permutations of almost linear length, which indicates that an algorithm with sub-exponential running time is unlikely, even for patterns from these restricted classes.

## Subject Classification

##### ACM Subject Classification
• Theory of computation → Data structures design and analysis
• Theory of computation → Pattern matching
##### Keywords
• permutations
• pattern matching
• constraint satisfaction
• exponential time

## Metrics

• Access Statistics
• Total Accesses (updated on a weekly basis)
0

## References

1. Shlomo Ahal and Yuri Rabinovich. On Complexity of the Subpattern Problem. SIAM J. Discrete Math., 22(2):629-649, 2008. URL: https://doi.org/10.1137/S0895480104444776.
2. M.H. Albert and M.S. Paterson. Bounds for the growth rate of meander numbers. Journal of Combinatorial Theory, Series A, 112(2):250-262, 2005. URL: https://doi.org/10.1016/j.jcta.2005.02.006.
3. Michael Albert and Mireille Bousquet-Mélou. Permutations sortable by two stacks in parallel and quarter plane walks. Eur. J. Comb., 43:131-164, 2015. URL: https://doi.org/10.1016/j.ejc.2014.08.024.
4. Michael H. Albert, Robert E. L. Aldred, Mike D. Atkinson, and Derek A. Holton. Algorithms for Pattern Involvement in Permutations. In Proceedings of the 12th International Symposium on Algorithms and Computation, ISAAC '01, pages 355-366, London, UK, 2001. Springer-Verlag. URL: http://dl.acm.org/citation.cfm?id=646344.689586.
5. Michael H. Albert, Cheyne Homberger, Jay Pantone, Nathaniel Shar, and Vincent Vatter. Generating permutations with restricted containers. J. Comb. Theory, Ser. A, 157:205-232, 2018. URL: https://doi.org/10.1016/j.jcta.2018.02.006.
6. Michael H. Albert, Marie-Louise Lackner, Martin Lackner, and Vincent Vatter. The Complexity of Pattern Matching for 321-Avoiding and Skew-Merged Permutations. Discrete Mathematics & Theoretical Computer Science, 18(2), 2016. URL: http://dmtcs.episciences.org/2607.
7. David Aldous and Persi Diaconis. Longest Increasing Subsequences: From Patience Sorting to the Baik-Deift-Johansson Theorem. Bull. Amer. Math. Soc, 36:413-432, 1999.
8. David Arthur. Fast Sorting and Pattern-avoiding Permutations. In Proceedings of the Fourth Workshop on Analytic Algorithmics and Combinatorics, ANALCO 2007, pages 169-174, 2007. URL: https://doi.org/10.1137/1.9781611972979.1.
9. Omri Ben-Eliezer and Clément L. Canonne. Improved Bounds for Testing Forbidden Order Patterns. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, pages 2093-2112, 2018. URL: https://doi.org/10.1137/1.9781611975031.137.
10. Donald J. Berndt and James Clifford. Using Dynamic Time Warping to Find Patterns in Time Series. In Proceedings of the 3rd International Conference on Knowledge Discovery and Data Mining, AAAIWS'94, pages 359-370. AAAI Press, 1994. URL: http://dl.acm.org/citation.cfm?id=3000850.3000887.
11. Hans L. Bodlaender. A partial k-arboretum of graphs with bounded treewidth. Theoretical Computer Science, 209(1):1-45, 1998. URL: https://doi.org/10.1016/S0304-3975(97)00228-4.
12. Miklós Bóna. A survey of stack-sorting disciplines. The Electronic Journal of Combinatorics, 9(2):1, 2003.
13. Miklós Bóna. Combinatorics of Permutations. CRC Press, Inc., Boca Raton, FL, USA, 2004.
14. Miklós Bóna. A Walk Through Combinatorics: An Introduction to Enumeration and Graph Theory. World Scientific, 2011. URL: https://books.google.de/books?id=TzJ2L9ZmlQUC.
15. Prosenjit Bose, Jonathan F. Buss, and Anna Lubiw. Pattern Matching for Permutations. Inf. Process. Lett., 65(5):277-283, 1998. URL: https://doi.org/10.1016/S0020-0190(97)00209-3.
16. Karl Bringmann, László Kozma, Shay Moran, and N. S. Narayanaswamy. Hitting Set for Hypergraphs of Low VC-dimension. In 24th Annual European Symposium on Algorithms, ESA 2016, August 22-24, 2016, Aarhus, Denmark, pages 23:1-23:18, 2016. URL: https://doi.org/10.4230/LIPIcs.ESA.2016.23.
17. Marie-Louise Bruner and Martin Lackner. The computational landscape of permutation patterns. Pure Mathematics and Applications, 24(2):83-101, 2013.
18. Marie-Louise Bruner and Martin Lackner. A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs. Algorithmica, 75(1):84-117, 2016. URL: https://doi.org/10.1007/s00453-015-0013-y.
19. Laurent Bulteau, Romeo Rizzi, and Stéphane Vialette. Pattern Matching for k-Track Permutations. In Costas Iliopoulos, Hon Wai Leong, and Wing-Kin Sung, editors, Combinatorial Algorithms, pages 102-114, Cham, 2018. Springer International Publishing.
20. Parinya Chalermsook, Mayank Goswami, László Kozma, Kurt Mehlhorn, and Thatchaphol Saranurak. Pattern-Avoiding Access in Binary Search Trees. In IEEE 56th Annual Symposium on Foundations of Computer Science, FOCS 2015, pages 410-423, 2015. URL: https://doi.org/10.1109/FOCS.2015.32.
21. Maw-Shang Chang and Fu-Hsing Wang. Efficient algorithms for the maximum weight clique and maximum weight independent set problems on permutation graphs. Information Processing Letters, 43(6):293-295, 1992. URL: https://doi.org/10.1016/0020-0190(92)90114-B.
22. Hubie Chen. A rendezvous of logic, complexity, and algebra. ACM Comput. Surv., 42(1):2:1-2:32, 2009. URL: https://doi.org/10.1145/1592451.1592453.
23. Marek Cygan, Lukasz Kowalik, and Arkadiusz Socala. Improving TSP Tours Using Dynamic Programming over Tree Decompositions. In 25th Annual European Symposium on Algorithms, ESA 2017, pages 30:1-30:14, 2017. URL: https://doi.org/10.4230/LIPIcs.ESA.2017.30.
24. Rina Dechter and Judea Pearl. Tree clustering for constraint networks. Artificial Intelligence, 38(3):353-366, 1989. URL: https://doi.org/10.1016/0004-3702(89)90037-4.
25. Rodney G. Downey and Michael R. Fellows. Parameterized Complexity. Monographs in Computer Science. Springer, 1999. URL: https://doi.org/10.1007/978-1-4612-0515-9.
26. Vida Dujmovic, David Eppstein, and David R. Wood. Structure of Graphs with Locally Restricted Crossings. SIAM J. Discrete Math., 31(2):805-824, 2017. URL: https://doi.org/10.1137/16M1062879.
27. Pál Erdős and G. Szekeres. A combinatorial problem in geometry. Compositio Mathematica, 2:463-470, 1935. URL: http://www.numdam.org/item/CM_1935__2__463_0.
28. Fedor V. Fomin, Serge Gaspers, Saket Saurabh, and Alexey A. Stepanov. On Two Techniques of Combining Branching and Treewidth. Algorithmica, 54(2):181-207, 2009. URL: https://doi.org/10.1007/s00453-007-9133-3.
29. Fedor V. Fomin and Kjartan Høie. Pathwidth of cubic graphs and exact algorithms. Information Processing Letters, 97(5):191-196, 2006. URL: https://doi.org/10.1016/j.ipl.2005.10.012.
30. Jacob Fox. Stanley-Wilf limits are typically exponential. CoRR, abs/1310.8378, 2013. URL: http://arxiv.org/abs/1310.8378.
31. Jacob Fox and Fan Wei. Fast property testing and metrics for permutations. Combinatorics, Probability and Computing, pages 1-41, 2018.
32. Eugene C. Freuder. Complexity of K-tree Structured Constraint Satisfaction Problems. In Proceedings of the Eighth National Conference on Artificial Intelligence - Volume 1, AAAI'90, pages 4-9. AAAI Press, 1990. URL: http://dl.acm.org/citation.cfm?id=1865499.1865500.
33. Sylvain Guillemot and Dániel Marx. Finding small patterns in permutations in linear time. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, pages 82-101, 2014. URL: https://doi.org/10.1137/1.9781611973402.7.
34. Sylvain Guillemot and Stéphane Vialette. Pattern Matching for 321-Avoiding Permutations. In Yingfei Dong, Ding-Zhu Du, and Oscar Ibarra, editors, Algorithms and Computation, pages 1064-1073. Springer Berlin Heidelberg, 2009.
35. Kurt Hoffmann, Kurt Mehlhorn, Pierre Rosenstiehl, and Robert E. Tarjan. Sorting Jordan sequences in linear time using level-linked search trees. Information and Control, 68(1-3):170-184, 1986.
36. Louis Ibarra. Finding pattern matchings for permutations. Information Processing Letters, 61(6):293-295, 1997. URL: https://doi.org/10.1016/S0020-0190(97)00029-X.
37. Vít Jelínek and Jan Kyncl. Hardness of Permutation Pattern Matching. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, pages 378-396, 2017. URL: https://doi.org/10.1137/1.9781611974782.24.
38. Eamonn J. Keogh, Stefano Lonardi, and Bill Yuan-chi Chiu. Finding surprising patterns in a time series database in linear time and space. In Proceedings of the Eighth ACM SIGKDD 2002 International Conference on Knowledge Discovery and Data Mining, pages 550-556, 2002. URL: https://doi.org/10.1145/775047.775128.
39. Sergey Kitaev. Patterns in Permutations and Words. Monographs in Theoretical Computer Science. An EATCS Series. Springer, 2011. URL: https://doi.org/10.1007/978-3-642-17333-2.
40. Donald E. Knuth. The Art of Computer Programming, Volume I: Fundamental Algorithms. Addison-Wesley, 1968.
41. Adam Marcus and Gábor Tardos. Excluded permutation matrices and the Stanley-Wilf conjecture. J. Comb. Theory, Ser. A, 107(1):153-160, 2004. URL: https://doi.org/10.1016/j.jcta.2004.04.002.
42. Dániel Marx. Can You Beat Treewidth? Theory of Computing, 6(1):85-112, 2010. URL: https://doi.org/10.4086/toc.2010.v006a005.
43. Both Neou, Romeo Rizzi, and Stéphane Vialette. Permutation Pattern matching in (213, 231)-avoiding permutations. Discrete Mathematics & Theoretical Computer Science, Vol. 18 no. 2, Permutation Patterns 2015, 2017. URL: https://dmtcs.episciences.org/3199.
44. Ilan Newman, Yuri Rabinovich, Deepak Rajendraprasad, and Christian Sohler. Testing for Forbidden Order Patterns in an Array. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, pages 1582-1597, 2017. URL: https://doi.org/10.1137/1.9781611974782.104.
45. Pranav Patel, Eamonn Keogh, Jessica Lin, and Stefano Lonardi. Mining Motifs in Massive Time Series Databases. In In Proceedings of IEEE International Conference on Data Mining ICDM’02, pages 370-377, 2002.
46. Vaughan R. Pratt. Computing Permutations with Double-ended Queues, Parallel Stacks and Parallel Queues. In Proceedings of the Fifth Annual ACM Symposium on Theory of Computing, STOC '73, pages 268-277. ACM, 1973. URL: https://doi.org/10.1145/800125.804058.
47. Pierre Rosenstiehl. Planar permutations defined by two intersecting Jordan curves. In Graph Theory and Combinatorics, pages 259-271. London, Academic Press, 1984. URL: https://hal.archives-ouvertes.fr/hal-00259765.
48. Pierre Rosenstiehl and Robert E. Tarjan. Gauss codes, planar hamiltonian graphs, and stack-sortable permutations. Journal of Algorithms, 5(3):375-390, 1984. URL: https://doi.org/10.1016/0196-6774(84)90018-X.
49. Raimund Seidel. A New Method for Solving Constraint Satisfaction Problems. In Proceedings of the 7th International Joint Conference on Artificial Intelligence, IJCAI 1981, pages 338-342, 1981. URL: http://ijcai.org/Proceedings/81-1/Papers/062.pdf.
50. Rodica Simion and Frank W. Schmidt. Restricted Permutations. European Journal of Combinatorics, 6(4):383-406, 1985. URL: https://doi.org/10.1016/S0195-6698(85)80052-4.
51. N. J. A. Sloane. The Encyclopedia of Integer Sequences, http://oeis.org. Sequence A073028.
52. S. M. Tanny and M. Zuker. On a unimodal sequence of binomial coefficients. Discrete Mathematics, 9(1):79-89, 1974. URL: https://doi.org/10.1016/0012-365X(74)90073-9.
53. Robert E. Tarjan. Sorting Using Networks of Queues and Stacks. J. ACM, 19(2):341-346, April 1972. URL: https://doi.org/10.1145/321694.321704.
54. Edward P. K. Tsang. Foundations of constraint satisfaction. Computation in cognitive science. Academic Press, 1993.
55. Vincent Vatter. Permutation Classes. In Miklós Bóna, editor, Handbook of Enumerative Combinatorics, chapter 12. Chapman and Hall/CRC, New York, 2015. Preprint at URL: https://arxiv.org/abs/1409.5159.
56. V. Yugandhar and Sanjeev Saxena. Parallel algorithms for separable permutations. Discrete Applied Mathematics, 146(3):343-364, 2005. URL: https://doi.org/10.1016/j.dam.2004.10.004.
X

Feedback for Dagstuhl Publishing