NANUQ: a method for inferring species networks from gene trees under the coalescent model

Species networks generalize the notion of species trees to allow for hybridization or other lateral gene transfer. Under the network multispecies coalescent model, individual gene trees arising from a network can have any topology, but arise with frequencies dependent on the network structure and numerical parameters. We propose a new algorithm for statistical inference of a level-1 species network under this model, from data consisting of gene tree topologies, and provide the theoretical justification for it. The algorithm is based on an analysis of quartets displayed on gene trees, combining several statistical hypothesis tests with combinatorial ideas such as a quartet-based intertaxon distance appropriate to networks, the NeighborNet algorithm for circular split systems, and the Circular Network algorithm for constructing a splits graph.


Background
In this paper we provide the theory supporting a new, statistically consistent method of inferring most topological features of a level-1 hybridization network under the network multispecies coalescent (NMSC) model. The method uses as data a collection of unrooted topological gene trees, which may themselves have been inferred from sequences.
Unlike pseudo-likelihood methods [1,2], our method does not require an assumed limit on the number of hybridization events in the network, nor does it involve a time-intensive search over the space of possible networks. Instead, it computes a certain distance between taxa which, under ideal circumstances, corresponds to a circular split system. When the expected distance is processed through particular algorithms to produce a splits graph, interpretation rules allow one to read off network information. The total theoretical running time of the algorithm is O(n 4 m) for an input of m binary gene trees on n taxa, making it computationally feasible when n has moderate size.
While we illustrate the method's utility through several examples with simulated and empirical data, our focus in this work is on providing its theoretical basis. This draws on a number of independent research works, but also requires new results on the nature of the splits graphs that are produced under ideal circumstances.
We call this new method the Network inference Algorithm via NeighbourNet Using Quartet distance, or by the acronym NANUQ. 1 It involves the following steps, applied to a collection of unrooted gene tree topologies assumed to have arisen under the NMSC on an unknown binary level-1 network: a. For each subset of 4 taxa, determine the empirical quartet counts from the gene trees, which will reflect possible cycles on the network, as shown in [1,3]. b. Apply a statistical hypothesis test to these counts, as in [4], to judge evidence as to whether the quartet species network displays a 4-cycle. c. Use the test results on quartets to construct a network quartet distance between taxa, extending the ideas of [5]. d. Apply the NeighborNet [6] and Circular Network algorithms [7] to construct a splits graph from the quartet distance. e. Interpret the abstract network produced in the previous step by certain rules developed in this paper to infer most topological features of the unknown network.
All steps but the last have been fully automated; in R for the steps (a-c), and SplitsTree4 [8] for step (d). While it is conceivable the last step could be as well, there are advantages to not doing so until more experience with the method has accumulated. For instance, some data sets may not support a hypothesis of evolution on a level-1 hybridization network, and a human interpretation of both the hypothesis test results of step (b) and the Split-sTree4 output of step (e) may suggest this. Simply returning a hybridization network most in accord with the output might be misleading if poor model fit is ignored. NANUQ offers several important advantages over other network inference methods we know of. In particular, it can indicate poor model fit to the level-1 NMSC and, in the case of reasonable fit, indicate the number of hybridization events without conducting a time-consuming search. In contrast, pseudo-likelihood methods, which can be used for network inference [1,2], are known broadly to be poor for judging model fit, though often perform well for inference. However, NANUQ only gives information on network topology, whereas pseudo-likelihood can be used to obtain metric information as well. We thus view NANUQ as complementary to existing approaches.
Several recent works [9,10] have taken a Bayesian approach to inference of species networks from genetic sequence data, to obtain a joint posterior on both species networks and gene trees. As attractive as one might find this as a conceptual approach, it produces a formidable computational challenge for data sets with many taxa or gene trees. Indeed, the largest analyses in these works are quite small, involving only 7 taxa and 106 gene trees from a yeast data set which we also analyze. The alternative approaches offered by NANUQ and the pseudo-likelihood algorithms easily handle much larger data sets, with thousands of genes, as have already been assembled by researchers.
We note that NANUQ's use of a splits graph is the first instance, to our knowledge, of such a graph being given a firm model-based interpretation as supporting a biological process underlying a data set. Splits graphs are generally viewed as exploratory devices for judging the extent to which a data set is "tree-like, " and authors often warn against interpreting them as supporting any particular biological mechanism [11]. We fully agree with this general statement; only in the framework of our multi-step algorithm do we claim that an interpretation of support for a hybridization network is justified by theory. While an earlier step in this direction was taken by [12], that work assumed no coalescent process modeling incomplete lineage sorting (ILS) was involved in the formation of gene trees, and provided a less detailed description of the form of a splits graph than is given here.
The theory we present is based on consideration of the quartets displayed on a collection of gene trees arising under the NMSC, but it differs in important ways from the more purely combinatorial work, such as [13], on undirected networks of level-1 and higher. First, we crucially focus on unrooted phylogenetic networks in the sense of [1,3], which retain the direction of hybrid edges from the rooted species network underlying the biological model, rather than fully undirected networks of [13]. This leads to a different notion of the trees and quartets displayed on a network, and of the set of splits we associate to a network. Second, unlike most purely combinatorial studies, our algorithm takes into account that due to the coalescent process some gene trees will display quartets inconsistent with the species network. NANUQ provides a means of determining, up to statistical inference error, which quartets are displayed on the network. Third, if these quartets are known exactly, we are able to recover not only the undirected version of the network (modulo contraction of 2-and 3-cycles) but also directions of hybrid edges in cycles of size 5 or larger. This paper proceeds as follows: We first outline and develop theory behind the NANUQ algorithm in a purely theoretical setting. This constitutes the majority of the work. We then more carefully outline the algorithm for data analysis, and conclude with a few examples of network inference.
In more detail, the theoretical portion of this work first formally defines the type of phylogenetic networks which underly our model, as well as unrooted semidirected networks induced from them. While this precise notion of unrooted network appeared in [3], it is not standard to the literature, yet it is essential to our work. Briefly recalling the network multispecies coalescent model (NMSC) and the notion of a quartet concordance factor (CF), we summarize results of [1,3] indicating how these concordance factors reflect quartet network topology, and provide a new analysis indicating the extent to which one can avoid the one important case of ambiguity in interpreting CFs. After reviewing terminology for split systems, we then define a split system associated to an unrooted semidirected level-1 network. This is used to define a new quartet intertaxon distance for a level-1 topological network, which can be computed from quartet information alone. We then investigate the splits graph computed from the quartet distance of a binary level-1 network. This requires establishing some new theoretical results which enable us to directly relate the form of a level-1 hybridization network to the form of the splits graph found from its network quartet distance.
Finally, we present our algorithm in full, making use of all the theory above, as well as hypothesis testing using CFs as developed in [4], and the NeighborNet [6] and Circular Network [7] algorithms as implemented in Split-sTree4 [8]. We give a running time analysis for NANUQ and establish its statistical consistency. As our primary goal in this paper is to provide the theoretical background to our algorithm, we conclude with a minimal set of example analyses, using both simulated and biological data. A later work, directed at empiricists, will focus further on NANUQ's performance in data analysis.

Rooted and unrooted phylogenetic networks
We begin by establishing terminology for phylogenetic networks. Throughout, X = {x 1 , x 2 , . . . , x n } denotes a fixed set of taxa.
Our focus is on an explicit network [11], that can be interpreted as providing an evolutionary history of species relationships, including hybridization or other forms of lateral gene transfer that occur at discrete moments in time.
Definition 1 ( [3,14]) A topological binary rooted phylogenetic network N + on taxon set X is a connected directed acyclic graph with vertices V and edges E, together with a bijective leaf-labeling function f : V L → X with the following characteristics: 1. The root r has indegree 0 and outdegree 2. 2. A leaf v ∈ V L has indegree 1 and outdegree 0. 3. A tree node v ∈ V T has indegree 1 and outdegree 2. 4. A hybrid node v ∈ V H has indegree 2 and outdegree 1. 5. A hybrid edge e ∈ E H is an edge whose child is a hybrid node. 6. A tree edge e ∈ E T is an edge whose child is a tree node or a leaf.
If ( , γ ) is a metric for N + , then we refer to (N + , ( , γ )) as a metric binary rooted phylogenetic network. While the idea of unrooting a tree is simple, unrooting a network is more subtle. For example, it may not be clear how to proceed when the two edges incident to the root have the same child. We follow [3] in elucidating this concept.
In a directed network, we say that a node v is above a node u, and u is below v, if there exists a non-empty directed path in N + from v to u. We also say that an edge with parent node x and child y is above (below) a node v if y is above or equal to v (x is below or equal to v). Definition 3 ([14]) Let N + be a (metric or topological) binary rooted phylogenetic network on X and Z ⊆ X . Let D be the set of nodes which lie on every directed path from the root r of N + to any z ∈ Z . Then the lowest stable ancestor of Z on N + , denoted LSA(Z) , is the unique node v ∈ D such that v is below all u ∈ D , u = v.
The lowest stable ancestor is a generalization (though not the only one) on a network of the concept of most recent common ancestor on a tree.
If z is a degree two node on a semidirected graph, with nodes x and y adjacent to z, then by suppressing z we mean deleting z and its incident edges, and introducing a new edge joining x and y. If the deleted edges formed a semidirected path, we direct this new edge consistently with that path; otherwise the new edge is undirected.

