Darwin Help

Back to Index

Leaf

Class Leaf - external node for binary Tree

Calling Sequence  Leaf(Label)
Leaf(Label,Height)
Parameters
NameTypeDescription

Label anythingoptional label
Height numericoptional height
Return Type  Leaf
Methods type
Synopsis The Leaf structure holds the information associated with the leaf of a tree (Tree structure). The format is generally unspecified allowing Leaf structures containing anything. However, most phylogenetic tree construction algorithms in Darwin assume that a leaf label is contained in the first position and the height information is contained in the second position. Type testing for Tree will also yield true for a Leaf so that recursive trees with Leaf() nodes are easy to code. If additional information needs to be stored in the Leaf, the Leaf class can be extended with ExtendClass. Alternatively, extra arguments to Leaf will be left undisturbed.
Examples
> t:=Tree(Tree(Leaf(A),5,Leaf(B)),0,Tree(Leaf(C),11,Leaf(D)));
t := Tree(Tree(Leaf(A),5,Leaf(B)),0,Tree(Leaf(C),11,Leaf(D)))
> t[Left, Left, Label];
A


See also DrawTree,   ExtendClass,   Infix,   Leaves,   Postfix,   Prefix,   Tree