Counting orientations of random graphs with no directed k-cycles

For every $k \geq 3$, we determine the order of growth, up to polylogarithmic factors, of the number of orientations of the binomial random graph containing no directed cycle of length $k$. This solves a conjecture of Kohayakawa, Morris and the last two authors.


Introduction
An orientation H of a graph H is an oriented graph obtained by assigning an orientation to each edge of H.The study of the number of H-free orientations of a graph G, denoted by D(G, H), was initiated by Erdős [7], who posed the problem of determining D(n, H) := max D(G, H) : |V (G)| = n .For tournaments, this problem was solved by Alon and Yuster [2], who proved that D(n, T ) = 2 ex(n,K k ) holds for any tournament T on k vertices if n ∈ N is sufficiently large as a function of k.
Let C k denote the directed cycle of length k.Bucić and Sudakov [5] determined D(n, C 2ℓ+1 ) for every ℓ 1 as long as n is sufficiently large, extending the proof in [2].Another extension of the results in [2] was given by Araújo, Botler, and the last author [3] who determined D(n, C 3 ) for every n ∈ N (see also [4]).
A first step towards determining log D(G(n, p), C k ) for k 4 was also given in [6], where it was proved that log D(G(n, p), C k ) = O n/p .Moreover, they proved that a natural generalisation of the lower bound construction used in the proof of Theorem 1.1 gives log D(G(n, p), C k ) = Ω n p 1/(k−2) (1) with high probability when p ≫ n −1+1/(k−1) .They conjectured that this lower bound is sharp up to polylogarithmic factors, and we confirm this conjecture by proving the following result.
Theorem 1.2.Let k 3 and p = p(n) ≫ n −1+1/(k−1) .Then, with high probability as n → ∞, The proof of this result will be outlined in the next section, but we present here a short overview of three key ideas in the proof.First, we ensure that the graph encoding (k − 2)-paths is dense enough to apply the graph container lemma in an unexpected way.To do so, we define, for each 1 r k − 2, a pseudorandomness condition on the number of directed r-paths between small sets, and split the proof into k − 2 cases according to whether such a pseudorandomness condition holds for a given r.We design these conditions in such a way that the case r = 1 holds for any orientation of G(n, p) with high probability, and such that we may finish the proof using the graph container method (introduced by Kleitman and Winston [8], and rediscovered and developed by Sapozhenko [10]) if the condition holds for r = k − 2. The second key idea is how to deal with orientations that do not satisfy the pseudorandomness condition for some 2 r k − 2. In this situation, we provide a way to efficiently "encode" the orientations that do not satisfy the condition for some value of r but do for all smaller values.
We remark that, to implement the above two ideas, we need to construct the orientation "online", that is, to consider a subgraph H ⊂ G(n, p), and for each possible orientation H of H, reveal the randomness between a new subset of vertices and V (H) and consider all ways to extend H. Counting orientations of G(n, p) is, however, an "offline" problem: when exposing G(n, p) in multiple rounds, the orientation of an early-round edge may depend on the randomness of later rounds.To circumvent this fact, we use our third key idea, which is to count the expected number of orientations of G(n, p) that are C ℓ+2 -free.When estimating this expectation we will be able to split it in a way that makes possible to proceed inductively and use the randomness in steps after orienting part of the edges.

Outline of the proof of Theorem 1.2
We start by presenting a short sketch of the proof of Theorem 1.2 for C 3 , as proved in [6].This will motivate the idea behind the proof for general directed cycles C k .[6].The idea is to obtain, by induction on the number of vertices, the following upper bound on the number of C 3 -free orientations of an n-vertex graph G:

