Table of Contents

Interface ITree<TValue>

Namespace
Garyon.DataStructures.Trees
Assembly
Garyon.dll

Represents a tree.

public interface ITree<TValue> : ICollection<TValue>, IEnumerable<TValue>, IEnumerable

Type Parameters

TValue

The type of the elements the tree nodes store.

Inherited Members
Extension Methods

Properties

Breadth

Gets the breadth of this tree. It is equal to the breadth of the root node.

int Breadth { get; }

Property Value

int

Height

Gets the height of this tree. It is equal to the height of the root node.

int Height { get; }

Property Value

int

Methods

ClearChildren(TValue)

Clears the children of a node with the specified value, that is within this tree.

void ClearChildren(TValue value)

Parameters

value TValue

The value of the parent node whose children to clear. The node must be within this tree.

GetTreeView(int)

Gets the tree view of this tree node as a subtree.

string GetTreeView(int childIndent)

Parameters

childIndent int

The length of the indentation for each subsequent child.

Returns

string

The tree view.

RemoveNode(TValue)

Removes a child within this tree.

bool RemoveNode(TValue value)

Parameters

value TValue

The value of the child to remove from the node.

Returns

bool

true if the node was successfully removed, otherwise false.

RemoveNodes(IEnumerable<TValue>)

Removes nodes within this tree that contain the specified values.

void RemoveNodes(IEnumerable<TValue> values)

Parameters

values IEnumerable<TValue>

The values of the children to remove.

TraverseLevelOrder()

Traverses the tree from the root using level-order.

IEnumerable<TValue> TraverseLevelOrder()

Returns

IEnumerable<TValue>

An IEnumerable<T> containing the yielded values.

TraversePostOrder()

Traverses the tree from the root using post-order.

IEnumerable<TValue> TraversePostOrder()

Returns

IEnumerable<TValue>

An IEnumerable<T> containing the yielded values.

TraversePreOrder()

Traverses the tree from the root using pre-order.

IEnumerable<TValue> TraversePreOrder()

Returns

IEnumerable<TValue>

An IEnumerable<T> containing the yielded values.