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 denotes the number of nontrivial splits shared by unrooted binary trees and , Then their split distance is .
Given: A collection of at most 3,000 species taxa and two unrooted binary trees and on these taxa in Newick format.
Return: The split distance .
将两棵无根二叉树之间的分割距离定义为一棵树而不是另一棵树中包含的非平凡分割的数目。
正式地,如果 表示无根二叉树共享的非平凡拆分的数量 和 ,则它们的分割距离为 。
给出:最多可收集3,000种分类单元和两棵无根二叉树的集合 和 以Newick格式在这些分类单元上。
返回:分割距离
Sample Dataset
dog rat elephant mouse cat rabbit (rat,(dog,cat),(rabbit,(elephant,mouse))); (rat,(cat,dog),(elephant,(mouse,rabbit)));
Sample Output
2