Counting Small Permutation Patterns

A sample of n generic points in the xy-plane defines a permutation that relates their ranks along the two axes. Every subset of k points similarly defines a pattern, which occurs in that permutation. The number of occurrences of small patterns in a large permutation arises in many areas, including nonparametric statistics. It is therefore desirable to count them more efficiently than the straightforward ~O(n^k) time algorithm. This work proposes new algorithms for counting patterns. We show that all patterns of order 2 and 3, as well as eight patterns of order 4, can be counted in nearly linear time. To that end, we develop an algebraic framework that we call corner tree formulas. Our approach generalizes the existing methods and allows a systematic study of their scope. Using the machinery of corner trees, we find twenty-three independent linear combinations of order-4 patterns, that can be computed in time ~O(n). We also describe an algorithm that counts another 4-pattern, and hence all 4-patterns, in time ~O(n^(3/2)). As a practical application, we provide a nearly linear time computation of a statistic by Yanagimoto (1970), Bergsma and Dassios (2010). This statistic yields a natural and strongly consistent variant of Hoeffding's test for independence of X and Y, given a random sample as above. This improves upon the so far most efficient ~O(n^2) algorithm.

[1]  Joshua N. Cooper,et al.  The complexity of counting poset and permutation patterns , 2014, Australas. J Comb..

[2]  Rodica Simion,et al.  Restricted Permutations , 1985, Eur. J. Comb..

[3]  Yoshiharu Kohayakawa,et al.  Testing permutation properties through subpermutations , 2011, Theor. Comput. Sci..

[4]  Anders Claesson,et al.  Mesh Patterns and the Expansion of Permutation Statistics as Sums of Permutation Patterns , 2011, Electron. J. Comb..

[5]  Mathias Drton,et al.  Efficient computation of the Bergsma–Dassios sign covariance , 2015, Comput. Stat..

[6]  Alexander Burstein,et al.  Packing sets of patterns , 2010, Eur. J. Comb..

[7]  Peter A. Hästö The Packing Density of Other Layered Permutations , 2002, Electron. J. Comb..

[8]  R. Stanley Enumerative Combinatorics: Volume 1 , 2011 .

[9]  Jirí Matousek,et al.  Geometric range searching , 1994, CSUR.

[10]  D'aniel Marx,et al.  Finding and Counting Permutations via CSPs , 2019, Algorithmica.

[11]  D. Wolfe,et al.  Nonparametric Statistical Methods. , 1974 .

[12]  VishkinUzi,et al.  An O(n2 log n) parallel max-flow algorithm , 1982 .

[13]  Walter Stromquist,et al.  Improving bounds on packing densities of 4-point permutations , 2017, Discret. Math. Theor. Comput. Sci..

[14]  Malka Gorfine,et al.  Consistent Distribution-Free $K$-Sample and Independence Tests for Univariate Random Variables , 2014, J. Mach. Learn. Res..

[15]  C. Schensted Longest Increasing and Decreasing Subsequences , 1961, Canadian Journal of Mathematics.

[16]  T. Wet Cramér-von Mises tests for independence , 1980 .

[17]  Peter Winkler,et al.  Permutations with fixed pattern densities , 2015, Random Struct. Algorithms.

[18]  Mark de Berg,et al.  Orthogonal Range Searching , 1997 .

[19]  R. Heller,et al.  A consistent multivariate test of association based on ranks of distances , 2012, 1201.3522.

[20]  Daniel Král,et al.  Hereditary properties of permutations are strongly testable , 2012, SODA.

[21]  Maw-Shang Chang,et al.  Efficient Algorithms for the Maximum Weight Clique and Maximum Weight Independent Set Problems on Permutation Graphs , 1992, Inf. Process. Lett..

[22]  Nicholas I. Fisher,et al.  Nonparametric measures of angular-angular association , 1981 .

[23]  Dániel Marx,et al.  Finding small patterns in permutations in linear time , 2013, SODA.

[24]  Wicher P. Bergsma,et al.  A study of the power and robustness of a new test for independence against contiguous alternatives , 2016 .

[25]  Lisa Hofer A Central Limit Theorem for Vincular Permutation Patterns , 2017, Discret. Math. Theor. Comput. Sci..

[26]  Jan Kynčl,et al.  Hardness of Permutation Pattern Matching , 2017, SODA.

[27]  S. Janson,et al.  On the Asymptotic Statistics of the Number of Occurrences of Multiple Permutation Patterns , 2013, 1312.3955.

[28]  W. Knight A Computer Method for Calculating Kendall's Tau with Ungrouped Data , 1966 .

[29]  Rudini Menezes Sampaio,et al.  Limits of permutation sequences , 2011, J. Comb. Theory, Ser. B.

[30]  J. Kiefer,et al.  DISTRIBUTION FREE TESTS OF INDEPENDENCE BASED ON THE SAMPLE DISTRIBUTION FUNCTION , 1961 .

[31]  Clément L. Canonne,et al.  Improved Bounds for Testing Forbidden Order Patterns , 2017, SODA.

[32]  Jan Volec,et al.  Characterization of quasirandom permutations by a pattern sum , 2020, Random Struct. Algorithms.

[33]  Oleg Pikhurko,et al.  Quasirandom permutations are characterized by 4-point densities , 2012, 1205.3074.

[34]  Yijie Han,et al.  Parallel Algorithms for Testing Length Four Permutations , 2014, 2014 Sixth International Symposium on Parallel Architectures, Algorithms and Programming.

