# Generation of Tree-Child phylogenetic networks

Phylogenetic networks generalize phylogenetic trees by allowing the modelization of events of reticulate evolution. Among the different kinds of phylogenetic networks that have been proposed in the literature, the subclass of binary tree-child networks is one of the most studied ones. However, very little is known about the combinatorial structure of these networks. In this paper we address the problem of generating all possible binary tree-child networks with a given number of leaves in an efficient way via reduction/augmentation operations that extend and generalize analogous operations for phylogenetic trees and are biologically relevant. Since our solution is recursive, this also provides us with a recurrence relation giving an upper bound on the number of such networks.

## Authors

• 1 publication
• 1 publication
• 6 publications
06/28/2019

### Generating Normal Networks via Leaf Insertion and Nearest Neighbor Interchange

Galled trees are studied as a recombination model in theoretic populatio...
05/27/2018

### Palindromes in starlike trees

In this note, we obtain an upper bound on the maximum number of distinct...
11/19/2018

### Sorting permutations with a transposition tree

The set of all permutations with n symbols is a symmetric group denoted ...
08/31/2018

### How to Fit a Tree in a Box

We study compact straight-line embeddings of trees. We show that perfect...
04/27/2018

### Average Case Analysis of Leaf-Centric Binary Tree Sources

We study the average size of the minimal directed acyclic graph (DAG) wi...
08/09/2020

### A Flexible Pipeline for the Optimization of CSG Trees

CSG trees are an intuitive, yet powerful technique for the representatio...
11/16/2018

### A tight kernel for computing the tree bisection and reconnection distance between two phylogenetic trees

In 2001 Allen and Steel showed that, if subtree and chain reduction rule...
##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1. Introduction

Networks have been introduced in phylogenetics to generalize the tree paradigm, which permits to represent only descent with modification (i.e. speciation events). Phylogenetic networks allow to model evolutionary scenarios including a larger class of evolutionary events, such as recombinations, lateral gene transfers and hybridizations.

In this paper, we shall focus on directed phylogenetic networks (see survey, for a short survey on the phylogenetic network paradigm also covering undirected phylogenetic networks). Mathematically, such networks are, in the broadest sense, directed acyclic graphs with a single node with no incoming edges –the root– representing the common ancestor of all the Operational Taxonomic Units (OTUs for short) under study, which are represented by the nodes with no outgoing edges – the leaves– of the graph; internal nodes represent either (hypothetical) speciations or (hypothetical) reticulated events. Unfortunately, this definition is too broad, both for representing biologically-meaningful evolutionary scenarios, and for giving objects that can be efficiently handled.

So far, several restrictions on this general definition have been introduced in the literature. Some of them are based on biological considerations, while others have been introduced to artificially narrow the space of networks under study. This led to the introduction of a panoply of different classes of phylogenetic networks, such as time-consistent networks (baroni2006), regular networks (Baroni2005), orchard networks (orchard), galled trees (galled_trees) and galled networks (galled_net), level- networks (vanIersel2011), tree-sibling networks (Cardona2009), tree-based networks (Francis2015) and LGT networks (cardona2015reconstruction), just to name a few.

In this paper, we shall focus on binary tree-child networks (BTC networks, for short), which were introduced by Cardona2009 and are one of the most studied classes of phylogenetic networks (VANIERSEL2010; vanIersel2014; Semple2016; Bordewich2018). Mathematically, being tree-child means that every internal node is compelled to have at least a child node with a single incoming arc. Biologically, it boils down to say that every non-extant OTU has at least a direct descendant through mutation.

The combinatorial study of phylogenetic networks is nowadays a challenging and active field of research. Nevertheless, the problem of counting how many phylogenetic networks are in a given subclass of networks is still open even for long-established classes. More precisely, this problem has been only recently solved for galled networks (COuntGalled); for other classes, including tree-child networks, we only have asymptotic results (McDiarmid2015; CountTC). Associated to the problem of counting networks, we find the problem of their “injective” generation, i.e. without having to check for isomorphism between pairs of constructed networks.

