Apr 14, 1997 - strings with lead term k. For k 2 f1;2;:::;ng, jDk nj= (n ?1)!. This follows from the counts as in the description of Gn or by symmetry (jDk nj= jDj nj).
Equivalence Class Universal Cycles for Permutations Glenn Hurlbert Garth Isaaky April 14, 1997
1 Introduction In this note we describe a representation of permuations of an n-element set that can be viewed as equivalence classes of permuations of length n on n + 1 symbols. An equivalence class universal cycle is a string x x ; : : : ; xn such that among the n! length n substrings xi xi ; : : : xi n (subscript addition modulo n!) each equivalence class is represented exactly once. We produce a complete family of n such cycles. In such a family, distinct cycles use distinct representatives and each member of an equivalence class acts as representative exactly once. The notion of universal cycles as cyclic representations of combinatorial objects, as a generalization of DeBruijn cycles, was introduced by Chung, Diaconis and Graham [1] and studied by Hurlbert [2] and Jackson [3]. The universal cycles for permutations that we examine here are one such example. Let ki;j denote the set of all k?permutations of fi; i + 1; : : : ; j g. We write a typical element a 2 ki;j as a vector of k distinct terms from fi; i + 1; : : : ; j g. It is easy to show that universal cycles exist for k;n for 1 k n ? 1 and do not exist for k = n. (See Jackson [3].) Chung, Diconnis and Graham [1] use the concept of order isomorphism as an equivalence relation on strings from n;m to get universal cycles for n;n. Such cycles exist for m 5=2n (Hurlbert [3]) and it is conjectured that m = n + 1 suces. We consider another natural equivalence relation on n;n for which equivalence class universal cycles representing n;n exist. This gives a universal cycle for permuations of length f1; 2; : : : ; ng using n +1 symbols. Moreover, we are able to construct a complete family of such cycles. 1
+1
2
!
+
1
1
1
0
1
y
Depatment of Mathematics, Arizona State University, Tempe, AZ Department of Mathematics, Lehigh University, Bethlehem, PA
1
2 Equivalence Classes Let 1m = (1; 1; : : : ; 1) denote the vector of m ones. De nition 1 For a; b 2 m;n 0
a b () a ? b k1m (mod n + 1) for some k: It is easy to see that is an equivalence relation and that there are n! equivalence
classes corresponding to the elements of n;n. An alternative perspective on these permuations in terms of dierences will prove to be useful. 1
De nition 2 For a = (a ; a ; : : : ; am ) 2 m;n let d(a) = ((a ? a ); (a ? a ); : : : ; (am ? am? )) 2 f1; 2; : : : ; ngm? 1
2
0
1
2
1
3
2
1
where subtraction is modulo n + 1.
The following obvious lemma provides the connection to the equivalence relation. Lemma 1 a b () d(a) = d(b)
Lemma 2 a 2 m;n if and only if d(a) = (d ; d ; : : : dm? ) satis es 1
0
Xj d 6 0 k k i
2
1
(mod n + 1) for 1 i j m ? 1:
=
Proof: The ai are distinct. 2 In general we will say that a string x ; x ; : : : ; xm of terms from f1; 2; : : : ; ng has property P if all sums of consecutive terms (including a `sum' of a single term) are P j distinct modulo n + 1. That is, if k i xk 6 0 (mod n + 1) for 1 i j m ? 1. Denote by Dn the set of elements of f1; 2; : : : ngn? satisfying property P . The one to one correspondances from Lemmas 1 and 2 between permuatations of f1; 2; : : : ng (n;n), equivalence classes of n?permutations of f0; 1; : : : ng and length n ? 1 vectors from f1; 2; : : : ; ng satisfying property P (Dn) will be frequently used in what follows. 1
2
=
1
1
2
3 Dierence Representations Having set up the equivalence class partitions, with permutaions as representations, it is relatively straighforward to show the existance of universal cycles for Dn using standard techniques. We will need an additional property to `lift' universal cycles for Dn to a equivalence class universal cycles for n;n. Construct the directed graph Gn with vertices corresponding to strings in f1; 2; : : :; ngn? satisfying property P and arcs corresponding to elements in Dn. The arc corresponding to d = (d ; d ; : : : ; dn? ) 2 Dn goes from vertex (d ; d ; : : : ; dn? ) (the pre x of d) to the vertex (d ; d ; : : : ; dn? ) (the sux of d). By P , the partial sums dk? ; dk? + dk? ; : : : ; d + + dk? ; d + d + dk? are distinct for any k. (If j < i and dj + + dk? = di + + dk? then dj + + di = 0 (mod n +1).) Thus, given d ; d ; : : : ; dk satisfying P , there are n ? k choices for dk so that d ; d ; : : : dk satis es P . In particular, there are 2 choices of dn? for any pre x. That is, the outdegree of each vertex is two. (By a symmetric argument each indegree is two.) Note also that since there are jDnj = n! arcs, there are n!=2 vertices in Gn. Figures 1 and 2 show D and D . The vertices are labeled by dierence pre xes/suxes and the arcs are labeled by the corresponding element of Dn and, in italics, the permutations in n;n with this dierence sequence. The following elementary lemma shows that Gn is in general Eulerian. 1
2
1
1
2
2
1
2
2
1
2
1
3
1
2
1
1
1
1
2
1
2
1
1
+1
2
+1
+1
1
3
4
1
Lemma 3 Gn is strongly connected and every vertex of Gn has indegree and outdegree 2.
Proof: The statement about the degrees follows from the discussion above. Construct the directed graph Hn with vertices corresponding to permutations in n ? ;n and arcs corresponding to permutations in n;n. The arc a = (a ; a ; : : : ; an) 2 n;n goes from vertex (a ; a ; : : : ; an? ) 2 n;n? to (a ; a ; : : : ; an) 2 n;n? . It is easy to see that the indegree and outdegree of each vertex is two. It is also not dicult to show that Hn is strongly connected (see Jackson [3].) For completeness we include a short proof of this fact. We show how to nd a path between any two arcs in Hn and thus since there are no isolated vertices, Hn is strongly connected. First note that there is a path from arc x = (x ; x ; : : : xn) to any cyclic permutation of x. Namely, (x ; x ; : : : ; xn), (x ; x ; : : : ; xn; x ), (xi ; xi ; : : : ; xn; x ; : : : ; xi? ). Since any permutation can be obtained from another by a sequence of transpositions of adjacent elements, it is enough to show that there is a path from a = (a ; a ; : : : ai ; ai ; : : : an) to ab = (a ; a ; : : : ; ai? ; ai ; ai; ai ; : : : ; an). Let b be the element of f0; 1; : : : ; ng that does not appear in a. Making use of paths P ; P ; P for cyclic permutations, we have the 1
0
1
0
2
1
1
0
1
2
3
1
2
2
1
1
2
0
0
2
1
1
+1
1
1
1
1
3
+1
+2
1
2
3
3
2
+1
2
path a = (a ; a ; : : : ai ; ai ; : : : an), P ; (ai; ai ; : : : ; an; a ; : : : ; ai? ), (ai ; : : : ; an; a ; : : : ; ai? ; b), (ai ; : : : ; an; a ; : : : ; ai? ; b; ai), P , (b; ai; ai : : : ; an; a ; : : : ; ai? ), (ai; ai ; : : : ; an; a ; : : : ; ai? ; ai ), P ; (a ; a ; : : : ; ai? ; ai ; ai; ai ; : : : ; an) = ab . For example, in H we have (1; 2; 3; 4), (2; 3; 4; 1), (3; 4; 1; 2), (4; 1; 2; 0), (1; 2; 0; 3), (2; 0; 3; 1), (0; 3; 1; 2), (3; 1; 2; 4), (1; 2; 4; 3). Finally, we observe that the graph obtained from Hn by identifying vertices that belong to the same equivalence class of n;n? is Gn and thus Gn is strongly connected. Identify vertices in Hn corresponding to a; b 2 n;n? if d(a) = d(b). Each new vertex arises from an equivalence class of n + 1 vertices and corresponds to a string of length n?2 from f1; 2; : : : ; ng satisfying P . That is, it corresponds to a vertex of Gn. Similarly, there is a correspondence between equivalence classes of arcs in n;n of Hn and arcs of Gn. It is not dicult to check that with these correspondences Gn is obtained from Hn. In gure 3 we give the example of H . 2 1
+2
3
2
+1
1
1
1
1
2
1
+1
+1
2
1
+2
1
1
1
+2
+1
+2
1
1
1
4
1
0
1
0
0
3
Lemma 4 Universal cycles for Dn exist. Proof: By Lemma 3, Gn is Eulerian. An Eulerian cycle produces the universal cycle.
2
For example, there is one Eulerian cycle in D starting with arc 11, namely 112332. One Eulerian cycle in D is 111242224344431213331342. 3
4
4 Universal Cycles for n1;n Finally, we need to `lift' the universal cycles for Dn to equivalence class universal cycles for n;n. Since we select a representative from each equivalence class, the cyclic representation must return to the same representative of each class. It is this `lifting' that produces diculties with the order isomorphic approach described in the introduction. For a given a 2 f0; 1; : : : ; ng and a universal cycle u u : : : un for Dn we construct the cycle v v : : : vn with u = a and vi = vi? + ui? for i = 2; 3; : : : n!, with addition modulo n + 1. For example, with the cycle 112332 for D we get 1
1
1
2
!
1
1
2
!
1
3
a=0 a=1 a=2 a=3
012032 123103 230210 301321
So for a = 0, the equivalence class representatives are 012 123, 120 231, 203 132, 032 321, 320 213 and 201 312. 4
1
+1
With 111242224344431213331342 for D we get 4
a=0 a=1 a=2 a=3 a=4
012304130421042301420143 123410241032103412031204 234021302143214023142310 340132413204320134203421 401243024310431240314032
Note that in both cases, every choice of a `lifts' to an equivalence class universal cycle. So in fact we get a family of such cycles, depending on the initial choice of a. In general, v v : : : vn will be cyclic if and only if v vn + un (mod n + 1). But, this is the same as v v + u + u + un (mod n + 1) since vi = vi? + ui? . So we need the following Lemma. Lemma 5 Let u u : : : un be a universal cycle for Dn. Then Pni ui 0 (mod n+1). Proof: Let Dnk denote the set of strings d ; : : : ; dn? 2 Dn with d = k. That is, those strings with lead term k. For k 2 f1; 2; : : : ; ng, jDnk j = (n ? 1)!. This follows from the counts as in the description of Gn or by symmetry (jDnk j = jDnj j). Let di = (di ; di ; : : : din? ) for i = 1; 2; : : : n! be the list of the strings in Dn in some order. Then since each ui is the rst term of some string in Dn and conversely, 1
2
!
1
1
1
1
2
!
!
!
1
1
!
1
2
!
=1
1
1
2
1
1
1
n X u !
i
i
=
=1
= =
n X dj !
j
1
Xn jDk j =1
n
k
=1
k
=1
Xn (n ? 1)!
= (n +2 1)n (n ? 1)! 0 (mod n + 1):
2
Theorem 1 There exists a complete family of equivalence class universal cycles for permutations of f1; 2; : : : ; ng using the symbols f0; 1; 2; : : : ; ng. Proof: Immediate from the above remarks and Lemmas 4 and 5. 2 5
Observe that by using the matrix tree theorem, counts on the number of spanning trees and hence the number of Eulerian paths in Gn can be obtained. (See for example Tutte [4].) These methods would then give a count of the numbers of equivalence class universal cycles for permutations. However, it appears that it may be dicult to obtain a general expression for the evaluation of the determinant used in these counts. As is the case with de bruijn cycles, it may be possible to use the structure of the graph Gn to obtain algorithms for generating universal cycles for permutations (and hence for generating permutations).
References [1 ] F. Chung, P. Diaconis and R. Graham, Universal cycles for combinatorial struc-
tures, Discrete Math. 110 (1992) 43{55. [2 ] G. Hurlbert, Universal cycles: on beyond de Bruijn, Ph.D. Thesis, Rutgers University, New Brunswick, New jersey, 1990. [3 ] B. Jackson, Universal cycles for k-subsets and k-permutations, manuscript, 1990. [4 ] W.T. Tutte, Graph Theory (Cambridge University Press, New York, 1986).
6