Abstract
A universal cycle, or u-cycle, for a given set of words is a circular word that contains each word from the set exactly once as a contiguous subword. The celebrated de Bruijn sequences are a particular case of such a u-cycle, where a set in question is the set of all words of length n over a k-letter alphabet A. A universal word, or u-word, is a linear, i.e., non-circular, version of the notion of a u-cycle, and it is defined similarly. Removing some words in may, or may not, result in a set of words for which u-cycle, or u-word, exists. The goal of this paper is to study the probability of existence of the universal objects in such a situation. We give lower bounds for the probability in general cases, and also derive explicit answers for the case of removing up to two words in , or the case when and .
1. Introduction
A universal cycle, or u-cycle, for a given set S with ℓ words of length n over an alphabet A is a circular word that contains each word from S exactly once (and no other word) as a contiguous subword for some , where the indices are taken modulo ℓ. The notion of a universal cycle was introduced in [1]. The celebrated de Bruijn sequences are a particular case of such a u-cycle, where a set in question is the set of all words of length n over a k-letter alphabet A. A universal word, or u-word, for S is a (non-circular) word that contains each word from S exactly once as a contiguous subword for some . In this paper, we assume that and to make all of our definitions well-defined and to avoid trivialities.
There is a long series of research in the literature dedicated to the study of universal cycles and universal words for various sets of combinatorial structures. For example, see [2] and references therein. We note that the existence of a u-cycle trivially implies the existence of a u-word, but not vice versa. Indeed, if is a u-cycle for S then is a u-word for S. In either case, solving problems on u-cycles and u-word is normally done through considering de Bruijn graphs. A de Bruijn graph consists of nodes corresponding to words in and its directed edges are where for . De Bruijn graphs are an important structure that is used in solving a variety of problems, e.g., in combinatorics on words [3] and genomics [4].
Let be a directed graph. A directed path in G is a sequence of distinct nodes such that there is an edge for each . Such a path is a Hamiltonian path if it contains all nodes in G. A closed Hamiltonian path ( is an edge) is a Hamiltonian cycle. If G has a Hamiltonian cycle then G is Hamiltonian. It is well-known, and is not difficult to show, that is Hamiltonian, so any Hamiltonian cycle (resp., path) in corresponds to a u-cycle (resp., u-word) for . For example, the cycle in corresponds to the u-cycle 0011, and we can also get a u-word 00110 from this.
The problem in question. Now, suppose that we remove words from where A is an alphabet of size k so that each word is equally likely to be removed. The resulting set S may, or may not have a u-cycle or a u-word. Let and be the probabilities of the events that S has a u-cycle and u-word, respectively. Then, a natural question is: What are and ? Note that by definition, a u-cycle for S must cover at least n distinct words, and thus if then .
It is not difficult to see that if , or , then with probability 1 a u-word exists. Indeed, if then removing a word in corresponds to removing a node in that turns a Hamiltonian cycle passing through it to a Hamiltonian path giving a u-word, while if then only one word remains and it is a u-word. Similarly, it is not difficult to see that if then with probability a u-cycle exists. Indeed, if then one can only remove words of the form called loops, and there are k such words, while if then the only u-cycle of length n can be a loop.
In Table 1, Table 2 and Table 3 we present the values of and for obtained by Mathematica 11.3. Even though these tables were obtained by computer, it is possible to check them by hand for by considering the existence of a Hamiltonian path in . Moreover, in the case of , one can consider Eulerian cycles/paths (to be introduced below) in and be also able to check Table 3 by hand.
Table 1.
Values of and for .
Table 2.
Values of and for .
Table 3.
Values of and for .
Our results in this paper. In this paper, we not only provide lower bounds for and for any values of (summarized in Table 4), but also give exact values in the case of in Theorem 8. For example, we will show that for and ,
Table 4.
References for the lower bounds for and . The gray cells refer to exact values.
We remark that some of our proofs require rather subtle considerations, which tend to be more difficult in the case of the binary alphabet.
Preliminaries. In this paper, denotes the graph obtained from after removing s nodes, or s edges depending on the context.
A directed graph is strongly connected if there exists a directed path from any node to any other node. A directed graph is connected if for any pair of nodes a and b there exists a path in the underlying undirected graph. A trail in a directed graph G is a sequence of nodes such that there is an edge for each and edges are not visited more than once. An Eularian trail in G is a trail that goes through each edge exactly once. A closed Eulerian trail is an Eulerian cycle. A directed graph is Eulerian (resp., semi-Eulerian) if it has an Eulerian cycle (resp., Eulerian trail). Let (resp., ) denote the out-degree (resp., in-degree) of a node v. A directed graph is balanced if for each node v in the graph. The following result is well-known and is not hard to prove.
Theorem 1.
A directed graph G is semi-Eulerian if and only if at most one vertex v has , at most one vertex u has , every other vertex w has , and G is connected. A graph is Eulerian if and only if it is balanced and (strongly) connected.
The line graph of a directed graph G is the directed graph whose vertex set corresponds to the edge set of G, and has an edge if in G, the head of e meets the tail of v. It is well-known, and not difficult to show, that , and thus a Hamiltonian path (resp., cycle) in corresponds to an Eulerian trail (resp., cycle) in , and this property will be often used throughout this paper to show the existence of u-cycles and u-words.
Nodes of the form , as well as edges of the form , are loops. Nodes of the form are out-special and nodes of the form are in-special. Out-special and in-special nodes together are special. The following theorem will be used by us in the paper multiple times.
Theorem 2
([5]). Let u and v be two distinct non-loop nodes in . Then, there exist k distinct node-disjoint paths from u to v if and only if u is not out-special and v is not in-special.
2. The Case of the Alphabet of Size
Let
where the sum is taken over all with and . In the next theorem, we will obtain the following lower bounds for and :
where and the sum is taken over all with and . The case of and will be considered in Theorem 4 below.
Proof.
Assume . We observe that removing all i-cycles in , , of the binary form, that is, involving only nodes for for and , results in a strongly connected and balanced graph . Indeed, clearly is balanced. To justify that is strongly connected, we need to show that for any edge belonging to a removed binary cycle, there is a directed path from A to B which does not go through any other edge from the removed binary cycles. Then, in a path in from a node X to a node Y, we can replace any such e with , so that it gives a path in from X to Y.
Suppose and where all for some x and y. Let . Then, is given by
since no of the edges in belongs to an i-cycle for . So, is Eulerian, and thus its line graph is Hamiltonian, and there exists a u-cycle corresponding to it.
To justify (1), we consider i-cycles, , of the form
where , and . Note that no two of such cycles can share an edge. Thus, we can remove in such i-cycles for so that the total number of removed edges (corresponding to the total number of removed nodes in ) is s. Clearly, the number of such one-cycles is k, and for , the number of such i-cycles is .
To justify (2) we note that if all of the s removed edges come from the binary cycles considered above, then the same lower bound as in (1) will be obtained. This bound can be improved as follows. Begin with removing edges coming from the binary i-cycles as above, which will result in a Eulerian graph, so that we can remove any edge e in such a graph and obtain a semi-Eulerian graph corresponding to a u-word. To count the possibilities to remove such an e, we do not want e to be a loop, because this will result in some double counting. However, if e is not a loop, all the cases will be different from already considered cases, because before we were removing entire i-cycles for some i. This explains the term in (2). □
In the proof of the next theorem we need the following simple lemma. There, by a circular binary string, we mean a number of digits 0 and 1 placed around a circle in positions labeled by
Lemma 1.
For , the number of circular binary strings with i 1s and 0s, , in which no two 1s stay next to each other is given by
Proof.
Let be the number of binary (non-circular) strings with i 1s in which no two 1s stay next to each other. Then, . Indeed, clearly counts placing i 1s in a binary string of length and then replacing each 1, but the rightmost 1, by 10. For the circular case, if 0 is in position 1, then we clearly have such strings. On the other hand, if 1 is in position 1 in the circular case, then we have such strings since then positions k and 2 must be occupied by 0s. This completes the proof. □
Theorem 4.
Let and , ,
and
Then,
Also,
Proof.
Instead of removing s nodes in , we consider removing s edges in , whose nodes are k loops , and for every pair of nodes x and y, both and are present. We call a 2-cycle in special if it involves nodes x and for , or 1 and k. Clearly, the number of non-special two-cycles is .
To justify (3), note that removing all the edges in any i of non-special 2-cycles in , and then removing loops results in a balanced and strongly connected graph showing the existence of a u-cycle in this case. The number of ways to proceed in this way is clearly given by . Moreover, we can proceed in the same way after first removing the k edges either from the cycle , or from the cycle , which explains the term of .
To produce a more subtle estimate, we will be removing just a single i-cycle for a fixed from , which is clearly not counted previously. The only condition on removing such an i-cycle is that it must not involve any of the edges in a special two-cycle for us to guarantee strong connectivity of the obtained graph. The number of ways to selected i nodes to form such an i-cycle is given by Lemma 1, and since there are edges in both directions between any pair of selected nodes, there are ways to choose a cycle on the chosen nodes. The remaining edges to be removed after removing i-edges in an i-cycle can be chosen among the k loops. This explains the term of . Finally, removing the k edges in either the cycle , or the cycle , and then removing an i-cycle as above results in a balanced and strongly connected graph, and explains the term . This completes the justification of (3).
To justify (4), first note that all cases considered in proving (3) can be used in the case of u-words. To improve the bound, we note that a directed path (on distinct nodes) of length j, , consisting of edges coming from special 2-cycles, can be removed, and then some other cycles can be removed as discussed in the case of u-cycles, which will result in a semi-Eulerian graph and thus corresponds to a u-word. There are two ways to pick the direction of such a path on special two-cycles, and k ways to pick its start, justifying the term of . Finally, the following two options also result in semi-Eulerian graph not considered above:
- remove any non-loop edge among the edges coming not from special two-cycles, and the remaining edges can be removed from loops. This gives possibilities;
- remove the k edges in either the cycle , or the cycle , and then remove one more non-loop edge among the edges coming not from special two-cycles, and the remaining edges can be removed from loops, which gives possibilities.
This explains the term of and completes the proof of (4). □
3. The Case of the Alphabet Size
Let
where the sum is taken over all with , and . Then, for and , we will show in the next theorem that
where the sum is taken over all with , and .
Proof.
We have and . We observe that after removing two loops, the two-cycle, and the two -cycles of the form
in results in a strongly connected and balanced graph . Indeed, clearly is balanced. To justify that is strongly connected, we need to show that for any edge belonging to a removed cycle, there is a directed path from A to B which does not go through any other edge from the removed cycles. Then, in a path in from a node X to a node Y we can replace any such e with giving a path in from X to Y. We consider two cases.
Case 1. and for . If then . If then is given by
If , then is given by
In all other cases, is given by
Case 2. and are in the 2-cycle where . Then, for even n, is given by
and for odd n, is given by
So, is Eulerian, and thus its line graph is Hamiltonian, and there exists a u-cycle corresponding to it.
To justify (5), we note that no two of the two loops, one two-cycle and two -cycles considered above can share an edge. Thus, we can remove in such i-cycles for so that the total number of removed edges (corresponding to the total number of removed nodes in ) is s.
To justify (6) we note that if all of the s removed edges come from the cycles considered above, then the same lower bound as in (5) will be obtained. This bound, can be improved as follows. Begin with removing edges coming from the i-cycles as above, which will result in an Eulerian graph, so that we can remove any edge e in such a graph and obtain a semi-Eulerian graph corresponding to a u-word. To count the possibilities to remove such an e, we do not want e to be a loop, because this will result in some double counting. However, if e is not a loop, all the cases will be different from already considered cases, because before we were removing entire i-cycles for some i. This explains the factor of in (6). □
4. Exact Values of and
Theorem 6.
We have and for and ,
Proof.
If two nodes are removed in , the only possibility for the graph to stay Hamiltonian (and thus to correspond to a u-cycle) is if the removed nodes are loops, which explains that . On the other hand, if and then in order to obtain an Eulerian graph by removing two edges in we must either remove two loops, or remove a two-cycle. Each of these gives possibilities thus explaining the formula for . □
The proof of Theorem 8 relies on the following theorem, which looks like an intuitively true statement, but its proof is rather involved and requires consideration of many cases, and we were not able to find this result in the literature.
Theorem 7.
Let be an edge in . Then, there exists a Hamiltonian cycle in that goes through e, with the only exception when , a is out-special and b is in-special.
Proof.
If , and then no Hamiltonian cycle can cover the loop and go through e because the only edge coming to comes from a. This is not the case for .
If either a or b is a loop , then the statement is true. Indeed, if then there is only one edge coming in to , and one edge coming out of , so these edges will be part of any Hamiltonian cycle. On the other hand, if , then suppose and ; the case when can be considered similarly. Since has a Hamiltonian cycle and the corresponding u-cycle U, it will go through an edge , . If we are done. Otherwise, we can swap all y’s and z’s in U to obtain the desired Hamiltonian cycle from the new u-cycle.
Thus, we can assume that neither a nor b is a loop.
In what follows, we will use the following approach. We will be considering edges and in corresponding to a and b, respectively. Next, we will demonstrate that after removing and (corresponding to removing a and b in ) the obtained graph remains connected. This is done via finding alternative directed paths from X to Y, , where or . Together with the fact that is balanced if , or otherwise A has one extra edge coming in, and C has one extra edge coming out, has an Eulerian trail corresponding to a Hamiltonian path in obtained from after removing a and b. Such a Hamiltonian path can clearly be extended to a Hamiltonian cycle in by adding back the removed edge e.
Suppose that . If then we have 8 possibilities for e (loops are not involved, and we cannot have a be out-special and b be in-special). Each of the eight possible choices of e can be found in one of the following two Hamiltonian cycles in giving the desired result:
Thus we can assume . Let and . Then, , and . Letting we see that if , or else . is found in the same way.
In what follows, we assume that (and a and b are not loops).
If then form a 2-cycle, and for none of these vertices is special. Thus, and exist by Theorem 2. So, we can assume that .
Suppose that one of A, B, or C is a loop.
Case 1. is a loop, , , and . exist by Theorem 2, and for , is given by
where . For , we note that does not exist in this case. However, it is sufficient for us to prove that there exists that does not use the edge ( clearly will not be used). Such a path is given by
where denotes the letter distinct from z. In the case the path above has one extra step than otherwise.
Case 2. is a loop, , , , and . For , is essentially in Case 1, and is given by
where . The case corresponds to a being out-special, and b being in-special, and it is the exception in the statement of the theorem (the loop B becomes non-reachable from any other node).
Case 3. is a loop, , , and . exist by Theorem 2, and for is given by
where . Similarly to Case 1, for , does not exist, but we can find not using and :
where is the letter different from x so the last step is not the edge .
Thus, we can assume that none of A, B, or C is a loop. Moreover, we only need to consider the following two cases, because otherwise, and are given by Theorem 2.
Case i. is out-special and is in-special, where . In this case, .
Case ii. is out-special and is in-special, where . This is essentially Case i. □
Theorem 8.
We have and for ,
Moreover, for and , we have
Proof.
If and , then it is easy to see that the graph obtained from by removing two nodes has a Hamiltonian path unless the removed nodes are 01 and 10. This gives .
So, we can assume that either and or and .
Let a and b be the nodes in corresponding to the removed words of length n over k-letter alphabet. Note that is semi-Eulerian (in particular, respecting the conditions on in-degrees and out-degrees) if and only if
- either a or b is a loop, in which case clearly a Hamiltonian path in exists, or
- (or ) is an edge in , in which case a Hamiltonian path in exists by Theorem 7 with one exception.
Thus, exactly one of the following four cases of choosing a can occur in order for to have a Hamiltonian path.
Case 1. a is a loop, in which case b can be any node. Clearly, there are ways to choose such a and b.
Case 2. (i) or (ii) . b can only be of the form, in case (i) or or or where , and in case (ii) or or or where . In either case, b can be chosen in ways depending on the respective choices of t and z. There are choices to pick a giving in total for this case possibilities.
Case 3. is out-special or is in-special. In either case, b can be either a loop, or the other endpoint of an edge coming into a or going out of a. There are k loops, k edges coming in, and k edges coming out of a, but one of these edges is connected to a loop. Thus, in this case we have choices for b, and in total possibilities (2 corresponds to the choices of being out-special or in-special). However, the last formular only works for , because when , we cannot remove a and b connected by an edge, when both of them are special (in this case a loop becomes isolated). So, if we have possibilities.
Case 4. In all other cases of a, b can be any of nodes connected to a by an edge, or any of k loops. So, we have
possibilities.
Since every pair appears twice in our arguments, Cases 1–4 give
and for ,
□
5. Directions of Further Research
A universal cycle (or a universal word) for an arbitrary set S is a cyclic sequence (or a non-circular sequence) whose substrings of length n encode distinct instances in S. U-cycles and u-words have been studied for a wide variety of combinatorial objects including permutations [6,7], partitions [8], subsets [9], multisets [10], labeled graphs [11], various functions and passwords; for more information, the reader is referred to [12]. There are many studies on universal cycles or universal words because of their applications including dynamic connections in overlay networks [13], genomics [4], software calculation of the ruler function in computer words [12], etc. An interesting direction of research would be extending our studies of and to other combinatorial structures. It would also be interesting to explore new methods to compute the exact values of and . Finally, our bounds for the general case presented in (1) and (2) can be improved by conducting a more subtle analysis of the removed cycles in the proof of Theorem 3, and exploring how far the improvement could go is another interesting direction.
Author Contributions
conceptualization, S.K.; methodology, H.Z.Q.C. and S.K.; software, H.Z.Q.C.; validation, H.Z.Q.C. and S.K.; formal analysis, H.Z.Q.C., S.K. and B.Y.S.; investigation, H.Z.Q.C., S.K. and B.Y.S.; resources, H.Z.Q.C., S.K. and B.Y.S.; data curation, H.Z.Q.C.; writing—original draft preparation, H.Z.Q.C. and S.K.; writing—review and editing, H.Z.Q.C., S.K. and B.Y.S.; visualization, H.Z.Q.C., S.K. and B.Y.S.; supervision, S.K.; project administration, S.K.; funding acquisition, N/A. All authors have read and agreed to the published version of the manuscript.
Funding
The work of the first author was supported by the National Natural Science Foundation of China (Grant Numbers 11901319) and the Fundamental Research Funds for the Central Universities (Grant Number 63191349). The third author was partially supported by the National Natural Science Foundation of China (Grant Numbers 11701491, 11726629 and 11726630) and the China Postdoctoral Science Foundation (Grant Number 2017M621188).
Acknowledgments
The authors are thankful to the reviewers for a number of useful comments.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Chung, F.; Diaconis, P.W.; Graham, R.L. Universal cycles for combinatorial structures. Discrete Math. 1992, 110, 43–59. [Google Scholar] [CrossRef]
- Gardner, K.B.; Godbole, A. Universal cycles of restricted words. J. Combin. Math. Combin. Comput. 2018, 106, 153–173. [Google Scholar]
- Moreno, E. De Bruijn sequences and De Bruijn graphs for a general language. Inform. Process. Lett. 2005, 96, 214–219. [Google Scholar] [CrossRef]
- Zerbino, D.; Birney, E. Velvet: Algorithms for de novo short read assembly using de Bruijn graphs. Genome Res. 2008, 18, 821–829. [Google Scholar] [CrossRef] [PubMed]
- Baumslag, M. An algebraic analysis of the connectivity of DeBruijn and shuffle-exchange digraphs. Discrete Appl. Math. 1995, 61, 213–227. [Google Scholar] [CrossRef][Green Version]
- Johnson, J.R. Universal cycles for permutations. Discrete Math. 2009, 309, 5264–5270. [Google Scholar] [CrossRef]
- Kitaev, S.; Potapov, V.N.; Vajnovszki, V. On shortening u-cycles and u-words for permutations. Discrete Appl. Math. 2019, in press. [Google Scholar] [CrossRef]
- Casteels, K.; Stevens, B. Universal cycles of (n − 1)-partitions of an n-set. Discrete Math. 2009, 309, 5332–5340. [Google Scholar] [CrossRef][Green Version]
- Jackson, B. Universal cycles of k-subsets and k-permutations. Discrete Math. 1993, 117, 114–150. [Google Scholar] [CrossRef]
- Hurlbert, G.; Johnson, T.; Zahl, J. On universal cycles for multisets. Discrete Math. 2009, 309, 5321–5327. [Google Scholar] [CrossRef][Green Version]
- Brockman, G.; Kay, B.; Snively, E. On universal cycles of labeled graphs. Electron. J. Combin. 2010, 17, 1–9. [Google Scholar] [CrossRef]
- Wong, D. Novel Universal Cycle Constructions for a Variety of Combinatorial Objects. Ph.D. Thesis, University of Guelph, Guelph, ON, Canada, 2015. [Google Scholar]
- Sridhar, M.A.; Raghavendra, C.S. Fault-tolerant networks based on the de Bruijn graph. IEEE Trans. Comput. 1991, 40, 1167–1174. [Google Scholar] [CrossRef]
© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).