The main result of this paper is a systematic way of recursively generating, with unicity, all BTC networks with a given number of leaves. This generation relies on a pair of reduction/augmentation operations –both producing BTC networks– where reductions decrease by one the number of leaves in a network, and augmentations increase it. The idea of using pairs of operation has already been used to deal either with other classes of phylogenetic networks (cardona2008distance; cardona2009metrics2), or for BTC networks but without the unicity feature (orchard).

As interesting side product, this procedure gives a recursive formula providing an upper bound on the number of BTC networks.

The paper is organized as follows. In Section 2, we review the basic definitions that will be used throughout the paper. Section 3 is devoted to the reduction procedure, while in Section 4 we introduce the augmentation operation and prove that any BTC network can be obtained, in an unique way, via a sequence of augmentation operations applied to the trivial network with one leaf. In Section 5, we show how to relax the conditions for the applicability of the augmentation operation to obtain a recursive formula providing an upper bound on the number of BTC networks. In Section 6 we introduce the implementation of the algorithms presented in the paper, and some experimental results, including the exhaustive generation of all BTC networks with up to six leaves and an upper bound of their number up to ten leaves. Finally, in Section 7 we discuss how our reduction/augmentation operations extend and generalize analogous operations for phylogenetic trees.

## 2. Preliminaries

Throughout this paper, a tree node in a directed graph is a node whose pair of degrees is for the leaves, for the roots, or for internal tree nodes; a hybrid node is a node with .

A binary phylogenetic network over a set of taxa is a directed acyclic graph with a single root such that all its nodes are either tree nodes or hybrid nodes, and whose leaf set is bijectively labeled by the set . In the following, we will implicitly identify every leaf with its label. A binary phylogenetic network is tree-child if every node either is a leaf or has at least one child that is a tree node (Cardona2009); in particular, the single child of a hybrid node must be a tree node. We will denote by the set of binary tree-child phylogenetic networks over the set .

An elementary node in a directed graph is a node with or . An elementary path is a path composed of elementary nodes such that neither the single parent of (if it exists) nor the single child of are elementary. We call these last two nodes respectively the grantor (if this node is well-defined) and heir of the nodes in the elementary path. In case of an elementary node, its grantor and heir are those of the nodes in the single elementary path that contains the given node. The elimination of an elementary path consists in deleting all nodes in , together with their incident arcs, and adding an arc between the grantor and the heir of (provided that the grantor exists; otherwise, no arc is added). The elimination of an elementary node is defined as the elimination of the elementary path that contains the given node.

Given a node , we can split it by adding a new node , an arc , and replacing every arc with . If is a tree node, then is an elementary node whose heir is , and the elimination of recovers the original network. The successive splitting (say times) of a tree node generates an elementary path formed by nodes, whose heir is , and whose elimination recovers the original network.

## 3. Reduction of networks

The goal of this section is to define a reduction procedure on BTC networks that can be applied to any such network, and producing a BTC network with one leaf less. By successive application of this procedure, any BTC network can thus be reduced to the trivial network with a single leaf.

We start by associating to each leaf a path whose removal will produce the desired reduction (up to elementary paths).

Let be a leaf of a BTC network . A pre-TH-path for is a path such that:

1. Each node in the path is a tree node.

2. For each , the child of different from , denoted by , is a hybrid node.

3. For each , we have that .

A TH-path is a maximal pre-TH-path, i.e. a pre-TH-path that cannot be further extended. Note that, since all nodes in a pre-TH-path are tree nodes, if can be extended by prepending one node, then this extension is unique. Hence, starting with the trivial pre-TH-path formed by the leaf alone, and extending it by prepending the parent of the first node in the path as many times as possible, we obtain a TH-path that is unique by construction. Let be a TH-path; different possibilities may arise that make it maximal: (1) is the root of ; (2) the parent of , call it , is a hybrid node; (3) is a tree node whose both children are tree nodes; (4) is a parent of for some . (We shall see in Lemma 1 that the first case cannot hold).

For each leaf , we denote by its single TH-path and by the first node of this path. Note that we allow the case . In this case, if we are not in a trivial BTC network (i.e. a network consisting of a single node), the parent of is either a hybrid node, or a tree node whose two children are tree nodes.

###### Lemma 1.

Let be a non-trivial BTC network and let be any of its leaves. Then, cannot be the root of .

###### Proof.