Definition 4
Let N + be a binary topological rooted phylogenetic network on a set of taxa X. Then N − , the topological unrooted phylogenetic network induced from N + , is the semidirected network obtained by 1. Deleting all edges and nodes above LSA(X), 2. Undirecting all tree edges, and 3. Suppressing LSA(X).
If N + has a metric structure, then N − inherits one in an obvious way. Edge lengths on N − are the sum of conjoined edge lengths in N + , and hybridization parameters are the same as those on N + .
Note that in some other phylogenetic works the term "unrooted network" is used for a fully undirected network. An unrooted network in our sense retains directions on hybrid edges, and thus encodes some information about possible root locations on N + . Figure 1 depicts a topological binary rooted phylogenetic network on the left and its induced topological unrooted network on the right.
For simplicity, when we refer to an unrooted network N − in this paper, either metric or topological, we mean a semidirected network induced from a rooted binary phylogenetic network N + as in Definition 4. That is, we implicitly assume the existence of N + . This is an important convention to keep in mind, since under the standard graph theoretical definition there are unrooted networks which are not so induced.
Since an unrooted network retains some directed edges, a useful definition of an induced quartet network is more elaborate than the analog for a tree. Recall that a trek between vertices x, y on a network is the union of a semidirected path from some vertex v to x and a semidirected path from v to y. A trek is simple if the two paths intersect only at v.

Definition 5
Let N − be a unrooted network on X, and let a, b, c, d ∈ X . The induced quartet network Q abcd is the unrooted network obtained by 1. Keeping only the edges in simple treks between pairs of elements of {a, b, c, d} , and then 2. Suppressing all degree two nodes.
In the case that N − is a metric network, the quartet network Q abcd inherits a metric structure in a natural way: noting that any hybrid edge e in Q abcd arises from a single hybrid edge ẽ of N − possibly conjoined with several tree edges, we set the hybridization parameter for e equal to that for ẽ . Edge lengths in Q abcd are simply sums of lengths of conjoined edges from N − . Figure 2 shows several quartet networks induced from the unrooted network in Fig. 1.
Finally, most of our results are established only for a subclass of phylogenetic networks exhibiting a level-1 structure. The definition we give is not the standard one for level-1 (e.g., [14]), but it is equivalent for binary directed networks [15]. We also use our notion of level-1 for the unrooted networks in this paper, where the directions of hybrid edges are preserved.

Definition 6
Let N be a (rooted or unrooted) binary topological network. If no two cycles in the undirected graph of N share a vertex, then N is level-1.

The network multispecies coalescent model and quartet concordance factors
The multispecies coalescent model (MSC) [16,17] is the standard probabilistic model of incomplete lineage sorting, by which gene trees, showing direct ancestral relationships, form within species trees composed of multi-individual populations. It traces, backwards in time, the lineages of a finite set of individual copies of a gene, sampled from different extant species, as they coalesce at common ancestral individuals.
The network multispecies coalescent model (NMSC) [18][19][20] is a generalization of the multispecies coalescent model, which allows a finite number of hybridization events, or other discrete horizontal gene transfer events, between populations. Its parameters are captured by a metric, rooted phylogenetic network, assumed to be binary, as defined above. Branch lengths are given in coalescent units, so that the rate of coalescence between two lineages is 1. At a hybrid node in the network, a gene lineage may pass into either of two ancestral populations, with probabilities given by the hybridization parameters γ , 1 − γ for that node. This differs from other generalizations of the MSC, such as those built on a structured coalescent, where genes may switch populations continuously over an interval in time.

Quartet concordance factors
The NMSC model is often used to obtain the probability (or density) of observing a specific gene tree (metric or topological, rooted or unrooted) in a species network. The NANUQ algorithm focuses on summaries of gene trees; that is, that a species network produces various gene tree quartets (unrooted topological gene trees on 4-taxa) in parameter-dependent frequencies under the NMSC. The study of these probabilities, and their use for network inference, was pioneered in [1], with further work in [3]. A key concept is that of a quartet concordance factor, whose definition we recall. A binary unrooted topological tree on four taxa a, b, c, d is called a quartet, denoted as ab|cd if deletion of its internal edge gives a connected component {a, b} . When n ≥ 4 , an n-taxon tree displays a quartet ab|cd if the induced unrooted tree on the four taxa is ab|cd.

Definition 7
Let N + be a metric rooted network on a taxon set X, and A, B, C, D lineages for a single gene sampled from individuals in species a, b, c, d ∈ X respectively. Given a gene quartet AB|CD, the concordance factor CF AB|CD = CF AB|CD (N + ) is the probability under the NMSC on N + that a gene tree displays the quartet AB|CD. The concordance factor CF abcd = CF abcd (N + ) is the ordered triple of concordance factors of each quartet on the taxa a, b, c, d.
When there is no ambiguity, such as when we have a fixed rooted metric network N + in mind, we denote the concordance factor simply by CF abcd . Similarly, when a, b, c, d are clear from context (e.g., if N + has only four taxa), we write CF for CF abcd . Also, while the language of 'concordance factor' is sometimes used for both theoretical values and empirical estimates, in this work we use this term exclusively for the expected values, being CF abcd = (CF AB|CD , CF AC|BD , CF AD|BC ) careful to refer to 'estimators of CFs, ' or 'empirical CFs, ' when these are computed from data.
As established in [1,3], the concordance factors for a level-1 network N + depend only on the unrooted metric network N − , and, more precisely, CF abcd depends only on the metric quartet network Q abcd induced from N − . Significantly, these concordance factors carry information about what 4-taxon substructures might be on that network. For instance, if four taxa a, b, c, d are related by the tree ab|cd on N − , then under the NMSC the concordance factors satisfy CF AB|CD > CF AC|BD = CF AD|BC . To explain what information CF abcd contains about cycle structure on N + , we quickly review some terminology and results from these works.
By an m k -cycle in a level-1 network we mean an m-cycle with exactly k taxa descended from its unique hybrid node. In a level-1 quartet network, there are exactly 6 types of cycles that may appear: 2 1 -, 2 2 -, 2 3 -, 3 1 -, 3 2 -, and 4 1 -cycles which are depicted in Fig. 3. When considering level-1 quartet networks, there are restrictions on the number and types of cycles that may occur simultaneously. For example, Q abcd might have a 4 1 -cycle or a 3 2 -cycle, but not both.
We next classify concordance factors CF abcd depending on the magnitude of its entries.

Definition 8
If the two smallest entries of the concordance factor CF = CF abcd are equal, then CF is said to be tree-like. If a tree-like CF has a unique largest entry, without loss of generality CF AB|CD , then CF supports the quartet ab|cd. If CF = (1/3, 1/3, 1/3) , then it supports all three quartets. This terminology is motivated by the fact that if a concordance factor CF arises from the NMSC on a species tree, then CF is tree-like, and its largest entry indicates the quartet species tree topology [21]. However, as was first shown in [1], certain types of non-tree networks also produce tree-like CFs under the NMSC.
Viewing CF as a point in the probability simplex  The next proposition summarizes several results from [3]. By contraction of a cycle, we mean the removal of its edges followed by the identification of all vertices in it.
Proposition 9 Let N + be a level-1 binary quartet network and N − c the network obtained from N − by contracting all 2-and 3-cycles and then suppressing degree 2 nodes.
1. If N − has no cycle of type 4 1 or 3 2 , then its concordance factor CF is tree-like, and supports the quartet CF AB|CD > CF AC|BD = CF AD|BC .

