/unique-paths-visualizer

A dynamic grid-based visualizer that animates pathfinding with obstacles, using both DP and 8-directional shortest path search. Built with React + TypeScript.

Primary LanguageTypeScript

๐Ÿงฝ Unique Paths Visualizer

A visual, interactive React application to explore dynamic programming (DP) and shortest path algorithms. Easily toggle between Leetcode-style Unique Paths II and Dijkstra's shortest path, build your own grid, and visualize the paths with animations.

๐ŸŒ Live Demo

https://greenmarioh.github.io/unique-paths-visualizer/


๐Ÿ“Œ Features

  • ๐Ÿง  Unique Paths II (DP): Visualizes total valid paths using a dynamic programming table. Implements logic based on LeetCode - Unique Paths II.
  • ๐Ÿ“ Shortest Path Mode: Uses a modified Dijkstraโ€™s algorithm that supports 8-directional movement (diagonals included) for pathfinding.
  • ๐Ÿ‘ก๏ธ Interactive Grid Editor:
    • Click or drag to add/remove obstacles.
    • In shortest path mode, drag Start (๐ŸŸฉ) and End (๐ŸŸฆ) nodes freely.
  • ๐Ÿงฎ DP Table Rendering: Optionally display the number of ways to reach each cell in unique paths mode.
  • ๐Ÿ” Path Animation: Each cell in a computed path lights up sequentially to demonstrate traversal order.
  • ๐Ÿ“€ Resizable Grid: Supports grids from 1ร—1 to 12ร—12 with smooth resets and state preservation.
  • โšก Fast and reactive UI thanks to React + Vite + Tailwind.

๐Ÿš€ Getting Started

1. Clone the Repository

git clone https://github.com/GreenMarioh/unique-paths-visualizer.git
cd unique-paths-visualizer

2. Install Dependencies

npm install
# or
yarn install

3. Start Development Server

npm run dev
# or
yarn dev

Then open: http://localhost:3000


๐Ÿ› ๏ธ Built With

  • โš›๏ธ React โ€” UI component library
  • ๐Ÿ”† TypeScript โ€” Typed JavaScript for safety and tooling
  • ๐ŸŽจ Tailwind CSS โ€” Utility-first CSS framework
  • โšก Vite โ€” Lightning-fast build tool and dev server
  • ๐Ÿ“ฆ Modular Architecture โ€” Reusable components (GridCell, InfoCard, etc.)
  • ๐Ÿ“ Single-File Visualizer Component โ€” Main logic lives in UniquePathsVisualizer.tsx for simplicity and portability

๐Ÿ“„ License

MIT License. Feel free to fork and improve!


๐Ÿš‡๏ธ Author

Created with โค๏ธ by @GreenMarioh

๐Ÿ‘‰ View the source code:
๐Ÿ”— https://github.com/GreenMarioh/unique-paths-visualizer