Table of Contents

Class HuffmanNode<T>

Namespace
AiDotNet.ModelCompression
Assembly
AiDotNet.dll

Represents a node in the Huffman tree.

public class HuffmanNode<T>

Type Parameters

T

The 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

value T

The value stored in this node (for leaf nodes, default for internal nodes).

frequency int

The frequency of this value.

isLeaf bool

Whether this is a leaf node.

id int

Unique identifier for stable sorting.

left HuffmanNode<T>

Left child node (null for leaf nodes).

right HuffmanNode<T>

Right child node (null for leaf nodes).

Properties

Frequency

Gets the frequency of this value or subtree.

public int Frequency { get; }

Property Value

int

Id

Gets the unique identifier for stable sorting.

public int Id { get; }

Property Value

int

IsLeaf

Gets a value indicating whether this is a leaf node.

public bool IsLeaf { get; }

Property Value

bool

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