Let be the path and assume for the sake of contradiction that is the root of . For each , let be the hybrid node that is a child of and the parent of different from ; recall that does not belong to by the definition of a pre-TH-path. Since is the root of , every node of either belongs to the path or is descendant of a node in . In particular, for each , there exists some such that is descendant of , and since this node is descendant of , is descendant of . Hence, starting with we get a sequence where each node in the sequence is a descendant of the following one. Since there is a finite number of nodes, at some point we find a repeated node, which means that contains a cycle and hence we have a contradiction. ∎

We say that a leaf is of type (resp. of type ) if the parent of is a tree node (resp. a hybrid node). If is of type , we indicate by the path obtained by prepending to the parent of . For convenience, we let if is of type .

###### Definition 1.

Let be a leaf in a BTC network . We define the reduction of with respect to as the result of the following procedure:

1. Delete all nodes in (together with any arc incident on them).

2. Eliminate all elementary nodes.

We indicate this reduction by . If we want to emphasize the type of the deleted leaf, we indicate the reduction by and say it is a -reduction if is of type , or by and say that it is a -reduction if is of type .

To ease of reading, we shall introduce some notations:

###### Definition 2.

Let be the path and let be the first node in . For each , is the hybrid child of , the parent of different from , and the single child of . The parent(s) of is (are ); the node is always a tree node, is its parent (if it exists, since could be the root of ), and its child different from .

In the following, we shall use the notations given in the definition above, which are illustrated in Figure 1.

###### Remark 1.

Since is tree-child, the nodes are always tree nodes, and so are and in case of an -reduction. In case of a -reduction, by definition of a TH-path, is either a tree node or coincides with one of the hybrid nodes . Also, the removal of the arcs of the form and makes nodes and elementary in , where , and for -reductions and for -reductions. Since no other arc is removed, no other node can be elementary. In order to find the heirs of nodes and , we must analyse under which circumstances two of these elementary nodes are adjacent in .

1. If we had that two nodes and were connected by an arc in , then the single child of a hybrid node in would be also a hybrid. This contradicts the fact that is tree-child.

2. The existence of an arc would imply the existence of a cycle in , which is impossible.

3. Consider now the case of an arc . In case of an -reduction, it would imply that both children of are hybrid nodes, which is impossible. However, such an arc can be present in a -reduction: when is equal to . In this last case, and form an elementary path in and their common heir is .

4. Finally, in case of an -reduction, it can exist an arc between and , say that the arc is (which implies, , ). In this case, and form an elementary path in and their common heir is .

In all other cases, the elementary nodes and are isolated, and their respective heirs are and .

We study now what we call the recovering data of a reduction. This information will be used in the next section to recover the original network from its reduction.

###### Definition 3.

The recovering data of the reduction is the pair , where:

• is the multiset of the nodes of that are heirs of the nodes . The cardinality of (as a multiset) is either or , depending on the type of the reduction, and will be denoted by .

• is the tuple of nodes of , which are the heirs of the nodes . This tuple could be empty, corresponding to the case .

We introduce now a set of conditions on multisets and tuples of nodes, and prove that the recovering data associated to any of the defined reductions satisfies them.

###### Definition 4.

Given a BTC network and a pair with

• a multiset of tree nodes of ,

• , with , an (eventually empty) tuple of tree nodes of ,

consider the following set of conditions:

1. For every with , the nodes and are different, and if they are siblings, then or .

2. For every , if is the child of a hybrid node or has a hybrid sibling, then .

3. No node in is a proper descendant of any node in .

4. .

5. and no node of appears in .

We say that is -feasible if it satisfies conditions 1, 2, 3, and 4T, and -feasible if it satisfies conditions 1, 2, 3, and 4H. Finally, we say that is feasible if it is either -feasible or -feasible.

###### Proposition 2.

Let be a -reduction of a BTC network . Then, its recovering data is -feasible.

###### Proof.

First, note that, by Remark 1, all nodes in are tree nodes and that Condition 4T holds trivially. Note also that is equal to if , or to if this node is different from all the nodes . We now prove that Conditions 1, 2 and 3 hold:

1. If , then in we have , which is impossible by definition of TH-path. If and are siblings in but none of these nodes is equal to , then and are siblings in , which implies that their common parent has two hybrid children, which is impossible in a BTC network.

