# vidyakamath/hirschviz architecture

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

- Interactive diagram: https://gitdiagram.com/vidyakamath/hirschviz
- Repository: https://github.com/vidyakamath/hirschviz

## Overview

HirschViz is a DNA global-alignment algorithm visualizer and comparison tool. Its principal workflow accepts two sequences and an output directory, computes Hirschberg’s recursive split process, and produces a recursion-tree image and animations of the recursive alignment tables. A separate benchmark workflow compares Hirschberg with Needleman–Wunsch for scores, alignments, memory, and runtime; the README also documents plotted benchmark results. Source excerpts show the main entry points and algorithm implementations, but not every visualization detail, so the graph limits links to documented or indexed relationships.

Main entry points: [`run_benchmark.py`](https://github.com/vidyakamath/hirschviz/blob/main/run_benchmark.py) (Benchmark runner), [`src/hirschberg_viz.py`](https://github.com/vidyakamath/hirschviz/blob/main/src/hirschberg_viz.py) (Recursive visualization), [`src/score_functions.py`](https://github.com/vidyakamath/hirschviz/blob/main/src/score_functions.py) (DNA scoring functions), [`hirschviz.py`](https://github.com/vidyakamath/hirschviz/blob/main/hirschviz.py) (Visualization CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_visualization["Hirschberg visualization"]
  node_viz_cli["Visualization CLI<br/>[hirschviz.py]"]
  node_viz_engine["Recursive visualization<br/>[hirschberg_viz.py]"]
  node_viz_files["Image and animation files"]
end

subgraph group_alignment["Alignment algorithms"]
  node_hirschberg["Hirschberg alignment<br/>[hirschberg.py]"]
  node_needleman["Needleman–Wunsch"]
  node_scoring["DNA scoring functions<br/>[score_functions.py]"]
end

subgraph group_benchmark["Benchmarking"]
  node_benchmark_cli["Benchmark runner<br/>[run_benchmark.py]"]
  node_benchmark_csv["Benchmark CSV results"]
  node_benchmark_plots["Benchmark plots<br/>[plot.py]"]
end

node_user(("Sequence user"))

node_user -->|"provides sequences"| node_viz_cli
node_viz_cli -->|"calls visualization"| node_viz_engine
node_viz_engine -->|"loads DNA scores"| node_scoring
node_viz_engine -->|"writes animations"| node_viz_files
node_hirschberg -->|"loads DNA scores"| node_scoring
node_needleman -->|"loads DNA scores"| node_scoring
node_user -->|"sets benchmark range"| node_benchmark_cli
node_benchmark_cli -->|"measures alignment"| node_hirschberg
node_benchmark_cli -->|"measures alignment"| node_needleman
node_benchmark_cli -->|"writes measurements"| node_benchmark_csv
node_benchmark_csv -->|"reads benchmark data"| node_benchmark_plots

click node_viz_cli "https://github.com/vidyakamath/hirschviz/blob/main/hirschviz.py"
click node_viz_engine "https://github.com/vidyakamath/hirschviz/blob/main/src/hirschberg_viz.py"
click node_hirschberg "https://github.com/vidyakamath/hirschviz/blob/main/src/hirschberg.py"
click node_needleman "https://github.com/vidyakamath/hirschviz/blob/main/src/needleman_wunsch.py"
click node_scoring "https://github.com/vidyakamath/hirschviz/blob/main/src/score_functions.py"
click node_benchmark_cli "https://github.com/vidyakamath/hirschviz/blob/main/run_benchmark.py"
click node_benchmark_plots "https://github.com/vidyakamath/hirschviz/blob/main/src/plot.py"

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_viz_cli,node_viz_engine,node_viz_files,node_user toneBlue
class node_hirschberg,node_needleman,node_scoring toneAmber
class node_benchmark_cli,node_benchmark_csv,node_benchmark_plots toneMint
```

## Components

### Hirschberg visualization

- [Visualization CLI](https://github.com/vidyakamath/hirschviz/blob/main/hirschviz.py): `hirschviz.py`
- [Recursive visualization](https://github.com/vidyakamath/hirschviz/blob/main/src/hirschberg_viz.py): `src/hirschberg_viz.py`
- **Image and animation files**

### Alignment algorithms

- [Hirschberg alignment](https://github.com/vidyakamath/hirschviz/blob/main/src/hirschberg.py): `src/hirschberg.py`
- [Needleman–Wunsch](https://github.com/vidyakamath/hirschviz/blob/main/src/needleman_wunsch.py): `src/needleman_wunsch.py`
- [DNA scoring functions](https://github.com/vidyakamath/hirschviz/blob/main/src/score_functions.py): `src/score_functions.py`

### Benchmarking

- [Benchmark runner](https://github.com/vidyakamath/hirschviz/blob/main/run_benchmark.py): `run_benchmark.py`
- **Benchmark CSV results**
- [Benchmark plots](https://github.com/vidyakamath/hirschviz/blob/main/src/plot.py): `src/plot.py`

### Other components

- **Sequence user**

## Connections

- Sequence user → Visualization CLI: provides sequences (evidence: `README.md`)
- Visualization CLI → Recursive visualization: calls visualization (evidence: `hirschviz.py`)
- Recursive visualization → DNA scoring functions: loads DNA scores (evidence: `src/hirschberg_viz.py`)
- Recursive visualization → Image and animation files: writes animations (evidence: `README.md`)
- Hirschberg alignment → DNA scoring functions: loads DNA scores (evidence: `src/hirschberg.py`)
- Needleman–Wunsch → DNA scoring functions: loads DNA scores (evidence: `src/needleman_wunsch.py`)
- Sequence user → Benchmark runner: sets benchmark range (evidence: `README.md`)
- Benchmark runner → Hirschberg alignment: measures alignment (evidence: `run_benchmark.py`)
- Benchmark runner → Needleman–Wunsch: measures alignment (evidence: `run_benchmark.py`)
- Benchmark runner → Benchmark CSV results: writes measurements (evidence: `run_benchmark.py`)
- Benchmark CSV results → Benchmark plots: reads benchmark data (evidence: `src/plot.py`)