[35]  Walter Stromquist,et al.  On Packing Densities of Permutations , 2002, Electron. J. Comb..

[36]  Jason E. Fulman Stein’s method and non-reversible Markov chains , 1997, math/9712241.

[37]  Timothy M. Chan,et al.  Orthogonal range searching on the RAM, revisited , 2011, SoCG '11.

[38]  Wicher P. Bergsma,et al.  Nonparametric Testing of Conditional Independence by Means of the Partial Copula , 2010, 1101.4607.

[39]  T. Yanagimoto On measures of association and a related problem , 1970 .

[40]  R. Heller,et al.  Computing the Bergsma Dassios sign-covariance , 2016, 1605.08732.

[41]  M. Drton,et al.  High dimensional independence testing with maxima of rank correlations , 2018 .

[42]  Luca Weihs,et al.  Large-Sample Theory for the Bergsma-Dassios Sign Covariance , 2016, 1602.04387.

[43]  Sanjeev Saxena,et al.  Parallel algorithms for separable permutations , 2005, Discret. Appl. Math..

[44]  Timothy M. Chan,et al.  Counting inversions, offline orthogonal range counting, and related problems , 2010, SODA '10.

[45]  M. Bóna Permutation Patterns: On three different notions of monotone subsequences , 2007, 0711.4325.

[46]  Fan Wei,et al.  Fast Property Testing and Metrics for Permutations , 2016, Combinatorics, Probability and Computing.

[47]  N. Meinshausen,et al.  Symmetric rank covariances: a generalized framework for nonparametric measures of dependence , 2017, Biometrika.

[48]  Louis Ibarra Finding Pattern Matchings for Permutations , 1997, Inf. Process. Lett..

[49]  Mike D. Atkinson,et al.  Algorithms for Pattern Involvement in Permutations , 2001, ISAAC.

[50]  Prosenjit Bose,et al.  Pattern Matching for Permutations , 1993, WADS.

[51]  Daniel Král,et al.  Finitely forcible graphons and permutons , 2015, J. Comb. Theory, Ser. B.

[52]  C. Spearman The proof and measurement of association between two things. , 2015, International journal of epidemiology.

[53]  M. Rosenblatt A Quadratic Measure of Deviation of Two-Dimensional Density Estimates and A Test of Independence , 1975 .

[54]  Yuri Rabinovich,et al.  On Complexity of the Subpattern Problem , 2008, SIAM J. Discret. Math..

[55]  Eric Babson,et al.  Generalized permutation patterns and a classification of the Mahonian statistics , 2000 .

[56]  Joshua N. Cooper A Permutation Regularity Lemma , 2006, Electron. J. Comb..

[57]  Gábor Tardos,et al.  Excluded permutation matrices and the Stanley-Wilf conjecture , 2004, J. Comb. Theory, Ser. A.

[59]  Martin Lackner,et al.  A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs , 2012, SWAT.

[60]  Miklós Bóna,et al.  Combinatorics of permutations , 2022, SIGA.

[61]  Einar Steingrimsson,et al.  Generalized permutation patterns - a short survey , 2008, 0801.2412.

[62]  S. Janson The asymptotic distributions of incomplete U-statistics , 1984 .

[63]  Walter Stromquist,et al.  Packing Rates Of Measures And A Conjecture For The Packing Density Of 2413 , 2010 .

[64]  Marek Cygan,et al.  Kernelization lower bound for Permutation Pattern Matching , 2014, Inf. Process. Lett..

[65]  Yijie Han,et al.  Algorithms for testing occurrences of length 4 patterns in permutations , 2018, J. Comb. Optim..

[66]  J. N. Joshua,et al.  Quasirandom permutations , 2002, J. Comb. Theory A.

[67]  László Kozma Faster and simpler algorithms for finding large patterns in permutations , 2019, ArXiv.

[68]  Donald E. Knuth,et al.  The Art of Computer Programming, Volume I: Fundamental Algorithms, 2nd Edition , 1997 .

[69]  Xin-She Yang,et al.  Introduction to Algorithms , 2021, Nature-Inspired Optimization Algorithms.

[70]  M. Bóna The copies of any permutation pattern are asymptotically normal , 2007, 0712.2792.

[71]  Sylvain Guillemot,et al.  D S ] 5 N ov 2 01 5 Pattern matching in ( 213 , 231 )-avoiding permutations Both , 2009 .

[72]  Sergey Kitaev,et al.  Patterns in Permutations and Words , 2011, Monographs in Theoretical Computer Science. An EATCS Series.

[73]  Martin Lackner,et al.  The computational landscape of permutation patterns , 2013, ArXiv.

[74]  Jan Volec,et al.  Minimum Number of Monotone Subsequences of Length 4 in Permutations , 2015, Comb. Probab. Comput..

[75]  Alkes Long Price Packing densities of layered patterns , 1997 .

[76]  Jon Louis Bentley,et al.  Multidimensional binary search trees used for associative searching , 1975, CACM.

[77]  Christian Sohler,et al.  Testing for Forbidden Order Patterns in an Array , 2017, SODA.

[78]  M. Kendall A NEW MEASURE OF RANK CORRELATION , 1938 .

[79]  Wicher P. Bergsma,et al.  A consistent test of independence based on a sign covariance related to Kendall's tau , 2010, 1007.4259.