Drawing Permutations with Few Corners Sergey Bereg1 , Alexander E. Holroyd2 , Lev Nachmanson3 , and Sergey Pupyrev4 1
University of Texas at Dallas, USA,
[email protected] Microsoft Research, USA,
[email protected] 3 Microsoft Research, USA,
[email protected] 4 Ural Federal University, Russia,
[email protected] 2
Abstract. A permutation may be represented by a collection of paths in the plane. We consider a natural class of such representations, which we call tangles, in which the paths consist of straight segments at 45 degree angles, and the permutation is decomposed into nearest-neighbour transpositions. We address the problem of minimizing the number of crossings together with the number of corners of the paths, focusing on classes of permutations in which both can be minimized simultaneously. We give algorithms for computing such minimizing tangles for several classes of permutations.
1
Introduction
What is a good way to draw a permutation? In this paper we study drawings of permutations in which the permutation of interest is connected to the identity permutation via a sequence of intermediate permutations, with consecutive elements of the sequence differing by one or more non-overlapping nearest-neighbour swaps. The position of each permutation element through the sequence may then traced by a piecewise-linear path comprising vertical and 45◦ to the vertical. Our goal is to keep these paths as simple as possible, and to avoid unnecessary crossings. Such drawings have applications in channel routing for integrated circuit design (see [5] and Figure 1), and in graph drawing with edge bundles (see [4] and Figure 1(b) of [1]).
Fig. 1. An example of a channel routing from [5, Figure 9].
Let us give some definitions. Let Sn be the symmetric group of all permutations of {1, . . . , n}. A swap s(i) transforms a permutation by exchanging its ith and (i + 1)th
2
Sergey Bereg, Alexander E. Holroyd, Lev Nachmanson, and Sergey Pupyrev
elements. Two permutations a and b of Sn are close if b can be obtained from a by swaps s(p1 ), s(p2 ), . . . , s(pk ) that are not overlapping, i.e. such that |pi − pj | ≥ 2, if i 6= j. A tangle is a finite sequence of permutations in which every two consecutive permutations are close. Figure 2(a) shows an example of a tangle, and Figure 2(b) shows how we draw it. As we can see, this drawing is done by polylines on Z2 , where polyline segments can be vertical, or have slopes of 45◦ , or 135◦ . We say, that a tangle solves permutation π, if the tangle starts from π, and ends at the identity permutation. We are interested in tangles with aesthetically pleasing drawings. For this purpose, in this paper we only consider simple tangles. A tangle is simple if it does not have two paths crossing each other more than once. Figure 2(c) shows an example of a nonsimple tangle. We plan to address non-simple tangles in a subsequent article.
3
1
4
2 6
5
3
1
4
2 6
5
1
3
2
4 5
6
1
2
3
5 4
6
1
2
3
4 5
6
1
2
3
4 5
6
(a)
3
1
4
2 6
1
2
3 4 (b)
5
5
3
1
4
2 6
6
1
2
3 4 (c)
5
5
6
Fig. 2. (a) A tangle solving permutation (3, 1, 4, 2, 6, 5). (b) A drawing of the tangle. The tangle is not simple, since paths 4 and 5 intersect each other twice. (c) The corners of the tangle paths are indicated by the circles.
Our second aesthetic criterion is keeping the paths straight by using only a few turns. We count the number of corners in each path of a tangle; that is, points at which the path changes its direction between vertical, 45◦ , and 135◦ . By convention we start and end paths with vertical segments. In terms of the sequence of permutations this means repeating the first and the last permutations at least once each as in Figure 2(a). Path i is the path traced by element i ∈ {1, . . . , n}. Let corners(i) denote the number of corners of path i. We call a tangle a k-tangle if it is simple and each its path has at most k corners. If a permutation is solved by some k-tangle we call it a k-tangle permutation. Clearly, a k-tangle permutation has k ≥ 2 unless it is the identity permutation. We are interested in the following problem. Problem. Given permutation π, compute the smallest k such that π is a k-tangle permutation. We do not know if the problem formulated above can be solved by a polynomialtime algorithm, and we do not have a complete solution for it. In this article we address the problem for some restricted classes of permutation.
Drawing Permutations with Few Corners
3
Research in [5] targets, in our terminology, the tangle height, and the total length of the tangle paths. We are not aware of any study on the number of corners in a tangle. Generally, it does not appear to be straightforward to determine whether a tangle that solves a given permutation has the minimum number of corners among such tangles. However, a tangle of the following special type always has the minimum number of corners.
2
Nice Tangles
We always draw tangles oriented downwards. A segment of a path is a maximal straight portion between two corners. We call a non-vertical segment of a tangle path an Lsegment if it goes south-west (i.e. has slope 45◦ ), or an R-segment if it is directed south-east (i.e. has slope 135◦ ). Let us mark a path in a tangle by a sequence of letters from the alphabet {R, L}. The sequence is built by tracing the path top-down; as we meet an L-segment, we add an L to the sequence, and as we meet an R-segment, we add an R to the sequence; vertical segments are ignored for the purpose of this marking. A vertical path without turns is marked by an empty sequence. Let π ∈ Sn , and suppose tangle t solves π. For an integer 1 ≤ i ≤ n we denote by M (i) the marking sequence of path π(i), and we call M the marking of t. Lemma 1. Let k be the length of a marking sequence of a path i in a simple tangle. Then there are 2k corners in the path. Proof. It is enough to proof that the path does not contain a 90◦ corner, or, in another words, no L-segment of the path abuts an R-segment. Suppose, to the contrary, that we have path i with such L- and R-segments. Without loss of generality we can assume that the L-segment is above the R-segment. Then the tangle has the following sub-sequence of permutations: ...ai..., ...ia..., ...ai..., where path a is the last path intersecting the Lsegment. This means that the paths a and i intersect each other twice, which contradicts simplicity of the tangle. t u
(a)
(b)
Fig. 3. (a) The solid paths represent the valid nice tangle path types; the dashed path cannot appear in a nice tangle. (b) An example of a nice tangle drawing.
4
Sergey Bereg, Alexander E. Holroyd, Lev Nachmanson, and Sergey Pupyrev
We call a tangle nice if it is simple and if the marking sequence of each of its paths has at most one L and at most one R. There are only five such marking sequences: the empty one, L, R, RL, and LR, see Figure 3(a). Also see Figure 3(b) for an example of a drawing of a nice tangle. Lemma 2. Let T be a nice tangle solving a permutation, and let T 0 be a simple tangle solving the same permutation. Then path i in T 0 has at least as many corners as path i in T . Proof. Let π be the permutation solved by the tangles. Let m be the marking sequence of some path π(i) in tangle T , and m0 be the marking sequence of path π(i) in T 0 . If an R appears in m, then path π(i) in T has an R-segment. This R-segment is intersected from the right by some path π(j). That means that i, j is an inversion with i < j, and π(i) > π(j). Therefore, path π(j) intersects path π(i) from the right in tangle T 0 also, and R appears in m0 too. The symmetric reasoning shows that if an L appears in m, then it appears in m0 too. Marking sequence m does not have repeating letters, hence the length of m0 is greater than or equal to the length of m, and the proof follows from Lemma 1. t u Clearly, all nice tangles are 4-tangles. A further special case of a nice tangle is a 2-tangle (see Figure 4(f) for an example), which we address next.
3
Characterization of 2-Tangle Permutations
Theorem 1 A permutation π is a 2-tangle permutation iff it is 321-avoiding. Proof. Let us show that every 2-tangle permutation avoids the pattern 321. Suppose, to the contrary, that there exists a 2-tangle for permutation π, and three indices i < j < k such that π(i) > π(j) > π(k). Path π(j) contains an L-segment, since paths π(i) and π(j) intersect. It also contains an R-segment, since it intersects π(k). It contradicts corners(π(j)) ≤ 2. Now we provide an algorithm that constructs a 2-tangle solving π for any 321avoiding permutation π. We define a function D : {1, 2, . . . , n} → {L, R, S} as follows. If π(i) = i, then D(i) = S. If π(i) > i, then D(π(i)) = R. If π(i) < i, then D(π(i)) = L. Informally the value of D(π(i)) means the direction of the future path π(i). The algorithm sweeps the plane by the vertical line from left to right. We show one step of the sweep from the line with equation x = i to the line with equation x = i + 1. Consider the slab between lines x = i, and x = i + 1. The algorithm computes a box Bi = {(x, y)|i ≤ x ≤ i + 1, yib ≤ y ≤ yit }. Later we show how to find integers yit and yib . The box is composed of grid cells c1 , c2 , . . . , chi . Draw a cross in each other cell of Bi starting from the bottom cell, see Figure 4(c). t b and yi−1 are already calculated. We initialize y0t = 0 and y0b = 1. Suppose that yi−1 t b t If D(π(i)) = S, then yi = 0 and yi = 1. If D(π(i)) = R, then yit = yi−1 + 1; if t t b b D(π(i)) = L, then yi = yi−1 − 1. If D(i) = R, then yi = yi−1 + 1; if D(i) = L, then b yib = yi−1 − 1.
Drawing Permutations with Few Corners
5
To complete the drawing of the paths we need to add the vertical segments. If yit < yib , then we draw a vertical line with x-coordinate i. Otherwise, draw a line startt b ing from (i, max(yit , yi−1 )) upwards, and draw a line starting from (i, min(yib , yi−1 )) t downwards, see Figure 4(f). We suppose that each path starts at y-coordinate y = n+1 and ends at y-coordinate y b = −n − 1.
5
5 1
5 1 6
5 1 6 8
5 1 6 8 2
5 1 6 8 2
3 4 7
...
1
1 2
(a)
(b)
1 2 3 (c)
1 2 3 4 (d)
1 2 3 4 5
1 2 3 4 5 6 7 8
(e)
(f)
Fig. 4. Drawing a 2-tangle.
Let us prove that the algorithm is correct 5 . Correctness here means that (1) no two paths share a line segment, (2) for each 1 ≤ q ≤ n the corresponding points (q, y t ) and (π(q), y b ) are connected by a path, thus creating path π(q), and (3) for each q holds corners(q) ≤ 2. We can assume that π is such that for any i holds i 6= π(i). Indeed, if i = π(i), then we have π(j) < i for any j < i, and π(j) > i for any j > i, otherwise we find j0 < i < j1 forming a 321-pattern. So we can split the permutation into parts without vertical paths, and prove that the algorithm behaves correctly on those parts only. We prove properties (1), (2), and (3) by induction on i, where i is the x-coordinate of the sweep line. The induction claim is that all path parts in the half-plane x ≤ i are drawn correctly; That is the partial paths are connected and have no more than one corner, the paths with start and end x-coordinated not greater that i are connected, finished have at most 2-corners, and no paths share a line segment. We start the induction from i = 1. The base case holds, since we have D(π(1)) = R, D(1) = L, and y1t = y0t + 1 = 1, y1b = y0b − 1 = 0, so we have paths π(1) and 1 correctly partially drawn. Suppose that the claim holds for i. We need to prove that the algorithm correctly continues each path to the slab i, i + 1. Consider any path starting to the left of i + 1. Such path is π(k), for some k ≤ i. If π(k) ≤ i, then path is finished to the left of i + 1 by the induction claim. Let us suppose that π(k) = j > i. In this case D(j) = R, and path j has an end point on the 5
The algorithm is implemented and the demo is available at http://www.utdallas.edu/˜besp/very-nice-tangle.php
6
Sergey Bereg, Alexander E. Holroyd, Lev Nachmanson, and Sergey Pupyrev
right side of Bi−1 . Suppose that j > i + 1. Then we will not be able to continue the R segment of path j to Bi only if path j ended at the right bottom corner of Bi−1 , and b Bi shrunk from the bottom comparing with Bi−1 ; that is yib = yi−1 + 1. By definition we have D(i) = R, therefore i = π(u), for some u ≤ i. Notice that u > k, otherwise two R-paths j and i will intersect each other to the left of i for j to be at the bottom of Bi−1 , contrary to the induction claim. At the bottom of Bi−1 we have an L-path q, so q = π(v) for some v > i. We have q < i + 1 < j. We conclude that j, i, q is a 321pattern, see Figure 5(a). The case of a path ending to the left of i + 1 is similar. We still have the case when j = i + 1, but we cannot drop the path j with the vertical segment down, because j in Bi is not at the right bottom. In this case we find a 321-pattern l, j, f as in Figure 5(b). Now consider the case of an R-path starting at i + 1. For this path we created a new cell in Bi+1 , so we can join this path to the left top of this cell without overlaps. The case of an L-path ending at i + 1 is similar. t u
a)
b)
Fig. 5. Finding 321-patterns.
4
Nice Permutations
In this section we consider the following problem. Problem NT. For a given permutation, determine whether it is nice. If so, compute a nice tangle solving it. Problem NT can be solved by an exhaustive search as follows. Consider any permutation π ∈ Sn of a tangle. It can be verified that there are at most Fn+1 (the Fibonacci number) of possible permutations π 0 following π in a tangle. Consider all such pairs (π, π 0 ) as the vertices of a directed graph G. The edges of G have the form (π, π 0 ) → (π 0 , π 00 ). The weight of such an edge is the number of corners of the tangle (π, π 0 , π 00 ) on the level of π 0 . To find a minimal tangle solving π, we can compute a shortest path in G from (π, π) to (I, I), where I is the identity permutation. If π is nice, then this algorithm finds a nice tangle solving it. The running time and the space required by the algorithm are Ω(n!Fn+1 ). We implemented such an algorithm, and succeeded running it for n ≤ 11.
Drawing Permutations with Few Corners
7
We do not have a polynomial algorithm solving problem NT, but we provide an algorithm faster than the exhaustive search described above. To describe this algorithm, we need some more definitions. We call a marking valid if it is a marking of a nice tangle. Before solving problem NT we show how to compute a nice tangle from a valid marking. Letus denote by inv (π) the number of inversions in permutation π. Of course, inv (π) ≤ n2 if π ∈ Sn . Theorem 2 For a nice permutation π ∈ Sn , and a valid marking for π we can compute in O(n2 ) steps a nice tangle solving π, and having the same marking. Proof. Let us consider any nice tangle with the given marking, and let π be its permutation. Consider path π(i) from the tangle. This path might be crossed by some paths from the right, and by some paths from the left. The crossing paths can be ordered by the y-coordinate of the crossings: the paths with a larger y-coordinate appear first in the ordering. We denote by R(i) the sequence of the paths crossing π(i) from the right, and by L(i) the sequence of paths crossing π(i) from the left, where the sequences have the order mentioned above. The proof consists of two steps. (1) In O(n2 ) steps we calculate sequences R(i) and L(i) for each i, and show that they are uniquely defined by π and the marking. (2) In O(n2 ) we draw a nice tangle using R and L. These steps are described in Lemmas 3 and 4, and the polynomial running time will follow from the lemmas also. t u Lemma 3. Let π ∈ Sn be a nice permutation with a valid marking. The functions R and L are the same for every nice tangle that complies with this marking. Furthermore, we can compute functions R and L in O(n2 ) time. Proof. We compute R0 and L0 , and show that R = R0 and L = L0 . Algorithm. Let l be a function with the domain {1, 2, . . . , n}, where l(i) is the number of inversions of the form (π(j), π(i)) (that is, the number of j < i with π(j) > π(i)). In any tangle solving π we have l(i) equal to the number of paths crossing path π(i) from left to right (recall that the paths are directed downwards). Similarly, we let r(i) be the number of inversions (π(i), π(j)). Note that r(i) is the number of paths crossing path π(i) from right to left in any tangle solving π. Initialize R0 (i) and L0 (i) as empty sequences for each i. Let π ∈ Sn . Consider an array T of length n of pairs (path, steps), where path is π(i) for some i, and steps is a number. T [i] is initialized by (π(i), s), where s is −l(i), if M (i) starts from L, and r(i), if M (i) starts from R, or 0, if M (i) is empty. The algorithm greedily swaps two adjacent elements of T . It looks for any i such that T [i].steps> 0, and T [i+1].steps< 0. It stops if such an i does not exist. Otherwise, it appends T [i + 1].path at the end of R0 (T [i].path), and appends T [i].path at the end of L0 (T [i + 1].path).Then it modifies the tuples and swaps them. It increases T [i + 1].steps by one, and decreases T [i].steps by one. If steps becomes 0 in either of the tuples, then it sets steps as in the initialization, using the tail of the corresponding marking sequence, instead of the marking sequence. To give some intuition, one can imagine that participants stand in row, and each one is given an instruction of a kind “make l steps to the left, then make r steps to
8
Sergey Bereg, Alexander E. Holroyd, Lev Nachmanson, and Sergey Pupyrev
the right”. Two participants can exchange their positions if they are neighbors and if their instructions do not contradict each other. The sequence R(i) (respectively L(i)) is the list of the participants π(i) exchanges the position with, when going to the right (respectively left), in time order. Let us show that the algorithm in fact calculates R0 = R, and L0 = L. First notice that since M is a valid marking, we have at least one successful run of the algorithm. By a successful run here we mean a sequence of swaps bringing T to the state where steps is 0 everywhere; this run can be reconstructed from the tangle of the marking. Now let us show that the algorithm result does not depend on the order of the swaps. We prove this by induction on the number of inversions in π. If the number of inversions is 0, the claim holds since all sequences of R, R0 , L, and L0 are empty. Suppose the claim holds for all permutations with k inversions. Consider a permutation π with k + 1 inversions, and take any two runs of the algorithm. If both runs start from the same swap, then the claim holds by the induction hypothesis. Otherwise, let (a, b) be the first swap of the first run. Reschedule this swap in the second run to be the first swap too. It will not change the result of the second run, because all swaps of the second run happening before (a, b) include neither a nor b. The problem is reduced to the first case. The algorithm requires inv (π) steps, since at each step one swap in π is deleted. t u Lemma 4. Let π ∈ Sn be a nice permutation with a valid marking M and R, L. A nice tangle solving π with the same M, R, L can be computed in O(n2 ) time. Proof. We call permutation π ∈ Sn connected if for any 1 ≤ k < n there is 1 ≤ j ≤ k such that π(j) > k. If π is not connected, then we find k such that the k-head of π is a connected permutation of k elements. We will give an algorithm for processing a connected permutation. After processing the connected head the algorithm can be repeated for the tail. We construct an undirected graph G with edges corresponding to the path crossings. For each i from 1 to n we create vertices im for each letter m ∈ M (i). For example, if the marking of i is RL, we create two vertices iR and iL . An edge of G is a pair (iR , jL ) if j appears in R(i). We start the drawing by placing the R-segment of π(1) arbitrarily. Let us suppose that for some set V of vertices of G the corresponding segments are drawn already. Take any edge (iR , jL ) from G such that only one of its vertices is in V . Since we know how segments iR and jL intersect each other (by looking at L(j) or R(i)), we can place the segment which is not from V . Add the new vertex to V , and stop when all segments are drawn. The algorithm makes O(n2 ) steps, since the number of edges in G is O(inv (π)), and it takes O(n2 ) steps to create G. To prove that the algorithm is correct, we only need to show that G is connected. The latter fact is shown by Lemma 5. t u Lemma 5. For connected π, the graph G is connected. Proof. Let us consider the permutation graph G0 of π as introduced in [2]. The vertices of G0 are numbers 1, . . . , n, and (i, j) forms an edge of G0 if and only if (i, j) is an
Drawing Permutations with Few Corners
9
inversion in π. By Lemma 3.2 from [3] G0 is connected. We show how to build graph G from G0 , by modifying G0 , and preserving the connectivity. Let us consider a vertex i from G0 . Suppose M (i) has length one. Then vertex i corresponds to only one vertex in G, so we rename i to im , where m is the letter of M (i). Of course, G0 remains connected in this case. π(j )
π(i )
π(k)
iL jR
iR
kL
Fig. 6. jR intersects kL .
Suppose M (i) has two letters. Without loss of generality, suppose M (i) is LR. We replace vertex i by two vertices iL and iR . Let us explain what happens with edges adjacent to i. Consider an edge (i, v) of G0 . This edge corresponds to the intersection of paths π(i) and π(j), for some j. That means that v = j or v = jm for some m ∈ {R, L}. If j appears in L(i), add edge (iL , v) to G, otherwise, add edge (iR , v) to G. Connectivity will be preserved, if in the new G0 the new vertices iL and iR are connected. Let us prove that iL and iR are connected. Since LR is the marking of i, there is path π(j) in L(i), and path π(k) in R(i). In any drawing paths π(j) and π(k) cross each other, otherwise one of these paths double-crosses π(i), see Figure 6. Furthermore, the R-segment of π(j) intersects the L-segment of π(k). At a stage of changing G0 each path π(j), π(k) is represented by one or two vertices of G0 . There are four possible cases; (1) Each j, and k are represented by one vertex, i.e. G0 contains vertices j and k. Since paths π(j) and π(k) intersect each other, (j, k) is an inversion, and G0 contains path iL , j, k, iR connecting the new vertices. (2) Both j, and k have been split. It can be seen that sequence iL , jR , kL , iR is a path in G0 by construction: this path connects iL and iR (3) j has been split, and k has been not. In this case again there is path connecting iL and iR , namely iL , jR , k, iR . Edge (jR , k) was created when splitting j (4) k has been split, and j has been not. This case is symmetric to 3. t u
5
Recognizing Nice Permutations
By using the results of the previous section we can find out if permutation π ∈ Sn is nice in O(2n n2 ) steps by going over all possible markings, and by observing success
10
Sergey Bereg, Alexander E. Holroyd, Lev Nachmanson, and Sergey Pupyrev
or failure of the algorithm 6 . We do not have a polynomial time algorithm for problem NT in general case, but we noticed that often we can speed up the search by using the patterns defined below, see Figure 7. 5 3 2 4 1
3 5
2 4 1
5 3
1 4 2
N W
E S
(a) 4 2 5
3 1
5 2 4 1 3
5
2 4 3 1
(b)
Fig. 7. The marking sequence of the dashed paths is defined by the pattern
The following lemma shows, how these patterns can help finding a valid marking, or discovering that such a marking does not exist. To be more succinct, below we sometimes omit the word path were it is possible. If the marking sequence of path b is m, we might express it by saying that b is an m-path. Lemma 6. a) Let us suppose that π is a nice permutation containing one of the following patterns: 53241, 35241, and 53142. Then 4 is an RL-path in any nice tangle solving π (see Figure 7(a)). b) Let us suppose that π is a nice permutation containing one of the following patterns: 42531, 52413, and 52431. Then 2 is an LR-path in any nice tangle solving π (see Figure 7(b)). Here by saying, for example, that 4 is an RL-path, we mean the path playing the role of path 4 in the pattern. Proof. It is enough to prove the statement a) of the lemma, since the statement b) can be derived from a) by the symmetry. Since 53142 is the inverse of 35241, it is enough to prove the statement a) only for patterns 53241, and 35241. Suppose, to the contrary, that in some nice tangle solving π the path of 4 is an LRpath. Consider the intersection of paths 3 and 2. This intersection belongs to one of the four areas marked by letters W, N, E, and S in Figure 7(a). We consider all possibilities for the intersection and exclude all of them. 6
The demo is at https://sites.google.com/site/gdcgames/nicetangle
Drawing Permutations with Few Corners 5
1
11
1
5
l4 l4 l2 l2
j
1
2
3
4
5
1
(a)
2
3
4
5
(b)
Fig. 8. (a) l2 is not above l4, (b) l2 is above l4.
Knowing that 4 is an LR-path, we deduce that it avoids E-area, since for entering E, it would need to be an RL-path. Another useful fact is that, because of the simplicity of the tangle, the paths 3, and 2 do not intersect 4. 1) 2, 3 intersect each other in E. This is impossible, since 4 separates these paths from E. 2) 2, 3 intersect each other in N. It is impossible for pattern 35241, since then 3, and 5 would double cross. In the case of pattern 53241 path 3 has to be an RL-path, since it goes right first to cross 2. But then its R-segment has to cross 4 before crossing 1, and we established above that 3 does not intersect 4. 3) 2, 3 intersect each other in S. For both patterns this would mean that 2 intersects 4, which is not true. 4) 2, 3 intersect each other in W. Let us call the infinite straight line containing the L-segment of path 4 by l4, and the infinite straight line containing the L-segment of path 2 by l2, see Figure 8. The L-segment of path 2 in both patterns crosses path 5; then if l2 is not above l4, then the L-segment of 2 crosses 4, see Figure 8(a), which is a contradiction. In the case when l2 is above l4, consider path j crossing 2, whose L-segment is contained in l4. This path is illustrated by the dashed line segment in Figure 8(b). Such path j exists, because 2 crosses 1. Path j, to avoid a double crossing with 2, has to cross 5 by the L-segment of path j, but then the segment overlaps with the L-segment of path 4, which is a contradiction. t u
6
Experiments and Open Questions
We checked that all permutations in Sn for n ≤ 6 are nice. There are 16 not nice permutations in S7 presented in Table 1. We calculated the number of not nice permutations in Sn for n ≤ 11, see Table 2. For n > 11 we tested a subset of Sn of random permutations. The percentage of the not nice permutations of Sn increases together with n. The last column in Table 2 shows the number of permutations for which Lemma 6 predicts its not-niceness. This was found by noticing that if an element in π plays the role of path 4 in one of the patterns of (a), and the role of path 2 in one of the patterns of (b) of
12
Sergey Bereg, Alexander E. Holroyd, Lev Nachmanson, and Sergey Pupyrev 7324651 3724651 6324751 3624751
7314652 3714652 6314752 3614752
7324615 3724615 6324715 3624715
7314625 3714625 6314725 3614725
Table 1. 16 permutations of order 7 that are not nice.
n
|Sn |
number and percentage of not nice permutations
number of not nice permutations determined with Lemma 6
6 7 8 9 10 11
720 5040 40320 362880 3628800 39916800
0 16 680 18085 392594 7686592
0 0.317 1.68 4.98 10.81 19.3
0 9 424 12247 284574 5899295
15 20 50
100000 100000 100000
64312 95133 100000
64.3 95.1 100
57603 93087 99999
Table 2. Statistics on the nice permutations in Sn .
the lemma, then π is not nice. In addition to the problems formulated above, we would like to post the following open problems: 1. How many nice permutations are in Sn ? 2. For a nice permutation π ∈ Sn , what is the number of nice tangles solving π? 3. Is there a polynomial-time algorithm that recognizes all nice permutations?
References 1. E. Argyriou, M. A. Bekos, M. Kaufmann, and A. Symvonis. Two polynomial time algorithms for the metro-line crossing minimization problem. In Proc. 16th Int. Symp. on Graph Drawing, pages 336–347, 2009. 2. F. H. G. Chartrand. Planar permutation graphs. Ann. Inst. H. Poincares Sect. B(NS) 3, pages 433–438, 1967. 3. Y. Koh and S. Ree. Connected permutation graphs. Discrete Mathematics, 307(21):2628– 2635, 2007. 4. S. Pupyrev, L. Nachmanson, S. Bereg, and A. E. Holroyd. Edge routing with ordered bundles. In Proc. 19th Int. Symp. on Graph Drawing, pages 136–147, 2011. 5. D. C. Wang. Novel routing schemes for IC layout, part I: Two-layer channel routing. In Proc. 28th ACM/IEEE Design Automation Conference, pages 49–53, 1991.