3.
If N − has a 4 1 -cycle, then its concordance factor CF is not tree-like, and if N − c displays a 4-cycle joining taxa in circular order a, b, c, d, then In Fig. 4, we make concrete the proposition's results. The CFs for binary quartet networks partition the simplex: 2 = {tree-like CFs} ⊔ {4 1 -cycle CFs} , with the collection of CFs for 3 2 -cycles meeting both subsets non-trivially. Notably, if a quartet network N − has no 3 2 -cycle, then CFs suffice to determine if N − c is a tree or a 4-cycle. This idea underlies our algorithm, as well as the network identifiability results from [3].
Indeed, we see from the partition that (in the absence of 3 2 -cycles) the presence of 2-cycles and 3 1 -cycles has no impact on whether a quartet tree or 4-cycle network is supported. This observation leads to the non-identifiability of such cycles on a network by the proof method utilized in [3], and prevents NANUQ from detecting them too. However, since 2-and 3 1 -cycles on a large network model 'hybridization' between the most closely related populations (two that split and then rejoin, or CF AB|CD > CF AC|BD and CF AD|BC > CF AC|BD . hybridization between two populations which have just split from a common one) the inability to infer that such hybridization events occurred by our method may not be too surprising. The SNaQ algorithm [1] is likewise unable to detect these, as it too is based on CFs.
Because concordance factors arising from quartet networks with a 3 2 -cycle (case 2 of Proposition 9) coincide with CFs for particular parameter choices for 4 1 -cycle networks and tree-like networks, such CFs must be handled with delicacy. Clearly, 3 2 -cycles on quartet networks are not identifiable from CFs, and therefore will not be reconstructed by the NANUQ algorithm which focuses only on 4-cycles and tree-like quartet networks. Because such 3 2 -cycles will be disregarded, we investigate them more fully next.
A first observation is that for a tree-like CF arising from a quartet network N − with a 3 2 -cycle, say with descendants a, b of the hybrid node as in Fig. 5, then N − c has topology ab|cd. This is exactly the topology supported by the CF, when viewed as arising from a particular parameter choice on the 4-taxon tree ab|cd. Thus, while determining if the CF arises from a 3 2 -cycle or a tree is not possible, a tree-like CF always correctly supports the topology of N − c . This leaves the question of how 'rare' are non-tree-like 3 2 -cycle networks, and what metric structure on a 3 2 -cycle network might lead to CFs that coincide with 4 1cycle CFs.

2 -cycles
Let N − be the unrooted quartet network shown in the left of Fig. 5, with branch length parameters t i in coalescent units, and hybridization parameter γ as shown. With x i = e −t i then [1,3] the quartet concordance factors of N − are We say a choice of parameters {t 1 , t 2 , t 3 , t 4 , γ } , or their transformed versions x i , is tree-like if the CF for the network is tree-like for those parameters. The set of tree-like parameters for N − is a region in the 5-dimensional cube, To get a sense of the size of the tree-like region on N − , we sampled uniformly at random 10 10 points in [0, 1] 5 . For untransformed branch length parameters t i , this corresponds to sampling from an exponential distribution with mean 1. We computed that approximately 0.00532 of the resulting CFs were not tree-like. In this sense, non-tree-like CFs from 3 2 -cycles are rare.
For additional insight into tree-like parameters on N − , we investigate CFs as functions of x 1 and x 3 , with 0 < x 2 , x 4 , γ ≤ 1 , noting that when x 2 , x 4 achieve their maximum value of 1, this corresponds to the network with hybrid branch lengths t 2 = t 4 = 0 . Concretely, parameters are tree-like if Hence parameters are tree-like for any values of , a region shown in the center of Fig. 5. This region has area 4 ln 5 4 ≈ .89 . More crudely, provided x 1 ≤ 4/5 (that is, t 1 ≥ log(5/4) ≈ 0.2231 coalescent units), then a tree-like CF results regardless of all other parameter values. Thus non-tree-like parameters require that t 1 be fairly short, causing substantial incomplete lineage sorting. For comparison, if the internal branch on a rooted 3-taxon species tree has length t < log(5/4) , then fewer than half of the gene trees match the species tree under the MSC.
Although this argument assumed the non-existence of 2 1 -, 2 2 -, and 3 1 -cycles in N − , a general level-1 quartet network with a 3 2 -cycle might have cycles of those types. The result generalizes without difficulty to these more general networks, with t 1 the length of the edge descended from the 3 2 -hybrid node. For larger networks, we have the following proposition.
Proposition 10 Suppose N + is a level-1 network on n taxa and that for each m k -cycle with m ≥ 3 and k ≥ 2 the branch descending from the hybrid node has length t ≥ log(5/4) . Then under the NMSC model all CFs for induced quartet networks Q on N − are tree-like, except when Q has a 4-cycle.
Before proving the proposition, note that an m k -cycle in N + can induce not only a 4 1 -cycle in an induced quartet network, but also smaller cycles, depending on the particular choice of four taxa. For instance, a 4-cycle in the network of Fig. 1(L) leads to a 3 2 -cycle in the induced quartet network on a, b, c, d, as shown in Fig. 2

(R).
Proof Choose taxa so that the 3 2 -cycle in N − abcd and its parameters are named as in Fig. 5. Then t 1 ≥ t since the edge of length t 1 in N − abcd is made by (possibly) conjoining several edges in N + , including the one of length t. The argument following equation (1) now applies.
The branch length hypotheses in Proposition 10 are sufficient, but not necessary, for tree-like CFs in the presence of 3 2 -cycles. For instance, if a tree edge e descendant from a hybrid node in a 3 2 -cycle in N + is followed by one (1) (or more) 2-cycles, then the length requirement on e to produce tree-like CFs might be shortened. Focusing again on the quartet network of Fig. 5, we now investigate transformed branch length parameters x 2 , x 4 on hybrid edges that lead to tree-like parameter choices. To this end, let M = max(x 2 , x 4 ) ≤ 1 . Then from Eq. (1) for any x 3 , γ , we find and parameters are tree-like if M ≤ min 2 The branch length conditions presented here that rule out non-tree-like 3 2 -cycles come with a caution, since one might prefer to avoid a priori modeling assumptions on branch lengths. Nonetheless, our goal has been to suggest that plausible assumptions can rule out nontree-like CFs arising from 3 2 -cycles in quartet networks. Inspection of empirical CFs from a data set may provide further evidence that no such CFs are involved in a data analysis

Network split systems and distances
The ability to use quartet CFs to determine whether a quartet network displays a 4-cycle can be combined with ideas from [5] to compute a pairwise distance between taxa on a large n-taxon network. Indeed, the intertwining of these ideas with that of a weighted circular split system is the foundation of the NANUQ algorithm. In this section we review the concepts of weighted circular split systems and associated distances, as needed for our inference method.

Split systems
We adopt standard terminology concerning splits [22]. A split A|B = B|A of taxa X is a bipartition X = A ⊔ B with A, B non-empty. The subsets A, B are called split sets. The set of all splits of X is denoted by Split(X), and S ⊆ Split(X) is called a split system on X.
Definition 11 A split system S ⊆ Split(X) is circular if there exists a linear ordering x 1 < · · · < x n of the elements of X such that each split in S has the form A|B with for appropriately chosen 1 ≤ p < q < n . The ordering of the x i is a circular ordering for S.
A circular ordering for S is not unique, since it can be modified by cyclically permuting the x i (e.g., replaced with x 2 < x 3 < · · · < x n < x 1 ) or by inversion (replaced with x n < x n−1 < · · · < x 1 ), while remaining a circular ordering for S . We treat such variants as the same, without further comment.
Given a tree T on X, deleting an edge defines a split according to the connected components of the resulting graph. The set of all such displayed splits is denoted S(T ) , and it is clear from a planar depiction of a tree that S(T ) is circular.
For a tree, the correspondence between edges and displayed splits allows edge weights to be viewed as split weights, by setting weights of non-displayed splits to 0. This is a special case of a weighted split system on X, a map A weighted split system ω on X induces a distance function d ω on X by where S xy ⊆ Split(X) is the set of splits separating x and y, i.e., splits A|B, with x ∈ A and y ∈ B . Clearly d ω is non- Recall that the support of a weighted split system, denoted supp(ω) , is the set of splits on which ω is non-zero.
As pointed out in [22], it follows from [23] that a circular distance function d uniquely determines the weighted split system ω such that d = d ω .

Splits from unrooted networks
Our notion of splits associated to a network, and some related terminology, is not standard, but is essential to this work. In particular, we focus only on phylogenetic unrooted networks N − as in Definition 4 induced from a rooted phylogenetic network and the direction of hybrid edges are retained in N − .

