Skip to main content

A More Practical Algorithm for the Rooted Triplet Distance

  • Conference paper
  • First Online:
Algorithms for Computational Biology (AlCoB 2015)

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

Included in the following conference series:


The rooted triplet distance is a measure of the dissimilarity of two phylogenetic trees with identical leaf label sets. An algorithm by Brodal et al. [2] that computes it in \(O(n \log n)\) time, where n is the number of leaf labels, has recently been implemented in the software package tqDist [14]. In this paper, we show that replacing the hierarchical decomposition tree used in Brodal et al.’s algorithm by a centroid paths-based data structure yields an \(O(n \log ^{3} n)\)-time algorithm that, although slower in theory, is easier to implement and apparently faster in practice. Simulations for values of n up to 1, 000, 000 support our claims experimentally.

J. Jansson—Funded by The Hakubi Project and KAKENHI grant number 26330014.

R. Rajaby—Funded by the EXTRA Project at the University of Milano-Bicocca.

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

Access this chapter

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


  1. Bansal, M.S., Dong, J., Fernández-Baca, D.: Comparing and aggregating partially resolved trees. Theor. Comput. Sci. 412(48), 6634–6652 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  2. Brodal, G.S., Fagerberg, R., Mailund, T., Pedersen, C.N.S., Sand, A.: Efficient algorithms for computing the triplet and quartet distance between trees of arbitrary degree. In: Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2013), pp. 1814–1832. SIAM (2013)

    Google Scholar 

  3. 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  MATH  Google Scholar 

  4. Critchlow, D.E., Pearl, D.K., Qian, C.: The triples distance for rooted bifurcating phylogenetic trees. Syst. Biol. 45(3), 323–334 (1996)

    Article  Google Scholar 

  5. Dobson, A.J.: Comparing the shapes of trees. In: Street, A.P., Wallis, W.D. (eds.) Combinatorial Mathematics III. LNM, vol. 452, pp. 95–100. Springer-Verlag, Heidelberg (1975)

    Chapter  Google Scholar 

  6. Estabrook, G.F., McMorris, F.R., Meacham, C.A.: Comparison of undirected phylogenetic trees based on subtrees of four evolutionary units. Syst. Zool. 34(2), 193–200 (1985)

    Article  Google Scholar 

  7. Felsenstein, J.: Inferring Phylogenies. Sinauer Associates Inc, Sunderland (2004)

    Google Scholar 

  8. Fenwick, P.M.: A new data structure for cumulative frequency tables. Softw.: Pract. Experience 24(3), 327–336 (1994)

    Google Scholar 

  9. Gusfield, D., Eddhu, S., Langley, C.: Optimal, efficient reconstruction of phylogenetic networks with constrained recombination. J. Bioinform. Comput. Biol. 2(1), 173–213 (2004)

    Article  MATH  Google Scholar 

  10. Holt, M.K., Johansen, J., Brodal, G.S.: On the scalability of computing triplet and quartet distances. In: Proceedings of the 16th Workshop on Algorithm Engineering and Experiments (ALENEX 2014), pp. 9–19. SIAM (2014)

    Google Scholar 

  11. Jansson, J., Lingas, A.: Computing the rooted triplet distance between galled trees by counting triangles. J. Discrete Algorithms 25, 66–78 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  12. McKenzie, A., Steel, M.: Distributions of cherries for two models of trees. Math. Biosci. 164(1), 81–92 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  13. Nethercote, N., Seward, J.: Valgrind: a framework for heavyweight dynamic binary instrumentation. In: Proceedings of the ACM SIGPLAN 2007 Conference on Programming Language Design and Implementation (PLDI 2007), pp. 89–100. ACM (2007)

    Google Scholar 

  14. Sand, A., Holt, M.K., Johansen, J., Brodal, G.S., Mailund, T., Pedersen, C.N.S.: tqDist: a library for computing the quartet and triplet distances between binary or general trees. Bioinformatics 30(14), 2079–2080 (2014)

    Article  Google Scholar 

  15. sparsehash project webpage.

  16. Documentation for unordered_map.

Download references

Author information

Authors and Affiliations


Corresponding author

Correspondence to Jesper Jansson .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Jansson, J., Rajaby, R. (2015). A More Practical Algorithm for the Rooted Triplet Distance. In: Dediu, AH., Hernández-Quiroz, F., Martín-Vide, C., Rosenblueth, D. (eds) Algorithms for Computational Biology. AlCoB 2015. Lecture Notes in Computer Science(), vol 9199. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-21232-6

  • Online ISBN: 978-3-319-21233-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics