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.
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
,
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. Organization of the paper. In
Section 2 and
Section 3 we provide the lower bounds for
and
in the cases of
and
, respectively. In
Section 4 we give exact values of
and
, and in
Section 5 we provide some concluding remarks.
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.
Theorem 3. For , the lower bounds in (1) and (2) hold. 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 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). □
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
,
□