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.
- ๐ง 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.
git clone https://github.com/GreenMarioh/unique-paths-visualizer.git
cd unique-paths-visualizer
npm install
# or
yarn install
npm run dev
# or
yarn dev
Then open: http://localhost:3000
- โ๏ธ 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
MIT License. Feel free to fork and improve!
Created with โค๏ธ by @GreenMarioh
๐ View the source code:
๐ https://github.com/GreenMarioh/unique-paths-visualizer