A Complexity Dichotomy for Permutation Pattern Matching on Grid Classes

08/11/2020 ∙ by Vít Jelínek, et al. ∙ Charles University in Prague 0

Permutation Pattern Matching (PPM) is the problem of deciding for a given pair of permutations P and T whether the pattern P is contained in the text T. Bose, Buss and Lubiw showed that PPM is NP-complete. In view of this result, it is natural to ask how the situation changes when we restrict the pattern P to a fixed permutation class C; this is known as the C-Pattern PPM problem. Grid classes are special kind of permutation classes, consisting of permutations admitting a grid-like decomposition into simpler building blocks. Of particular interest are the so-called monotone grid classes, in which each building block is a monotone sequence. Recently, it has been discovered that grid classes, especially the monotone ones, play a fundamental role in the understanding of the structure of general permutation classes. This motivates us to study the hardness of C-Pattern PPM for a (monotone) grid class C. We provide a complexity dichotomy for C-Pattern PPM when C is taken to be a monotone grid class. Specifically, we show that the problem is polynomial-time solvable if a certain graph associated with C, called the cell graph, is a forest, and it is NP-complete otherwise. We further generalize our results to grid classes whose blocks belong to classes of bounded grid-width. We show that the C-Pattern PPM for such a grid class C is polynomial-time solvable if the cell graph of C avoids a cycle or a certain special type of path, and it is NP-complete otherwise.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

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 NP-complete. 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 break-through result in this direction by establishing the fixed-parameter 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 Stanley-Wilf 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 grid-width 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 well-known 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 so-called 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 polynomial-time solvable for and NP-complete 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 grid-like 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 well-ordered 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 polynomial-time algorithm solving -Pattern PPM when is the class of the so-called 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 polynomial-time solvable if the cell graph is a forest, NP-complete otherwise.

In Section 4, we further extend our results to matrices whose every entry is a permutation class of bounded grid-width. We prove that for such grid classes, -Pattern PPM is polynomial-time solvable if is a forest which does not contain a certain type of path, and NP-complete 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 short-hands 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.

           

Figure 1: A gridding matrix on the left and an -gridded permutation on the right. Empty entries of are omitted and the edges of are displayed inside .

Grid-width.

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 grid-complexity 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 grid-width of a vertex in is the grid-complexity of , and the grid-width of , denoted by , is the maximum grid-width of a vertex of . Finally, the grid-width 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 path-width of a permutation , denoted by , is the minimum of over all caterpillar grid trees  of  .

We now provide a useful alternative definition of path-width. For permutations and of length , the path-width of in -ordering, denoted by is the maximum grid-complexity attained by a set for some .

A permutation of length has path-width 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 grid-width. In fact, we obtain all the polynomial-time solvable cases of -Pattern PPM in this paper via showing that has bounded grid-width.

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 path-width and -Pattern PPM can be decided in polynomial time, or

  • contains a cycle, has unbounded grid-width and -Pattern PPM is NP-complete.

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 top-right or towards the bottom-left, while the -cells are oriented towards the top-left or the bottom-right. The orientation is consistent in the sense that in a given column , either all the nonempty cells are oriented left-to-right (if ) or right-to-left (if ), while in a row , they are all oriented bottom-to-top (if ) or top-to-bottom (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 non-empty entries equal to , each