Small subgraphs in the trace of a random walk

We consider the combinatorial properties of the trace of a random walk on the complete graph and on the random graph $G(n,p)$. In particular, we study the appearance of a fixed subgraph in the trace. We prove that for a subgraph containing a cycle, the threshold for its appearance in the trace of a random walk of length $m$ is essentially equal to the threshold for its appearance in the random graph drawn from $G(n,m)$. In the case where the base graph is the complete graph, we show that a fixed forest appears in the trace typically much earlier than it appears in $G(n,m)$.


Introduction
For a positive integer n and a real p ∈ [0, 1], we denote by G(n, p) the probability space of all (simple) labelled graphs on the vertex set [n] = {1, . . . , n}, where every pair of vertices is connected independently with probability p. A closely related model, which we denote by G(n, m), is the uniform probability space over all graphs on n vertices with m edges. Both models have been extensively studied since first introduced by Gilbert [7], and by Erdős and Rényi [4,5].
One of the problems studied in [5] was the problem of finding the threshold for the appearance of a fixed subgraph. Formally, given a fixed graph H, one is interested in the smallest value of p 0 such that when p ≫ p 0 the random graph G(n, p) contains a copy of H with high probability (whp), that is, with probability tending to 1 as n grows. It turns out that the threshold for the appearance of H is determined by m 0 (H), the maximum edge density of all of its non-empty subgraphs. In symbols, The problem of finding the threshold for every fixed subgraph was settled by Bollobás [3] in 1981, and the result can be stated as follows (see also [1,Section 4.4] or [9,Theorem 3.4]). Here and later, the notation f ≫ g means that f /g → ∞. For a vertex v, denote by N (v) the set of its neighbours, and let N + (v) = {v} ∪ N (v). Given a (finite) base graph G = (V, E), a (lazy) simple random walk on G is a stochastic process (X 0 , X 1 , . . .) where X 0 is sampled uniformly at random from V , and for t ≥ 0, X t+1 is sampled uniformly at random from N + (X t ), independently of the past. The trace of the random walk at time t is the (random) subgraph Γ t ⊆ G on the same vertex set, whose edges consist of all edges traversed by the walk by time t, excluding loops and suppressing possible edge multiplicity. Formally, Note. There are various definitions of laziness of random walks, perhaps the most common is staying put with probability 1/2 (see, e.g., [12]); however, for the case of random walks on the complete graph on n vertices, a random walk which stays put with probability 1/n yields an independent sequence of uniformly distributed locations, which is far easier to handle. We decided therefore to adopt here a general definition of laziness which, in the case of the complete graph, behaves like that. However, as the thresholds discussed in this work are coarse, the results below can be applied for more traditional definitions of laziness, as well as for non-lazy random walks.
In [2] it was shown that the trace of a random walk whose length is proportional to n 2 on (dense) quasirandom graphs (including dense random graphs) on n vertices is typically quasirandom. In [6], several results were given concerning graph-theoretic properties of the trace, for sparser base graphs and shorter random walks. In this paper we continue this study of the structure of the trace, finding thresholds for the appearance of fixed subgraphs. Our first result, which is analogous to Theorem 1.2, considers the random walk on the random graph G(n, p), and is restricted to fixed subgraphs containing a cycle. As we will see later, that restriction is necessary, as the statement is simply false for forests.
Note that the condition m 0 (H) ≥ 1 is equivalent to the condition of containing a cycle. Theorem 1.3. Let H be a fixed graph with m 0 (H) ≥ 1, let ε > 0, p ≥ n −1/m 0 (H)+ε and G ∼ G(n, p), and let Γ t be the trace of a random walk of length t on G. Then, Remark 1.4. When proving the above theorem, we do not really require that G is random, but rather that it possesses some pseudo-random properties, which occur with high probability in G(n, p).
The complementary case m 0 (H) < 1 is in fact quite different, and we were able to find the threshold in that case for random walks on the complete graph K n only. We will discuss potential difficulties in this aspect in Section 4. Denote by odd(G) the number of odd degree vertices in G. Theorem 1.5. Let T be a fixed tree on at least 2 vertices with odd(T ) = θ. Let Γ t be the trace of a random walk of length t on K n . Then, In particular, the theorem implies that the probability that the trace contains a fixed path (the case θ = 2) as a subgraph is 1 − o(1) if t ≫ 1. The corollary below follows easily from Theorem 1.5. Corollary 1.6. Let F be a non-empty fixed forest, and let T 1 , . . . , T z be its connected components. Let θ = max i∈[z] {odd(T i )}. Let Γ t be the trace of a random walk of length t on K n . Then, The overall proof strategy of Theorems 1.3 and 1.5 is to apply the first and the second moment methods. Our key lemma (Lemma 2.1) estimates the probability that the random walk on a random graph will traverse the edges of a fixed copy of a constant-sized graph H. We find that if t ≫ n, the probability for the appearance of a copy in the trace is asymptotically equivalent to the probability of its appearance in a uniform random choice of a subgraph of G(n, p) with t edges, and if t ≪ n, it is determined by a structural property of H, namely, by the smallest number ρ for which H admits a trail decomposition with ρ parts. For the proof of the key lemma we use standard tools from Markov chain theory, and, in particular, a result about the mixing time of random graphs.
The rest of the paper is organized as follows. In Section 2 we state the key lemma and present some preliminary results to be used in its proof. The lemma itself is proved in Section 2.1, and in Section 2.2 we use it to prove Theorem 1.3. Section 3 contains the proofs of Theorem 1.5 and Corollary 1.6. Finally, in Section 4, we conclude with some remarks and open problems.