2. If is the child in of a hybrid node and , then in we have that , which is a hybrid node, is the child of a hybrid node, which is impossible in a tree-child network. Analogously, if has a sibling in which is a hybrid node, and , then in we have that is sibling of another hybrid node, which is again impossible.

3. The existence of a non-trivial path in from to would, by construction, imply the existence of a path from to in . Since there exists also a path in from to , this would contradict the fact that is a DAG. ∎

###### Proposition 3.

Let be an -reduction of a BTC network . Then, its recovering data is -feasible.

###### Proof.

Again we have, by Remark 1, that all nodes in the recovering data are tree nodes. Additionally, by the same remark, we have that –and hence the first part of Condition 4H holds– and if is an arc of , then , otherwise with . Note that Condition implies that Conditions 1 and 2 can be simplified as follows: for all with , and are neither equal nor siblings, and for all , is neither the child nor the sibling of a hybrid node.

Conditions 1 and Conditions 2 and 3 in their simplified form follow using the same arguments as in the previous proposition. As for the condition 4H, the nodes and are different from the nodes since the parents of and in are tree nodes, while the parent of each of the nodes is hybrid. ∎

The following proposition is the main result of this section, since it shows that the reduction that we have defined, when applied to a BTC network, gives another BTC network with one leaf less. Hence, successive applications of these reductions reduce any BTC network to the trivial BTC network.

###### Proposition 4.

Let be a BTC network over and one of its leaves. Then, is a BTC network over .

###### Proof.

First, it is easy to see that, since no new path is added, the resulting directed graph is still acyclic.

Then, we need to check that is binary. To do so, we start noting that every node in is either a tree node, a hybrid node, or an elementary node. Indeed, the removal of (Phase 1 of Definition 1) only affects the nodes adjacent to this path, that is the nodes and , which, as shown in Remark 1, become elementary. The elimination of all elementary nodes (Phase 2 of Definition 1) does not affect the indegree and outdegree of any other node, apart when the root of is elementary. In such a case, the heir of becomes the new root. Hence, is binary and rooted.

Note also that the set of leaves of is , since in no node becomes a leaf and the only leaf that is removed is .

Finally, we need to prove that is tree-child. Note that, from what we have just said about how the reduction affects indegrees and outdegrees of the nodes that persist in the network, it follows that each hybrid node of is also a hybrid node of , and that its parents in are the same as in . It follows that no node in can have that all its children are hybrid, since this would imply that is not tree-child, a contradiction. ∎

###### Corollary 5.

Let be a BTC network over . Let and define recursively for each . Then, is a BTC network over . In particular, is the trivial BTC network with its single node labeled by .

We finish this section with the computation of the number of tree nodes and hybrid nodes that the reduced network has, both in terms of the original network and of the reduction operation that has been applied. But before, we give an absolute bound on the number of these nodes in terms of the number of leaves.

###### Lemma 6.

Let be BTC network over with tree nodes and hybrid nodes. Then , and .

###### Proof.

The equality follows easily from the handshake lemma taking into account the number of roots, internal tree nodes, leaves and hybrid nodes in , and their respective indegrees and outdegrees. The inequality is shown in Proposition 1 in (Cardona2009), and the last inequality is a simple consequence of the equality and the inequality already proved. ∎

###### Proposition 7.

Let be a BTC network and one of its leaves, and . Let (resp. ) the number of tree nodes and hybrid nodes of (resp. of ). Then

 t′=t−|¯¯¯¯¯¯¯¯TH(ℓ)|−1,h′=h−|¯¯¯¯¯¯¯¯TH(ℓ)|+1,

where is the number of nodes in .

###### Proof.

Since the number of tree nodes and hybrid nodes are linked by the equality in Lemma 6, it is enough to prove that . From the discussion in Remark 1, it is straightforward to see that the number of hybrid nodes in that are not in is if is of kind , and otherwise. Hence, in both cases we have and the result follows. ∎

## 4. Generation of networks

In this section, we consider the problem of how to revert the reductions defined in the previous section, taking as input the reduced network and its recovering data. This will allow us to define a procedure that, starting with the trivial BTC network with one leaf, generates all the BTC networks with any number of leaves in an unique way.

We start by defining two augmentation procedures that take as input a BTC network and a feasible pair, and produce a BTC network with one leaf more.

