Documentation ¶
Index ¶
- type Node
- func (n *Node) AddChild(child *Node) bool
- func (n *Node) GetChildren() []*Node
- func (n *Node) GetHeight() int
- func (n *Node) GetID() string
- func (n *Node) GetLeaves() []*Node
- func (n *Node) GetNumChildren() int
- func (n *Node) GetParent() *Node
- func (n *Node) GetPathToRoot() []*Node
- func (n *Node) GetValue() int
- func (n *Node) HasLeaf(leafID string) bool
- func (n *Node) IsLeaf() bool
- func (n *Node) IsRoot() bool
- func (n *Node) RemoveChild(child *Node) bool
- func (n *Node) SetValue(value int)
- func (n *Node) String() string
- type Tree
- func (t *Tree) GetHeight() int
- func (t *Tree) GetLeafIDs() []string
- func (t *Tree) GetLeafNode(nodeID string) *Node
- func (t *Tree) GetLeaves() []*Node
- func (t *Tree) GetNode(nodeID string) *Node
- func (t *Tree) GetNodeIDs() []string
- func (t *Tree) GetNodeListBFS() []*Node
- func (t *Tree) GetRoot() *Node
- func (t *Tree) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { // unique id for the node ID string // contains filtered or unexported fields }
Node : a basic node in a tree
func (*Node) GetChildren ¶
GetChildren : the children of this node
func (*Node) GetLeaves ¶
GetLeaves : the leaf nodes in the subtree consisting of this node as a root
func (*Node) GetNumChildren ¶
GetNumChildren : the number of children of this node
func (*Node) GetPathToRoot ¶
GetPathToRoot : the path from this node to the root of the tree; node (root) is first (last) in list
func (*Node) RemoveChild ¶
RemoveChild : remove a child from this node
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree : a basic tree
func (*Tree) GetLeafIDs ¶
GetLeafIDs : the IDs of the leaves of the tree
func (*Tree) GetLeafNode ¶
GetLeafNode : get a leaf node by ID; null if not found
func (*Tree) GetNodeIDs ¶
GetNodeIDs : get (sorted) IDs of all nodes in the tree
func (*Tree) GetNodeListBFS ¶
GetNodeListBFS : list of nodes in BFS order
Click to show internal directories.
Click to hide internal directories.