INGRID RINSMA Department of Mathematics and Statistics, Waikato Unicemity, Hmilton, New Zealand MICHAEL HENDY Dtpartment of Mathematics and Statistics, Palmemon North, New Zealand

q Uniuersity,

AND

DAVID PENNY Dqwtment of Botany and Zoology, Massey University, Palmerston North, New Zealand Received 7 August 1989; mised 28 August 1989

ABSTRACT Each edge in a weighted colored tree has a nonnegative weight cofrespouding to the colors of its incident vertices. The ~31 of these weights is the weight of the tree. Algori of O(n) are known to find minimal colorings, that is, to assign colors from a given finite settotheverticesoiatfeesoastomiGmize the weight of the tree. In this paper generating functions are used to find the number Gf minimal colorings and the average weight of each edge over such colorings, also using O(n) operations. Applications to evolutionary trees are given.

1. INTRODUCTION AND BACKGROUND A coloting of a tree T is an assignment of colors from a given set to ezh of the vertices of T. A change is an edge whose incident vertices have different colors. A weighted colored tree is a coloring in which each edge has a weight dependent upon the colors of its incident vertices. Throughoutthis are interested paper we shall assume that these weights are e sum of the in minimally colored trees, those colorings of each edg* 2 major application is in biology, tionary trees. Fitch [l] devised an algori used, so much so that it is now a “ci This algorithm is applied to a binary tree whose n pendant Gf with eas t=, in at least one solution, and the changes on each edge that TICAL BIOSCIENCES 98:201-210 (1 1,uOlO

2%5564/90,/\$03.50

INGRID RINSMA ET AL.

202

mouse

rabbit

FIG. i. A tree (a) on 11 taxa from Penny et al. (3) with 09 the from cdumn 110on the alignedDNA sequences.

codes

solution. Penny et al. [3j applied it to the tree shown in Figure la The DNA for each of the 11 taxa were aligned, and the algorithm was applied to each column. The situation for column 110 is shown in Figure lb. ~~thecalorsare~~~~A,C,aadG.~pendantv~hasafixed while the internal vertices can have any of the three colors. The ts here could correspond to the relative substitution probabilities from

of times there is a

. In addition, it allows the exon an edge to be calculated, though

and shown it to be correct [2, ~gorithm to any tree [2), to and to allow for alternative er we answer two further questions: colorings exist for a given tree, weightings, and

MINMALLY

COLORED

203

TREES

(2) What is the average weight of any edge over all such minimal colorings? These questions can be answered in O(n) time.

T is a tree with n vertices v,, v2,. . . , v,, and root v,,.If T is wooted, any vertex is arbitrarily designated the root v,. E(T) denotes T is then made into a directed tree by directing each l

## Minimally colored trees.

Each edge in a weighted colored tree has a nonnegative weight corresponding to the colors of its incident vertices. The sum of these weights is the we...