###### Definition 5.

Let be a BTC network over , a label not in , and a -feasible pair. We apply the following operations to :

1. Create a path of new nodes .

2. Split the node creating one elementary node and add an arc .

3. For each node , split it introducing one elementary node and add an arc .

4. Label the node by .

We denote by the resulting network and say that it has been obtained by an augmentation operation of type .

Note that the order in which steps 2 and 3 are done is relevant in the case that for some . In such a case, two nodes and are created, linked by an arc .

###### Proposition 8.

Using the notations of Definition 5, the network

 ~N=T−1(N,ℓ;{τ1},(y1,…,yr−1))

is a BTC network over . Moreover, if has hybrid nodes, then has hybrid nodes.

###### Proof.

We first check that the resulting directed graph is acyclic. Let us assume that contains a cycle. If we define and , we have that the only arcs connecting with are (with ), and is the only arc connecting with . The cycle can be contained neither inside , since these nodes are linked by a single path, nor inside , since otherwise would contain a cycle. Hence, the cycle must contain at least the arc and an arc . This implies the existence of a path from to visiting only nodes in , which in turn means that contains a path from to , against Condition 3 of Definition 4.

Note that the nodes in are tree nodes by construction. Also by construction, the node is a tree node, the nodes are hybrid nodes and is a leaf which is labelled with . Finally, the other nodes keep the same degrees they had in and hence is a binary phylogenetic network over with hybrid nodes.

Since is tree-child, in order to check that is also tree-child, we only need to check the newly added hybrid nodes, which are the parents of the nodes .

Let us first consider the case that for all . For each node , its parents are and the parent of in . The node is by construction a tree node whose other child is , which, in turn, is a tree node. Since , by Condition 2 of Definition 4, can have neither a hybrid parent nor a hybrid sibling, and it cannot be a sibling of any other node with . This latter restriction implies that has the same sibling in and . Thus both and are not hybrid nodes, and the network is tree-child.

Let us now consider the case that for a single choice of . The hybrid node in has as parents the nodes and , and these two nodes have as respective children and , which are tree nodes. For each other node with and such that is a not sibling of , the same argument as in the previous case proves that both parents of have a tree child. If is a sibling of , it is easy to see that the parent of is still tree-child since it has as child. ∎

###### Definition 6.

Let be a BTC network over , a label not in , and a -feasible pair. We apply the following operations to :

1. Create a path of new nodes .

2. Split each of the nodes introducing one elementary node and add an arc from to . Note that, if , two consecutive elementary nodes must be created.

3. For each node , split it introducing one elementary node and add an arc .

4. Label the node by .

We denote by the resulting network and say that it has been obtained by an augmentation operation of type .

###### Proposition 9.

Using the notations of Definition 6, the network

 ~N=H−1(N,ℓ;{τ1,τ2},(y1,…,yr−1))

is a BTC network over . If has hybrid nodes, then has hybrid nodes.

###### Proof.

The proof is completely analogous to that of Proposition 8, taking into account that one extra hybrid node is created. ∎

Given a BTC network over , a label and a feasible pair , in order to unify notations we define the augmented network as , if , and as , if . Also, we shall generically say that the offspring of a BTC network is the set of networks that can be obtained from it by means of augmentation operations.

Our next goal is to prove that different augmentation operations applied to a same BTC network or different BTC networks over the same set of taxa provide different networks. We start with the case of different networks.

###### Proposition 10.

Let and be two BTC networks, both obtained by one augmentation operation applied to two non-isomorphic BTC networks and over the same set of taxa . Then and are not isomorphic.

###### Proof.

If and have different set of labels, then it is clear that they are not isomorphic. We can therefore assume that both augmentation operations introduced the same new leaf . Suppose that . Then . Now, from the definitions of the reductions and augmentations it is straightforward to check that and we get that , a contradiction. ∎

We treat now the case of applying different augmentation operations to the same BTC network. But first, we give a technical lemma that will be useful in the proof of the proposition.

###### Lemma 11.

Let be a BTC network. Then, the identity is the only automorphism (as a leaf-labeled directed graph) of .

###### Proof.

Let be any automorphism of . Since is an automorphism of directed graphs and sends each leaf to itself, it follows that for each node of , where is the