The proof in
In order to obtain such a bound, let G be a graph on vertex set V and consider v ∈ V .Let H = G \ {v} and suppose that the number of C 3 -free orientations of H is .
Then, for each C 3 -free orientation G of G, let H be its restriction to H and pick The key observation is that, by the minimality of T , the vertex sets N + T (v) and N − T (v) are independent sets in H, so there are at most n α(G) 2 choices for T .This together with (3) and α(H) α(G) completes the proof of (2).Since α(G(n, p)) 3 log n p holds with high probability, one can check that the bound (2) implies Theorem 1.2 for C 3 .
We will generalise the ideas depicted above in two ways, which will be described in the next two subsections.Directed paths of length k − 2 starting or ending in the neighbourhood of a vertex will play a key role in our proofs.For this reason, we fix ℓ = k − 2 1, and our aim is to count orientations of G(n, p) avoiding copies of C ℓ+2 .
2.2.Pseudorandomness.To count the desired orientations of G(n, p), we define a "pseudorandom" oriented graph property, and we proceed to separately count the C ℓ+2free orientations depending on whether some already-oriented subgraph H is pseudorandom.We then use the randomness of G(n, p) in a stronger way, exposing the randomness bit by bit in each step of the induction.
Let us discuss the pseudorandom property we mentioned in the previous paragraph.We write P r for the directed path with r edges and, given a oriented graph G, we denote by G r the digraph such that (u, v) is an edge whenever there is a P r from u to v in G. Roughly speaking, we say an oriented graph G is r-locally dense (for a complete description of this property, see Definition 3.2), if for all disjoint sets A ′ , B, X ⊂ V (G) of size roughly (log n)/p, where G \ X is a shorthand for G[V (G) \ X] and e ( G\X) r (A ′ , B) denotes the number of edges between A ′ and B (in Observe that being 1-locally dense does not depend on the orientation of the graph (and the set X plays no role in this case), i.e., being 1-locally dense is a pseudorandom property that depends only on the underlying graph G.By Chernoff's inequality, any orientation of G(n, p) is 1-locally dense with high probability, and one may think of this property as a strengthening of the fact that α(G(n, p)) 3 log n p .
2.3.Sketch of the proof.We will count separately the orientations which are ℓ-locally dense and the orientations which are not r-locally dense but are (r − 1)-locally dense for some 2 r ℓ.To count the C ℓ+2 -free, ℓ-locally dense orientations G (see Lemma 3.6 (ii)), we proceed similarly to the proof in [6]: let v ∈ V , put H = G \ {v}, and let H be the restriction of G to H.Moreover, let T ⊂ E( G) \ E( H) be minimal such that G is the only C ℓ+2 -free orientation of G containing T ∪ H.Note that, since we are avoiding copies of C ℓ+2 , the sets T + := N + T (v) and T − := N − T (v) are independent sets in H ℓ by minimality of T .Since G is ℓ-locally dense, the edge density of H ℓ is at least of order p 1/ℓ .This allows us to prove that the largest independent set in N G (v) has size roughly (log n)/p 1/ℓ , which will be enough to finish the proof of this case using the graph container lemma.
To count orientations G that are not r-locally dense but are (r − 1)-locally dense (see Lemma 3.6 (i)), we use the fact that there are "large" disjoint sets |B|, where d (a, B) denotes d + (a, B) + d − (a, B) (for simplicity, in this outline we assume the set X in ( 4) is empty).Put H = G \ A and note that, since G is (r − 1)-locally dense, H r−1 has "many" edges between any two "sufficiently large" sets 2 .Now given a ∈ A we may choose |B|.

We claim that |S
|B|/4 paths of length r starting with the edge av or ending with the edge va, so if ) would be too large.Moreover, we are able to use the randomness of G to show that S + and S − determine the orientation of all but a very small number of edges of G between a and V (H).

