Documentation
¶
Overview ¶
tree package defines methods that generates tree of specified shape.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FullTree ¶
type FullTree struct {
// contains filtered or unexported fields
}
FullTree is a tree where each non-leaf vertex has N children. N is the degree. For a full tree of height H and degree D, the total number of vertices is `(D^H -1)/(D-1)`.
func NewFullTree ¶
NewFullTree creates a full tree of height and degree.
type Vertex ¶
type Vertex struct { // BFS order of the node in the tree. starting from 0. Order int // Level of the node in the tree. Root has level 0. Level int Children []*Vertex Parent *Vertex // The next node in BFS order. Next *Vertex }
Vertex is a general vertex in a tree. Each vertex records information of its positional information in a tree. For simplicity, a leaf has empty Children[], instead a non-empty Children[] where each item in Children[] being nil.
func (*Vertex) IsInternal ¶
Click to show internal directories.
Click to hide internal directories.