Skip to content

About

Interactive algorithm visualizer built with Flask + React. Step-by-step animations for sorting, searching, pathfinding, and data structures.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

####################################################################################

AlgorithmVisualizer.

#################################################################################### /* An interactive, step-by-step algorithm visualization tool built as a fullstack / / portfolio project. / / / / Covers sorting, searching, pathfinding and classic data structures through an / / educational canvas interface. */ ####################################################################################

Design Philosophy: Paper & Ink, a warm notebook aesthetic where color only appears where it matters: on the canvas, during execution.


Algorithms & Structures.

Sorting.

| Algorithm | Time | Space | Stable |

| Bubble Sort | O(n^2) | O(1) | Yes | | Selection Sort | O(n^2) | O(1) | No | | Insertion Sort | O(n^2) | O(1) | Yes | | Merge Sort | O(n log n) | O(n) | Yes | | Quick Sort | O(n log n) | O(log n) | No | | Heap Sort | O(n log n) | O(1) | No | | Shell Sort | O(n log^2 n) | O(1) | No |

Searching.

| Algorithm | Time | Space | Sorted Input Required |

| Linear Search | O(n) | O(1) | No | | Binary Search | O(log n) | O(1) | Yes (auto-sorted) |

Pathfinding.

| Algorithm | Optimal | Weighted |

| Breadth-First Search(BFS) | Yes (unweighted) | No | | Depth-First Search(BFS) | No | No | | Dijkstra | Yes | Yes | | A* (Manhattan) | Yes | Yes |

Data Structures.

| Structure | Operations |

| Binary Search Tree | Insert · Search · Delete · In-order | | Min / Max Heap | Insert · Extract · Heapify | | Trie | Insert · Search · Delete · Autocomplete | | Stack | Push · Pop · Peek | | Queue | Enqueue · Dequeue · Peek |

For algorithm details see AlgorithmDocumentation.md.


Architecture.

┌─────────────────────────────────────────────────────┐
│  React 18 + Vite  (port 3000)                       │
│  POST /api/sorting/run                              │
│  POST /api/searching/run                            │
│  POST /api/pathfinding/run       ──────────────┐    │
│  POST /api/structures/run                      │    │
└────────────────────────────────────────────────┼────┘
                                                 │ Vite proxy
                                                 ▼
                        ┌─────────────────────────────────────┐
                        │  Python 3.11 + Flask  (port 5000)   │
                        │  Stateless — runs full algorithm    │
                        │  and returns all snapshots at once  │
                        └─────────────────────────────────────┘

Key design decision: The backend executes the algorithm once and returns the complete snapshot list. The frontend stores and replays them with setInterval, decoupling animation speed from network latency and enabling frame-perfect step control without websockets.


Tech Stack.

| Layer | Tech |

| Frontend | React 18, Vite 5, Canvas API, SVG, Axios | | Styling | Pure CSS custom properties, no Tailwind, no CSS-in-JS | | Typography | JetBrains Mono (Google Fonts) | | Backend | Python 3.11, Flask 3, Flask-COR S |


Project Structure.

AlgorithmVisualizer/
├── requirements.txt
├── README.md
├── package.json
├── LICENSE.md
├── CONTRIBUTING.md
├── .gitignore
├── .gitattributes
├── .env.example
├── .env
├── AlgorithmDocumentation.md
├── docs/
│   └── AlgorithmDocumentation.md
│   └── API.md
├── backend/
│   ├── app.py
│   ├── config.py
│   ├── algorithms/
│   │   ├── __init__.py
│   │   ├── sorting/
│   │   ├── searching/
│   │   ├── pathfinding/
│   │   └── dataStructures/
│   └── routes/
│       ├── __init__.py
│       ├── sorting.py
│       ├── searching.py
│       ├── pathfinding.py
│       ├── structures.py
│       └── meta.py
└── frontend/
    ├── index.html
    ├── vite.config.js
    ├── package.json
    ├── package-lock.json
    └── src/
        ├── App.jsx
        ├── main.jsx
        ├── api/
        │   └── client.js
        ├── hooks/
        │   ├── useSortingVisualizer.js
        │   ├── useSearchingVisualizer.js
        │   ├── usePathfindingVisualizer.js
        │   └── useStructureVisualizer.js
        ├── pages/
        │   ├── SortingPage.jsx
        │   ├── SearchingPage.jsx
        │   ├── PathfindingPage.jsx
        │   └── StructuresPage.jsx
        ├── components/
        │   ├── layout/ 
        │   │   ├── ControlPanel.jsx
        │   │   └── Header.jsx
        │   ├── ui/
        │   │   ├── AlgoSelector.jsx
        │   │   ├── ColorLegend.jsx
        │   │   ├── ControlButtons.jsx
        │   │   ├── EduPanel.jsx
        │   │   └── SpeedSlider.jsx
        │   ├── sorting/
        │   │   └── SortingCanvas.jsx
        │   ├── searching/
        │   │   └── SearchingCanvas.jsx
        │   ├── pathfinding/
        │   │   └── PathfindingCanvas.jsx
        │   └── structures/
        │       ├── BSTRenderer.jsx
        │       ├── StackQueueRenderer.jsx
        │       ├── StructureCanvas.jsx
        │       ├── TrieRenderer.jsx
        │       └── HeapRenderer.jsx
        └── styles/
            ├── global.css
            ├── layout.css
            └── components.css