The main result
In this section our goal is to count orientations of G(n, p) containing no copies of C ℓ+2 .We prove the following result, which implies Theorem 1.2.
2 Note that we want H r−1 = ( G \ A) r−1 to have many edges between pairs of sets.This does not directly follow from G being (r − 1)-locally-dense, because many (r − 1)-paths could pass through A. The set X in the definition of r-locally-dense graphs is used to handle this issue.
We present the proof of Theorem 3.1 (assuming the validity of Lemma 3.6, which will be proved in Sections 4 and 5) at the end of the section.Throughout the rest of the paper, ℓ, n and p will be fixed, all graphs will have vertex set contained in [n], and we set For any oriented graph G, its underlying undirected graph will be denoted by G.We recall other useful notation introduced in Section 2: Given a graph G, the digraph G r contains the edge (u, v) precisely whenever there is an oriented path of length r starting at u and ending at v in G.Moreover, G \ X is a shorthand for G[V (G) \ X], and, for disjoint sets A, B ⊂ V (G), e G (A, B) denotes the number of edges between A and B (in either direction) in G.
The following definition will be used to "encode" orientations of C ℓ+2 -free graphs.
we have Otherwise, the orientation G is called r-locally-sparse.
Even though the following lemma is a trivial application of Chernoff's inequality together with the fact that the definition of 1-locally-dense depends solely on the underlying undirected graph and not on the orientation of the edges, it will be crucial.Lemma 3.3.With high probability every orientation of G(n, p) is 1-locally-dense.

Given a graph G and an induced subgraph
. Furthermore, we say that G extends H. Due to Lemma 3.3, in the rest of the paper we count 1-locally-dense C ℓ+2 -free orientations.Definition 3.4.Let G = (V, E) be a graph and let H be an orientation of an induced subgraph H of G.We denote by D r (G, H) (resp.S r (G, H)) the set of all 1-locally-dense, C ℓ+2 -free orientations of G that extend H and are r-locally-dense (resp.r-locally-sparse).For convenience, we also write D r (G) for D r (G, ∅) and S r (G) for S r (G, ∅).
In view of Lemma 3.3 and using the language described in Definition 3.4, our goal is to prove that |D 1 (G(n, p))| exp 13ℓn(log n) 2 /p 1/ℓ holds with high probability.
Note that if G ∈ S r (G), then there exist pairwise disjoint sets A ′ , B and X of V (G) satisfying ( 5) such that (6) fails to hold.This fact implies the existence of |B| for every a ∈ A. This motivates the following definition, where H will play the role of G \ A. Recall that α = 2 6 (log n)/p.Definition 3.5.Let H be a graph, A ⊂ [n] \ V (H) and let B and X be disjoint subsets of V (H).The quadruple (A, H, B, X) is an r-frame if Given an an r-frame (A, H, B, X), an orientation H of H, and a graph |B| for every a ∈ A.
We let S r (G, H, B, X) denote the set of all orientations of G that are (r, B, X)-sparse extensions of H. Observe that we have where the first union is over all (A, B, X) such that (A, G \ A, B, X) is an r-frame.
Given a graph H and a set A disjoint from V (H), we define G(A, H, p) as the random graph G on vertex set is present in E(G) with probability p independently at random.We are now ready to state the main tool for the proof of Theorem 3.1, consisting of two bounds on the expected number of extensions of a digraph H. Its proof is postponed to Sections 4 and 5. (i) If 2 r ℓ and B, X ⊂ V (H) are such that (A, H, B, X) is an r-frame, then Before proving Theorem 3.1, we state a simple probabilistic estimate which will be used a few times throughout the paper.Lemma 3.7.Let 0 p 1 and C > 0. If S p is a p-random subset of a finite set S, then Proof.Since P(|S p | = t) p|S| t /t! for every t 0, we can compute as claimed.
We are ready to prove Theorem 3.1.
Proof of Theorem 3.1.Recall that n is fixed, and put z := exp 4(ℓ + 2)p − 1 ℓ (log n) 2 .We will show by induction on n ′ n that which together with Lemma 3.3 and Markov's inequality implies the desired result since 4(ℓ + 2) 12ℓ.Note that if n ′ p −1−1/ℓ (log n) 2 holds, then an application of Lemma 3.7 gives Therefore, we may assume n ′ > p −1−1/ℓ (log n) 2 , which implies p ≫ (log n)/n.We claim that it is enough to prove that Indeed, by ( 9) and the induction hypothesis we obtain which proves (8).Thus, the remainder of the proof is dedicated to showing that (9) holds.Let G = G(n ′ , p) and notice that, since every 1-locally-dense orientation is either ℓ-locally dense or admits a minimal 2 r ℓ for which it is r-locally sparse, we have Thus, it suffices to bound the expected sizes of the sets in the right-hand side of (10).
Let A ⊂ V (G) be an arbitrary set of size α/2, and let H = G \ A and F be the graph with . Observe that F and H are independent.Therefore, where the sums are over H ∈ D 1 (H).Conditioned on H (that is, on G \ A = H), the distribution of F ∪ H is the same as G(A, H, p).Then, from Lemma 3.6(ii) we obtain and hence, by (11), To bound the expected sizes of the remaining sets of the right-hand side of (10), we proceed analogously.For any 2 r ℓ, using (7) we have where the first sums are over all triples (A, B, X) such that (A, H, B, X) is an r-frame for H = G \ A. Since there are at most n (2ℓ+1)α z α/4 such triples, an application of Lemma 3.6(i) gives By (10), we thus have which verifies (9) and concludes the proof of Theorem 3.1, since ℓ p −1/ℓ z α/6 .

