1 Introduction
A permutation is a sequence in which each number from the set appears exactly once. We then say that a permutation contains a permutation , if has a subsequence of length whose elements have the same relative order as the elements of (see Section 2 for a more formal definition). If does not contain , we say that avoids .
An essential algorithmic problem involving permutations is Permutation Pattern Matching (PPM): Given a permutation (‘pattern’) of size and (‘text’) of size , does contain ? Bose, Buss and Lubiw [10] have shown that PPM is NPcomplete. This result has motivated a study of various variants of PPM, in particular to obtain the best possible runtime dependence on . Guillemot and Marx [15] provided the breakthrough result in this direction by establishing the fixedparameter tractability of PPM in terms of the pattern length with algorithm running in time. The first phase of their algorithm finds a suitable decomposition that relies on the proof of StanleyWilf conjecture given by Marcus and Tardos [21]. Subsequently, Fox [14] refined the results by Marcus and Tardos and thereby reduced the complexity of the algorithm to .
Several algorithms also exist whose runtimes depend on different parameters than the length of . Bruner and Lackner [12] described an algorithm for PPM with run time where is the number of consecutive monotone sequences needed to obtain via concatenation. Ahal and Rabinovich [1] designed an algorithm for PPM that runs in time where is a certain graph associated to the pattern and denotes the treewidth of . Later Jelínek, Opler and Valtr [19] introduced a related parameter , called the gridwidth of , and showed that is equivalent to up to a constant and thereby implying an algorithm for PPM running in time .
Another approach to tackling the hardness of PPM is to restrict the choice of pattern to a particular permutation class , where a permutation class is a set of permutations such that for every , every permutation contained in belongs to as well.
Pattern Permutation Pattern Matching (Pattern PPM)  

Input:  A pattern of size and a permutation of size . 
Question:  Does contain ? 
For a permutation , we let denote the class of permutations avoiding . Notice that Pattern PPM simply reduces to finding the longest increasing subsequence of , which is a wellknown problem and can be solved in time [20]. Bose, Buss and Lubiw [10] showed that Pattern PPM can be solved in polynomial time if is the class of the socalled separable permutations. Further improvements were given by Ibarra [17], Albert et al. [3] and by Yugandhar and Saxena [28]. Recently, Jelínek and Kynčl [18] completely resolved the hardness of Pattern PPM for classes avoiding a single pattern. They proved that Pattern PPM is polynomialtime solvable for and NPcomplete otherwise.
Lately, a new type of permutation classes has been gaining a lot of attention. The grid class of a matrix whose entries are permutation classes, denoted by , is a class of permutations admitting a gridlike decomposition into blocks that belong to the classes . If moreover contains only and we say that is a monotone grid class. To each matrix we also associate a graph , called the cell graph of . We postpone their full definitions to Section 2.
Monotone grid classes were introduced partly by Atkinson, Murphy and Ruškuc [6] and in full by Murphy and Vatter [22] who showed that a monotone grid class is partially wellordered if and only if is a forest. Brignall [11] later extended their results to a large portion of general grid classes. General grid classes themselves were introduced by Vatter [25] in his paper investigating the growth rates of permutation classes. Since then the grid classes played a central role in most subsequent works on growth rates of permutation classes [4, 27]. Bevan [8, 9] tied the growth rates of grid classes to algebraic graph theory.
Given the prominent role of grid classes in recent developments of the permutation pattern research, it is only natural to investigate the hardness of searching patterns that belong to a grid class. Neou, Rizzi and Vialette [24] designed a polynomialtime algorithm solving Pattern PPM when is the class of the socalled wedge permutations, which can be also described as a monotone grid class. Consequently, Neou [23] asks at the end of his thesis about the hardness of Pattern PPM for a monotone grid class .
Our results.
In Section 3, we answer the question of Neou by proving that for a monotone grid class , the problem Pattern PPM is polynomialtime solvable if the cell graph is a forest, NPcomplete otherwise.
In Section 4, we further extend our results to matrices whose every entry is a permutation class of bounded gridwidth. We prove that for such grid classes, Pattern PPM is polynomialtime solvable if is a forest which does not contain a certain type of path, and NPcomplete otherwise.
2 Preliminaries
A permutation of length is a sequence in which each element of the set appears exactly once. When writing out short permutations explicitly, we shall omit all punctuation and write, e.g., for the permutation . The permutation diagram of is the set of points in the plane. Note that we use Cartesian coordinates, that is, the first row of the diagram is at the bottom. We blur the distinction between permutations and their permutation diagrams, e.g., we shall refer to ‘the point set ’ rather than ‘the point set of the diagram of the permutation ’.
For a point in the plane, we denote its first coordinate as , and its second coordinate as . A subset of a permutation diagram is isomorphic to a subset of a permutation diagram if there is a bijection such that for any pair of points of we have if and only if , and if and only if . A permutation of length contains a permutation of length , if there is a subset of isomorphic to the permutation diagram of . Such a subset is then an occurrence (or a copy) of in . If does not contain , we say that avoids .
A permutation class is a set of permutations with the property that if is in , then all the permutations contained in are in as well. For a permutation , we let denote the class of avoiding permutations. We shall sometimes use the symbols and as shorthands for the class of increasing permutations and the class of decreasing permutations .
For a permutation of length the reverse of is the permutation , the complement of is the permutation , and the inverse of is the permutation satisfying . We let , and denote the reverse, complement and inverse of , respectively. For a permutation class , we let denote the set , and similarly for and . Note that , and are again permutation classes.
A permutation of length is a horizontal alternation if all the even entries of
precede all the odd entries of
, i.e., there are no indices such that is odd and is even. A permutation is a vertical alternation if is a horizontal alternation.Griddings and grid classes.
For two sets and of numbers, we write if every element of is smaller than any element of . In particular, both and holds for any .
A matrix whose entries are permutation classes is called a gridding matrix. Moreover, if the entries of belong to the set then we say that is a monotone gridding matrix. A gridding of a permutation of length are two sequences of (possibly empty) disjoint integer intervals and such that both and are equal to . We call the set an cell of . An gridding of a permutation is a gridding such that the restriction of to the cell is isomorphic to a permutation from the class . If possesses an gridding, then is said to be griddable and equipped with a fixed gridding is called an gridded permutation. We let be the class of griddable permutations. Note that for consistency with our Cartesian numbering convention, we number the rows of a matrix from bottom to top.
The cell graph of the gridding matrix , denoted , is the graph whose vertices are the cells of that contain an infinite class, with two vertices being adjacent if they share a row or a column of and all cells between them are finite or empty. A proper turning path in is a path such that no three consecutive cells of share the same row or column. See Figure 1.
Gridwidth.
An interval family is a set of pairwise disjoint integer intervals. The intervalicity of a set , denoted by , is the size of the smallest interval family whose union is equal to . For a point set in the plane, let denote its projection on the axis and similarly its projection on the axis. We write and as short for and , respectively. For a subset of the permutation diagram, the gridcomplexity of is the maximum of and .
A grid tree of a permutation of length is a rooted binary tree with leaves, each leaf being labeled by a distinct point of the permutation diagram. Let denote the point set of the labels on the leaves in the subtree of rooted in . The gridwidth of a vertex in is the gridcomplexity of , and the gridwidth of , denoted by , is the maximum gridwidth of a vertex of . Finally, the gridwidth of a permutation , denoted by , is the minimum of over all grid trees of .
We also consider a linear version of this parameter. We say that a rooted binary tree is a caterpillar if each vertex is either a leaf or has at least one leaf as a child. The pathwidth of a permutation , denoted by , is the minimum of over all caterpillar grid trees of .
We now provide a useful alternative definition of pathwidth. For permutations and of length , the pathwidth of in ordering, denoted by is the maximum gridcomplexity attained by a set for some .
A permutation of length has pathwidth if and only if the minimum value of over all permutations of length is exactly .
Proof.
Suppose that as witnessed by a caterpillar grid tree . Observe that all leaves of except for the deepest pair lie in different depths. Define to simply order the labels by the depths of their leaves, defining arbitrarily the order of the two deepest leaves. Then every set corresponds exactly to the set for some vertex of .
In order to prove the other direction, we define a sequence of caterpillar trees in the following way. Let be a single vertex labeled by . For , let be the binary rooted tree with left child a leaf labeled by and right child the tree . The tree is a caterpillar grid tree of and for every inner vertex the set is equal to for some . The claim follows. ∎
Ahal and Rabinovich [1] designed an algorithm for PPM that runs in time where is a certain graph associated to the pattern and denotes the treewidth of . The following theorem follows by combining this algorithm with the result of Jelínek et al. [19] who showed that up to a constant, is equivalent to .
[Ahal and Rabinovich [1], Jelínek et al. [19]] Let be a permutation of length and a permutation of length . The problem whether contains can be solved in time .
Importantly, Theorem 2 implies that Pattern PPM is decidable in polynomial time whenever the class has bounded gridwidth. In fact, we obtain all the polynomialtime solvable cases of Pattern PPM in this paper via showing that has bounded gridwidth.
3 Monotone grid classes
This section is dedicated to proving that the complexity of Pattern PPM is for a monotone gridding matrix determined by whether contains a cycle.
For a monotone gridding matrix one of the following holds:

Either is a forest, has bounded pathwidth and Pattern PPM can be decided in polynomial time, or

contains a cycle, has unbounded gridwidth and Pattern PPM is NPcomplete.
A consistent orientation of a monotone gridding matrix is a pair of functions such that , and for every , the value is positive if and negative if .
Intuitively speaking, the purpose of the consistent orientation is to ‘orient’ each nonempty cell of a monotone gridding matrix, so that cells are oriented towards the topright or towards the bottomleft, while the cells are oriented towards the topleft or the bottomright. The orientation is consistent in the sense that in a given column , either all the nonempty cells are oriented lefttoright (if ) or righttoleft (if ), while in a row , they are all oriented bottomtotop (if ) or toptobottom (if ). See Figure 2 (left) for an example of a gridding matrix with a consistent orientation.
Not every monotone gridding matrix has a consistent orientation: consider, e.g., a gridding matrix with three cells equal to and one cell equal to . However, Albert et al. [4] observed that we can transform a given gridding matrix into another, similar gridding matrix that has a consistent orientation. Let be a monotone gridding matrix and a positive integer. The refinement of is the matrix obtained from by replacing each entry by a diagonal matrix with all the nonempty entries equal to , each
Comments
There are no comments yet.