Getting Started.

Prerequisites.

  1. Python 3.11+
  2. Node.js 18+
  3. npm 9+

Quick Start.

 git clone https://github.com/your-username/AlgorithmVisualizer.git
 cd AlgorithmVisualizer
 
 # Install all dependencies (Python + Node)
 npm run setup
 
 # Copy and edit environment variables
 cp .env.example .env
 
 # Start backend + frontend together
 npm run dev

Open 'http://localhost:3000'. The Vite dev server proxies all '/api/*' request to Flask on port 5000.

Manual Setup.

 ## Backend.
  python -n venv venv
   - venv\Scripts\activate
   - source venv/bin/activate
  pip install -r requirements.txt
  cp .env.example .env
  cd backend && python app.py
  
  ## Frontend.
  cd frontend
  npm install
  npm run dev
  ```

---
# API Reference.

See [docs/API.md](docs/API.md) for the full rest API reference.

|  Method  |        Endpoint       |              Description              |
----------------------------------------------------------------------------
|   GET    | 'api/health'          |             Health check.             |
|   GET    | 'api/algorithms'      | Full algorithm catalog with metadata. |
|   POST   | 'api/sorting/run'     |       Run a sorting algorithm.        |
|   POST   | 'api/searching/run'   |      Run a searching algorithm.       |
|   POST   | 'api/pathfinding/run' |     Run a pathfinding algorithm.      |
|   POST   | 'api/structures/run'  |     Operate on a data structure.      |
----------------------------------------------------------------------------   


---
# Color System.

The **Papper & Ink** palette, pastel semantic colors on a warm paper background.

|         State         |     Fill    |    Border   |
-----------------------------------------
|        Default        | '#E8F4FF' | '#5BA4E8' |
|  Comparing / Current  | '#FFF3CD' | '#D4A820' |
|    Swapping / Mid     | '#FFE4E4' | '#D45050' |
|     Sorted / Found    | '#E4F5EC' | '#3DAB6A' |
|      Pivot / Range    | '#F0E8FF' | '#9060D0' |
|        Visited        | '#F0E8FF' | '#C4A0F0' |
|        Frontier       | '#FFF0E4' | '#F5B880' |
|         Path          | '#FFF3CD' | '#D4A820' |

---
# Deployment

## Backend >>> Railway.
  Step 1. Connect repo on [Railway](https://railway.app), root directory 'backend/'.
  Step 2. Set 'FLASK_ENV=production'.
  Step 3. Railway auto-detects Python and runs 'python app.py'.

## Frontend >>> Vercel.
  Step 1. Import repo on [Vercel](https://vercel.com), root directory 'frontend/'.
  Step 2. Set 'VITE_API_URL=https://your-railway-url.railway.app'.
  Step 3. Vercel auto-detects Vite.    

---
# Contributing

To contribute see [CONTRIBUTING.md](CONTRIBUTING.md).

## License

[MIT](LICENSE) — José Luis López, 2026.

About

Interactive algorithm visualizer built with Flask + React. Step-by-step animations for sorting, searching, pathfinding, and data structures.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages