Weighting the Tree
A vital goal of creating phylogenies is to quantify a molecular clock that indicates the amount of evolutionary time separating two members of the phylogeny. To this end, we will assign numbers to the edges of a tree so that the number assigned to an edge represents the amount of time separating the two species at each end of the edge. More generally, the evolutionary time between any two species will be given by simply adding the individual times connecting the nodes.
In a weighted tree, each edge is assigned a (usually positive) number, called its weight. The distance between two nodes in a weighted tree becomes the sum of the weights along the unique path connecting the nodes.
To generalize Newick format to the case of a weighted tree
Given: A collection of
Return: A collection of
(dog:42,cat:33); cat dog ((dog:4,cat:3):74,robot:98,elephant:58); dog elephant