Definition 13
Let N − be a unrooted network on X. An unrooted tree T on X is displayed on N − if it can be obtained from N − by deleting some edges, including at least one hybrid edge from each pair, undirecting remaining hybrid edges, and suppressing degree 2 nodes. The set of all unrooted topological trees on X displayed on If N − has an m-cycle with m ≥ 4 , then the grove G(N − ) is a proper subset of the displayed trees on the undirected network N u underlying N − as defined in [13]. This is because N u is obtained by undirecting the hybrid edges in N − , and there is additional freedom in the choice of edges to delete in N u to obtain its displayed trees: It is not necessary to delete at least one of the edges from N u that arose from each pair of hybrid edges in N − .
If N − has 2-or 3-cycles, then deleting either hybrid edge in those cycles yields trees with the same topology, and hence gives the same elements of G(N − ) . In contrast, for cycles of size 4 or larger, the trees in G(N − ) vary with the choice of hybrid edge deleted. Since we assume that N − is level-1 with k cycles of size ≥ 4 , then

Definition 14
For an unrooted network N − , the set of splits is called the (unweighted) split system for N − . A weighted split system for N − is any weighted split system with support S(N − ).
The study of undirected networks in [13] provides the following theorem, establishing a connection between circular split systems and undirected level-1 networks.

Theorem 15 ([13]) Let S be a split system on a set X. Then S is circular if, and only if, there exists an undirected level-1 network N such that S ⊆ S(N ), the set of all splits of all trees on X displayed on N.
Note that if N u is the undirected network underlying the unrooted network N − , then S(N − ) ⊆ S(N u ) . As a consequence, we obtain the following. Quartet distance for level-1 networks As shown in [5], a topological tree has a natural metrization tied to the quartets displayed on the tree. Importantly, intertaxon distances from this metrization can be computed from the collection of displayed quartets, without having knowledge of the full tree, giving a means for consistently inferring the tree topology. After briefly reviewing these results in the tree setting, we generalize them to the setting of level-1 networks.

Quartet distance on a tree
For an unrooted binary topological phylogenetic tree T on X, any internal edge e induces a partition of X into 4 non-empty blocks, X 1 , X 2 , X 3 and X 4 , where the split associated to e is s e = X 1 ∪ X 2 |X 3 ∪ X 4 , and the splits associated to the 4 adjacent edges have an X i as one split set. Similarly, a pendant edge e to taxon a induces a partition into 3 blocks X 1 , X 2 and {a} , where s e = {a}|X 1 ∪ X 2 , and the splits associated to the 2 edges adjacent to e have an X i as one split set. The quartet weight function w T : Split(X) → R is defined as This split weight function then induces d w T , the quartet distance function on X. This distance is a tree metric, and therefore can be used to reconstruct the topological binary n-taxon tree T by several algorithms. Significantly, the distance function d w T can computed another way, from the set of quartets displayed on T, without prior knowledge of the full tree topology.
Theorem 17 [5] For any quartet q on taxa in X with |X| = n , let ρ xy (q) = 1 if q = xz|yw, and 0 otherwise. That is, ρ xy is the indicator function for separation of x and y on a quartet. Then for an unrooted binary tree T on X, and any x, y ∈ X,

Quartet distance on a network
To generalize Theorem 17 to a network, we begin with a definition.

Definition 18
Let N − be an unrooted network on X.
Then the quartet weight function ω N − is defined by where s ∈ Split(X) and w T (s) is the quartet weight function on T.
Thus, by Corollary 16, the quartet weight function ω N − is a weighted circular split system for N − . Moreover, the induced distance function is easily related to those for the trees in the grove G(N − ).

Lemma 19 Let N − be a level-1 unrooted network on X. Then
Proof For x, y ∈ X , let S xy ⊂ Split(X) be the set of splits separating x and y. Then To state a network analog of Theorem 17, we must extend the indicator function ρ xy to quartet networks.

Definition 20
Let Q xyzw be an unrooted level-1 4-taxon network on 4 distinct taxa x, y, z, w ∈ X . After contracting all 2-and 3-cycles, and suppressing degree 2 nodes, we obtain a network Q xyzw that is either a tree or has a single 4-cycle. Let In the case Q xyzw is a tree, this definition agrees with that in Theorem 17. An intuitive way of viewing this extension to networks is to observe that when Q xyzw is a 4-cycle, ρ xy (Q xyzw ) is the average of the values of ρ xy (T ) for T ∈ G( Q xyzw ) , so ρ xy measures how separated x and y are on Q xyzw . See Fig. 6.

Lemma 21
For an unrooted level-1 network N − , with k cycles of size ≥ 4, and distinct x, y, z, w ∈ X, let Q xyzw be the induced unrooted 4-taxon network on x, y, z, w. Then otherwise. Proof If ρ xy (Q xyzw ) = 0 , then there is no T ∈ G(N − ) with T xyzw separating x, y, so the equation holds. If ρ xy (Q xyzw ) = 1/2 , then Q xyzw has two hybrid edges, which are induced from hybrid edges of N − . Each of these is deleted in exactly half of the 2 k trees in G(N − ) , so 2 k−1 of the T ∈ G(N − ) have T xyzw displaying a quartet separating x, y, and the equation holds. Finally, if ρ xy (Q xyzw ) = 1 , so Q xyzw is either a quartet tree separating x, y, or has a 4-cycle with x, y opposite in its circular ordering, then for all T ∈ G(N − ) , T xyzw will display a quartet separating x, y, so the equation holds.
We now define a distance function in terms of quartet networks displayed on the network.

Definition 22
Let N − be an unrooted level-1 network on X. Then the quartet distance d Q,N − is with x, y ∈ X , distinct from w, z ∈ X.
Note that if N − = T is a tree, the definition of d Q,N − (x, y) agrees with Eq. (2). We now prove the network analog of Theorem 17, showing that the network distance d ω N − can be computed from induced quartet networks.

Theorem 23
Let N − be an unrooted level-1 network on X, with k cycles of size ≥ 4. Then Proof Using Lemma 19, Theorem 17, and Lemma 21, for x = y ∈ X, The import of this theorem is that from the induced quartet networks on N − we can compute the distance d Q,N − , which is, up to scaling, d ω N − , the distance from a weighted split system. In contrast, computing d ω N − directly from definition requires knowing G(N − ) , the collection of trees on X displayed on N − . This lies at the heart of our algorithm for network inference under the NMSC, as we can obtain information about induced quartet networks from biological data relatively easily, using empirical concordance factors, while information about the trees displayed on the species network does not seem to be directly obtainable.
Furthermore, since by Corollary 16 the underlying quartet weighted split system is circular, we have the following.

Corollary 24
Let N − be an unrooted level-1 network. Then the distance d Q,N − arises from a weighted circular split system, with support S(N − ).
Thus given sufficient information on induced quartet networks to compute d Q,N − , even approximately as in the presence of error, methods for analyzing distances from weighted circular split systems, such as the NeighborNet algorithm, can be productively applied, as we show in the next section.

Splits graphs from the network quartet distance
The last sections have shown a path toward obtaining, under the NMSC model, the distance associated to the weighted circular split system ω N − . But for this to have value, we need to be able to extract from this distance information about features of N − . While there is a well developed theory of splits graphs [7,11,23,24], associated to distances from such split systems, and splits graphs are networks, one can not hope that such splits graphs give N − directly. In particular splits graphs have no directed edges, and are generally not level-1.
Our goal in this section is thus to investigate the relationship between a level-1 network and the splits graphs obtainable from the quartet distance for that network. We develop precise rules by which one can interpret features in a splits graph for ω N − to obtain much information on the topological features of N − . While there is some overlap between the results in this section and those of [12], we give a complete presentation as is necessary for our more detailed results.
The tree edges (i.e., the undirected edges) in a level-1 unrooted network N − can be classified into two types, extending Definition 1 in this setting. Specifically, a cycle edge in N − is an undirected edge in a cycle, and a cut edge is an undirected edge that is not a cycle edge. Any k-cycle in N − is then composed of k − 2 cycle edges and 2 hybrid edges.
These notions extend to trees displayed on networks. For any T ∈ G(N − ) , the edges of T arise from those of N − in one of the following ways: 1. An edge ē of T is obtained directly from an edge of N − . Then ē is called a cycle or cut edge of T according to its classification in N − . 2. An edge ē of T is obtained from several edges of N − by suppressing internal nodes of degree 2. Since N − is level-1, at least one of these conjoined edges of N − is a cut edge, so we refer to ē as a cut edge of T.
As we show below, cut edges in N − correspond to splits s ∈ S(N − ) that occur on every T ∈ G(N − ) , while a split s derived from a cycle edge on T does not occur on every T ′ ∈ G(N − ) . Moreover, we see that edges in 2-cycles and 3-cycles on N − induce only cut edges on any T ∈ G(N − ) . For k ≥ 4 , a k-cycle on N − will induce k − 3 cycle edges on any T ∈ G(N − ) , since one hybrid edge is deleted, one hybrid edge is conjoined with its descendent cut edge, and one cycle edge is conjoined with a cut edge. A split s ∈ S(N − ) is called a cycle split (respectively, a cut split) if s = sē for a cycle edge (respectively, a cut edge) ē on some T ∈ G(N − ) . Note that the cut splits are precisely those splits obtained from N − by deletion of a cut edge, and that these two classes of splits form a partition of S(N − ).
In the next lemma, we prove that the quartet weight function ω N − on an unrooted network N − carries no information about 2-or 3-cycles.

