Skip to content

Commit e3c50a7

Browse files
authored
Merge pull request #1 from GreenMarioh/shortest-path
Shortest path
2 parents 6bbaee1 + 30b1aec commit e3c50a7

File tree

2 files changed

+520
-199
lines changed

2 files changed

+520
-199
lines changed

README.md

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,76 @@
1-
# 🛤️ Unique Paths II Visualizer
1+
# 🧽 Unique Paths Visualizer
22

3-
An interactive web application that visualizes the **Unique Paths II** dynamic programming problem with obstacle support.
3+
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.
44

5-
## ✨ Features
5+
### 🌐 Live Demo
66

7-
- **🖱️ Click & Drag**: Paint obstacles by clicking and dragging across the grid
8-
- **🎬 Path Animation**: Watch random valid paths being traced step-by-step
9-
- **📊 DP Values**: Toggle display of dynamic programming computation values
10-
- **📱 Responsive Design**: Works on desktop and mobile devices
11-
- **⚡ Real-time Updates**: Instant recalculation as you modify the grid
7+
> _https://greenmarioh.github.io/unique-paths-visualizer/_
128
13-
## 🚀 Demo
9+
---
10+
11+
## 📌 Features
1412

15-
Visit the live demo: [https://GreenMarioh.github.io/unique-paths-visualizer/](https://GreenMarioh.github.io/unique-paths-visualizer/)
13+
- 🧠 **Unique Paths II (DP)**: Visualizes total valid paths using a dynamic programming table. Implements logic based on [LeetCode - Unique Paths II](https://leetcode.com/problems/unique-paths-ii/description/).
14+
- 📏 **Shortest Path Mode**: Uses a modified Dijkstra’s algorithm that supports 8-directional movement (diagonals included) for pathfinding.
15+
- 👡️ **Interactive Grid Editor**:
16+
- Click or drag to add/remove obstacles.
17+
- In shortest path mode, drag Start (🟩) and End (🟦) nodes freely.
18+
- 🧮 **DP Table Rendering**: Optionally display the number of ways to reach each cell in unique paths mode.
19+
- 🔁 **Path Animation**: Each cell in a computed path lights up sequentially to demonstrate traversal order.
20+
- 📀 **Resizable Grid**: Supports grids from 1×1 to 12×12 with smooth resets and state preservation.
21+
- ⚡ Fast and reactive UI thanks to React + Vite + Tailwind.
22+
23+
---
1624

17-
## 🎮 How to Use
25+
## 🚀 Getting Started
1826

19-
1. **Grid Setup**: Adjust rows and columns using the input fields
20-
2. **Add Obstacles**: Click and drag to paint red obstacle cells
21-
3. **Remove Obstacles**: Drag over existing obstacles to erase them
22-
4. **Animate Path**: Click "Show Random Path" to see a path traced with smooth animation
23-
5. **View DP Values**: Toggle "Show Path Counts" to see the computed values
27+
### 1. Clone the Repository
2428

25-
## 🧮 Algorithm
29+
```bash
30+
git clone https://github.com/GreenMarioh/unique-paths-visualizer.git
31+
cd unique-paths-visualizer
32+
```
2633

27-
This visualizer demonstrates the **Unique Paths II** problem:
34+
### 2. Install Dependencies
2835

29-
- **Input**: An `m × n` grid with obstacles
30-
- **Goal**: Count unique paths from top-left to bottom-right
31-
- **Constraints**: Can only move right or down, obstacles block paths
32-
- **Solution**: Dynamic programming with obstacle handling
36+
```bash
37+
npm install
38+
# or
39+
yarn install
40+
```
3341

34-
## 🛠️ Technical Details
42+
### 3. Start Development Server
3543

36-
- **Frontend**: React with Hooks
37-
- **Styling**: Tailwind CSS
38-
- **Animations**: CSS transitions with JavaScript timing
39-
- **Deployment**: GitHub Pages
44+
```bash
45+
npm run dev
46+
# or
47+
yarn dev
48+
```
49+
50+
Then open: [http://localhost:3000](http://localhost:3000)
51+
52+
---
4053

41-
## 📜 License
54+
## 🛠️ Built With
4255

43-
MIT License - feel free to use this code for educational purposes.
56+
- ⚛️ **[React](https://reactjs.org/)** — UI component library
57+
- 🔆 **[TypeScript](https://www.typescriptlang.org/)** — Typed JavaScript for safety and tooling
58+
- 🎨 **[Tailwind CSS](https://tailwindcss.com/)** — Utility-first CSS framework
59+
-**[Vite](https://vitejs.dev/)** — Lightning-fast build tool and dev server
60+
- 📦 **Modular Architecture** — Reusable components (GridCell, InfoCard, etc.)
61+
- 📁 **Single-File Visualizer Component** — Main logic lives in `UniquePathsVisualizer.tsx` for simplicity and portability
4462

4563
---
4664

47-
_Enhanced visualization of classic dynamic programming concept._
65+
## 📄 License
66+
67+
MIT License. Feel free to fork and improve!
68+
69+
---
70+
71+
## 🚇️ Author
72+
73+
Created with ❤️ by [@GreenMarioh](https://github.com/GreenMarioh)
74+
75+
👉 View the source code:
76+
🔗 [https://github.com/GreenMarioh/unique-paths-visualizer](https://github.com/GreenMarioh/unique-paths-visualizer)

0 commit comments

Comments
 (0)