Extending locally-sparse orientations
The main goal of this section is to prove Lemma 3.6(i), which bounds the expected number of (r − 1)-locally dense, (r, B, X)-sparse extensions of an oriented graph H.The deterministic part of the proof is the following proposition.We remark that, although we intentionally state the result in a way that emphasises its container-type nature, its proof does not use the Hypergraph Container Lemma.Proposition 4.1.Let H be an oriented graph and 2 r ℓ.If (A, H, B, X) is an r-frame, then there exists a family C of digraphs on vertex set A ∪ V (H) such that Proof of Proposition 4.1.The proof loosely follows the idea behind the proof of the Kleitman-Winston graph container lemma.We will describe an algorithm which takes as input a fixed graph G on vertex set A ∪ V (H) and an orientation G ∈ D r−1 (G) ∩ S r (G, H, B, X), and outputs a bipartite digraph C with parts A and V (H) trivially satisfying properties (i) and (ii).Along with C, the algorithm will output a special subgraph T ⊂ C, called a fingerprint, which will be useful for proving (iii).
Recall that α = 2 6 (log n)/p.Recall also, from the definition of r-frame, that A ⊂ Algorithm 1: Encode: A container-like algorithm for C ℓ+2 -free extensions of H with ties broken canonically We will denote the outputs of Encode( G) by T ( G) and C( G), respectively.Define Observe that, for every extension G of H, it holds that E( T ) ⊂ E G (A, V (H)), since edges are only added to T in line 10.Moreover, whenever e i = uw is added to C in line 10, it holds that wu ∈ E( G), and therefore E G (A, V (H)) ⊂ E( C), verifying property (i).Similarly, property (ii) holds because, for every a ∈ A, the loop in line 15 adds |V (H)| − L 2ℓα pairs of antiparallel edges to C by the choice of L, and the other places in which C is modified (lines 10 and 13) add edges in one direction only.
Showing that C satisfies property (iii) will require the most amount of work.The intuition for it (which will be formalised in Claim 4.3) is easy to describe, however: the if-statement in lines 5-8 determines the orientation of {a, v i } that "extends the majority of (r − 1)-paths" with one endpoint in B i to r-paths.If this directed edge is in G, it is added to T .Therefore, if the input G is (r − 1)-locally-dense, each edge added to T extends Ω(p extension of H, however, there can be at most O(p ℓ−r+1 ℓ |B|) r-paths starting or ending at a given a ∈ A. Therefore, at most O(p −1/ℓ ) edges can be added to T in line 10 for each a ∈ A. Since T determines C (Claim 4.2), this implies that there are few choices for C.
We start the formal proof of (iii) by showing that, given an oriented graph H and an r-frame (A, H, B, X), one of the outputs of the algorithm, C, is determined by the other.
Proof.Line 9 is the only time at which the algorithm examines edges outside V (H).Therefore, if C( G 1 ) = C( G 2 ), we may suppose without loss of generality there exists a ∈ A and 1 i L such that e i ∈ E( G 1 ) and e i ∈ E( G 2 ).If i is minimal with this property, then e i is the same in both executions, but then e i is added to T ( G 1 ) and not added to T ( G 2 ), contradicting the fact that If the extension G of H given as input to Encode is not restricted, then it is possible for the graph T to have many edges.Roughly speaking, the following claim shows this cannot happen when G ∈ D r−1 (G) ∩ S r (G, H, B, X).In other words, for these digraphs, T can be thought of as an "efficient encoding" of most of the edges of E G (A, V (H)).
Proof.Fix a ∈ A, and let S be the set of values of i ∈ [L] for which lines 10 and 11 of the algorithm are executed (that is, for which e i ∈ E( G)).Observe that |S| = d T (a), since only line 10 adds edges to T .Therefore, our goal is to upper bound |S|.We claim that 1 Indeed, the second inequality follows directly from the assumption that G ∈ S r (G, H, B, X).
To see the first inequality, let S + ⊂ S be those values of i for which ), let S − = S \ S + , and define ), since we can use the edge e i to extend an (r − 1)-path starting or ending at v i to an r-path starting or ending at a.Moreover, since N i ⊂ B i−1 by definition and N j ∩ B i−1 = ∅ if j < i by line 11, the family ) by line 5 (that is, by the condition used to decide whether an i ∈ S is in S + or S − ), we obtain (13).
We will obtain an upper bound on |S| by lower bounding the terms in the left-hand side sum of (13), which will use the assumption that G ∈ D r−1 (G).To do so, recall that v i was chosen in line 4 to maximise f We want to use the hypothesis G ∈ D r−1 (G) to bound the right-hand side of (14).For that, from Definition 3.
We have already seen that the collection C, defined in (12), satisfies the claimed properties (i) and (ii), and we are now ready to prove (iii).Let Proof of Lemma 3.6(i).Let G = G(A, H, p), recalling that, by definition, we have  We can take expectations on both sides and apply Lemma 3.7 to obtain where the last inequality uses Proposition 4.1(ii)-(iii) to bound |D( C)| and |C|, respectively.Since pα = 2 6 log n and p (2 7 ℓ) −ℓ , we have ℓpα p −1/ℓ (log n)/2.Therefore, This finishes the proof.