Lemma 25
Let N − c be the graph obtained from a level-1 binary network N − by contracting each 2-and 3-cycle to a vertex and then suppressing degree 2 nodes. Then Proof If one or the other hybrid edge in a 2-or 3-cycle on N − is deleted, the resulting network has the same topology as obtained by contracting the cycle. Thus N − and N − c display the same topological trees.
In the next lemma, we formalize some observations made above.

Lemma 26
Let s ∈ S(N − ) for a level-1 binary network N − . Then the following are equivalent: Proof Clearly (2) implies (1). To see that (1) implies (2), suppose on some tree T ∈ G(N − ) there is a cycle edge ē with s = sē . Then ē arises from a cycle edge in N − and that cycle has hybrid edges e 1 and e 2 , where e 1 was deleted to form T. Then no tree T ′ ∈ G(N − ) which is formed by deleting e 2 will display s. This contradicts (1).
That (1) implies (3) is immediate. For the converse, observe that since N − is binary, each T ∈ G(N − ) is binary. But the set of splits on a binary tree is maximal with respect to compatibility, so (3) implies (1).
The equivalences in Lemma 26 imply that a split from a cycle edge in some T ∈ G(N − ) is incompatible with some split from a cycle edge on some other tree in G(N − ) , an observation we further refine in the following lemma. Suppose e, e ′ are in cycles C = C ′ . Now T determines a hybrid edge of C whose removal from N − , along with the removal of e, determines the split s, and T ′ similarly determines a hybrid edge of C ′ . Removing these two hybrid edges, together with one hybrid edge from every other cycle on N − determines a tree T ′′ ∈ G(N − ) . But T ′′ has both s, s ′ as displayed splits, which implies they are compatible. Thus e, e ′ must be in the same cycle on N − . Moreover, T , T ′ must be obtained by deleting different hybrid edges in the cycle containing e, e ′ , since if the same hybrid edge were deleted, the splits s, s ′ would again be displayed on a common tree, and hence be compatible.
For the converse, suppose e, e ′ are cycle edges in cycle C of N − , which induce cycle edges in trees T , T ′ ∈ G(N − ) , where T , T ′ are obtained by deleting different hybrid edges in C. Let X = X 0 ⊔ X 1 ⊔ X 2 ⊔ · · · ⊔ X m−1 be the partition of X obtained from the connected components of the graph resulting from removing all edges of C from N − . Suppose further that the ordering of these sets reflects the ordering around the cycle, so that X 0 is descendants of the hybrid node, and X 1 , X m−1 are its neighbors, etc. Then, without loss of generality, we may assume that split These splits are incompatible as claimed.
Split networks [11], also known as splits graphs, provide a valuable visual tool for interpreting split systems.
In what follows, we use the terminology 'splits graph' exclusively to avoid confusion with the species networks N + and N − associated with the NMSC.
In a splits graph, each edge is colored by exactly one of the splits, with each split possibly coloring multiple edges. Deleting all edges with a common color leaves two connected components, with taxon labels on the components giving the split sets. Unfortunately splits graphs are generally not uniquely determined by split systems. However, since the split systems of interest here arise from level-1 networks N − , and thus are circular by Corollary 16, we can impose an additional requirement, that of 'frontier-minimality' developed below, to determine most features of N − from interpretation of a frontier-minimal splits graph. The Circular Network Algorithm of [7] is the key to both showing split graphs with this additional property exist in this case, and producing them in specific instances.
Recall that the frontier of a planar graph is the subset of edges adjacent to the unbounded component of its complement in the plane (more informally, the "outside" edges of the graph). A graph is outer-labelled if the labelled vertices are in the frontier. Also, a blob on a network is a maximal set of edges in undirected edgeintersecting cycles. On an unrooted level-1 network such as N − , a blob is simply an undirected version of a cycle. [7] produces an outerlabelled planar splits graph N S such that 1. If s ∈ S c , then s colors exactly one edge in the frontier of N S , and this edge is not in any blob. 2. If s ∈ S i , then s colors precisely 2 edges in the frontier (and possibly additional edges not in the frontier) which lie in the same blob. 3. If s, s ′ ∈ S i are incompatible, then they color frontier edges in the same blob.

Lemma 28 Let S = S c ⊔ S i be a circular split system, with S c the subset of splits compatible with all others in S, and S i those incompatible with at least one other. Then the Circular Network Algorithm of
Proof The Circular Network Algorithm works iteratively, by adding new vertices and edges as each split is considered in some order, to produce an outer-labelled splits graph [7]. We may assume the trivial splits are in the system. The algorithm begins with these splits represented by a star tree, and the stated properties hold. Each time an additional split s is considered, the algorithm first determines if this split is incompatible with the current graph G i . If it is, the algorithm 'duplicates' parts of the frontier, composed of some edges labelled by splits incompatible with s, joining the duplicated section to the old part by 'ladder' edges colored by the new split s to form G i+1 . This makes the frontier grow by 2 edges colored by s, and ensures that any splits incompatible with s previously coloring only one frontier edge in G i , now color two frontier edges in G i+1 . Then any two edges colored by the same split lie in the same blob, as do frontier edges coloring incompatible splits.
If the new split s ∈ S c , then, reminiscent of the treepopping algorithm, a single new edge in G i is introduced to form G i+1 and is colored by s. This new edge is not in a blob.
This coloring of edges in the frontier of the splits graph produced by the Circular Network Algorithm can be characterized in an alternative, less algorithmic, way.

Definition 29
If S is a circular split system on X, then an outer-labelled planar splits graph N S on S is frontierminimal, if N S contains the minimal number of frontier edges among all outer-labelled planar splits graphs on S. Proof First, observe that each split in S must label at least one frontier edge, else deletion of edges labelled by that split would not disconnect N S .

Proposition 30 Any frontier-minimal splits graph N S for a circular split system S has properties (1), (2), and (3) of Lemma 28. Moreover, the Circular Network Algorithm produces a frontier-minimal splits graph.
Next, recall that the operation of contraction of a split s in a splits graph for S , which identifies the two endpoints of each edge labelled by s and deletes the edge, yields a splits graph for S {s} (Lemma 5.10.1 of [11]). Moreover, frontier edges resulting from contraction must arise from frontier edges in the original splits graph. If s, s ′ ∈ S i are incompatible splits in a splits graph for S , then by contracting all other splits we obtain a split network depicting only these two. Now if it were the case that only one frontier edge in this splits graph were labelled by s, deletion of that edge must separate the graph. But then, since s ′ is incompatible with s, s ′ must label edges whose deletion disconnects each of the components obtained by deleting the s edge. But this implies that deleting only the s ′ edges in N S separates the graph into at least 3 components, which contradicts that it is a splits graph. Thus s labels at least 2 frontier edges.
It follows that any splits graph has at least |S c | + 2|S i | frontier edges, and since this minimal count is achieved by the splits graph output from the Circular Network Algorithm, a frontier-minimal splits graph has |S c | + 2|S i | frontier edges.
Furthermore, in any splits graph for S each element of S i colors at least two frontier edges and each element of S c at least one. It then follows from the count of frontier edges in a frontier-minimal splits graph that the elements of S i color precisely two frontier edges, and elements of S c precisely one. The single frontier edge labelled by an element of S c cannot lie in a blob, since otherwise deleting it would not disconnect the graph. This establishes properties (1) and (2) of Lemma 28.
Finally, if s ∈ S i , then for any s ′ ∈ S i incompatible with s, contracting all splits but s, s ′ in a frontier-minimal splits graph must give a splits graph with four frontier edges. By considering all possible such graphs, these edges must form a 4-cycle with edges labelled in order s, s ′ , s, s′ . Since these four edges are in the same blob on this graph, they must be in the same blob in the original graph.
In [7] it is shown that the Circular Network Algorithm produces a splits graph minimal in a different sense: It has the smallest number of edges among all splits graphs whose bounded faces are parallelograms (i.e., quadrilaterals with opposite sides sharing colors). This addresses internal structure of the blobs, which our notion of frontier-minimal ignores. We have not investigated whether the two notions of minimality are equivalent, nor to what extent a frontier-minimal splits graph for a circular split system is unique.
The tree of blobs of a graph is the graph obtained by contracting edges and vertices in each blob to a single vertex.