Walking on G(n, p)
Recall that a walk on G is a sequence of vertices v 1 , . . . , v t such that for 1 ≤ i < t, {v i , v i+1 } is an edge of G, and that a trail on G is a walk in which all of these edges are distinct. Denote by ρ(G) the trail decomposition number of G, that is, the minimum number of edge-disjoint trails in G whose union is the edge set of G.
We begin with a key lemma. In what follows, we use P to denote the probability given that the initial distribution of the walk is uniform, and P µ to denote the probability given that the initial distribution is µ.
Let H be a fixed graph with ℓ ≥ 1 edges and ρ(H) = ρ. Then, whp (over the distribution of G), for a fixed copy H 0 of H in G, Moreover, if t ≫ n, then The assumption that p −1 ≪ t = O n 2−γ p in the statement of the lemma is artificial. The upper bound on t is essential for proving (in Lemma 2.6) that the random walk traverses all edges at most a constant number of times with very high probability -a fact which is clearly not true for every t. The lower bound on t is used to show that it is "too expensive" for the walk to traverse an edge of H 0 more than once (see (9)). As we will see later, these bounds on t do not affect the proofs of our main theorems.
Before proving the lemma, we state a simple corollary.
Corollary 2.2. Let H be a fixed graph with k vertices, ℓ ≥ 1 edges, m 0 (H) = m 0 and ρ(H) = ρ. Let ε, γ > 0, ν = max{m 0 , 1}, p ≥ n −1/ν+ε , G ∼ G(n, p) and p −1 ≪ t = O n 2−γ p . Finally, let Z be a random variable counting the number of copies of H in Γ t (where multiple edges are ignored). Then, whp (over the distribution of G), Proof (of the corollary). Since p ≥ n −1/ν+ε ≫ n −1/m 0 , the number of copies of H in G is whp asymptotically equal to its expectation (see for example [9,Remark 3.7]) which is Θ n k p ℓ . The result then follows from Lemma 2.1 and the linearity of expectation.
Our goal now is to prove Lemma 2.1. In what follows, ε, γ > 0 are fixed constants, p ≥ n −1+ε , G ∼ G(n, p), X 0 , X 1 , . . . , X t is a (lazy, simple) random walk on G starting at a uniformly chosen vertex, Γ t is its trace and p −1 ≪ t = O n 2−γ p . The transition rate of X from u to v is the probability and for an integer s ≥ 0 we denote Since, as is well known, G is whp connected, the sequence X forms an irreducible Markov chain, hence it has a unique stationary distribution given by (see, e.g., [12, Section 1.5]) The following lemma about the degree distribution in G(n, p) can easily be proved using standard estimates for the tail of the binomial distribution. We will use the fact that the random walk on G(n, p) "mixes well". Roughly speaking, this means that the walk quickly forgets its starting point, and the distribution of its location quickly approaches stationarity. Recall that the total variation distance between the distribution of X t and the stationary distribution is In [8], Hildebrand showed 1 that there exists a constant s = s(ε) for which, whp (and regardless of the starting distribution), d T V (X s , π) < 1/e. It follows (see, i.e., [12,Section 4.5]) that for an integer ℓ > 0, We therefore obtain the following.
Let x be a large positive constant to be determined later. Say that a vertex distribution π ′ is almost stationary if d T V (π ′ , π) = o(n −x ). The last corollary practically means that regardless of the starting distribution, after B steps, say, the distribution of the walk is almost stationary.
For a vertex v, let n v be the uniform distribution over N (v), and for s > 0 denote by η(v, s) the number of exits the walk has made from vertex v by time s. Formally, A key observation is that typically no vertex is visited too many times, hence no edge is traversed too many times. This is stated in the following two lemmas.
Lemma 2.5. For every α > 0 there exists γ ′ > 0 such that whp (over the distribution of G), the probability that the random walk (of length t) visits at least one of the vertices more than Proof. First note that we may assume that γ ≤ ε; otherwise, let t ε = n 2−ε p ≫ n 2−γ p = Ω(t). We can now prove the lemma for a walk of length t ε , and conclude that the result holds for the walk of length t.
Fix v ∈ [n] and let s = n 1−γ/2 . Observe that in order to exit v, starting at a vertex which is not v, the walk must first enter it, and in view of Lemma 2.3 the probability for that to happen at any given step is O(1/(np)). It follows that whp (over the distribution of G), For an integer a > 0, let Note that for an almost stationary distribution π ′ , and for large enough x, by the union bound we have that whp and for a > 1, there exists an almost stationary distribution π ′′ for which as the probability of visiting v at least a times is at most the probability of visiting it a − 1 times, and conditioning on that, the probability of visiting it once more, which is at most the probability of visiting it during the first B steps after exiting from it, plus the probability of visiting it at least once during s steps, starting from (another) almost stationary distribution π ′′ . By induction, for a > 2(α + 2)/γ and x > aγ/2, Now, let Consider dividing [t] into L segments of length at most s, with "buffers" of length B between them. Noting that the distribution of the first vertex is uniform (hence almost stationary), it follows from (1) and the union bound that (whp over the distribution of G) with probability o n −α−1 there exists a segment in which the walk exits v at least a times. Considering the possible visits in the buffers between the segments as well (at most BL such visits), we conclude that with probability o n −α−1 the walk exits v more than n 1−γ ′ p times by time t, for γ ′ = γ/3, say. The union bound over all vertices yields the desired result.
Lemma 2.6. For every α > 0 there exists M > 0 such that whp (over the distribution of G), the probability that the random walk (of length t) traverses at least one of the edges more than M times is o(n −α ).
Proof. For a vertex v and integer i ≥ 0, let x i v ∼ n v , independently of each other. Think of the random walk X t as follows. X 0 is sampled uniformly at random from V , and at each time t ≥ 0, X t+1 is determined as follows: with probability 1/(d(X t ) + 1) it equals X t , and with the remaining probability it equals x η(Xt,t) Xt . We think of x i v as being sampled before the walk is performed, and the walk, when it exits v for the i'th time, simply reveals x i v 2 . Let (u, v) be a directed edge. Let x i uv be the indicator of the event x i u = v. The number of traversals of (u, v) during the first η exits from u is therefore (whp) the sum of η independent Bernoulli-distributed random variables with success probability (roughly) 1/(np). Thus, the probability that (u, v) was traversed at least M times during the first η exits from u equals the probability that a binomial random variable with η trials and success probability (roughly) 1/(np) is at least M . The probability that (u, v) was traversed at least M times is at most the probability that it was traversed at least M times during the first η exits from u in addition to the probability that the walk has exited u more than η times.
Thus, by the union bound, the probability that there exists (u, v) which was traversed at least M times by time t is at most Choosing η = 2n 1−γ ′ p, with the right γ ′ , Lemma 2.5 tells us that the second term is o(n −α ), and standard concentration results for the binomial distribution tell us that for large enough M the first term is o(n −α ), concluding the proof.
For a set W ⊆ [t] denote by r(W ) the minimum number of integer intervals whose union is W . In symbols, , we say that the (i + 1)'th run is defective, and we denote by Proof. For every a = (a i ) r i=1 with a i > 0 and r i=1 a i = w, let W a be the set of W 's in W w,r with run lengths a 1 , . . . , a r . The number of W 's in W a is the number of ways to locate r runs with lengths a 1 , . . . , a r in [t] so that any two distinct runs will be separated by at least 1. For every a, this number is the number of integer solutions to the equation where we think of b 0 as the space before the first run, b r the space after the last run, and for 1 ≤ i ≤ r − 1, b i is the space between the i'th run and the one following it. Thus Since the number of a's with a i > 0 and r i=1 a i = w is the number of integer solutions to the equation The cardinality of A J,b is the number of solutions to the integer equation which is clearly at most the number of integer solutions to the equation It was shown in Claim 2.7 that |W w,r | = Θ(t r ). By a similar argument, |A J,b | = O(t r−q ). The union bound over all choices of J and b yields be the (random) set of times in which an edge from H had been traversed. That is, We are now ready to prove our key lemma.

