Class HuffmanNode<T>
- Namespace
- AiDotNet.ModelCompression
- Assembly
- AiDotNet.dll
Represents a node in the Huffman tree.
public class HuffmanNode<T>
Type Parameters
TThe numeric type.
- Inheritance
-
HuffmanNode<T>
- Inherited Members
Constructors
HuffmanNode(T?, int, bool, int, HuffmanNode<T>?, HuffmanNode<T>?)
Initializes a new instance of the HuffmanNode class.
public HuffmanNode(T? value, int frequency, bool isLeaf, int id, HuffmanNode<T>? left, HuffmanNode<T>? right)
Parameters
valueTThe value stored in this node (for leaf nodes, default for internal nodes).
frequencyintThe frequency of this value.
isLeafboolWhether this is a leaf node.
idintUnique identifier for stable sorting.
leftHuffmanNode<T>Left child node (null for leaf nodes).
rightHuffmanNode<T>Right child node (null for leaf nodes).
Properties
Frequency
Gets the frequency of this value or subtree.
public int Frequency { get; }
Property Value
Id
Gets the unique identifier for stable sorting.
public int Id { get; }
Property Value
IsLeaf
Gets a value indicating whether this is a leaf node.
public bool IsLeaf { get; }
Property Value
Left
Gets the left child node (null for leaf nodes).
public HuffmanNode<T>? Left { get; }
Property Value
- HuffmanNode<T>
Right
Gets the right child node (null for leaf nodes).
public HuffmanNode<T>? Right { get; }
Property Value
- HuffmanNode<T>
Value
Gets the value stored in this node (for leaf nodes, default for internal nodes).
public T? Value { get; }
Property Value
- T