Processing math: 100%

Phylogeny Comparison with Split Distance solved by 232

July 2, 2012, midnight by Rosalind Team

Topics: Phylogeny

Quantifying Binary Tree Comparisonclick to expand

We may often obtain two different phylogenies on the same collection of taxa from different sets of data. As a result, we would like to have a way of quantifying how much the two phylogenies differ. In the simplest case, we would like to compare the characters of two phylogenies.

Recall from “Counting Unrooted Binary Trees” that two unrooted binary trees are equivalent when they have the same set of splits; recall also (by extension of “Counting Phylogenetic Ancestors”) that any unrooted binary tree on n taxa must have n3 nontrivial splits.

Problem

Define the split distance between two unrooted binary trees as the number of nontrivial splits contained in one tree but not the other.

Formally, if s(T1,T2) denotes the number of nontrivial splits shared by unrooted binary trees T1 and T2, Then their split distance is dsplit(T1,T2)=2(n3)2s(T1,T2).

Given: A collection of at most 3,000 species taxa and two unrooted binary trees T1 and T2 on these taxa in Newick format.

Return: The split distance dsplit(T1,T2).

Sample Dataset

dog rat elephant mouse cat rabbit
(rat,(dog,cat),(rabbit,(elephant,mouse)));
(rat,(cat,dog),(elephant,(mouse,rabbit)));

Sample Output

2

Please login to solve this problem.