Proof of Lemma 2.1
Let ε, γ > 0, p ≥ n −1+ε , G ∼ G(n, p) and p −1 ≪ t = O n 2−γ p . As promised in Remark 1.4, we assume that G possesses the properties guaranteed whp by Lemmas 2.3 and 2.6 and Claim 2.4. Let H be a fixed graph with ℓ ≥ 1 edges, k vertices and ρ(H) = ρ, and let H 0 be a copy of H in G. Let A be the event H 0 ⊆ Γ t , and for any W ⊆ [t] let A W be the event A ∧ (W (H 0 ) = W ).
Our goal now is to estimate P(A).
Claim 2.9. If P(A W ) is positive then Proof. The only non-obvious claim is that r(W ) ≥ ℓ + ρ− |W |. We will prove it by decomposing H 0 into at most |W | + r(W ) − ℓ trails. Suppose W 1 , . . . , W r are the r = r(W ) runs of W , and let w 1 , . . . , w r be their lengths. Let ℓ i be the number of edges of H 0 that were traversed by W i but not by W j for j < i. By removing from W i every edge that was previously traversed by either W i or by an earlier run, we create at most 1 + (w i − ℓ i ) edge-disjoint trails, which are disjoint to every trail created so far. At the end of this process we have created at most As a result of Claim 2.9, letting r w = max{1, ℓ + ρ − w}, we have:

Upper bound
Let M > 0 be such that the probability that any edge was traversed at least M times is o n −3ℓ , as guaranteed by Lemma 2.6, and let K = ℓM . Write so, noting that r ℓ = ρ it follows from (2) that Now, according to the choice of K, we have that Let W ∈ W w,r,q with w < K. In these settings, as at the beginning of any non-defective run the probability that the walk will be at a vertex of H 0 is Θ(1/n) (and there are r − q non-defective runs), at the beginning of any defective run the probability that the walk will be at a vertex of H 0 is O(1/(np)), and at any time of W , the probability that the walk will traverse an edge of H 0 is O(1/(np)).
If w < K, it follows from Claim 2.7 and Lemma 2.8 that and therefore it follows from (5) and since B ≪ tp, that and Λ w,r,0 = O (np) −w t n r , and therefore Suppose that ℓ < w < K. If t ≥ n then, since t ≪ n 2 p and using (8), and if t < n then, since t ≫ p −1 and using (8), Finally, using (8), and therefore, using (3), (4), (9) and (10), This concludes the proof of the upper bound of the first part of the lemma.

Lower bound
Proof. First note that Now, conditioning on H 0 ⊆ Γ W , the probability that an edge of H 0 is ever traversed during times not in W , can be bounded from above as follows. Let Let e = (u, v) be an arbitrary edge of H 0 with the direction assigned to it. Let i ∈ [t] W B , and assume first that i is between two consecutive runs of W . Let i 0 be the maximal element in W with i 0 < i, and let i 1 be the minimal element in W with i < i 1 . Write Observing that for every two vertices v 1 , v 2 and s > B we have p s v 1 v 2 ∼ n −1 , we have that for every u 0 , u 1 , Since this holds for every u 0 , u 1 , the probability that i ∈ W (H 0 ) is O 1/ n 2 p . Now let i ∈ W B W , and let i 0 , i 1 and s 0 , s 1 be as before. Since W ∈ W ℓ,r,0 , s 0 + s 1 ≥ 3B. Suppose first that s 0 > B. In that case, If on the other hand s 0 ≤ B then s 1 > B and we may use the reversibility of the walk to obtain a similar bound for P( e i = e | H 0 ⊆ Γ W ), and therefore, since this holds for every u 0 , u 1 , the probability that i ∈ W (H 0 ) is O(1/np).
If i < min W (or i > max W ), letting i 1 (i 0 , respectively) be as before, a similar argument, now conditioning only on the location of X at time i 1 (at time i 0 , respectively), gives the same bounds.
Since |W B | = O(B), B ≪ np and t ≪ n 2 p we have that Now, let W ∈ W ℓ,r,0 with ρ ≤ r ≤ ℓ. In this case, This can be seen as follows. Let At the beginning of the j'th run of W (which is non-defective), the probability that the walk will be at u j 1 is Ω(1/n), and the i'th time in the j'th run of W , the probability that the traversed edge is f j i , given that the location of the walk before that move is u j i , is Ω(1/(np)). Using Claim 2.10 we have that Therefore, This concludes the proof of the lower bound of the first part of the lemma.