Corollary 31
The tree of blobs of a level-1 network N − is isomorphic to the tree of blobs of a frontier-minimal splits graph for S(N − ).
Proof The tree of blobs of N − displays precisely those splits associated to cut edges of N − . By Lemma 26, these are precisely the splits compatible with all others in S(N − ) , and by Proposition 30, the tree of blobs of a frontier-minimal splits graph displays the same set.
To go further, we investigate how the structure of a blob (a cycle) in N − corresponds to a related structure of a blob (not generally a cycle) in a frontier-minimal splits graph for S(N − ) . The following, which characterizes splits associated to a cycle in N − , follows straightforwardly from definitions, so a formal proof is omitted. The argument is readily supplied by considering Fig. 7, which depicts a single cycle in N − , and the two networks obtained from it by deleting one or the other hybrid edge.

Lemma 32
Suppose a level-1 unrooted network N − has k cycles of size ≥ 4 . Let C be an m-cycle on N − , m ≥ 4 , and X = X 0 ⊔ X 1 ⊔ X 2 ⊔ · · · ⊔ X m−1 the partition of X obtained from the connected components of the graph resulting from removing all edges of C from N − . Suppose further that the ordering of these sets reflects the ordering around the cycle, so that X 0 is the descendants of the the hybrid node, and X 1 , X m−1 are its neighbors, etc. (see Moreover, (X 0 , X 1 , X 2 , . . . , X m−1 ) is the only circular ordering of the X i consistent with these splits, and with X m = X 0 the number of cycle splits arising from C that separate X i from X i+1 is The next lemma describes the part of the frontier in a frontier-minimal splits graph arising from splits associated to a single m-cycle, a description which will be used later to identify hybrid edges.

Lemma 33
With notation as in Lemma 32, a frontierminimal splits graph for the cycle splits S(C) arising from a single cycle C of size m ≥ 4 in N − forms a single blob whose frontier is a cycle of size 4(m − 3). Moreover, there are distinct vertices labelled in circular order by X 0 , X 1 , . . . , X m−1 along the frontier, with the number of edges between labels X i , X i+1 equal to the number of splits in S(C) that separate X i , X i+1 .
Proof Consider two splits associated to the cycle. By Lemma 32, they are either incompatible, or they are both incompatible with a third split from the same cycle. By Lemma 28, they therefore color edges in the same blob, and it follows that there is only one blob in the splits graph. Since by Lemma 32 there are 2(m − 3) splits associated to the cycle, by Proposition 30 the blob has |S c | + 2|S i | = 4(m − 3) edges in its frontier.
Also by Lemma 32 there exist splits separating any X i , X j , i = j , so the X i must label distinct vertices in the frontier. Since any split separating X i and X i+1 labels at least one edge in any frontier path between them, the number of edges in a minimal frontier path between and X i+1 is at least the number of splits separating them. This then implies that the X i must be in order along the frontier, at the distances claimed. Now suppose C is an m-cycle in N − . If m = 4 , this lemma indicates that a frontier-minimal splits graph for the splits associated to C is also a 4-cycle, that is, the undirected version of the cycle. However, if m ≥ 5 , the splits graph is more complicated, having frontier as those depicted in the examples of Fig. 8. We refer to such blobs as m-darts. The corners of the m-dart are the vertices on the frontier of the dart that are labeled by sets of taxa X i . The point of the m-dart, labelled by X 0 , is the unique corner that is m − 3 frontier edges away from its two closest corners. Thus in a closed walk around the frontier of the dart starting at the point, the number of edges between consecutive corners is Putting all this together, we have the following.  Proof By Lemma 25, we may assume N − has no 2-or 3-cycles. Let k denote the number of cycles of size ≥ 4 on N − , and G a frontier-minimal splits graph for S(N − ). By Corollary 31, the tree of blobs of N − and the tree of blobs of G are isomorphic, so we identify them. Moreover, since cycles in N − are vertex-disjoint, each cycle of size m ≥ 4 on N − gives rise to a node of degree m in the tree of blobs, so the tree of blobs has k multifurcations. This implies G has at least k blobs. A priori it is possible that G has more than k blobs, since if two blobs in G shared a vertex they would be collapsed to a single node in the tree of blobs.
By Proposition 30 property (3), frontier edges of G colored by splits associated with a single cycle of N − all lie in a single blob of G, since Lemma 32 shows two such cycle splits are either incompatible, or both incompatible with a third. Moreover, since the tree of blobs of N − (and G) has exactly k vertices corresponding to cycles in N − , it follows that G has exactly k blobs, which are vertex disjoint, and each blob has only splits associated to a single cycle of N − coloring its frontier edges. This establishes a one-to-one correspondence between cycles in N − and blobs in G, according to the coloring of frontier edges Fixing a cycle C on N − , and contracting all edges of G not labeled by splits associated to C preserves the frontier of the blob of G corresponding to C. By Lemma 33, this frontier is either a 4-cycle (if m = 4 ) or an m-dart (if m ≥ 5 ). Moreover, the partition of X according to the connected components of N − with C deleted is the same as that from the labeled corners of the 4-cycle or m-dart, with the same circular ordering, and in the case m ≥ 5 the descendants of the hybrid node of C label the dart's point. Thus both C in N − and the blob of G associated to C must map to the same multifurcation in the tree of blobs, and the frontier of G must have the form described. Figure 9 illustrates this theorem for a particular network. Note that the theorem only describes the topological structure of the splits graph. The metric splits graph's structure depends on details of the network beyond the analysis of the theorem, as is seen in Definition 18 of the split weights.
Importantly for applications, one can apply Theorem 34 "in reverse" to obtain information about the network N − from the frontier-minimal splits graph for S(N − ) . Indeed, although the correspondence between level-1 networks N − and frontier-minimal splits graphs as described in Theorem 34 is not one-to-one, the only information lost from N − is that of the existence of 2-and 3-cycles and the determination of the hybrid node in a 4-cycle. The specific geometry of the frontier of an m-dart in G for m ≥ 5 allows one to identify such m-cycles and hybrid nodes in N − . In conjunction with previous sections of this paper, this recovers the main result of [3]: Corollary 35 Under the NMSC model on a level-1 network N + , for generic parameters, the network obtained from N − by suppressing 2-and 3-cycles and undirecting 4-cycles is identifiable.
Beyond providing a different argument for this corollary, Theorem 34 provides theoretical underpinnings to a practical algorithm for (partial) network topology inference from a sample of gene trees, as outlined in the next section.

The NANUQ algorithm for inference of phylogenetic networks
Here we revisit and formalize the NANUQ algorithm sketched in the introduction.
Algorithm (NANUQ) Input: A collection of unrooted topological gene trees on subsets of a taxon set X, such that each 4-element subset of X appears on at least one tree; and two hypothesis testing levels 0 < α, β < 1.
1. For each subset of 4 taxa, determine the empirical quartet counts across the gene trees for each of the 3 resolved topologies. If all four taxa are not on a gene tree, that tree does not contribute to the counts. These 3 counts form an empirical quartet count concordance factor (qcCF) vector for the 4 taxa. 2. For each set of 4 taxa, apply two statistical hypothesis tests to its qcCF, with levels α, β , as described below, to determine whether to view the qcCF as supporting (1) a star tree, (2) a resolved tree, or (3) a 4-cycle network on the taxa. In cases (2) and (3), use the maximum likelihood estimate of the topology from the qcCF to determine which tree or network is supported. 3. Use the quartet networks/trees from the previous step to construct a network quartet distance between taxa, as in Definition 22, with the modification described below for unresolved quartets. 4. Use the NeighborNet Algorithm [6] to determine a weighted circular split system approximating the quartet distance. 5. Use the Circular Network Algorithm [7] to determine a frontier minimal splits graph for the circular system.
Output: A splits graph to interpret via Theorem 34 for features of N + . To analyze the running time for this algorithm, suppose |X| = n and the input set contains m trees. First note that tallying displayed quartets in Step 1 can be done in time O(n 4 m) , as discussed in [5]. The hypothesis tests for Step 2 are performed in constant time for each set of 4 taxa, for a total of O(n 4 ) . Step 3 in which the distance is computed requires running through the inferred quartet trees and networks for an additional time of O(n 4 ) . For Step 4, the NeighborNet algorithm as presented in [6] takes time O(n 3 ) . (The software implementation is different, having a guaranteed running time that is only exponential in n, but that in practice is much faster). Since NeighborNet can produce positive weights for all O(n 2 ) splits consistent with some circular ordering of the taxa, results from [7] show that the time for the Circular Network Algorithm in Step 5 is O(n 4 ) . Thus the total time for NANUQ is O(n 4 m).
We implemented Steps 1, 2, and 3 of the NANUQ algorithm in an R package MSCquartets, with a function accepting an input file of (metric or topological) Newick gene trees, and producing an output file of the network quartet distances computed from this data. When this file is opened by SplitsTree4 [8], Steps 4 and 5 are performed. With these implementations, we have found Step 1 by far dominates computational time, as is consistent with the running time analysis. However, the use of R probably slows computations considerably over what could be achieved.
The R package MSCQuartets is currently available on request from the authors, and has been submitted to CRAN for downloading.

Testing empirical quartet counts
The statistical tests in Step 2 of the NANUQ algorithm, based on [4], require further explanation.
We use a hypothesis testing framework, in which two tests are performed. One test is used to decide whether the topological signal in a qcCF is strong enough to justify belief in any resolved network or tree, as opposed to viewing the quartet as unresolved. The second test is used to decide if the qcCF supports a 4-cycle network or a tree. The particular network or tree is then chosen via maximum likelihood.
These tests are performed for each set of four taxa, as if all quartet gene trees are independent. Of course, these are not independent, since the quartet trees are subtrees of the same gene trees, and under the NMSC these gene trees are assumed to have formed on the same species network. Since the lack of independence depends in part upon the species network parameter, which is unknown and sought, it is not clear how one might compensate for it. However, treating summary statistics as independent when they are not also underlies phylogenetic inference schemes built on pseudo-likelihood (e.g., SNaQ) and seems a necessary and acceptable concession for developing fast and tractable methods. Suppose for a set of 4 taxa, one has tabulated the counts of the quartets displayed on gene trees in a sample, obtaining the qcCF. Under the NMSC model, these counts can be viewed as a multinomial sample from the distribution determined by the theoretical CF. Normalizing by the total count, we obtain an empirical CF which estimates the theoretical one. Because this empirical CF is computed from a finite sample, it is unlikely that it lies exactly where the theoretical CF would as shown in Fig. 4. However, an appropriate statistical test can be used for deciding whether the qcCF supports a quartet tree or network under the NMSC.
Specifically, for a fixed qcCF we first perform a hypothesis test for a star tree. More formally, under the NMSC the null hypothesis is The alternative hypothesis is that the qcCF may have arisen from either a resolved tree or a network under the NMSC, or that the NMSC model somehow does not apply. The NANUQ algorithm focuses exclusively on the first interpretation of the alternative, assuming that all data arises from the NMSC.
As the star tree has theoretical CF (1/3, 1/3, 1/3), we perform this test by computing the likelihood ratio statistic from the three quartet counts in qcCF, using a χ 2 distribution with 2 degrees of freedom to compute a p-value. With level β chosen for the test, we reject the star tree hypothesis for p-values smaller than β . (Note that β is used here as the size of the rejection region for the test, not the probability of a type II error). For larger p-values, we fail to reject the star tree.
As will be shown in Theorem 36 below, under the NMSC on a binary level-1 network for any level β > 0 , the probability that this test always rejects quartet star trees, approaches 1 as the sample size (number of gene trees) goes to infinity. Nonetheless, with finite and noisy data (perhaps due to gene tree inference error), this test is important to prevent interpreting a qcCF that is nearly uniform from indicating support for a particular tree or network topology. Performing this test allows for the suppression of weak and possibly erroneous signals in data sets of finite size. The second hypothesis test is to assess support for a tree-like quartet vs. a 4-cycle. Under the NMSC, we formulate a null hypothesis of with alternative that qcCF is not tree-like. Since underlying the NANUQ algorithm is the assumption that gene tree data arose from the NMSC, rejecting the null hypothesis is interpreted as giving evidence that the quartet network has a 4-cycle. That is, rejecting the null hypothesis is interpreted by NANUQ as support for a 4-cycle quartet network, ignoring the (measure 0) region where non-tree-like CFs from 3 2 -cycles may coincide with 4-cycle CFs. Geometrically, the model for this null hypothesis is the 3 line segments in the simplex of Fig. 4(L), with the alternative model the complement of the 3 line segments as shown in Fig. 4(R). For the test, we compute the likelihood ratio statistic for these hypotheses. Using a χ 2 distribution with 1 degree of freedom (the asymptotic distribution for a resolved tree) would be a standard approach to obtain a p-value for the statistic. However, the model space for H 0 has a singularity at the center of the simplex, and justification for the χ 2 depends on the model being approximated well by its tangent line. As this approximation fails at the singularity, using a χ 2 approximation in the vicinity of the singularity may result in poor testing, which in this case is quite conservative. Although the neighborhood of the singularity on which the χ 2 behaves poorly shrinks as the sample size m grows, this 'bad' neighborhood is present for any finite sample size. However, this particular model and its special geometry at the singularity has been studied extensively in [4], where an alternative approximate distribution has been developed. We adopt the techniques of that work for use with the likelihood ratio statistic, to compute p-values.
For the NANUQ algorithm with level α for this test, we interpret a p-value greater than α as support for a tree, with the particular tree topology chosen as the maximum likelihood estimate from the qcCF. The MLE quartet tree topology is simply the quartet topology with the largest count in the qcCF. A p-value less than α is interpreted as support for a 4-cycle network, where the particular 4-cycle topology supported is the maximum likelihood estimate from the qcCF. This is determined by which of the 3 triangular regions in the simplex the normalized qcCF lies, as in Fig. 4(R).
With two tests being performed in this way, it is possible that for a particular set of 4 taxa we find that we fail to reject the first hypothesis (that the qcCF arises a star tree) but reject the second (that it arises from a tree). This can be forced to occur by taking β quite small while α is large, but it may occur for less extreme values. In such a H 0 : The qcCF is tree-like, situation one must give priority to one test over the other. We choose to prioritize the first test, so that in this case we view the tests as supporting a star tree, on the principle that evidence for hybridization should be judged by the strictest standards.
The output of NANUQ depends on the choices of significance levels α and β , with smaller values of α requiring stronger evidence for 4-cycles, and smaller values of β requiring stronger evidence for any resolution of the 4-taxon network. We view this feature positively, as it requires that users of NANUQ examine their data and consider the impact of choosing different levels. Since the input gene trees are likely to be noisy from the error introduced by inferring them from gene sequences, it is reasonable to set α quite small, which imposes a high standard for evidence of hybridization. However, practitioners must decide (and report) what standards they impose by their choices of α and β.
We note also that there is no reason that α and β should be chosen to have equal values, and we believe appropriate choices of both will depend upon the level of noise in the data. In particular, a priori choices of conventional values such as 0.05 are likely poor choices. Investigating the impact of a range of choices for α and β on the final splits graph is a necessary part of the analysis. This issue is addressed briefly below through several examples of simulated and empirical data sets, but we defer more complete comments to a future paper directed at empiricists.
The testing framework described here treats any qcCF judged non-tree-like as supporting a 4-cycle and not a 3 2 -cycle. Using Proposition 10, by an assumption of sufficiently long edges descended from all hybrid nodes, one can rule out the possibility of non-tree-like 3 2 -cycles, although an empiricist may prefer not to make such an assumption. In a future version of NANUQ we intend to offer a choice of using an additional statistical test for 3 2cycle networks, but this test will also be nonstandard, due to the model having a singularity at the crossing of three line segments (see Fig. 4(C)), and thus requires additional theoretical development.
Finally, we note that these tests take into account the total number of quartets for a particular set of four taxa. If some gene trees have missing taxa, these numbers may vary with the set of four taxa, but the tests can still be performed. Thus such missing taxa will not be problematic for performing the algorithm, and moderate levels of missingness should not greatly degrade performance.

Quartet distance with unresolved quartets
The quartet distance defined for a binary network earlier in this work required that all quartet networks, after contraction of 2-and 3-cycles, be binary, with positive lengths for all tree edges. However, in Step 2 of the NANUQ algorithm we include a hypothesis test for a star tree, to reduce the possibility of supporting a particular resolved tree or 4-cycle when the qcCF is nearly uniform and gives at best weak evidence as to what the resolved topology should be. Additionally, one might sample multiple individuals per taxon, which can be thought of as polytomies at the leaves of the species network. (See, for instance, Example 39). We thus must explain how we modify the quartet distance computed in Step 3 to handle unresolved quartets.
To this end, we make a simple extension of Definition 20 for ρ xy (Q xyzw ) . Guided by the results in [5] on quartet distances for non-binary trees, we set In particular, this means a star tree is viewed as separating any two distinct taxa on it.
Under the assumption of a binary network, this modification has no impact on the asymptotic behavior of the algorithm under the NMSC model, since by Theorem 36 below the probability of rejecting all quartet star trees approaches 1 as the size of the data set grows.

Statistical consistency
An estimator of a model parameter is said to be statistically consistent if the probability of inferring the parameter to arbitrarily small precision from a data set of size m produced in accord with the model approaches 1 as m approaches infinity. Since the NANUQ algorithm depends upon choices of two significance levels, α and β , these choices must be taken into account in formulating an appropriate notion of consistency for it. As we will show, because of the assumption that the unknown network is binary, the value of 0 < β < 1 will be inconsequential for this notion, since as m grows the probability of rejecting a quartet star tree approaches 1 for every choice of four taxa.
In contrast, when a true quartet network is tree-like, then no matter how large the data set, we expect to reject the null hypothesis that the corresponding qcCF is tree-like approximately 100α % of the time. That is, with probability about α , the hypothesis test will incorrectly support a 4-cycle network when the true quartet network is tree-like. This behavior is fundamental to the hypothesis testing framework, and cannot be avoided.
As a consequence, any notion of statistical consistency for NANUQ must consider sequences of significance levels α m → 0 . We will show the existence of a sequence of levels α m , dependent on the sample size m, so that as m increases the probability of correctly failing to reject the null hypothesis (avoiding type I errors at level α m ) ρ xy (Q xyzw ) = 1 if Q xyzw is a star tree.

Variants of NANUQ
The NANUQ algorithm can be adapted to use any means of determining from data what 4-taxon species network is supported. Thus future developments might allow for the replacement of Steps 1 and 2 by alternative approaches. For instance, one might adopt for analyses of 4-taxon networks an invariants-based approach such as in [25], so that the data becomes aligned genomic sequences. Alternatively, generalizations of ideas from [26] which are now being investigated may allow for determination of rooted triple networks from genomic sequences, and a rooted triple distance can replace the quartet distance used here. The essence of the NANUQ approach is to use a quartet (or rooted triple) distance appropriate to networks along with the NeighborNet and Circular Network Algorithm, though how one obtains the information necessary to compute the distance may vary.

Sources of error
While NANUQ is a statistically consistent (in the precise sense of Theorem 36) method of inferring certain network features from a collection of gene trees produced by the NMSC model, in practice it must be applied to a finite set of inferred gene trees. Possible sources of errors in conclusions drawn from NANUQ include: 1. Error in gene trees, due to their inference from sequence data, 2. Small sample size (e.g., few gene trees, many missing taxa on gene trees), 3. Miscalls of evidence for/against hybridization in individual quartets, in Step 2, 4. The NeighborNet Algorithm's projection of the split system onto a circular one, in Step 4, 5. The presence of non-tree-like 3 2 -cycles on some induced quartet networks, 6. NMSC model misspecification due to any of: a. A non-level-1 network, b. Structure within populations, c. Continuous gene flow between populations.
Thus one should not expect empirical data to necessarily lead to a splits graph exactly conforming to form described by Theorem 34. Note that the algorithm of [27] offers an alternative to NeighborNet that might reduce the error arising in passing to a circular split system from the quartet distance. However, this has not been implemented in general purpose software yet, so we were unable to test its performance.
We have chosen not to suggest any automatic interpretation of the output of NANUQ, such as a mechanism for producing the closest splits graph (by some measure) that conforms exactly to the form described by Theorem 34. Thus the user must visually consider the output, which will reflect some of the error. In particular, SplitsTree offers a capability of removing splits with small weight from a splits graph, and this can be useful for removing some of the noise remaining after projecting onto a circular split system.

Examples
In this section we present three examples of data analysis with NANUQ. The first uses a simulated data set of gene trees (without any gene tree inference error), the second the well-known and well-studied yeast data set of [28], and the third the butterfly data set of [29]. For the empirical data sets, we use gene trees previously inferred from genetic sequences. Reported running times are from a Macbook Pro computer with a 3.1 GHz processor.
Example 37 We generated a data set of 1000 gene trees using Hybrid-Lambda [30] on the species network N + shown in Fig. 9(L), with branch lengths in coalescent units and hybridization parameters as shown in Table 1.
In running NANUQ on this data set, our implementation of Steps 1-3 in R required about 63s of computation time. We considered a range of values of α and β for the hypothesis tests. To visualize outcomes of the hypothesis tests, we produced simplex plots such as those shown in  Fig. 10, which plot empirical CFs (i.e., qcCFs normalized to sum to 1) for each set of 4 taxa, color coded to indicate test outcomes. The results of the hypothesis tests gave a rather clean separation of empirical CFs into those close to the 3 line segments which were classified as tree-like, and those farther away which were viewed as supporting a 4-cycle. We found that for any level α in the range 10 −17 ≤ α ≤ .01 , our hypothesis tests drew the same conclusions as to which qcCFs supported a 4-cycle (red triangles). The close clustering of the qcCFs not rejected as tree-like (blue circles) around the tree model also suggests little error in them, so that a rather large value of β might be sufficient to test for lack of resolution. When β is set to .05, all qcCFs result in rejection of the star tree hypothesis. As shown in the figure, when β is reduced to 10 −19 a single failure to reject the star tree hypothesis occurs (tan square). Using α = .01 and β = .05 to compute the quartet distance, from SplitsTree4 we obtain the splits graph shown earlier as Fig. 9(R). Under the rules of Theorem 34, this correctly gives all features of N − inferable by NANUQ, as shown in Fig. 9(C). Reducing the sample size to 300 gene trees, while using the same values of α and β , we obtained the same correct inference result.
Example 38 For the second example we use gene trees inferred from a subset of the yeast data set of [28] which have been analyzed by multiple investigators [9,10,[31][32][33][34]. The 106 gene trees each relate a single allele sampled from seven Saccharomyces species: S. cerevisiae (S cer), S. paradoxus (S par), S. mikatae (S mik), S. kudriavzevii (S kud), S. bayanus (S bay), S. castellii (S cas), S. kluyveri (S klu), and the outgroup fungus Candida albicans (C alb). Running time for NANUQ's Steps 1-3 was under 0.5 s. Fig. 11 are some sample results from hypothesis tests for several choices of α and β . As all of the empirical CFs are far from (1/3, 1/3, 1/3) , the CF for the star tree, only a quite small β would lead to failing to reject the star tree for any set of 4 taxa. Thus, for this data set, we set β = 0.1 and classify all quartet networks as resolved, either as trees or 4-cycle networks. (We also see that no empirical CFs are plotted near the locations of non-tree-like 3 2 -cycle CFs, giving us some confidence in NANUQ's assumption that there are none in the data).
Example 39 For the third example we use gene trees inferred from a Heliconius butterfly data set [29], also analyzed in [25], which have been presented as evidence of gene flow between sympatric species. The sequence data consists of 2909 loci, derived from non-overlapping 100-kb windows in the full genome of individuals. Four individuals were sampled from three ingroup Running time for Steps 1-3 of the algorithm was about 174s. Figure 13 shows results of hypothesis tests for one choice of α and β , with Fig. 14    and inferred network structure. Note that a number of the empirical CFs (tan squares in Fig. 13) are close to the star-tree CF, and the choice of test level β = 10 −30 results in these being treated as unresolved quartets, giving the multifurcations in the splits graph for the three multi-sampled taxa. If β is made larger so that star trees are rejected more often, then blobs can appear within the single taxon groups. For a broad range of choices for α and β (not shown), the three ingroups H. rosina, H. melpomene, H. c. chioneus and the outgroup are related by a 4-cycle by NANUQ.
Though not the taxa of focus in the study [29], the splits graph of Fig. 14 depicts interesting relationships between the outgroup taxa and illustrates the flexibility of our analysis. While difficult to see in the SplitsTree4 output, there is a split with very small weight separating H. ethilia, H. sergestus, and H. pardalinus from the rest of the taxa. Split-sTree4 allows such small weight splits to be filtered out, and doing so leaves a 5-dart pointed at H. sergestus. However, for different values of α the 5-dart can change: for example, for α = 10 −17 the 5-dart points to H. ethilla instead. Thus while the central 4-cycle is very well supported, across many values of α and β , one might not want to draw firm conclusions on other hybridizations in this data set. The analysis does, however, suggest that the relationships between these taxa might warrant further investigation.

Conclusions
The NANUQ algorithm is built on a broad collection of ideas, including theoretical understanding of the behavior of the network multispecies coalescent model on 4-taxon networks, hypothesis testing for certain submodels of the trinomial, a quartet-based intertaxon distance, circular split systems, and splits graphs. It provides a means of visualizing discordance in a collection of gene trees through a simplex plot, as well as fit to the coalescent on a level-1 species network in its splits graph output.
Importantly, NANUQ offers model-based, statistically consistent inference of most topological features of such a species network. Moreover, simulations and empirical examples suggest it is capable of performing network inference from gene trees rapidly in comparison to other approaches.