## Abstract

We investigate the number of permutations that occur in random labellings of trees. This is a generalisation of the number of subpermutations occurring in a random permutation. It also generalises some recent results on the number of inversions in randomly labelled trees (Cai et al. in Combin Probab Comput 28(3):335–364, 2019). We consider complete binary trees as well as random split trees a large class of random trees of logarithmic height introduced by Devroye (SIAM J Comput 28(2):409–432, 1998. https://doi.org/10.1137/s0097539795283954). Split trees consist of nodes (bags) which can contain balls and are generated by a random trickle down process of balls through the nodes. For complete binary trees we show that asymptotically the cumulants of the number of occurrences of a fixed permutation in the random node labelling have explicit formulas. Our other main theorem is to show that for a random split tree, with probability tending to one as the number of balls increases, the cumulants of the number of occurrences are asymptotically an explicit parameter of the split tree. For the proof of the second theorem we show some results on the number of embeddings of digraphs into split trees which may be of independent interest.

## Introduction and Statement of Results

Our two main results are the distribution of the number of appearances of a fixed permutation in random labellings of complete binary tree and split trees. Theorem 1.3 gives the distribution of the number of appearances of a fixed permutation in a random labelling of a complete binary tree. A split tree, see Sect. 1.3, is a random tree consisting of a random number and arrangement of nodes and non-negative number of balls within each node. We say an event \({\mathscr {E}}_n\) occurs *with high probability (whp)* if \({\mathbb P}({\mathscr {E}}_n)\rightarrow 1\) as \(n\rightarrow \infty\). Theorem 1.6 shows that for a random split tree with high probability, a result similar to Theorem 1.3 holds for the number of appearances of a fixed permutation in a random labelling of the balls of the tree. We write a complete introduction and statement of results in terms of complete binary trees first before defining split trees and stating our results for split trees. This paper extends the conference paper [1].

### Patterns in Labelled Trees

Let *V* denote the node set of a tree \(T_n\) with *n* nodes. Define a partial ordering on the nodes of the tree by saying that \(a < b\) if *a* is an ancestor of *b*. Suppose we have a labelling of the nodes \(\pi : V \rightarrow [n]\).

We say that nodes *a* and *b* form an *inversion* if \(a<b\) and \(\pi (a)>\pi (b)\). The enumeration of labelled trees with a fixed number of inversions has been studied by Gessel et al. [8], Mallows and Riordan [13] and Yan [16].

One can also extend the notion of inversions in labelled trees to longer permutations. For example, the number inverted triples in a tree *T* with labelling \(\pi\) is the number of triples of vertices \(u_1<u_2<u_3\) with labels such that \(\pi (u_1)>\pi (u_2)>\pi (u_3)\). In general, we say a permutation \(\alpha\) appears on the \(|\alpha |\)-tuple of vertices \(u_1, \ldots , u_{|\alpha |}\) , if \(u_1<\cdots < u_{|\alpha |}\) and the induced order \(\pi (u)=(\pi (u_1), \ldots , \pi (u_{|\alpha |}))\) is \(\alpha\). Write \(\pi (u)\approx \alpha\) to indicate the induced order is the same: for example \(527\approx 213\). Permutations in labelled trees have been studied before: Anders et al. [2] and Chauve et al. [4] enumerated labelled trees avoiding permutations in the labels.

We shall be interested in the number of permutations in random labellings of trees. From now on, for fixed trees we let \(\pi : V \rightarrow [n]\) be a node labelling chosen uniformly from the *n*! possible labellings (for split trees \(\pi\) is a uniformly random ball labelling). The (random) number of inversions in random node labellings of fixed trees as well as some random models of trees were studied in [7, 14] and extended in a recent paper [3]. The nice paper [12] by Lackner and Panholzer studied runs in labelled trees; i.e. the permutations \(12\ldots k\) and \(k\ldots 21\) for constant *k*. Their paper gives both enumeration results as well as a central limit law for runs in randomly labelled random rooted trees. This new paper finds approximate extensions to some of the results in [3].

We now define the notation we will use. The number of inverted triples in a fixed tree *T* is the random variable \(R(321,T)=\sum _{u_1<u_2<u_3} \mathbf{1}[\pi (u_1)>\pi (u_2)>\pi (u_3)]\) where the sum runs over all triples of nodes in *T* such that \(u_1\) is an ancestor of \(u_2\) and \(u_2\) an ancestor of \(u_3\). For a tree *T* and uniformly random node labelling define

so in particular *R*(21, *T*) counts the number of inversions in a random labelling of *T*. (For split trees we take \(\pi\) to be a uniformly random ball labelling and the balls get a partial relation of ancestor induced by the nodes: see Sect. 1.3 for details.)

Let *d*(*v*) denote the *depth* of *v*, i.e., the distance from *v* to the root \(\rho\). For any \(u_1< \cdots < u_{|\alpha |}\) we have \(\mathbb {P}[\pi (u) \approx \alpha ] = 1/|\alpha |!\) and so it immediately follows that,

For length two permutations, e.g. inversions, \(\mathbb {E} \left[ R(21,T)\right] =\frac{1}{2}\Upsilon (T)\) the tree parameter \(\Upsilon (T) \,{\buildrel {\mathrm {def}} \over =}\,\sum _{v} d(v)\) is called the *total path length* of *T*. We will state our results in terms of a tree parameter \(\Upsilon ^k_r(T)\) which generalises the notion of total path length.

Defining \(\Upsilon _{r}^k(T)\) will allow us to generalize (1.1) to higher moments of \(R(\alpha ,T)\). For *r* nodes \(v_1, \ldots , v_r\) let \(c(v_1, \ldots ,v_r)\) be the number of ancestors that they share and so

which is also the depth of the least common ancestor plus one. That is \(c(v_1,\ldots ,v_r)=d(v_1\vee \ldots \vee v_r)+1\) where we write \(v_1\vee v_2\) for the least common ancestor of \(v_1\) and \(v_2\). The ‘off by one error’ is because the root is in the set of common ancestors for any subsets of nodes but we use the convention that the root has depth 0. Also define

where the sum is over all ordered *r*-tuples of nodes in the tree and with the convention \(\left( \begin{array}{c}{x}\\ {0}\end{array}\right) =1\). For a single node *v*, \(d(v)=c(v)-1\), since *v* itself is counted in *c*(*v*). So \(\Upsilon (T)=\Upsilon _1^2(T)-|V|\); i.e., we recover the usual notion of total path length. The \(k=2\) case recovers the *r*-total common ancestors \(\Upsilon _{r}^2(T)=\sum _{v_1,\ldots , v_r}c(v_1,\ldots ,v_r)\) defined in [3].

Indeed the distribution of the number of inversions in a fixed tree has already been studied in [3]. Similarly to the way one can describe a distribution by giving all finite moments, we may also describe a distribution via its cumulant moments. The cumulants, which we denote by \(\varkappa _r=\varkappa _r(X)\), are the coefficients in the Taylor expansion of the log of the moment generating function of *X* about the origin (provided they exist)

thus \(\varkappa _1(X)=\mathbb {E} \left[ X\right]\) and \(\varkappa _2(X)={\mathrm {Var}}\left( X\right)\). For more information on cumulants see for example [11, Section 6.1].

### Theorem 1.1

(Cai et al. [3]) Let *T* be a fixed tree, and denote by \(\varkappa _{r}=\varkappa _r(R(21,T))\) the *r*th cumulant of *R*(21, *T*). Then for \(r\ge 2\),

where \(B_r\) denotes the *r*th Bernoulli number.

### Remark 1.2

In essence Theorem 1.1 (Cai et al. [3]) shows the *r*th cumulant of the number of inversions is a constant times \(\Upsilon _{r}^2(T)\). Our main result on complete binary trees, Theorem 1.3 (respectively Theorem 1.6 on split trees), shows that for any fixed permutation \(\alpha\) of length *k* for complete binary trees (and whp for split trees) the *r*th cumulant is a constant times \(\Upsilon _{r}^k(T_n)\) asymptotically. The exact constant is defined in Eq. (6.1) and is a little more involved than for inversions but observe it is a function only of the moment *r* and the length of \(k=|\alpha |\) together with the first element \(\alpha _1\) of the permutation \(\alpha =\alpha _1\ldots \alpha _k\).

### Complete Binary Trees

We move on to stating our results. For the case of *T* a complete binary tree on *n* vertices we asymptotically recover Theorem 1.1 [3] for large *n*. Moreover we extend it to cover any fixed permutation \(\alpha\) for complete binary trees.

The first of our theorems gives the distribution of the number of \(\alpha\) in a random labelling of the nodes in a complete binary tree. This result formed Theorem 2 in the extended abstract version of the paper however there was an error in the definition of the constant \(D_{\alpha ,r}\) for \(r>2\) which has now been corrected.

### Theorem 1.3

Let \(T_n\) be the complete binary tree with *n* nodes and fix a permutation \(\alpha =\alpha _1\ldots \alpha _k\) of length *k*. Let \(\varkappa _{r}=\varkappa _r(R(\alpha ,T_n))\) be the *r*th cumulant of \(R(\alpha ,T_n)\). Then for \(r\ge 2\), there exists a constant \(D_{\alpha ,r}\) depending only on \(\alpha\) and *r* such that,

An explicit formula for \(D_{\alpha ,r}\) is derived in Eq. (6.1) and in the “Appendix”, we list values of \(D_{\alpha ,r}\) for permutations \(\alpha\) of length at most 6 and moments \(r\in \{1,\ldots ,5\}\). The explicit formula (6.1) implies the following corollary.

### Corollary 1.4

Let \(T_n\) be the complete binary tree with *n* nodes. For permutations \(\alpha\) of length 3, the variance is

and more generally for \(\alpha =\alpha _1\alpha _2\ldots \alpha _k\),

### Remark 1.5

The methods in the proofs are very different for inversions and general permutations. In [3], the method takes advantage of a nice independence property of inversions. For a node *u* let \(I_u\) be the number of inversions involving *u* as the top node: \(I_u=|\{w: u<w, \pi (u)>\pi (w)\}|\). Then the \(\{I_u\}_u\) are independent random variables and \(I_u\) is distributed as the uniform distribution on \(\{0,\ldots , |T_u|\}\) where \(T_u\) is the subtree rooted at *u*, see Lemma 1.1 of [3].

Without a similar independence property for general permutations our route instead uses nice properties on the number of embeddings of small digraphs in both complete binary trees and, whp, in split trees. This property allows us to calculate the *r*th moment of \(R(\alpha , T)\) directly from a sum of products of indicator variables as most terms in the sum are zero or negligible by the embedding property.

### Split Trees

Split trees were first defined in [5] and were introduced to encompass many families of trees that are frequently used in algorithm analysis, e.g., binary search trees [9], *m*-ary search trees [15] and quad trees [6]. The full definition is given below but note that a split tree is a random tree which consists of nodes (bags) each of which contains a number of balls. We will study the number of occurences of a fixed subpermutation \(\alpha\) in a random ball labelling of the split tree.

The random split tree \(T_n\) has parameters \(b, s, s_0, s_1, {\mathscr {V}}\) and *n*. The integers \(b, s, s_0, s_1\) are required to satisfy the inequalities

and \({\mathscr {V}}=(V_1,\dots ,V_b)\) is a random non-negative vector with \(\sum _{i=1}^b V_i = 1\) (the components \(V_i\) are probabilities).

We define \(T_n\) algorithmically. Consider the infinite *b*-ary tree \({\mathscr {U}}\), and view each node as a bucket or bag with capacity *s*. Each node (bag) *u* is assigned an independent copy \({\mathscr {V}}_u\) of the random split vector \({\mathscr {V}}\). Let *C*(*u*) denote the number of balls in node (bag) *u*, initially setting \(C(u) = 0\) for all *u*. Say that *u* is a *leaf* if \(C(u) > 0\) and \(C(v) = 0\) for all children *v* of *u*, and *internal* if \(C(v) > 0\) for some proper descendant *v*, i.e., \(v > u\). We add *n* balls labeled \(\{1,\dots ,n\}\) to \({\mathscr {U}}\) one by one. The *j*th ball is added by the following “trickle-down” procedure.

- 1.
Add

*j*to the root. - 2.
While

*j*is at an internal node (bag)*u*, choose child*i*with probability \(V_{u,i}\), where \({\mathscr {V}}_u=(V_{u,1}, \dots ,V_{u,b})\) is the split vector at*u*, and move*j*to child*i*. - 3.
If

*j*is at a leaf*u*with \(C(u) < s\), then*j*stays at*u*and we set \(C(u) \leftarrow C(u) + 1\). If*j*is at a leaf with \(C(u) = s\), then the balls at*u*are distributed among*u*and its children as follows. We select \(s_0\le s\) of the balls uniformly at random to stay at*u*. Among the remaining \(s+1-s_0\) balls, we uniformly at random distribute \(s_1\) balls to each of the*b*children of*u*. Each of the remaining \(s+1-s_0-bs_1\) balls is placed at a child node chosen independently at random according to the split vector assigned to*u*. This splitting process is repeated for any child which receives more than*s*balls.

Once all *n* balls have been placed in \({\mathscr {U}}\), we obtain \(T_n\) by deleting all nodes *u* such that the subtree rooted at *u* contains no balls. Note that an internal node (bag) of \(T_n\) contains exactly \(s_0\) balls, while a leaf contains a random amount in \(\{1,\dots ,s\}\). We can assume that the components \(V_i\) of the split vector \({\mathscr {V}}\) are identically distributed. If this was not the case they can anyway be made identically distributed by using a random permutation, see [5]. Let *V* be a random variable with this distribution. We assume, as previous authors, that \({\mathbb {P}\left\{ \exists i : V_i = 1\right\} } < 1\). For this paper we will also require that the internal node (bag) capacity \(s_0\) is at least one so that there are some internal balls to receive labels.

For example, if we let \(b=2, s=s_0=1, s_{1}=0\) and \({\mathscr {V}}\) have the distribution of \((U, 1-U)\) where \(U \sim \mathop {\mathrm {Unif}}[0,1]\), then we get the well-known binary search tree.

An alternate definition of the random split tree is as follows. Consider an infinite *b*-ary tree \({\mathscr {U}}\). The split tree \(T_n\) is constructed by distributing *n* balls (pieces of information) among nodes of \({\mathscr {U}}\). For a node *u*, let \(n_u\) be the number of balls stored in the subtree rooted at *u*. Once \(n_u\) are all decided, we take \(T_n\) to be the largest subtree of \({\mathscr {U}}\) such that \(n_u > 0\) for all \(u \in T_n\). Let \({\mathscr {V}}_u = (V_{u,1},\dots ,V_{u,b})\) be the independent copy of \({\mathscr {V}}\) assigned to *u*. Let \(u_1,\dots ,u_b\) be the child nodes of *u*. Conditioning on \(n_u\) and \({\mathscr {V}}_u\), if \(n_u\le s\), then \(n_{u_i}=0\) for all *i*; if \(n_u>s\), then

where Mult denotes multinomial distribution, and \(b, s, s_{0}, s_{1}\) are integers satisfying (1.3). Note that we have \(\sum _{i=1}^b n_{u_i} \le n\) (hence the “splitting”). Naturally for the root \(\rho\), \(n_{\rho }=n\). Thus the distribution of \((n_{u}, {\mathscr {V}}_{u})_{u \in V({\mathscr {U}})}\) is completely defined.

The balls inherit a partial order from the partial ordering of the nodes in the split tree. We write \(u_1<u_2\) if node \(u_1\) is an ancestor of node \(u_2\), \(u_1>u_2\) if \(u_2\) is an ancestor of \(u_1\) and finally \(u_1 \perp u_2\) is neither \(u_1\) nor \(u_2\) is an ancestor of the other node. For balls \(j_1, j_2\) in nodes (bags) \(u_1, u_2\) respectively \(j_1<j_2\) if \(u_1<u_2\) and \(j_1 \perp j_2\) if \(u_1 \perp u_2\). We say that balls \(j_1, j_2\) are incomparable, \(j_1\perp j_2\) if they are in the same node (bag).

This next theorem is our other main result. We determine the distribution of the number of occurences of a fixed subpermutation in a random ball labelling of the split tree. Denote the random variable for the number of occurences of \(\alpha\) in a uniformly random ball labelling of split tree \(T_n\) by \(R(\alpha , T_n)\).

### Theorem 1.6

Fix a permutation \(\alpha =\alpha _1\ldots \alpha _k\) of length *k*. Let \(T_n\) be a split tree with split vector \({\mathscr {V}}=(V_1,\ldots ,V_b)\) and *n* balls. Let \(\varkappa _{r}=\varkappa _r(R(\alpha ,T_n))\) be the *r*th cumulant of \(R(\alpha ,T_n)\). For \(r\ge 2\) the constant \(D_{\alpha ,r}\) is defined in Eq. (6.1). Whp the split tree \(T_n\) has the following property.

Our theorem says the following. Generate a random split tree \(T_n\), whp it has the property that the random number of occurrences of any fixed subpermutation in a random ball labelling of \(T_n\) has variance and higher cumulant moments approximately a constant times a ‘simple’ tree parameter of \(T_n\).

### Remark 1.7

We may contrast this with Theorem 1.12 of [3]. That theorem states the distribution of the number of inversions in a random split tree; where the distribution is expressed as the solution of a system of fixed point equations. Determining the distribution of \(\Upsilon _{r}^{k}(T_n)\) would extend Theorem 1.12 of [3] about inversions to general permutations.

### Embeddings of Small Digraphs

Certain classes of digraphs, defined below, will be important in the proof of Theorem 1.3. Loosely the digraphs we will consider are those that may be obtained by taking *r* copies of the directed path \(P_k\) and iteratively fusing pairs of vertices together. It will also matter how many embeddings each digraph has into the complete binary tree. In Proposition 4.1 we show the counts for most digraphs in such a class are of smaller order than the counts of a particular set of digraphs in the class. The main work in the proof of this proposition is to show that the number of embeddings of any digraph \(H\), up to a constant factor, depends only on the numbers of two types of vertices in \(H\). We separate this result out as a theorem, Theorem 1.8, which we prove in Sect. 2.

We now define the particular notion of embedding small digraphs into a tree which will be important. Define a digraph to be a simple graph together with a direction on each edge. We shall consider only acyclic digraphs i.e. those without a directed cycle.

In the complete binary tree we have a natural partial order, the ancestor relation, where the root is the ancestor of all other nodes. Any fixed acyclic digraph also induces a partial order on its vertices where \(v<u\) if there is a directed path from *v* to *u*. For an acyclic digraph \(H\), define \([H]_{T_n}\) to be the number of embeddings \(\iota\) of \(H\) to distinct nodes in \(T_n\) such that the partial order of vertices in \(H\) is respected by the embedding to nodes in \(T_n\) under the ancestor relation.

Observe that the inverse of embedding \(\iota ^{-1}\) need not respect relations. If \(u \perp v\) in \(H\), i.e. *u*, *v* are incomparable in \(H\) then we can embed so that \(\iota (u)<\iota (v)\), \(\iota (u)>\iota (v)\) or \(\iota (u)\perp \iota (v)\) in \(T_n\). For an example of this take the digraph
and denote by \(P_\ell\) the rooted path on \(\ell\) nodes. Notice that in
two of the vertices are incomparable but the vertices of the digraph can be embedded into the nodes of a path which are completely ordered. The counts are
and in general
.

A particular star-like digraph \(S_{k,r}\) will be important. This is the digraph obtained by taking *r* directed paths of length *k* and fusing their source vertices into a single vertex. Alternatively the theorem can be stated in terms of star counts as \([S_{|\alpha |,r}]_{T_n}= \Upsilon _{r}^{|\alpha |}(T_n)(1+o(1))\): see Lemma 4.2.

A vertex in a directed graph is a *sink* if it has zero out-degree. Define \(A_0(H)\subseteq V(H)\) to be the set of sinks in digraph *H*. Recall that a directed acyclic graph defines a partial order on the vertices: \(v<u\) if there is a directed path from *v* to *u*. If \(v<u\) we say that *u* is a descendant of *v*. Define \(A_1(H)\subseteq V(H)\) to be the vertices with exactly one descendant which is a sink. We will call vertices in \(A_1(H)\)*ancestors* as they are ancestors of a single sink. Define \(A_2(H)\) to be the remainder \(A_2(H)=V(H)\backslash \{A_0(H)\cup A_1(H)\}\). We call those in \(A_2(H)\)*common-ancestors* as they are the common ancestor of at least two sinks (see Fig. 1). Observe if \(H\) is a directed forest then the sinks are the leaves. However, \(H\) need not be a forest and indeed a sink may have indegree more than one as in the rightmost sink in Fig. 1.

For the split tree \(T_n\) and an acyclic digraph \(H\), define \([H]_{T_n}\) to be the number of embeddings \(\iota\) of vertices in \(H\) to distinct balls in \(T_n\) such that the partial order of vertices in \(H\) is respected by the embedding to balls in \(T_n\) under the ancestor relation.

### Theorem 1.8

Let \(H\) be a fixed directed acyclic graph and let \(T_n\) be the complete binary tree of height *m* with \(n=2^{m+1}-1\) vertices. Then writing \(|A_0|=|A_0(H)|\) for the number of sink (green) vertices and \(|A_1|=|A_1(H)|\) for the number of ‘ancestor’ (blue) vertices

This improves on bounds provided in the conference version of this paper [1]. Similarly for split trees we show that the expected number of embeddings of a fixed acyclic digraph \(H\), to constant factors, depends only on the number of sink and ‘ancestor’ vertices in \(H\).

### Theorem 1.9

Let \(H\) be a fixed directed acyclic graph and let \(T_n\) be a split tree with split vector \({\mathscr {V}}=\{V_1,\ldots ,V_b\}\) and *n* balls. Then writing \(|A_0|=|A_0(H)|\) for the number of sink (green) vertices and \(|A_1|=|A_1(H)|\) for the number of ‘ancestor’ (blue) vertices there exist constants \(c=c(H)\) and \(c'=c'(H)\) such that for large enough *n*,

and whp

In the extended abstract version of this paper [1], in Lemma 7, we proved the weaker upper bound that for constant \(c''\) whp \([H]_{T_n}\le c''n^{|A_0|}(\ln n)^{|A_1|}(\ln \ln n)^{|A_2|}\), i.e. a dependence also on the number of ‘common-ancestor’ (red) vertices in \(H\). It is a little trickier to prove the new upper bound. However, we are rewarded by a tighter bound on the number of embeddings; the expected number of embeddings is now determined only by the numbers of sink (green) and ‘ancestor’ (blue) vertices up to constant factors. It would be interesting to obtain tail bounds on the number of embeddings of small digraphs in a random split tree and we leave this as an open question.

## Embeddings of Small Digraphs into the Complete Binary Tree

In this section we prove Theorem 1.8 concerning upper and lower bounds on the number of embeddings of a fixed digraph \(H\), thought of as constant, into a complete binary tree \(T_n\) with *n* vertices.

We prove the lower bound of Theorem 1.8 first as the upper bound will require some preparatory lemmas.

### Proof

(of lower bound of Theorem 1.8)

We restrict attention to embeddings where all ‘common-ancestors’ of \(H\) are embedded very near the root of \(T_n\), the sink vertices are embedded to leaves of \(T_n\) and the ‘ancestor’ vertices are placed on the path between the root of \(T_n\) and the leaf to which their descendant sink was embedded (see Fig. 2). There are sufficiently many such embeddings to obtain the lower bound. In fact we restrict a little further to make it easy to check all the embeddings are valid.

The first task is to embed the vertices in \(A_2\) close to the root in such a way that \(A_2\) is embedded to ancestors of the nodes to which \(A_1\) and \(A_0\) are embedded and also such that the ordering within the vertices in \(A_2\) is preserved. As \(H\) is an acyclic digraph the directed edges define a partial order on all vertices of \(H\) and in particular for those in \(A_2\). Thus this relation can be extended to a total order. Fix such a total order \(<_*\) on \(V(H)\), one which extends the partial order on \(V(H)\), and relabel vertices in \(A_2\) so that \(v_1<_* \ldots <_* v_{|A_2|}\). Thus we may embed \(v_1\) to the root \(\rho\) in \(T_n\) and each \(v_{i+1}\) to a child of the node to which \(v_i\) was embedded and the relation between vertices in \(H\) will be preserved by their embedding in \(T_n\); i.e. we may embed \(A_2\) to the nodes on the path from \(\rho\) to some \(u^*\) at depth \(|A_2|-1\). Fix such a node \(u^*\) and let \(T^*\) be the subtree of \(T_n\) from \(u^*\).

Label the sinks \(A_0=\{s_1, \ldots , s_{|A_0|}\}\) and vertices in \(A_1\) according to which sink they are the ancestors of \(A_1^i\,{\buildrel {\mathrm {def}} \over =}\,\{v\in A_1 \; : \; v< s_i\}\).

We obtain a subcount of \([H]_{T_n}\) by embedding \(A_2\) onto the path from \(\rho\) to \(u^*\), embedding \(A_0\) to leaves of \(T^*\) and then for each *i* in turn embedding vertices in \(A_1^i\) on the path from \(u^*\) to the embedding of \(s_i\). There are \(m-|A_2|-1\) vertices on the path from \(s_i\) to \(u^*\) and at most \(|A_1|\) of them already have an ancestor vertex embedded onto to them (i.e. from \(A_1^j\) for some \(j<i\)). Thus

where the first binomial coefficient counts the number of ways to embed \(A_0\) and the *i*th binomial coefficient in the product counts the ways to embed \(A_1^i\). Now because \(H\) is fixed \(|A_0|\), \(|A_1|\) and \(|A_2|\) are all *O*(1). Hence for large *m* the RHS of Eq. (2.1) has first term of order \(\Theta (2^{m|A_0|})\) and the product over *i* is of order \(\Theta (m^{\sum _i |A_1^i|})=\Theta (m^{|A_0|})\) so the lower bound follows.□

The key observation to prove the upper bound in Theorem 1.8 is that for most pairs of nodes in a complete binary tree their least ‘common ancestor’ is very near the root. We make the required condition precise in the assumption of the next lemma, and show it implies the upper bound on the number of embeddings of \(H\). It then suffices to prove that the condition holds for complete binary trees. This allows us to recycle the lemma to show the corresponding result in split trees.

Define \(c(u_1, u_2)\) to be the number of ‘common ancestors’ of nodes \(u_1\) and \(u_2\).

### Lemma 2.1

Let \(H\) be a fixed directed acyclic graph and let \(T_n\) be any tree with *n* nodes and height *m*. Then writing \(|A_0|=|A_0(H)|\) for the number of sink (green) vertices, \(|A_1|=|A_1(H)|\) for the number of ‘ancestor’ (blue) vertices and \(|A_2|=|A_2(H)|\) for the number of ‘common-ancestor’ (red) vertices,

where the sum is over ordered pairs of distinct nodes in \(T_n\).

### Proof

Label the sinks \(A_0=\{s_1, \ldots , s_{|A_0|}\}\) and vertices in \(A_1\) according to which sink they are the ancestors of \(A_1^i\,{\buildrel {\mathrm {def}} \over =}\,\{v\in A_1 \; : \; v< s_i\}\). Similarly partition ‘common-ancestor’ vertices into disjoint sets \(\{A_2^{i,j}\}_{1\le i <j \le |A_0|}\) according to the lexicographically least pair of sinks \(s_i\) and \(s_j\) for which it is an ancestor. Formally a vertex \(v\in A_2\) is in \(A_2^{i,j}\) if *v* is the ancestor of sinks \(s_i\) and \(s_j\) but not an ancestor of a sink \(s_k\) for \(k< \max \{i,j\}\).

Suppose sinks \(s_i\) and \(s_j\) are embedded to vertices \(u_i\) and \(u_j\) in \(T_n\). Then to complete the embedding of ancestors of \(s_i\), vertices in \(A_1^i\) must be embedded to ancestors of \(u_i\) in \(T_n\) and there are at most \(d(u_i)\) options. Likewise vertices in \(A_2^{i,j}\) i.e. ‘common-ancestors’ of sinks \(s_i\) and \(s_j\) must be embedded to a common ancestor of \(u_i\) and \(u_j\) in the tree. Thus, recalling \(c(u_i, u_j)\) denotes the number of common ancestors of \(u_i\) and \(u_j\),

where the sum is over distinct nodes \(u_1,\ldots , u_{|A_0|}\) and the product \(i\ne j\) is over pairs \(u_i, u_{j}\) in \(u_1,\ldots , u_{|A_0|}\). Fix a particular embedding of the sinks to \(u_1,\ldots ,u_{|A_0|}\) and we shall bound both terms in the product in (2.2). Recall that for the (blue) ‘ancestor’ vertices, \(\sum _i|A_1^i|= |A_1|\) so \(\prod _i \left( \begin{array}{c}{d(u_i)}\\ {|A_1^i|}\end{array}\right) \le (\max _i d(u_i))^{|A_1|}\). It will suffice to use the trivial bound that all vertices have depth at most the height of the tree, i.e. \(\max _i d(u_i) \le m\). And so,

Similarly, for the (red) ‘common-ancestor’ vertices \(\sum _{i\ne j} |A_2^{i,j}|=|A_2|\) as the sets \(A_2^{i,j}\) are disjoint. Thus

Hence substituting the bounds above into the expression in (2.2),

which is the required result. □

There is one more result we need and then the upper bound in Theorem 1.8 will follow very fast.

### Lemma 2.2

Let \(H\) be a fixed directed acyclic graph and let \(T_n\) be a complete binary tree with *n* vertices and height *m*. Then for any positive integer \(\ell\),

the sum is over ordered pairs of distinct nodes in \(T_n\)

### Proof

Associate with each vertex \(v \in V(T_n)\) a binary string of length at most *m* in the usual way: the root has string \(\varnothing\), children of the root are labelled 0 and 1 and two vertices in the same subtree at depth *d* have the same initial *d*-length substring. Now \(\sum _{u_1,u_2} \mathbf{1}[c(u_1, u_2)\ge \ell ]\) is precisely the number of ordered pairs which share a common \((\ell -1)\)-length initial substring in their labels; i.e. ordered pairs with both vertices in the same depth \((\ell -1)\) subtree.

Let \(T_1^{\ell -1}, \ldots , T_{2^{\ell -1}}^{\ell -1}\) be the subtrees at depth \(\ell -1\). Since \(T_n\) is a complete binary tree \(|T_i^{\ell -1}|=2^{m-\ell +1}-1\). Recall \(n=2^{m+1}-1\) and so \(|T_i^{\ell -1}| \le n2^{-\ell }.\) Now

as required. □

### Proof

(of upper bound in Theorem 1.8) Observe Lemma 2.2 implies

Since \(|A_2|\) is a constant the sum \(\sum _{\ell =1}^\infty (\tfrac{1}{2})^{\ell }\ell ^{|A_2|}\) converges to a constant, say \(\beta =\beta (|A_2|)\). Thus by Lemma 2.1 we get

□

## Embeddings of Small Digraphs into the Split Trees

In this section we prove Theorem 1.9 concerning upper and lower bounds on the number of embeddings of a fixed digraph \(H\), thought of as constant, into a random split tree with *n* balls. We begin by briefly listing some results on split trees from the literature that will be useful for us.

For split vector \({\mathscr {V}}\) define \(\mu =\sum _{i}\mathbb {E} \left[ V_i \ln V_i\right]\). The average depth of a node is \(\sim \frac{1}{\mu }\ln n\) [10, Cor 1.1]. Moreover almost all nodes are very close to this depth. Define a node *v* to be *good* if it has depth

and then whp \(1-o(1)\) proportion of the nodes in the split tree are good [10, Theorem 1.2]. That whp in a split tree all good nodes have a \(\Theta (\ln n)\) depth and almost all nodes are good is the only result about split trees required for the proof of the lower bound on \([H]_{T_n}\) in Theorem 1.9. For the upper bound we need a bit more.

We will apply Proposition 3.1 below which is stated as Remark 3.4 in [10] (this remark refers to the proof of [10, Theorem 1.2] which is stated above).

### Proposition 3.1

Let \(T_n\) be a split tree with *n* balls. For any constant \(r > 0\) there is a constant \(K > 0\), such that the expected number of nodes with \(d(v) \ge K \ln n\) is \(O(\frac{1}{n^{r}})\).

We will use Proposition 3.1 as well as the property that most pairs of balls have their least common ancestor node very close to the root which we prove in Lemma 3.4.

We begin with the lower bound, the upper bound is proven at the end of this Sect. 3.

### Proof

(of the lower bound of Theorem 1.9)

We describe a strategy to embed \(H\) into \(T_n\). The details of the proof are then to show that whp this strategy can be followed to obtain a valid embedding of \(H\) and that there are sufficiently many different such embeddings to achieve the lower bound.

The idea is as follows: first embed ‘common-ancestor’ vertices along a path to some node \(u^*\) near the root of \(T_n\) so that the subtree from \(u^*\) has \(\tilde{n}\) balls where this \(\tilde{n}\) is a constant proportion of the total number of balls *n*. Now consider the split tree with \(\tilde{n}\) balls and embed ‘ancestor’ and sink vertices into that. Embed sink vertices to ‘good’ balls in the tree (i.e. depth very close to the expected depth) and the ‘ancestor’ vertices to balls which are in nodes on the path between \(u^*\) and the embedding of that ancestor’s descendant. See Fig. 3.

We embed the ‘common-ancestor’ vertices, \(A_2(H)\), to the balls in the nodes on the path between a node, \(u^*\) say, at depth \(|A_2|-1\) and the root, using one ball per node. This is so far effectively the same as in the binary case. And we will later embed the sink and ‘common-ancestor’ vertices to balls in the subtree \(T_{u^*}\).

We need to confirm there is some node \(u^*\) at depth \(L=|A_2|-1\) with \(\tilde{n}\) balls in its subtree. Each node (bag) has capacity at most \(s_0\) (internal nodes) or *s* (leaves) and there are at most \((b^{L+1}-1)\) nodes, a constant number, at depth less than *L*, so \(n-O(1)\) balls remaining. These balls are shared between \(b^L\), a constant, number of subtrees \(T_u\). Hence by pigeon-hole principle some vertex \(u^*\) has \(\tilde{n}=\Theta (n)\) balls in its subtree.

Now work in the split tree \(T_{\tilde{n}}\). Embed the sink vertices to any balls in good nodes \(v_1, \ldots , v_{|A_0|}\) in the split tree so these have depth \(\Omega (\ln \tilde{n})\). There are \(\Theta (\tilde{n}^{|A_0|})\) ways to embed them. In \(H\) label the sink vertices \(s_1, \ldots , s_{|A_0|}\) and \(A_1^j\subset A_1(H)\) to be the ‘ancestor’ vertices with \(s_j\) as their lone descendant. Vertices in \(A_1^j\) can be embedded to balls anywhere between \(v_j\) and \(u^*\) and so there are \(\Theta ((\ln \tilde{n})^{|A_1^j|})\) ways to do that for each *j*. All up there are \(\Omega (\tilde{n}^{|A_0|}(\ln \tilde{n})^{|A_1|})\) ways to embed \(A_0(H)\cup A_1(H)\) into balls of \(T_{\tilde{n}}\). But now as \(\tilde{n}=\Theta (n)\) we are done.□

The rest of this section is devoted to proving the upper bound of Theorem 1.9. To prove the upper bound on the expected number of embeddings of a fixed digraph into a split tree we begin by proving the split tree analogue of Lemma 2.1 which was for complete binary trees. Define \(c_n(b_1, b_2)\) to be the number of node common ancestors of balls \(b_1\) and \(b_2\). The lemma shows that the number of embeddings of \(H\) to balls in \(T_n\) can be bounded above by a function of the number of balls, the height of the tree and the number of node common ancestors. Note that the following lemma is deterministic and is true for any instance of a split tree.

### Lemma 3.2

Let \(H\) be a fixed directed acyclic graph and let \(T_n\) be a split tree with \(s_0>0\), *n* balls and height *m*. Then writing \(|A_0|=|A_0(H)|\) for the number of sink (green) vertices, \(|A_1|=|A_1(H)|\) for the number of ‘ancestor’ (blue) vertices and \(|A_2|=|A_2(H)|\) for the number of ‘common-ancestor’ (red) vertices,

the sum is over ordered pairs of distinct balls in \(T_n\)

### Proof

As in the proof of Lemma 2.1, label the sinks \(A_0=\{s_1, \ldots , s_{|A_0|}\}\) and vertices in \(A_1\) according to which sink they are the ancestors of \(A_1^i\,{\buildrel {\mathrm {def}} \over =}\,\{v\in A_1 \; : \; v< s_i\}\). Also let \(A_2^{ij}\) be the ‘common-ancestor’ vertices in \(A_2\) which are ancestors of both sink \(s_i\) and \(s_j\).

Suppose sinks \(s_i\) and \(s_j\) are embedded to balls \(b_i\) and \(b_{i'}\) in \(T_n\). Then to complete the embedding ancestors of \(s_i\), i.e. vertices in \(A_1^i\) must be embedded balls in node ancestors of \(b_i\) in \(T_n\) and there are at most \(s_0d(b_i)\) options as each node ancestor of \(b_i\) has \(s_0\) balls. Likewise vertices in \(A_2^{i,j}\) i.e. common-ancestors of sinks \(s_i\) and \(s_j\) must be embedded to balls in common ancestor nodes of \(b_i\) and \(b_j\) in the tree. Thus,

where the sum is over distinct balls \(b_1,\ldots , b_{|A_0|}\) and the product \(i\ne i'\) is over pairs \(b_i, b_{i'}\) in \(b_1,\ldots , b_{|A_0|}\). The expression above is very similar to Eq. (2.3) in the proof of Lemma 2.1 and the proof follows now in an identical way so we omit the details. Notice the upper bound for split trees simply picks up an additional factor of \(s_0^{|A_1|+|A_2|}\).□

### Lemma 3.3

Let *j* and \(j'\) be any two distinct balls, and *v* a node with split vector \({\mathscr {V}}^{\,{v}}=(V_1^v,\ldots ,V_b^v)\). Let *y* be the probability that balls *j* and \(j'\) pass to the same child node of node *v* conditional on the event that both balls reach node *v*. (We say a ball passes to a child node whether it stays at that child or continues further down the tree via that child node). Then,

### Proof

If a ball *j* reaches node *v* there are three possible scenarios

(i) ball

*j*is chosen as one of the \(s_0\) balls to remain at node*v*when all*n*balls have been added to the tree.(ii) ball

*j*is chosen as one of the \(bs_1\) balls which are distributed uniformly so each child of*v*receives \(s_1\) of them.(iii) ball

*j*chooses a child of*v*with probabilities given by the split vector \({\mathscr {V}}^{\,{v}}\).

For each of these possible scenarios we give the probability that balls \(j, j'\) pass to the same child of node *v*. Observe that swapping the scenarios for \(j,j'\) gives the same probability so we list only one possibility. We summarise these in a table and then provide the proof of each line below the table.

(i) | (ii) | (iii) | Probability that \(j,j'\) pass to same child |
---|---|---|---|

\(j,j'\) | 0 | ||

j | \(j'\) | 0 | |

j | \(j'\) | 0 | |

\(j,j'\) | \(\frac{s_1-1}{bs_1-1}\) | ||

j | \(j'\) | \(\frac{1}{b}\) | |

\(j,j'\) | \(\sum _i V_i^2\) |

Now, if either or both of the balls stay at node *v* then self-evidently they cannot pass to the same child of *v*, thus the situations indicated in the first three rows have probability zero.

The first interesting case is if both balls are in situation (ii), i.e. are both chosen to be part of the \(bs_1\) nodes that are distributed uniformly such that each child receives \(s_1\) balls. Fix a child of *v*, the number of ways both \(j, j'\) pass to that child is \(\left( \begin{array}{c}{s_1}\\ {2}\end{array}\right)\); and thus there are \(bs_1(s_1-1)/2\) ways for \(j,j'\) to pass to the same child of *v*. Then simply divide by \(bs_1(bs_1-1)/2\) to get the probability that \(j, j'\) pass to the same child of *v*. This finishes this case.

The next interesting case is if ball *j* is in situation (ii) and ball \(j'\) is in situation (iii). In this case ball \(j'\) goes to each child *v* with probability indicated by the split vector. The probability that ball *j* goes to the same node as \(j'\) is 1 / *b*; and indeed it didn’t matter the probability with which \(j'\) passes to each child of *v*.

The last case to consider is if both \(j, j'\) are in situation (iii), i.e. they pass to child *i* of node *v* with probability \(V_i\) as given by the split vector. Thus the probability they both go to child *i* of node *v* is \(\sum _i V_i^2\); and the probability they pass to the same child of *v* is then simply the sum over the children of *v* as required.

After justifying each line in the table it now suffices only to show that \(\frac{s_1-1}{bs_1-1} < \frac{1}{b} \le \sum _i V_i^2\). The first is immediate,

and the second follows by Jensen’s inequality.□

We write \(c_n(j,j')\) to denote the number of nodes which are common ancestors of balls \(j,j'\) and \(c_n(j)\) the number of nodes which are ancestors of ball *j*, including the node containing ball *j*. Similarly, write \(c_n(u)\) to be the number of nodes which are ancestors of node *u* including node *u* itself. Lastly denote by \(j \vee _n j'\) the node which is the least common-ancestor of balls *j* and \(j'\); note if *j* and \(j'\) are in the same node then this node is \(j\vee _n j'\). Observe that the number of nodes which are ancestors of a ball is one more than the depth \(c_n(j)=d(j)+1\) and similarly \(c_n(j,j')=d(j\vee _n j')+1\).

After recalling this notation, we can use it to express the probability *y* in the statement of Lemma 3.3. Observe that the event that the balls *j* and \(j'\) both reach node *v* can be expressed as \(j,j'\ge v\) or equivalently \((j \vee _n j) \ge v\).

Now *y* was defined as the probability that balls *j* and \(j'\) pass to the same child node of node *v* conditional on the event that both balls reach node *v* and conditional on node *v* having split vector \({\mathscr {V}}^{\,{v}}=(V_1^v,\ldots ,V_b^v)\). So

We may now also state the required lemma for split trees (this lemma plays a very similar role to the bound proven for \(\sum _{u_1,u_2} \mathbf{1}[ c(u_1,u_2) \ge \ell ]\) in the proof of Theorem 1.8 for complete binary trees).

### Lemma 3.4

Let \(j, j'\) be any two distinct balls in the split tree with split vector \({\mathscr {V}}=(V_1, \ldots , V_b)\). For \(\ell \ge 1\),

### Proof

The idea is to establish, using Lemma 3.3, the probability that two balls follow the same path through the tree to some specified level given they followed the same path through the tree to the level before. We condition on \(\{{\mathscr {V}}^{\,{v}\}}_v\) the set of all split vectors in the split tree. For \(\ell \ge 1\)

The first term is less than \(\sum _i (V_i^u)^2\) by Lemma 3.3. For the second term note the following. If balls *j* and \(j'\) have at least \(\ell\) common ancestors then their least common ancestor, the node \(j\vee _n j'\) must have at least \(\ell\) common ancestors. In particular \(j\vee _n j'\) itself or a node on the path from \(j\vee _n j'\) to the root must have precisely \(\ell\) ancestors and so,

(Another way to see this is that for *j* and \(j'\) to have at least \(\ell\) common ancestors there must be some node *u* which is an ancestor of both *j* and \(j'\) such that node *u* has precisely \(\ell\) ancestors.) Hence we get that

where \(\sum _u p_u=1\) and also the \(p_u\) depend only on split vectors for nodes *v* with \(c_n(v)<\ell\), i.e. closer to the root than node *u* and so the \(p_u\) are independent of the \(\left\{ {\mathscr {V}}^w\right\} _{w\; : \; c_n(w)=\ell }\). We can now calculate the probability that balls \(j, j'\) have \(\ell +1\) ancestors conditioned on having \(\ell\) by taking expectations (over split vectors) and using the tower property of expectations.

where the inequality in the third line followed by (3.4). We are basically done. Notice that the root is the ancestor of any two balls, so the event \(c_n(j, j')\ge 1\) has probability one and we have our ‘base case’. Hence

as required. □

The previous lemma implies the next proposition almost immediately.

### Proposition 3.5

Let \(C>0\) be any constant and let \(T_n\) be a split tree with *n* balls. Then there exists a constant \(\beta >0\) such that

where the sum is over balls \(b_1, b_2\).

### Proof

By Lemma 3.4, there exists a constant \(a<1\) such that for any positive integer \(\ell\),

hence as earlier in the proof of the upper bound in Theorem 1.8 this implies

and again since *C* and \(a<1\) are constants the sum \(\sum _{\ell =1}^\infty a^{\ell }\ell ^{C}\) converges to a constant, say \(\beta =\beta (a, C)\) and we are done. □

We are now ready to prove our upper bound on the expected number of embeddings.

### Proof

(of the upper bound of Theorem 1.9) Fix a digraph \(H\), and we will show that there exists a constant \(c=c(H)\) such that

It is important to have a strong bound on the likely height of the split tree. We apply Proposition 3.1. Choose \(K'\) such that \({\mathbb P}(h(T_n) > K' \ln n) \le n^{-|H|-1}\). Let \({\mathscr {B}}\) denote the (bad) event that \(h(T_n)> K'\ln n\), and denote by \({\mathscr {B}}^c\) the complement of this event.

Define random variable \(X=X(T_n)\) to be \(X=\sum _{b_1, b_2} c_n(b_1,b_2)^{|A_2|}\). Observe that because *X* is non-negative and by law of total expectation \(\mathbb {E} \left[ X \;|\; {\mathscr {B}}^c\right] \le \mathbb {E} \left[ X\right] /{\mathbb P}({\mathscr {B}}^c)\) and so, by Proposition 3.5, for *n* large enough,

Now by Lemma 3.2

In particular, by conditioning on \({\mathscr {B}}^c\): the event that the height being less than \(K' \ln n\), and by Eq. (3.4),

It remains now to bound the expected number of embeddings conditioning on \({\mathscr {B}}\), \(\mathbb {E} \left[ [H]_{T_n} \; | \; {\mathscr {B}}\right]\). We may use a very simple bound that for any tree with *n* balls, \(H\) can be embedded at most \(n^{|H|}\) times, as each vertex in \(H\) embedded to one of the *n* balls in the tree. This suffices as now \(\mathbb {E} \left[ [H]_{T_n} \; | \; {\mathscr {B}}\right] {\mathbb P}({\mathscr {B}}) \le n^{-1}\). Hence we may take \(c=c(H)\) to be \(2s_0^{|H|}K'^{|A_1}\beta\) and we have shown the Eq. (3.6) as required. □

## Embeddings: Stars are More Frequent than Other Connected Digraphs

After having proved some properties of embedding counts for our two classes of trees, complete binary trees and split trees, we show these imply the desired results on cumulants of the number of appearances of a permutation in the node labellings of complete binary trees, respectively ball labellings in split trees.

Say a sequence of trees \(T_n\) with *n* nodes (respectively balls) is *explosive* if for any fixed acyclic digraph \(H\)

Thus Sect. 2 was devoted to showing complete binary trees are explosive and Sect. 3 to showing split trees are explosive whp. This section proves the cumulant results using only this explosive property of the tree classes. The first result, Proposition 4.1, shows that the number of embeddings of most digraphs we will need to consider are of smaller order than the number of embeddings of a particular digraph the ‘star’ \(S_{k,r}\) which we define below. The other result of this section is to show the asymptotic number of embeddings of \(S_{k,r}\) is asymptotically the same as our extended notion of path length \(\Upsilon _r^k(T_n)\) in Lemma 4.2.

The set \({\mathscr {G}}_{k,r}\) is the set of acyclic digraphs which may be obtained by taking *r* copies of the path \(P_k\) and iteratively fusing pairs of vertices together. Likewise labelled \(H'\) in \({\mathscr {G}}_{k,r}'\) are those obtained by fusing together *j* labelled paths \(P_k\) keeping both sets of labels when a pair of vertices are fused. The set \({\mathscr {G}}'_{3,2}\) is illustrated in Fig. 4.

Formally let \({\mathscr {G}}_{k, r}\) be the set of directed acyclic graphs \(H\) on \((k-1)r\) edges (allowing parallel edges), such that the edge set can be partitioned into *r* directed paths \(P_1,\dots ,P_r\), each on \(k-1\) edges. For \(H\in {\mathscr {G}}_{k,r}\) write \(H'\) for \(H\) together with a labelling \(V_1, \ldots , V_r\), where \(V_i\) are the *k* vertices in \(P_i\) (note some vertices have multiple labels). Likewise write \({\mathscr {G}}'_{k,r}\) for the labelled set of graphs.

Denote by \(S_{k,j}\) the digraph composed by taking *j* copies of the path \(P_k\) and fusing the *j* source vertices into a single vertex. We shall refer to this as a star graph but note it is only really stars if \(k=2\).

### Proposition 4.1

Fix *k*, *r* and let \(H\) be a connected digraph in the set \({\mathscr {G}}_{k,r}\). If \(T_n\) is explosive and \(H\ne S_{k,r}\) then

### Proof

First observe that \(S_{k,r}\) has *r* sink vertices, \((k-2)r\) ancestor vertices and exactly one common-ancestor vertex. Thus by the explosive property of \(T_n\)

Now fix \(H\in {\mathscr {G}}_{k,r}\backslash S_{k,r}\) and fix a labelling \(V^1,\ldots , V^r\) on \(H\). Again by the explosive property

Hence if \(|A_0(H)|\le r-1\) then \([H]_{T_n}=o([S_{k,r}])\) and so we would be done. Thus we may assume that \(A_0(H)=r\) and it will suffice to show that \(A_1(H)<(k-2)r\).

As the digraph \(H\) is connected, each path \(V^i\) must have at least one fused vertex. Consider the path labelled \(V^i=(v^i_1, \ldots , v^i_k)\). We know \(v_k^i\) is a sink vertex and not fused with any other vertex otherwise we would have \(A_0(H)<r\). If vertex \(v^i_j\) on path \(V^i\) is fused with another vertex, it must be a vertex on a different path to avoid creating a directed cycle, and so \(v^i_j\) and \(v^i_{j-1}, \ldots , v^i_{1}\) would become common-ancestors. Thus if \(v^i_j\) is fused to another vertex there are at most \((k-j-1)\) ancestor vertices in path \(V_i\). Hence \(A_1(H)\le (k-2)r\) with equality only if we fused just the source vertices \(v_1^i\) of each path \(V^i\). But fusing just the source vertices would yield \(S_{k,r}\) and so for our digraph \(A_1(H)\le (k-2)r-1\) and we are done. □

We will also need the following lemma in the proof of Proposition 6.1. Recall the tree parameter \(\Upsilon _r^k(T_n)\), defined in Eq. (1.2), extends the notion of total path length of a tree.

### Lemma 4.2

Fix *k*, *r*. If \(T_n\) is explosive then

### Proof

The star \(S_{k, r}\) consists of *r* directed paths of length *k* (*rays*) with their source vertices fused to a common vertex. Let \(\rho\) denote the common vertex, and label all other vertices \(v_{i, j}\) for \(1\le i\le r\) and \(2\le j \le k\), where \((\rho , v_{i, 2}, v_{i, 3},\dots ,v_{i, k})\) makes up ray *i*.

As a warmup we count the number of ways to embed \(S_{k, r}\) into a tree \(T_n\). Suppose the leaves \(v_{1,k},v_{2,k},\dots ,v_{r, k}\) are mapped to \(u_1,\dots ,u_r\) in \(T_n\). Then \(\rho\) must be mapped to one of the \(c(u_1,\dots ,u_r)\) common ancestors of \(u_1,\dots ,u_r\). Having done this, for each *i* we choose \(k-2\) vertices between \(u_i\) and \(\iota (\rho )\), to which we map \(v_{i,2},\dots ,v_{i,k-1}\). So the total number of ways is

We now show that (4.2) is asymptotically \(\Upsilon _r^k(T_n)\). The directed star, \(S_{k,r}\) can be constructed by taking *r* directed paths of length *k* and fusing their source vertices together to a common vertex. Let \({\mathscr {F}}_{k,r}\) be the set of graphs obtained by taking *r* directed paths of length *k* and fusing one non-sink vertex from each path together to a common vertex and possibly additional pairs of vertices from paths where vertices were at or above this common vertex . So, \(S_{k,r} \in {\mathscr {F}}_{k,r}\), but as for \(k>2\) the common fused vertex need not be the source vertex of each path, there may be many other digraphs in \({\mathscr {F}}_{k,r}\).

We now count the number of ways to embed \(H \in {\mathscr {F}}_{k,r}\) into a tree \(T_n\). Let \(\rho\) denote the common vertex to all paths. Label all other unlabelled vertices \(v_{i, j}\) for \(1\le i\le r\) and \(1 \le j \le k\), where \((v_{i,1}, \rho , v_{i, 3},\dots ,v_{i, k})\) makes up ray *i* if it was the second vertex of path *i* that was fused.

Recall for any \(H\in {\mathscr {F}}_{k,r}\) the sinks of each path are not fused. Suppose the sinks/leaves \(v_{1,k},v_{2,k},\dots ,v_{r, k}\) are mapped to \(u_1,\dots ,u_r\) in \(T_n\). Then \(\rho\) must be mapped to one of the \(c(u_1,\dots ,u_r)\) common ancestors of \(u_1,\dots ,u_r\). Having done this, for each *i* we choose \(k-2\) between the root of \(T_n\) and \(u_i\) to which we map \(v_{i,2},\dots ,v_{i,k-1}\). (The number of the \(k-2\) vertex mapped above and below \(\iota (\rho )\) is dependent on which vertex on path *i* was common vertex in \(H\)). Thus,

However there are only finitely many digraphs \({\mathscr {F}}_{k,r}\) and all of these are connected digraphs also in the set \({\mathscr {G}}_{k,r}\). Therefore by Proposition 4.1

and we are done. □

## Labelling Stars

In the proof of Proposition 6.1 where we calculate the moments of the distribution of the number of \(\alpha\) that occur in a random labelling of our tree we will consider indicators over small subsets of vertices. A star \(S_{k,\ell }\) can be formed by fusing together \(\ell\) length *k* paths at their source vertices. For \(S_{k,\ell }\) with a uniform labelling, we calculate the probability each of the \(\ell\) paths is labelled with respect to \(\alpha\) in Proposition 5.1.

### Proposition 5.1

Let \(\alpha\) be a permutation of length *k*, \(S_{k,\ell }\) be the digraph defined earlier and let \(\lambda : V(S_{k,\ell }) \rightarrow [(k\!-\!1)\ell +1]\) be a uniform random labelling of the vertices of \(S_{k,\ell }\). Then the probability that every \(V_i\) induces a labelling of relative order \(\alpha\) is,

### Proof

First note that for each \(V_i\) to induce the relative order \(\alpha\), i.e. a ‘correct’ labelling there is only one possible label for the root \(\rho\). This is obvious if \(\alpha _1=1\) since then the root must receive the label ‘1’. For general \(\alpha _1\), each \(V_i\backslash \rho\) must have \(\alpha _1-1\) labels less than the label at the root \(\lambda (\rho )\) and \(k-\alpha _1\) labels greater than \(\lambda (\rho )\); hence we must have \(\lambda (\rho )=(\alpha _1-1)\ell +1\). Note that we may choose a uniform labelling \(\lambda\) by first choosing the label at the root \(\lambda (\rho )\) and then choosing uniformly from all labellings of \(S_{k,r}\backslash \rho\) with the remaining labels. Thus, as there is only one possible label for the root, the probability it is labelled correctly is \(((k\!-\!1)\ell +1)^{-1}\).

It now remains to calculate the probability that the non-root vertices are labelled correctly given that \(\lambda (\rho )=(\alpha _1-1)\ell +1\). We count the number of correct labellings. Note there are \((\alpha _1-1)\ell\) labels less than the root i.e. ‘small’ labels and \((k-\alpha _1)\ell\) labels greater than the root, ‘big’ labels, remaining. Again each \(V_i\) must receive \(\alpha _1-1\) of the ‘small’ labels and \(k-\alpha _1\) of the ‘big’ labels. As the labels of \(V_i\) must induce \(\alpha\) once we choose which labels appear on \(V_i\backslash \rho\) then they can only be placed in one way. Hence the number of correct labellings of \(S_{k,\ell }\backslash \rho\) (assuming \(\lambda (\rho )=(\alpha _1-1)\ell +1\)) is

Note the total number of possible labellings of \(S_{k,\ell }\backslash \rho\) is \(((k-1)\ell )!\) and so the probability of correctly labelling \(S_{k,\ell }\) is

and the result follows. □

## Cumulants Moments

By exploiting only the explosive property of binary and (whp) of split trees we will prove the moments result for both classes at once, using Proposition 4.1. In particular observe that Theorems 1.3 and 1.6 are both implied by taking Proposition 6.1 along with the lemmas proving complete binary trees are explosive and split trees are whp explosive.

To define the constant \(D_{\alpha ,r}\) used in Proposition 6.1 and Theorems 1.3 and 1.6 we use some basic notation of partitions. We write *P*(*r*) to indicate the set of all partitions of [*r*] and note \(\{\{1\}\{2,3,4\}\}\) and \(\{\{2\}\{1,3,4\}\}\) form different partitions of [4]. Given a partition \(\pi = \{s_1,\dots ,s_\ell \}\) of \(\{1,\dots ,r\}\) with set sizes \(r_i = |s_i|\) we let \(|\pi |=\ell\) denote the number of parts in \(\pi\). Noting \(a_{|\alpha |,\ell }(\alpha )\) is the constant defined in Proposition 5.1 we may now define \(D_{\alpha ,r}\) by

### Proposition 6.1

Suppose \(T_n\) is explosive. Let \(\varkappa _{r}=\varkappa _r(R(\alpha ,T_n))\) be the *r*th cumulant of \(R(\alpha ,T_n)\). Then for \(r\ge 2\),

### Proof

We fix a permutation \(\alpha\) with \(|\alpha | = k\) and an explosive tree \(T_n\) on *n* nodes, and consider the random variable

where we sum over vertex sets \(U\subseteq T_n\) of size \(|U| = |\alpha |\) which are ordered under the partial ordering of \(T_n\), i.e. \(U = \{u_1,\dots ,u_k\}\) with \(u_1< \cdots < u_k\).

In order to calculate the cumulants of *X*, we use mixed cumulants (see e.g. [11, Section 6.1]). Given a set of random variables \(X_1,\dots ,X_r\), we denote the mixed cumulant by \(\varkappa (X_1,\dots ,X_r)\). For now, we only need the following properties.

- 1.
If \(X_1 = X_2 = \cdots = X_r\) then \(\varkappa (X_1,\dots ,X_r)\) equals the

*r*th cumulant \(\varkappa _r(X_1)\) of \(X_1\), - 2.
\(\varkappa (X_1,\dots ,X_r)\) is multilinear in \(X_1,\dots ,X_r\),

- 3.
\(\varkappa (X_1,\dots ,X_r) = 0\) if there exists a partition \([r] = A\cup B\) such that \(\{X_i : i\in A\}\) and \(\{X_i : i\in B\}\) are independent families.

We then have

Now, suppose \(\{U_1,\dots ,U_r\}\) is a family such that \([r] = A\cup B\) with \(U_A = \cup _{i\in A}U_i\) and \(U_B = \cup _{i\in B}U_i\) disjoint. Then \(\{\mathbf{1}[\pi (U_i)\approx \alpha ] : i\in A\}\) and \(\{\mathbf{1}[\pi (U_i)\approx \alpha ] : i\in B\}\) are independent families. Indeed, conditioning on the label sets \(\pi (U_A), \pi (U_B)\), the random variables are determined by the internal order given to labels within \(U_A\) and \(U_B\), respectively, and this order is independent. Saying that the family \(\{U_1,\dots ,U_r\}\) is *connected* if there is no such partition \(A\cup B\), it follows that

Let \(\{U_1,\dots ,U_r\}\) be a connected family. We can write \(U_i = \{u_{i,1},\dots ,u_{i,k}\}\) with \(u_{i, 1}< \cdots < u_{i, k}\) for each *i*. Let *H* be the graph on vertex set \(U = U_1\cup \dots \cup U_r\) with an edge from \(u_{i, j}\) to \(u_{i, j+1}\) for each *i* and \(j < k\). The graph *H* is a connected member of \({\mathscr {G}}_{k, r}\). As the term \(\varkappa (\mathbf{1}[\pi (U_1)\approx \alpha ], \dots , \mathbf{1}[\pi (U_r)\approx \alpha ])\) only depends on the labels of vertices in *U*, it is a function of *H* which we denote by \(\varkappa (H)\). Then

By Proposition 4.1, this sum is dominated by the term corresponding to \(H = S_{k, r}\). We conclude that

But by Lemma 4.2\([S_{k, r}]_{T_n}=\Upsilon _r^k(T_n)(1+o(1))\) and so it remains only to show \(\varkappa (S_{k, r})=D_{\alpha ,r}\). The mixed cumulant \(\varkappa (X_1,\dots ,X_r)\) may be defined by (see e.g. [11, Section 6.1])

where we sum over all partitions of \(\{1,\dots ,r\}\) into nonempty sets \(\{I_1,\dots ,I_q\}, q \ge 1\).

Let \(V_1,\dots ,V_r\) denote the vertex sets of the *r* “rays” of \(S_{k, r}\); each \(V_i\) has size *k* and induces a path of length *k*, \(V_1\cup \cdots \cup V_r\) covers \(S_{k, r}\), and the \(V_i\) intersect only at the root of \(S_{k, r}\). We have

and need to establish \(\mathbb {E} \left[ \prod _{j\in I}\mathbf{1}[\pi (V_j)\approx \alpha ]\right]\) for any \(I\subseteq [r]\). By symmetry, this is determined by the size of *I*, and so for \(1 \le \ell \le r\),

is the probability that, under a labeling of \(S_{k, \ell }\) chosen uniformly at random, each ray respects the permutation \(\alpha\) which we calculated in Proposition 5.1. Hence we have

This may now be written as

summing over partitions \(\pi\) of [*r*] which is the constant \(D_{\alpha ,r}\) as required. □

## References

- 1.
Albert, M., Holmgren, C., Johansson, T., Skerman, F.: Permutations in binary trees and split trees. In: LIPIcs-Leibniz International Proceedings in Informatics, vol. 110. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2018)

- 2.
Anders, K., Archer, K.: Rooted forests that avoid sets of permutations. Eur. J. Combin.

**77**, 1–16 (2019) - 3.
Cai, X.S., Holmgren, C., Janson, S., Johansson, T., Skerman, F.: Inversions in split trees and conditional Galton–Watson trees. Combin. Probab. Comput.

**28**(3), 335–364 (2019) - 4.
Chauve, C., Dulucq, S., Rechnitzer, A.: Enumerating alternating trees. J. Combin. Theory Ser. A

**94**(1), 142–151 (2001) - 5.
Devroye, L.: Universal limit laws for depths in random trees. SIAM J. Comput.

**28**(2), 409–432 (1998). https://doi.org/10.1137/s0097539795283954 - 6.
Finkel, R., Bentley, J.: Quad trees a data structure for retrieval on composite keys. Acta Inf.

**4**(1), 1–9 (1974). https://doi.org/10.1007/bf00288933 - 7.
Flajolet, P., Poblete, P., Viola, A.: On the analysis of linear probing hashing. Algorithmica

**22**(4), 490–515 (1998) - 8.
Gessel, I.M., Sagan, B.E., Yeh, Y.N.: Enumeration of trees by inversions. J. Graph Theory

**19**(4), 435–459 (1995) - 9.
Hoare, C.: Quicksort. Comput. J.

**5**(1), 10–16 (1962). https://doi.org/10.1145/366622.366644 - 10.
Holmgren, C.: Novel characteristics of split trees by use of renewal theory. Electron. J. Probab. (2012). https://doi.org/10.1214/ejp.v17-1723

- 11.
Janson, S., Luczak, T., Rucinski, A.: Random Graphs, vol. 45. Wiley, New York (2011)

- 12.
Lackner, M.L., Panholzer, A.: Runs in labelled trees and mappings. arXiv preprint arXiv:1507.05484 (2015)

- 13.
Mallows, C., Riordan, J.: The inversion enumerator for labeled trees. Bull. Am. Math. Soc.

**74**(1), 92–94 (1968) - 14.
Panholzer, A., Seitz, G.: Limiting distributions for the number of inversions in labelled tree families. Ann. Combin.

**16**(4), 847–870 (2012) - 15.
Pyke, R.: Spacings. J. R. Stat. Soc. Ser. B Methodol.

**27**, 395–436 (1965) - 16.
Yan, C.H.: Generalized parking functions, tree inversions, and multicolored graphs. Adv. Appl. Math.

**27**(2–3), 641–670 (2001)

## Acknowledgements

Open access funding provided by Stockholm University. The authors sincerely thank the referees for their thoughtful comments which much improved the content of the paper. CH is supported by two grants from the Knut and Alice Wallenberg Foundation, a grant from the Swedish Research Council and the Swedish Foundations’ starting grant from Ragnar Söderbergs Foundation. Work partially completed while TJ and FS were at Uppsala Unversity and supported by the aforementioned grants.

## Author information

## Additional information

### Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Appendix

### Appendix

See Table 1.

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Albert, M., Holmgren, C., Johansson, T. *et al.* Embedding Small Digraphs and Permutations in Binary Trees and Split Trees.
*Algorithmica* **82, **589–615 (2020). https://doi.org/10.1007/s00453-019-00667-5

Received:

Accepted:

Published:

Issue Date:

### Keywords

- Random trees
- Split trees
- Permutations
- Inversions
- Cumulants