Skip to main content

Linear-Time Tree Containment in Phylogenetic Networks

  • Conference paper
  • First Online:
Comparative Genomics (RECOMB-CG 2018)

Part of the book series: Lecture Notes in Computer Science ((LNBI,volume 11183))

Included in the following conference series:


We consider the NP-hard Tree Containment problem that has important applications in phylogenetics. The problem asks if a given single-rooted leaf-labeled network (“phylogenetic network”) N “contains” a given leaf-labeled tree (“phylogenetic tree”) T. We develop a fast algorithm for the case that N is a phylogenetic tree in which multiple leaves might share a label. Generalizing a previously known decomposition scheme lets us leverage this algorithm, yielding linear-time algorithms for so-called “reticulation visible” networks and“nearly stable” networks. While these are special classes of networks, they rank among the most general of the previously considered cases. We also present a dynamic programming algorithm that solves the general problem in \(O(3^{t^*}\cdot |N|\cdot |T|)\) time, where the parameter \(t^*\) is the maximum number of “tree components with unstable roots” in any block of the input network. Notably, \(t^*\) is stronger (that is, smaller on all networks) than the previously considered parameter “number of reticulations” and even the popular parameter “level” of the input network.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others


  1. 1.

    Herein, is the maximum out-degree in T and is the maximum in-degree in the result of contracting all arcs between reticulations in N.

  2. 2.

    u is stable on \(\ell \) if all root-\(\ell \)-paths contain u. The notion of stability is equivalent to the notion of “dominators” in directed graphs [1, 24].

  3. 3.

    A biconnected component (or “block”) of a network is a subdigraph induced by the vertices of a biconnected component of its underlying undirected graph, that is, a connected component in the result of removing all bridges.

  4. 4.

    The level of a phylogenetic network is the largest number of reticulations in any biconnected component (of its underlying undirected graph).


  1. Alstrup, S., Harel, D., Lauridsen, P.W., Thorup, M.: Dominators in linear time. SIAM J. Comput. 28(6), 2117–2132 (1999)

    Article  MathSciNet  Google Scholar 

  2. Arenas, M., Valiente, G., Posada, D.: Characterization of reticulate networks based on the coalescent with recombination. Mol. Biol. Evol. 25(12), 2517–2520 (2008)

    Article  Google Scholar 

  3. Bender, M.A., Farach-Colton, M.: The LCA problem revisited. In: Gonnet, G.H., Viola, A. (eds.) LATIN 2000. LNCS, vol. 1776, pp. 88–94. Springer, Heidelberg (2000).

    Chapter  Google Scholar 

  4. Bentert, M., Malík, J., Weller, M.: Tree containment with soft polytomies. In: Proceedings of the 16th SWAT. LIPIcs, vol. 101, pp. 9:1–9:14. Schloss Dagstuhl (2018)

    Google Scholar 

  5. Bodlaender, H.L., Jansen, B.M.P., Kratsch, S.: Kernelization lower bounds by cross-composition. SIAM J. Discrete Math. 28(1), 277–305 (2014)

    Article  MathSciNet  Google Scholar 

  6. Bordewich, M., Semple, C.: Reticulation-visible networks. Adv. Appl. Math. 78, 114–141 (2016)

    Article  MathSciNet  Google Scholar 

  7. Briggs, P., Torczon, L.: An efficient representation for sparse sets. ACM Lett. Program. Lang. Syst. (LOPLAS) 2(1–4), 59–69 (1993)

    Article  Google Scholar 

  8. Chan, J.M., Carlsson, G., Rabadan, R.: Topology of viral evolution. Proc. Natl. Acad. Sci. 110(46), 18566–18571 (2013)

    Article  MathSciNet  Google Scholar 

  9. Chandran, B.G., Hochbaum, D.S.: Practical and theoretical improvements for bipartite matching using the pseudoflow algorithm. CoRR abs/1105.1569 (2011)

    Google Scholar 

  10. Cole, R., Farach-Colton, M., Hariharan, R., Przytycka, T., Thorup, M.: An \(o(n \log n)\) algorithm for the maximum agreement subtree problem for binary trees. SIAM J. Comput. 30(5), 1385–1404 (2000)

    Article  MathSciNet  Google Scholar 

  11. Cygan, M., et al.: Parameterized Algorithms. Springer, Heidelberg (2015).

    Book  MATH  Google Scholar 

  12. Downey, R.G., Fellows, M.R.: Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer, London (2013).

    Book  MATH  Google Scholar 

  13. Drucker, A.: New limits to classical and quantum instance compression. SIAM J. Comput. 44(5), 1443–1479 (2015)

    Article  MathSciNet  Google Scholar 

  14. Fakcharoenphol, J., Kumpijit, T., Putwattana, A.: A faster algorithm for the tree containment problem for binary nearly stable phylogenetic networks. In: Proceedings of the 12th JCSSE, pp. 337–342. IEEE (2015)

    Google Scholar 

  15. Gambette, P., Gunawan, A.D., Labarre, A., Vialette, S., Zhang, L.: Solving the tree containment problem in linear time for nearly stable phylogenetic networks. Discrete Appl. Math. 246, 62–79 (2018)

    Article  MathSciNet  Google Scholar 

  16. Gunawan, A.D.M.: Solving the tree containment problem for reticulation-visible networks in linear time. In: Jansson, J., Martín-Vide, C., Vega-Rodríguez, M.A. (eds.) AlCoB 2018. LNCS, vol. 10849, pp. 24–36. Springer, Cham (2018).

    Chapter  MATH  Google Scholar 

  17. Gunawan, A.D., DasGupta, B., Zhang, L.: A decomposition theorem and two algorithms for reticulation-visible networks. Inf. Comput. 252, 161–175 (2017)

    Article  MathSciNet  Google Scholar 

  18. Gunawan, A.D., Lu, B., Zhang, L.: A program for verification of phylogenetic network models. Bioinformatics 32(17), i503–i510 (2016)

    Article  Google Scholar 

  19. Gunawan, A.D., Lu, B., Zhang, L.: Fast methods for solving the cluster containment problem for phylogenetic networks. CoRR abs/1801.04498 (2018)

    Google Scholar 

  20. Gusfield, D.: ReCombinatorics: The Algorithmics of Ancestral Recombination Graphs and Explicit Phylogenetic Networks. MIT Press, Cambridge (2014)

    MATH  Google Scholar 

  21. Hopcroft, J., Tarjan, R.: Algorithm 447: efficient algorithms for graph manipulation. Commun. ACM 16(6), 372–378 (1973)

    Article  Google Scholar 

  22. Huson, D.H., Rupp, R., Scornavacca, C.: Phylogenetic Networks: Concepts, Algorithms and Applications. Cambridge University Press, New York (2010)

    Book  Google Scholar 

  23. Kanj, I.A., Nakhleh, L., Than, C., Xia, G.: Seeing the trees and their branches in the network is hard. Theor. Comput. Sci. 401(1–3), 153–164 (2008)

    Article  MathSciNet  Google Scholar 

  24. Lengauer, T., Tarjan, R.E.: A fast algorithm for finding dominators in a flowgraph. ACM Trans. Program. Lang. Syst. 1(1), 121–141 (1979)

    Article  Google Scholar 

  25. Treangen, T.J., Rocha, E.P.: Horizontal transfer, not duplication, drives the expansion of protein families in prokaryotes. PLoS Genet. 7(1), e1001284 (2011)

    Article  Google Scholar 

  26. Van Iersel, L., Semple, C., Steel, M.: Locating a tree in a phylogenetic network. Inf. Process. Lett. 110(23), 1037–1043 (2010)

    Article  MathSciNet  Google Scholar 

Download references


Thanks to Celine Scornavacca for her thorough proof-reading.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Mathias Weller .

Editor information

Editors and Affiliations




(Proof of correctness of Rule 2). Let \(S^v\) be a subdivision of \(T_v\) in P and let \((N',T')\) be the result of applying Rule 2 to (NT).

\(\Leftarrow \)”: Let \(N'\) contain a subdivision \(S'\) of \(T'\). It suffices to show that the result S of replacing \(\rho \left( P\right) \) with \(S^v\) in \(S'\) is contained in N since S is clearly a subdivision of T. Since \(S^v\) is contained in P, it suffices to show that \(S'\) and \(S^v\) are vertex disjoint (except for \(\rho \left( P\right) \)). Towards a contradiction, assume that \(S'\) and \(S^v\) both contain a vertex \(u\ne \rho \left( P\right) \) of P. Since \(\mathcal {L}(S')\) and \(\mathcal {L}(S^v)\) are disjoint, u is ancestor to at least two different leaves in N. Thus, u is in the tip of P, contradicting that u is in \(N'\).

\(\Rightarrow \)”: Let N contain a subdivision S of T and let . Since \(\rho \left( P\right) \) is stable on c and \(c\in \mathcal {L}(T_v)\), we have \(u\le _N \rho \left( P\right) \), implying \(\mathcal {L}(S_{\rho \left( P\right) })\supseteq \mathcal {L}(T_v)\). Further, maximality of v implies \(\mathcal {L}(S_{\rho \left( P\right) })\subseteq \mathcal {L}(T_v)\). Let \(S'\) result from S by contracting \(S_{\rho \left( P\right) }\) into a single vertex and labeling this vertex \(\lambda \). Since \(\mathcal {L}(S_{\rho \left( P\right) })=\mathcal {L}(T_v)\), we know that \(S'\) is a subdivision of \(T'\) and it suffices to show that \(N'\) contains \(S'\). To do this, we show that all vertices of \(S'\) are in \(N'\). Assume towards a contradiction that \(S'\) contains a vertex w that is not in \(N'\). Then, w is in the tip of P, implying \(\mathcal {L}(S_w)\subseteq \mathcal {L}(S_{\rho \left( P\right) })\). Thus, w is a vertex of \(S_{\rho \left( P\right) }\) contradicting w being in \(S'\).

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Weller, M. (2018). Linear-Time Tree Containment in Phylogenetic Networks. In: Blanchette, M., Ouangraoua, A. (eds) Comparative Genomics. RECOMB-CG 2018. Lecture Notes in Computer Science(), vol 11183. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-00833-8

  • Online ISBN: 978-3-030-00834-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics