Untangling Tanglegrams: Comparing Trees by Their Drawings

  • Balaji Venkatachalam
  • Jim Apple
  • Katherine St. John
  • Dan Gusfield
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5542)


A tanglegram is a pair of trees on the same set of leaves with matching leaves in the two trees joined by an edge. Tanglegrams are widely used in biology – to compare evolutionary histories of host and parasite species and to analyze genes of species in the same geographical area. We consider optimizations problems in tanglegram drawings. We show a linear time algorithm to decide if a tanglegram admits a planar embedding by a reduction to the planar graph drawing problem. This problem was considered by Fernau, Kauffman and Poths. (FSTTCS 2005). Our reduction method provides a simpler proof and helps to solve a conjecture they posed, showing a fixed-parameter tractable algorithm for minimizing the number of crossings over all d-ary trees.

For the case where one tree is fixed, we show an O(n logn) algorithm to determine the drawing of the second tree that minimizes the number of crossings. This improves the bound from earlier methods. We introduce a new optimization criterion using Spearman’s footrule optimization and give an O(n 2) algorithm.

We also show integer programming formulations to quickly obtain tanglegram drawings that minimize the two optimization measures discussed. We prove lower bounds on the maximum gap between the optimal solution and the heuristic of Dwyer and Schreiber (Austral. Symp. on Info. Vis. 2004) to minimize crossings.