The case t ≫ n
In this case, according to (4), and according to (9), Let W ∈ W ℓ,ℓ,0 . In this case we can give a more accurate estimate on P(A W ). There are ℓ! ways to order the edges of H 0 by their traversal times, and for each such ordering, as all the runs are non-defective and of length 1, the probability that the walk will traverse an edge at a prescribed time is approximately the inverse of the number of edges in G. Therefore, using Claim 2.10, we have that According to Claim 2.7 and (6), It follows from (7) that Now suppose that ρ ≤ r < ℓ. It follows from (8) that It follows from (3), together with (11), (12) and (13), that if t ≫ n, concluding the proof of the second part of the lemma.

Proof of Theorem 1.3
Throughout this subsection H is a fixed graph with k vertices, ℓ edges and m 0 (H) = m 0 ≥ 1, ε > 0, p ≥ n −1/m 0 +ε and G is sampled according to G(n, p).

Proof of the negative part
Assume t ≪ n 2−1/m 0 . Since p −1 ≤ n 1/m 0 −ε ≪ n ≤ n 2−1/m 0 we may assume without loss of generality that t ≫ p −1 . In addition, letting γ ≤ ε we have that t = O(n 2−γ p). Let H ′ ⊆ H with k 0 vertices and ℓ 0 edges be such that ℓ 0 /k 0 = m 0 , and write ρ = ρ(H ′ ). Let Z, Z ′ count the number of appearances of a copy of H, H ′ in Γ t , respectively. From Corollary 2.2 it follows that whp Now, if m 0 = 1 then k 0 = ℓ 0 and t ≪ n and thus whp E( Since the non-appearance of a copy of H ′ in Γ t implies that of H, Markov's inequality yields the desired result.

Proof of the positive part
Assume t ≫ n 2−1/m 0 ≥ n. We also assume, without loss of generality, that t = O n 2−γ p for sufficiently small γ > 0. For two graphs H 1 , H 2 denote by H 1 ∪ H 2 the graph whose vertex set is V (H 1 ) ∪ V (H 2 ) and whose edge set is E( Let Z, Z * count the number of appearances of a copy of H, H * in Γ t , respectively. Then, whp, Proof. According to Corollary 2.2, since t ≫ n and since m 0 ≥ ℓ/k, whp and thus E 2 (Z | G) = Θ n 2k−4ℓ t 2ℓ .
Let k ′ , ℓ ′ be the number of vertices and edges in the intersection H 1 ∩ H 2 , respectively, and note that H * has 2k − k ′ vertices and 2ℓ − ℓ ′ edges. We therefore have that, whp, and thus so, as H 1 , H 2 are intersecting, either ℓ ′ = 0 and k ′ > 0, in which case the above expression is ω(1), or ℓ ′ > 0, in which case t ℓ ′ ≫ n 2ℓ ′ −ℓ ′ /m 0 and the above expression is (since m 0 ≥ ℓ ′ /k ′ ), The following lemma shows that if two copies of H are not vertex-intersecting, then the events of their appearances in the trace are almost independent, in the sense that their covariance is very small. Lemma 2.12. Let H 1 , H 2 be two vertex-disjoint labelled copies of H in G. Let A i be the event "H i ⊆ Γ t ", and let Z i be its indicator, i = 1, 2. Then whp Proof. According to Lemma 2.1 and since t ≫ n, whp, and, since H 1 , H 2 are vertex disjoint, We now employ the second moment method to prove the positive part of the theorem.
Proof of the positive part of Theorem 1.3. Let Z count the number of copies of H in Γ t . Recall (e.g. from the proof of Lemma 2.11) that whp Let Y denote the number of copies of H in G, and recall that whp Y ∼ E(Y ). Let H = {H 1 , H 2 , . . . H Y } be the set of all copies of H in G, let Z i be the indicator of the event "H i ⊆ Γ t ", let U be the set of all possible unions of two intersecting (distinct) copies of H, and for H * ∈ U , let Z H * be the random variable counting the number of copies of H * in Γ t . Write i ∼ j if H i ∼ H j , and i ≁ j otherwise. Since |U | = O(1), and using Lemma 2.12, it follows that, whp, Chebyshev's inequality then yields the desired result.

Walking on K n , traversing trees
Recall that ρ(G) denotes the minimum number of edge-disjoint trails in G whose union is the edge set of G. In order to prove Theorem 1.5, we will prove the following theorem instead.
Theorem 3.1. Let T be a fixed tree on at least 2 vertices with ρ(T ) = ρ. Let Γ t be the trace of a random walk of length t on K n . Then, The following lemma shows that Theorems 1.5 and 3.1 are in fact equivalent. Proof. If odd(G) = 0 then G is Eulerian, thus ρ(G) = 1. Otherwise, let odd(G) = 2k, and let v 1 , v 2 , . . . , v 2k be the odd degree vertices. Create G ′ by adding the edges {v 2i−1 , v 2i }. G ′ is Eulerian; consider a tour (closed trail) T in G ′ , and remove the added edges from that tour. That creates exactly k trails which make a partition of E(G), thus ρ(G) ≤ k. On the other hand, every trail removed from E(G) decreases odd(G) by at most 2, hence ρ(G) ≥ k.

Proof of Theorem 3.1
Throughout this section T is a fixed non-empty tree with k vertices, ℓ = k − 1 edges and ρ(T ) = ρ.

Proof of the negative part
Assume 1 ≪ t ≪ n 1−1/ρ . Let Z count the number of copies of T in Γ t . According to Corollary 2.2, Since t ≪ n, we have that Markov's inequality then yields the result.

Proof of the positive part
We will need a couple of lemmas in order to prove the positive part of the theorem. Note. The above lemma does not hold for T 1 , T 2 which are not trees. For example, the star S 3 with three leaves has ρ(S 3 ) = 2, but if G = S 3 + e for any edge e in the complement of S 3 , then ρ(G) = 1. Similarly, the path P 3 of length 3 has ρ(P 3 ) = 1, but G = P 3 − e where e is the middle edge, is a forest with ρ(G) = 2.
Proof. It suffices to show that every trail in T 2 , restricted to the edges of T 1 , is a trail in T 1 . Let P be a trail in T 2 . Since T 2 is a tree, P is a path. Suppose to the contrary that the restriction of P to the edges of T 1 , P ′ , is not a path. Thus, it must have at least two connected components. Let u 1 and v 1 be two vertices of P ′ which belong to two distinct connected components. Thus in T 2 there are two distinct paths from u 1 to v 1 , one which passes through P and one which passes through T 1 , in contradiction to the fact that T 2 is a tree.
Alternative proof. In view of Lemma 3.2 it suffices to show that odd(T 1 ) ≤ odd(T 2 ), and this can be verified by starting with T 1 and incrementally adding edges until reaching T 2 , showing that each addition of an edge may not decrease the number of odd degree vertices.
Lemma 3.4. Let T 1 , T 2 be two intersecting labelled copies of T in K n . Let k ′ and ℓ ′ denote the number of vertices and edges, respectively, of the intersection T 1 ∩ T 2 , and letρ = ρ(T 1 ∪ T 2 ). Then Proof. Observe that T 1 ∩ T 2 is a forest. If it is not a tree, then k ′ − ℓ ′ ≥ 2 and the claim follows.
Consider now the case where T 1 ∩ T 2 is a tree. In that case, k ′ − ℓ ′ = 1, thus it suffices to show thatρ ≥ ρ. Note that in that case it also follows that T 1 ∪ T 2 is a tree, since it is connected with 2k − k ′ vertices and 2ℓ − ℓ ′ edges, and It follows that T is a subtree of T 1 ∪ T 2 , thus by Lemma 3.3, ρ ≤ρ.
In what follows, assume n 1−1/ρ ≪ t. We also assume without loss of generality that t ≪ n. The following lemma is the equivalent of Lemma 2.11 for the case of traversing trees.
Lemma 3.5. Let T 1 , T 2 be two intersecting labelled copies of T in K n , and let H = T 1 ∪ T 2 . Let Z, Z * count the number of appearances of a copy of T, T * in Γ t , respectively. Then Proof. According to Corollary 2.2 and since n −1/ρ ≪ t/n ≪ 1, we have that and thus E 2 (Z) = Θ n 2−2ρ t 2ρ .
Our next goal is to show that the events of the appearances of two vertex-disjoint graphs in the trace are not positively correlated. To that aim, we use a correlation inequality proved in [13]. For finite non-empty sets T and V , say that a collection F of families (W v ) v∈V of subsets of T is decreasing if for every family ( Lemma 3.6 ([13, Section 2]). Let T and I be finite non-empty sets. Let I be partitioned into two non-empty sets J and K. Let F be a decreasing collection of families (W v ) v∈J and let G be a decreasing collection of families (W v ) v∈K . Let (x j ) j∈T be a family of independent random variables, each taking values in some set containing I, and, for each v ∈ I, let S v = {j ∈ T | x j = v}. Let F be the event "(S v ) v∈J ∈ F" and let G be the event "(S v ) v∈K ∈ G". In these settings, P(F ∧ G) ≤ P(F )P(G).
Corollary 3.7. Let H 1 , H 2 be two vertex-disjoint subgraphs of K n . For i ∈ [2], let A i be the event "H i ⊆ Γ t ". Then A 1 , A 2 are not positively correlated.
Proof. It is easy to verify that if two events are not positively correlated then so are their complements. It therefore suffices to prove that the complements B 1 , B 2 of A 1 , A 2 are not positively correlated. For i ∈ [2] let H i = (V i , E i ). We say that a family (W v ) v∈V i of sets of times in {0, 1, . . . , t} misses an edge {u, v} ∈ E i if there is no j ∈ [t] such that either j − 1 ∈ W u and j ∈ W v or j − 1 ∈ W v and j ∈ W u . Let F, G be the collections of all families of sets of times which miss at least one edge from E 1 , E 2 , respectively, and observe that F, G are decreasing.
For v ∈ V , let S v be the (random) set of times at which the walk was located at v. We can now write B 1 , B 2 as the events "(S v ) v∈V i ∈ F", "(S v ) v∈V 2 ∈ G", respectively. Since X 0 , . . . , X t are independent, it follows from Lemma 3.6 (with J = V 1 , K = V 2 , T = {0, . . . , t} and x j = X j ) that P(B 1 ∧ B 2 ) ≤ P(B 1 )P(B 2 ).
Proof of the positive part of Theorem 3.1. Recall that n 1−1/ρ ≪ t ≪ n. Let Z count the number of copies of T in Γ t . Recall (e.g. from the proof of Lemma 3.5) that Let T = {T 1 , T 2 , . . . , T y } be the set of all copies of T in K n , let Z i be the indicator of the event "T i ⊆ Γ t ", let U be the set of all possible unions of two intersecting (distinct) copies of T , and for H ∈ U , let Z H be the random variable counting the number of copies of H in Γ t . Write i ∼ j if Z i and Z j are positively correlated, and recall (from Corollary 3.7) that if i ∼ j then T i ∼ T j (that is, T i , T j intersect). It follows that Since |U | = O(1), it follows from Lemma 3.5 that Var(Z) = o E 2 (Z) , and thus from Chebyshev's inequality it follows that Z > 0 whp.

Proof of Corollary 1.6
Suppose first that t ≪ n 1−2/θ . Let i ∈ [z] such that odd(T i ) = θ. By Theorem 1.5, whp T i is not a subgraph of Γ t , and hence F is not a subgraph of Γ t . Now suppose that t ≫ n 1−2/θ . We assume without loss of generality that t ≪ n. Let s = ⌊t/z⌋, and for i ∈ [z] let Γ i be the trace restricted to the times [(i − 1)s, is − 1). For i ∈ [z], let A i be the event "T i ⊆ Γ i ", and let T ′ i be the first copy of T i in Γ i (if there exists one; let it be an arbitrary tree otherwise). Note that the events A i are mutually independent. Let let B i be the event that an edge from Γ i intersects U i , and let C i = A i ∧ B i . Observe that for U ⊆ [n] with |U | = O(1), the probability that an edge from Γ i intersects U is O(s|U |/n) = o(1). It follows, using Theorem 1.5, that conditioning on C 1 , . . . , C i−1 , the probability of C i is 1−o(1), and therefore, whp, the trace contains vertex-disjoint copies T ′ 1 , . . . , T ′ z of T 1 , . . . , T z , hence it contains a copy of F .

Concluding remarks and open problems
Our results give another confirmation to the assertion that random walks which are long enough to typically cover a random graph, which is itself dense enough to be typically connected, leave a trace which "behaves" much like a random graph with a similar density. On the other hand, at least on the complete graph, the results suggest that if the random walk is of sublinear length then it leaves a trace which is very different from a random graph with similar edge density. In what other aspects do the two models differ?
In Theorem 1.5 we have found, in particular, that a fixed path P appears in the trace of a random walk on the complete graph whp as long as t ≫ 1. In fact, it is not difficult to show that if P is a path of length ℓ ≪ √ n and t ≥ ℓ, then Γ t contains a copy of P whp. This is true since a random walk of length t ≪ √ n typically does not intersect itself. It may be interesting to find thresholds for the appearance of other "large" trees. It may also be interesting to find the threshold for the appearance of forests in the trace of a random walk on a random graph. Is it true, for example, that if p ≥ n −1+ε for some ε > 0 then the thresholds are the same as in the case of p = 1? A slight variation in the proof of Lemma 3.5 works for random graphs as well, as long as ε ≥ 1/ρ, but our use of Lemma 3.6 already assumes that the locations of the random walk are independent of each other. Another possible direction would be to study the trace of the walk on other expander graphs, such as (n, d, λ)-graphs (see [11] for a survey), or on other random graphs, such as random regular graphs. The small subgraph problem for random regular graphs of growing degree was settled by Kim, Sudakov and Vu [10]. They have shown that the degree threshold for the appearance of a copy of H in a random regular graph is n 1−1/m 0 (H) , as long as H contains a cycle. Is it true that for d ≥ n 1−1/m 0 (H)+ε , the time threshold for the appearance of H in the trace of a random walk on a random d-regular graph is also typically n 2−1/m 0 (H) , as in Theorem 1.3?