Interface ITree<TValue, TTree, TTreeNode>
- Namespace
- Garyon.DataStructures.Trees
- Assembly
- Garyon.dll
Represents a tree.
public interface ITree<TValue, TTree, TTreeNode> : ITree<TValue>, ICollection<TValue>, IEnumerable<TValue>, IEnumerable where TTree : ITree<TValue, TTree, TTreeNode> where TTreeNode : ITreeNode<TValue, TTree, TTreeNode>
Type Parameters
TValueThe type of the elements the tree nodes store.
TTreeThe type of the tree that this type is used in.
TTreeNodeThe type of the tree nodes that are used in the
TTreetype.
- Inherited Members
- Extension Methods
Properties
Root
Gets or sets the root node.
TTreeNode Root { get; set; }
Property Value
- TTreeNode
Methods
ClearChildren(TTreeNode)
Clears the children of a node within this tree.
void ClearChildren(TTreeNode node)
Parameters
nodeTTreeNodeThe parent node whose children to clear. The node must be within this tree.
GetNode(TValue)
Gets a child node within this tree that has the specified value.
TTreeNode GetNode(TValue value)
Parameters
valueTValueThe value of the child tree node to find.
Returns
- TTreeNode
The TreeNode<T> with the specified value, if found; otherwise false.
RemoveNode(TTreeNode)
Removes a child within this tree.
bool RemoveNode(TTreeNode childToRemove)
Parameters
childToRemoveTTreeNodeThe child to remove from the node.
Returns
RemoveNodes(TTreeNode, IEnumerable<TValue>)
Removes nodes within a subtree with root as the specified node that contain the specified values.
void RemoveNodes(TTreeNode node, IEnumerable<TValue> values)
Parameters
nodeTTreeNodeThe node which is the root of the subtree in which to remove the nodes at.
valuesIEnumerable<TValue>The values of the children to remove.
TraverseLevelOrderNodes()
Traverses the tree from the root using level-order.
IEnumerable<TTreeNode> TraverseLevelOrderNodes()
Returns
- IEnumerable<TTreeNode>
An IEnumerable<T> containing the yielded nodes.
TraversePostOrderNodes()
Traverses the tree from the root using post-order.
IEnumerable<TTreeNode> TraversePostOrderNodes()
Returns
- IEnumerable<TTreeNode>
An IEnumerable<T> containing the yielded nodes.
TraversePreOrderNodes()
Traverses the tree from the root using pre-order.
IEnumerable<TTreeNode> TraversePreOrderNodes()
Returns
- IEnumerable<TTreeNode>
An IEnumerable<T> containing the yielded nodes.