Extending locally-dense orientations
In this section we count the number of ℓ-locally dense orientations.For that we use the graph container lemma, implicit in the work of Kleitman and Winston [8] and explicitly stated by Sapozhenko [10].The version we use can be found on a survey of Samotij [9].Lemma 5.1 ([9, Lemmas 1 and 2]).Let G be a graph on n vertices, an integer q and reals 0 β 1 and R such that R e −βq n.Suppose that every set Then there exists a collection C ⊂ P(V (G)) such that: The following simple averaging result will be useful for applying the graph container lemma in the proof of Lemma 3.6 (ii).Lemma 5.2.Let G be an ℓ-locally-dense oriented graph.For every pair of disjoint sets U, X ⊂ V (G) with |U| (ℓ + 1)α and |X| = α, the graph Proof.Let W be a random subset of U of size (ℓ + 1)α.By splitting W arbitrarily into two sets of size α and ℓα and applying the hypothesis that G is ℓ-locally-dense, we see that On the other hand, the probability that an edge of , and the result follows.
We are now ready to estimate the expected number of ℓ-locally dense extensions of an oriented graph H. Recall that we need to show that Proof of Lemma 3.6 (ii).Given the random graph G = G(A, H, p) and an orientation H, we want to find the expected size of D ℓ (G, H), that is, the expected number of C ℓ+2 -free, ℓ-locally-dense extensions of H.We will follow the proof strategy from [6].For each orientation G, let We claim that T + a is an independent set in H ℓ .Indeed, suppose there are x, y ∈ T + a such that xy ∈ E( H ℓ ).Let T ′ = T \ {ay} and observe that every orientation containing T ′ ∪ {ya} ∪ H contains a C ℓ+2 of the form ax P ya for some path P ⊂ H of length ℓ.Therefore, any C ℓ+2 -free orientation of G containing T ′ ∪ H also contains the edge ay, contradicting the minimality of T .By symmetry, the sets T − a , defined analogously for a ∈ A, are also independent sets in H ℓ .With this in mind, set To bound |T 1 | using the graph container lemma (Lemma 5.1), set β = p 1/ℓ 2(ℓ + 1) , q = 2(ℓ + 1) log n p 1/ℓ , R = (ℓ + 1)α.
Using Lemma 5.2, one can check that these constants satisfy the conditions of Lemma 5.1, from which we obtain a family C of containers for the independent sets of H ℓ .Therefore, since T + a and T − a are independent sets in H ℓ contained in N G (a) for each a ∈ A, we obtain n i en q q e q log n for every a ∈ A. Moreover, since |C| R + q 2R for every C ∈ C, we can apply Lemma 3. Plugging these bounds in (18) and recalling that |A| = α/2, R = (ℓ + 1)α and q = 2(ℓ + 1)p −1/ℓ log n, we have where in the last inequality we used that ℓpα = o(p −1/ℓ (log n) 2 ), a consequence of pα = 2 6 log n and p (2 7 ℓ) −ℓ .This finishes the proof.

