Class TreeNode<T>
A node of a tree, root or non-root, in the underlying forest representing the heap.
Inherited Members
Namespace: MoreStructures.PriorityQueues.BinomialHeap
Assembly: MoreStructures.dll
Syntax
public class TreeNode<T>
Type Parameters
Name | Description |
---|---|
T |
Properties
| Improve this Doc View SourceChildren
A
Declaration
public LinkedList<TreeNode<T>> Children { get; }
Property Value
Type | Description |
---|---|
MoreStructures.PriorityQueues.LinkedList<TreeNode<T>> |
IsALoser
Whether this node has lost a child since last reset, and will be promoted to roots next time they will lose a child. Only applies to, and it is taken into account from, Fibonacci heaps.
Declaration
public bool IsALoser { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsInAHeap
Whether this node is in the heap, either as a root or as a non-root node in a tree of the forest, or it is a dangling or detached node.
Declaration
public bool IsInAHeap { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Parent
A back-reference to the parent node. Null if a root.
Declaration
public TreeNode<T> Parent { get; set; }
Property Value
Type | Description |
---|---|
TreeNode<T> |
ParentListNode
A back-reference to the
Declaration
public LinkedListNode<TreeNode<T>>? ParentListNode { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<LinkedListNode<TreeNode<T>>> |
PrioritizedItem
The item of type T
, with its priority and push timestamp.
Declaration
public PrioritizedItem<T> PrioritizedItem { get; set; }
Property Value
Type | Description |
---|---|
MoreStructures.PriorityQueues.PrioritizedItem<T> |
RootsListNode
A back-reference to the
Declaration
public LinkedListNode<TreeNode<T>>? RootsListNode { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<LinkedListNode<TreeNode<T>>> |
Methods
| Improve this Doc View SourceAddChild(TreeNode<T>)
Add the provides treeNode
to the Children of this instance.
Declaration
public void AddChild(TreeNode<T> treeNode)
Parameters
Type | Name | Description |
---|---|---|
TreeNode<T> | treeNode | The TreeNode<T> instance to become a child. |
DeepCopy()
Deep copies this TreeNode<T> and its entire structure.
Declaration
public TreeNode<T> DeepCopy()
Returns
Type | Description |
---|---|
TreeNode<T> | A new instance of TreeNode<T>, pointing to a new, separate but equivalent structure. |
Remarks
This method is supposed to be used for a temporary copy of the heap, in order to iterate over it
without modifying the original heap.
It is not conceived to support full clones of a heap, such the one required by
It doesn't copy Parent for the top-level TreeNode<T>, nor its
RootsListNode or ParentListNode: those have to be set, according to the
scenario, by the caller of DeepCopy().
DetachFromParent()
Declaration
public void DetachFromParent()
ToString()
Includes the PrioritizedItem, IsInAHeap and IsALoser.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |