Darwin Help

Back to Index

RotateTree

Function RotateTree - Returns a new, rotated tree

Calling Sequence  RotateTree(tree,side,sub_side)
Parameters
NameTypeDescription

tree Treea tree to be rotated
side {Left,Right}the first indication about side
sub_side {Left,Right}the second indication about side
Return Type  Tree
Synopsis Returns a new, rotated tree rooted half-way through the edge that is indicated by the side and sub-side arguments. The leaves of the tree should have annotated heights, but this is not strictly enforced, unless the rotation is happening directly next to a leaf.
Examples
> t := Tree(Tree(Leaf(A,15),5,Leaf(B,15)),0,Tree(Leaf(C,15),11,Leaf(D,15)));
t := Tree(Tree(Leaf(A,15),5,Leaf(B,15)),0,Tree(Leaf(C,15),11,Leaf(D,15)))
> newt := RotateTree(t,Left,Left);
newt := Tree(Leaf(A,5),0,Tree(Leaf(B,15),5,Tree(Leaf(C,25),21,Leaf(D,25)),100))




See also AllRootedTrees,   AllTernaryRoots,   Tree