Concluding Remarks
This paper fits into the effort of understanding the number of H-free orientations of G(n, p), and there is still much to be understood about this problem.It is still an open problem to provide good estimates on log D(G(n, p), H) when H is a strongly connected tournament with at least 4 vertices.We remark that a more general version of Conjecture 6.1 appeared in [6].Coming back to the case studied in the present paper, there are also several open problems when H is a directed cycle.We believe the result in Theorem 3.1 can be tightened as in the following.The lower bound for this conjecture was proved in [6], but the upper bound is not known even in the case k = 3.It would also be interesting to understand the behaviour of log D(G(n, p), C k ) as k grows with n.It is not clear to us what should happen when k ≫ log n for instance.

Lemma 3 . 6 .
Let H be an oriented graph and A ⊂ [n] \ V (H) of size α/2.The following holds for G = G(A, H, p).

10 add
the edge e i to T and toC 11 B i ← B i−1 \ N ( H\X) r−1 (v i )12 else 13 add the edge reverse(e i ) to C, where reverse(uw) = wu 14 B i ← B i−1 15 foreach v ∈ V (H) \ {v 1 , . . ., v L } do 16 add the edges av and va to C 17 return T and C 2, we need that |A ′ | = α, (r − 1)α |B i−1 | ℓα, and |X ∪ A| (ℓ + 2 − r)α.It suffices to show that |B i−1 | (r − 1)α, since the other bounds hold trivially.We observe that |B 0 | = |B| and, for every i ∈ [L], and notice that by Claim 4.2 we have |C| = |T |.Moreover, Claim 4.3 implies that 1/ℓ log n , since to choose a T ∈ T it suffices to choose N + T (a) and N − T (a) for each a ∈ A. Having proved Proposition 4.1, we are now ready to deduce Lemma 3.6(i) from Proposition 4.1.

2
is an edge of G with probability p independently at random.Let O = D r−1 (G) ∩ S r (G, H, B, X), and recall that our goal is to bound the expected size of O.

Let 2 N
C be given by Proposition 4.1 and say an orientationG ∈ O is compatible with a container C ∈ C if E G (A, V (H)) ⊂ E( C),and let D( C) be the set of pairs {u, v} for which {uv, vu} ⊂ E( C).Given a container C ∈ C, let N( C) = |E(G) ∩ (D( C) ∪ (A × A))| and observe that 2 N ( C) is an upper bound on the number of orientations G ∈ O which are compatible with C.Moreover, by Proposition 4.1(i), every element of O is compatible with at least one element of C, and therefore |O| C∈C ( C) .

4
|C∩N G (a)| , (16)where the last inequality follows by convexity.On the other hand, it is clear that the setT 2 = { T ( G) ∩ (A × A) : G ∈ D ℓ (G, H)} satisfies |T 2 | 3 |E(G)∩(A×A)| .(17)Since T ( G) uniquely determines an orientation G ∈ D ℓ (G, H) by definition, we can use linearity of expectation and the fact that the exponents in (16) and (17) depend on pairwise disjoint sets of edges of G to obtainE |D ℓ (G, H)| E 3 |E(G)∩(A×A)| •