-vector of

as defined in Cardona2009. Then, by (Cardona2009, Lemma 5c), it follows that and are either equal, or one of them is the single child of the other one; according to our definition of BTC networks, this last possibility implies that one of them is a hybrid node and the other one is a tree node, which is impossible if is an automorphism. Hence for every node . ∎

###### Proposition 12.

Let and be two BTC networks, both obtained by one augmentation operation applied to the same BTC network . If either the kinds of operation or the feasible pairs used to construct and are different, then and are not isomorphic.

###### Proof.

Let us assume that and are isomorphic. Then, it is clear that they have the same set of labels, and exactly one of them, say , is not a label of . Since and are isomorphic, the kind of is the same in both networks, which implies that the kind of augmentation operations used to construct and are the same. Also, since and are isomorphic, the nodes in the respective recovering data of the reductions must be linked by an isomorphism of phylogenetic networks. Therefore, and since by Lemma 11 BTC networks do not have a nontrivial automorphism, the respective recovering data must be equal. ∎

The following proposition shows that the reduction procedure defined in the previous section can be reverted using the augmentation operations presented in this section.

###### Proposition 13.

Let be a BTC network and a leaf of . Let , its recovering data, and . Then, and are isomorphic.

###### Proof.

It is straightforward to see that the operations and reverse the effects of and , respectively. The only points worthy of attention correspond to the cases where the single node in appears in (for reductions/augmentations of type ) or where there is a single node in with multiplicity two (for reductions/augmentations of type ). In the first case, the augmentation process creates two elementary nodes, and , connected by an arc , which is the same situation as in after the removal of the nodes in . In the second case, two elementary nodes and are created, connected by an arc, once again the same situation as in after the removal of the nodes in . ∎

A direct consequence of the results in this section is the following theorem, which can be used to generate in an effective way all BTC networks over a set of taxa. See Figure 2 for an example.

###### Theorem 14.

Let be a BTC network over . Then, can be constructed from the trivial network in (with one node labeled by ) by application of augmentation operations, where at each step , the leaf is added. Moreover, these augmentation operations are unique.

###### Proof.

The existence is a direct consequence of Corollary 5 and Proposition 13. Unicity comes from Propositions 10 and 12. ∎

It should be noted that very recently, other methods to generate all BTC networks over a set of taxa have been proposed (orchard), but, to our knowledge, this is the first time that the networks are generated with unicity. In previous attempts, an isomorphism check was needed after the generation phase.

## 5. Bounding the number of networks

In this section, we shall first give bounds for the number of BTC networks that can be obtained from a given one by means of augmentation operations. This will be done by bounding the number of feasible pairs in such a network. Then, we shall find bounds for the number of BTC networks with a fixed number of leaves.

Let be a BTC network over with hybrid nodes. From Lemma 6 we know that it has tree nodes, and that and . In the following, we shall show how to compute the number of pairs satisfying all conditions of Definition 4, except for Condition 3, via an auxiliary problem. Note that this will only give an upper bound for the number of networks, since the pairs we find can produce networks with cycles.

### 5.1. An auxiliary problem

Let be the set of tuples of length of tree nodes of such that (1) no pair of them are equal or siblings, and (2) none of them has a hybrid parent or sibling. We indicate the number of such tuples as , and since this number will only depend on , and , we indicate it also by . We consider the problem of computing .

We compute first how many tree nodes are there that do not have neither a hybrid parent nor a hybrid sibling. Since the single child of a hybrid node must be a tree node, there are tree nodes that have a hybrid parent. Note that each hybrid node has two siblings that must be tree nodes; also, a tree node cannot be sibling of two different hybrid nodes; hence, there are tree nodes that have a hybrid sibling. Since there cannot be a tree node having the two properties (if it has a hybrid parent, then it does not have any hybrid sibling), there are tree nodes that are either a child or a sibling of a hybrid node. Then, the number of tree nodes that do not have neither a hybrid parent nor a hybrid sibling is . Note that this set of nodes is composed by the root of the network and pairs of tree nodes that are siblings.

Consider now the problem of counting the number of tuples in this set that are neither equal nor siblings. We distinguish two cases:

• If none of the nodes is the root of , we start having choices for , and at each stage the number of choices decreases of two units. Hence, the number of choices is

 p0(n ,h,k)= =(2n−2h−2)(2n−2h−4)⋯(2n−2h−2k) =2k(n−h−1)(n−h−2)⋯(n−h−k) =2k(n−h−1)!(n−h−k−1)!.
• If one of the nodes is the root of , then the process of constructing an element in can be described as first choosing at which position one puts the root, and then filling in the remaining positions with a tuple of the set such that none of the nodes is the root (which is what we have just computed). Hence, the number of possibilities is

 p1(n,h,k)=k2k−1(n−h−1)!(n−h−k)!.

Then we get that

 p(n,h,k) =p0(n,h,k)+p1(n,h,k) =2k(n−h−1)!(n−h−k−1)!+k2k−1(n−h−1)!(n−h−k)!

### 5.2. Counting pairs satisfying Conditions 1, 2 and 4H

Consider pairs satisfying Conditions 1, 2 and 4H. Recall that, since condition 4H implies that and cannot have elements in common, Conditions 1 and 2 are simplified: no pair of nodes in can be siblings and none of them can either be the child of a hybrid node or have a hybrid sibling. Hence, the problem is equivalent to finding a tuple in and then either a tree node or an unordered pair of different tree nodes, in either case disjoint from those in . Once the tuple is fixed, the number of tree nodes available for choosing and is . Hence, the number of possible pairs is

 FH(n,h,r−1)=FH,1(n,h,r−1)+FH,2(n,h,r−1),

where

 FH,1(n,h,r−1) =p(n,h,r−1)⋅(2n+h−r), FH,2(n,h,r−1) =p(n,h,r−1)⋅ ⋅12(2n+h−r)(2n+h−r−1).

### 5.3. Counting pairs satisfying Conditions 1, 2 and 4T

The problem now is to count the ways of choosing and a tuple satisfying Conditions 1, 2 and 4T. Now can appear in , and different possibilities arise, since it allows that one of the nodes in has a sibling in , or that it has a hybrid parent or sibling. We consider, thus, these different possibilities:

• (for all ): This case is very similar to one considered in the previous paragraph, specifically the case where only a single node had to be taken. The number of possible pairs is

 FT,1(n,h,r−1)=p(n,h,r−1)⋅(2n+h−r).
• is a child or a sibling of a hybrid node: Choosing one of these pairs is equivalent to first choosing the position , then filling the other positions with a tuple in , and then choosing a node that is a child or sibling of a hybrid node to be put in the position . The number of ways to do this procedure is

 FT,2(n,h,r−1)=p(n,h,r−2)⋅(r−1)⋅3h,

since each hybrid node has a single child and two siblings, and none of these nodes appears twice, associated to two different hybrid nodes.

• is a sibling of some other node in : In this case one has to choose the positions and where to put the pair of sibling nodes, fill the other positions with a tuple in , choose a pair of sibling tree nodes to take as and , and finally set . The choice of and can be done in different ways. The choice of the tuple of length can be done in ways; of them contain the root of (and tree nodes with a sibling tree node) and do not contain the root (and contain tree nodes with a sibling tree node). Once this is done, the number of available pairs of sibling tree nodes is , if the root of was chosen, or otherwise. Hence, the total number of pairs is , corresponding to these two cases, with:

 FT,3,A(n,h,r−1) =(r−1)(r−2)⋅p1(n,h,r−3)⋅ ⋅(2n−2h−2r+6), FT,3,B(n,h,r−1) =(r−1)(r−2)⋅p0(n,h,r−3)⋅ ⋅(2n−2h−2r+4).
• but none of the previous conditions hold: In this case one only has to take a tuple in and choose which of the nodes to take as . The number of possible pairs is then

 FT,4(n,h,r−1)=p(n,h,r−1)⋅(r−1).

Note that the four conditions above are mutually exclusive. Hence, the overall number of possible pairs is the sum of all numbers found:

 FT(n,h,r−1) =FT,1(n,h,r−1)+FT,2(n,h,r−1)+ +FT,3(n,h,r−1)+FT,4(n,h,r−1).

### 5.4. Bounds for the number of networks

Each network with hybrid nodes, appears as augmentation of an unique network with hybrid nodes, where has length