# thea0924/huffman architecture

> Architecture diagram of the GitHub repository thea0924/huffman, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thea0924/huffman
- Repository: https://github.com/thea0924/huffman

## Overview

Huffman is a small ASP.NET Core Razor Pages app that accepts text and reports a Huffman encoding and compression statistics. Its principal workflow is handled by the Index page: count character frequencies, build a tree, generate codes, encode the input, and calculate bit and reduction metrics. The tree and encoder operate on NodoHuffman. Source excerpts show the handler and algorithm calls; the Razor view and partial markup were not sampled, so presentation details are not inferred.

Main entry points: [`Huffman/Pages/Index.cshtml.cs`](https://github.com/thea0924/huffman/blob/master/Huffman/Pages/Index.cshtml.cs) (Text submission), [`Huffman/Modelos/CodificadorHuffman.cs`](https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/CodificadorHuffman.cs) (Code generation), [`Huffman/Program.cs`](https://github.com/thea0924/huffman/blob/master/Huffman/Program.cs) (ASP.NET host), [`Huffman/Modelos/ArbolHuffman.cs`](https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/ArbolHuffman.cs) (Tree construction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry"]
  node_host["ASP.NET host<br/>[Program.cs]"]
  node_index["Text submission<br/>[Index.cshtml.cs]"]
end

subgraph group_huffman["Huffman processing"]
  node_frequencies["Frequency counting<br/>[Index.cshtml.cs]"]
  node_tree["Tree construction<br/>[ArbolHuffman.cs]"]
  node_encoder["Code generation"]
  node_textencoding["Text encoding"]
  node_node["Tree node<br/>[NodoHuffman.cs]"]
end

node_user(("User"))

node_user -->|"submits text"| node_host
node_host -->|"maps Razor pages"| node_index
node_index -->|"counts characters"| node_frequencies
node_index -->|"builds tree"| node_tree
node_tree -->|"creates nodes"| node_node
node_index -->|"generates codes"| node_encoder
node_encoder -->|"traverses tree"| node_node
node_index -->|"encodes text"| node_textencoding
node_textencoding -->|"uses codes"| node_encoder

click node_host "https://github.com/thea0924/huffman/blob/master/Huffman/Program.cs"
click node_index "https://github.com/thea0924/huffman/blob/master/Huffman/Pages/Index.cshtml.cs"
click node_frequencies "https://github.com/thea0924/huffman/blob/master/Huffman/Pages/Index.cshtml.cs"
click node_tree "https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/ArbolHuffman.cs"
click node_encoder "https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/CodificadorHuffman.cs"
click node_textencoding "https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/CodificadorHuffman.cs"
click node_node "https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/NodoHuffman.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_host,node_index,node_user toneBlue
class node_frequencies,node_tree,node_encoder,node_textencoding,node_node toneAmber
```

## Components

### Web entry

- [ASP.NET host](https://github.com/thea0924/huffman/blob/master/Huffman/Program.cs): `Huffman/Program.cs`
- [Text submission](https://github.com/thea0924/huffman/blob/master/Huffman/Pages/Index.cshtml.cs): `Huffman/Pages/Index.cshtml.cs`

### Huffman processing

- [Frequency counting](https://github.com/thea0924/huffman/blob/master/Huffman/Pages/Index.cshtml.cs): `Huffman/Pages/Index.cshtml.cs`
- [Tree construction](https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/ArbolHuffman.cs): `Huffman/Modelos/ArbolHuffman.cs`
- [Code generation](https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/CodificadorHuffman.cs): `Huffman/Modelos/CodificadorHuffman.cs`
- [Text encoding](https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/CodificadorHuffman.cs): `Huffman/Modelos/CodificadorHuffman.cs`
- [Tree node](https://github.com/thea0924/huffman/blob/master/Huffman/Modelos/NodoHuffman.cs): `Huffman/Modelos/NodoHuffman.cs`

### Other components

- **User**

## Connections

- User → ASP.NET host: submits text
- ASP.NET host → Text submission: maps Razor pages (evidence: `Huffman/Program.cs`)
- Text submission → Frequency counting: counts characters (evidence: `Huffman/Pages/Index.cshtml.cs`)
- Text submission → Tree construction: builds tree (evidence: `Huffman/Pages/Index.cshtml.cs`)
- Tree construction → Tree node: creates nodes (evidence: `Huffman/Modelos/ArbolHuffman.cs`)
- Text submission → Code generation: generates codes (evidence: `Huffman/Pages/Index.cshtml.cs`)
- Code generation → Tree node: traverses tree (evidence: `Huffman/Modelos/CodificadorHuffman.cs`)
- Text submission → Text encoding: encodes text (evidence: `Huffman/Pages/Index.cshtml.cs`)
- Text encoding → Code generation: uses codes (evidence: `Huffman/Pages/Index.cshtml.cs`)