Integer Linear Program Internal Node Linear Time Algorithm Internal Edge Integer Linear Program Formulation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bansal, M.S., Chang, W.-C., Eulenstein, O., Fernández-Baca, D.: Generalized binary tanglegrams: Algorithms and applications. In: BiCoB (2009)Google Scholar
  2. 2.
    Bertolazzi, P., Battista, G.D., Mannino, C., Tamassia, R.: Optimal upward planarity testing of single-source digraphs. SIAM J. Comput. 27(1), 132–169 (1998)CrossRefGoogle Scholar
  3. 3.
    Biedl, T.C., Brandenburg, F.-J., Deng, X.: Crossings and permutations. In: Healy, P., Nikolov, N.S. (eds.) GD 2005. LNCS, vol. 3843, pp. 1–12. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  4. 4.
    Buchin, K., Buchin, M., Byrka, J., Nöllenburg, M., Okamoto, Y., Silveira, R.I., Wolff, A.: Drawing (complete) binary tanglegrams: Hardness, approximation, fixed-parameter tractability. In: Graph Drawing. Springer, Heidelberg (2008)Google Scholar
  5. 5.
    Burt, A., Trivers, R.: Genes in Conflict. Belknap Harvard Press (2006)Google Scholar
  6. 6.
    Charleston, M., Perkins, S.: Lizards, malaria, and jungles in the Caribbean. In: Page, R. (ed.) Tangled Trees: Phylogeny, Cospeciation, and Coevolution, pp. 65–92. University Of Chicago Press, Chicago (2003)Google Scholar
  7. 7.
    Diaconis, P., Graham, R.L.: Spearman’s footrule as a measure of disarray. Journal of the Royal Statistical Society. Series B (Methodological) 39(2), 262–268 (1977)Google Scholar
  8. 8.
    Dwork, C., Kumar, R., Naor, M., Sivakumar, D.: Rank aggregation methods for the web. In: WWW, pp. 613–622 (2001)Google Scholar
  9. 9.
    Dwyer, T., Schreiber, F.: Optimal leaf ordering for two and a half dimensional phylogenetic tree visualisation. In: Australasian Symp. on Info. Vis., pp. 109–115 (2004)Google Scholar
  10. 10.
    Page, R.D.M. (ed.): Tangled Trees: Phylogeny, Cospeciation, and Coevolution. University Of Chicago Press, Chicago (2002)Google Scholar
  11. 11.
    Fagin, R., Kumar, R., Sivakumar, D.: Comparing top k lists. In: SODA, pp. 28–36 (2003)Google Scholar
  12. 12.
    Fernau, H., Kaufmann, M., Poths, M.: Comparing trees via crossing minimization. In: Ramanujam, R., Sen, S. (eds.) FSTTCS 2005. LNCS, vol. 3821, pp. 457–469. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  13. 13.
    Foulds, L.R., Graham, R.L.: The Steiner problem in phylogeny is NP-complete. Adv. in Appl. Math. 3(1), 43–49 (1982)CrossRefGoogle Scholar
  14. 14.
    Garey, M., Johnson, D.S.: Crossing number is np-complete. SIAM Journal on Algebraic and Discrete Methods 4, 312–316 (1983)CrossRefGoogle Scholar
  15. 15.
    Hinze, R., Paterson, R.: Finger trees: A simple general-purpose data structure. Journal of Functional Programming 16(2), 197–217 (2006)CrossRefGoogle Scholar
  16. 16.
    Hopcroft, J.E., Tarjan, R.E.: Efficient planarity testing. J. ACM 21(4), 549–568 (1974)CrossRefGoogle Scholar
  17. 17.
    Huelsenbeck, J.P., Ronquist, F.: Mrbayes: Bayesian inference of phylogeny (2001)Google Scholar
  18. 18.
    Kaplan, H., Tarjan, R.E.: Purely functional representations of catenable sorted lists. In: STOC 1996, pp. 202–211. ACM, New York (1996)Google Scholar
  19. 19.
    Kawarabayashi, K., Reed, B.: Computing crossing number in linear time. In: STOC, pp. 382–390 (2007)Google Scholar
  20. 20.
    Lee, J.: All-different polytopes. Journal of Combin. Optim. 6(3), 335–352 (2002)CrossRefGoogle Scholar
  21. 21.
    Lozano, A., Pinter, R.Y., Rokhlenko, O., Valiente, G., Ziv-Ukelson, M.: Seeded tree alignment and planar tanglegram layout. In: Giancarlo, R., Hannenhalli, S. (eds.) WABI 2007. LNCS (LNBI), vol. 4645, pp. 98–110. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  22. 22.
    Hillis, D.M., Heath, T., John, K.S.: Analysis and visualization of tree space. Systematic Biology 3, 471–482 (2005)CrossRefGoogle Scholar
  23. 23.
    Nöllenburg, M., Holten, D., Völker, M., Wolff, A.: Drawing binary tanglegrams: An experimental evaluation. In: ALENEX, pp. 106–119. SIAM, Philadelphia (2009)Google Scholar
  24. 24.
    Roch, S.: A short proof that phylogenetic tree reconstruction by maximum likelihood is hard. IEEE/ACM Trans. Comp. Biol. and Bioinf. 3(1), 92–94 (2006)CrossRefGoogle Scholar
  25. 25.
    Shih, W.K., Hsu, W.-L.: A new planarity test. Theor. Comput. Sci. 223(1-2), 179–191 (1999)CrossRefGoogle Scholar
  26. 26.
    Swofford, D.L.: PAUP*. Phylogenetic Analysis Using Parsimony (*and Other Methods). Version 4. Sinauer Associates, Sunderland, Massachusetts (2002)Google Scholar
  27. 27.
    Swofford, D.L., Olsen, G.J., Waddell, P.J., Hillis, D.M.: Phylogenetic inference. In: Molecular Systematics, 2nd edn., pp. 407–514. Sinauer (1996)Google Scholar
  28. 28.
    Venkatachalam, B., Apple, J., John, K.S., Gusfield, D.: Untangling tanglegrams: Comparing trees by their drawings. Technical Report CSE-2009-1, UC Davis, Computer Science Department (2009)Google Scholar
  29. 29.
    Wan Zainon, W.N., Calder, P.: Visualising phylogenetic trees. In: Piekarski, W. (ed.) Seventh Australasian User Interface Conference (AUIC 2006), Hobart, Australia. CRPIT, vol. 50, pp. 145–152. ACS (2006)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Balaji Venkatachalam
    • 1
  • Jim Apple
    • 1
  • Katherine St. John
    • 2
  • Dan Gusfield
    • 1
  1. 1.Department of Computer ScienceUC DavisUSA
  2. 2.Department of Mathematics and Computer Science, Lehman College, and the Graduate CenterCity University of New YorkUSA

Personalised recommendations