Home | Trees | Indices | Help |
---|
|
object --+ | TernaryTrees
basic TT functionality
This class implements basic ternary functionality, such as ternary tree numbering and generation.
|
|||
Inherited from |
|
|||
|
|||
|
|||
|
|||
|
|
|||
LEFT = 0
|
|||
MIDDLE = 1
|
|||
RIGHT = 2
|
|||
PARENT = 3
|
|||
INTERNAL = 4
|
|||
DEPTH = 5
|
|
|||
Inherited from |
|
Calculate number of possible ternary trees. n ... number of nodes Binomial(3n,n)/(2n+1) (enumerates ternary trees and also non-crossing trees) http://www.research.att.com/~njas/sequences/A001764 |
Generate a random ternary tree. Evenly distributed. N ... number of (internal) nodes Generate an evenly distributed random ternary tree. Approach taken from [Panholzer2002]. Returned format is a complete ternary tree with internal and external nodes. To get a random ternary tree only the internal nodes are to use. Returns ternary tree in a list format where each entry represents a node. The index of the root node is also returned. T = [[LEFT, MIDDLE, RIGHT, PARENT, INTERNAL, DEPTH], ...] returns T, root NOTE: Depth information was intended to speed up the descendant test. The depth assignment is erroneous. Some parent-child nodes have the same depth. -> Don't use until resolved. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Apr 27 17:47:09 2011 | http://epydoc.sourceforge.net |