An interactive teaching and visualization tool for pathfinding algorithms in both Grid and Graph modes, built with React + Vite + Zustand.
- BFS (Breadth-First Search, unweighted shortest path)
- DFS (Depth-First Search, unweighted traversal)
- Dijkstra (weighted shortest path)
- A* (weighted shortest path with heuristic)
- Interactive grid (place/remove walls, adjust weights)
- Weighted cells:
- Cycle between common weights (1, 5, 10)
- Double-click to manually set custom weights
- Random obstacle generation & recursive maze generation
- Start/End fixed, visual step-by-step exploration
- Auto-fit grid + zoom controls
- Adjustable grid size with auto-scaling cells
- Switch between Grid and Graph
- Add/move nodes (double-click background to add, drag to move)
- Connect nodes with edges (click-to-connect, edit weights by clicking label)
- Weighted edges for Dijkstra & A*
- Start/End nodes selectable
- Algorithms run directly on graph structures
- Logs terminal: step-by-step algorithm messages
- Pseudocode terminal: C++-style pseudocode highlighting per step
- Frontier/Queue/Stack panel: live view of BFS queue, DFS stack, or priority queue (Dijkstra/A*)
- Tooltips: hover cells/nodes to inspect
g,h,f, distance, parent - Playback controls: Play, Pause, Step Forward, Step Backward, Jump to Start/End
- Progress bar with scrubbing & Fast Solve option
- Dark mode toggle with persistence (localStorage)
- Keyboard shortcuts:
- Space β Play/Pause
- β / β β Step Backward/Forward
- R β Reset
- Resizable panels (logs, pseudocode, frontier)
- Zoom modes: Fit (auto-fit screen) and Fixed (manual scaling)
src/
βββ algorithms/ # Algorithm implementations
β βββ bfs.js # BFS (Grid)
β βββ dfs.js # DFS (Grid)
β βββ dijkstra.js # Dijkstra (Grid)
β βββ astar.js # A* (Grid)
β βββ graph/ # Graph-mode algorithms
β βββ bfs.js
β βββ dfs.js
β βββ dijkstra.js
β βββ astar.js
β
βββ components/ # UI components
β βββ ControlsPanel.jsx # Header controls (algorithm, mode, theme, playback, size)
β βββ Layout.jsx # Main layout (grid/graph, side panels, logs)
β βββ GridVisualizer/ # Grid mode components
β β βββ Grid.jsx
β βββ Graph/ # Graph mode components
β β βββ GraphCanvas.jsx
β βββ PseudocodeTerminal.jsx # Shows pseudocode with highlighted line per step
β βββ TeachingLogs.jsx # Scrollable log terminal (step-by-step actions)
β βββ FrontierPanel.jsx # Queue/Stack/PQ live visualization
β
βββ store/
β βββ visualizerStore.js # Zustand store (all app state + playback engine)
β
βββ utils/
β βββ mazeGenerators.js # Random + recursive maze generation
β
βββ index.css # TailwindCSS + custom styles
βββ main.jsx # Entry point, wraps Layout
visualizerStore.jsβ the heart of the app; manages state for Grid & Graph, playback steps, logs, pseudocode line, frontier snapshots, and theme.- Algorithm files β each returns
{ visitedOrder, shortestPath, logs, meta, frontiers }so visualization panels can sync. - ControlsPanel.jsx β dropdowns, buttons, speed sliders, zoom control, fast solve toggle, etc.
- Layout.jsx β flex layout with resizable panels; integrates keyboard shortcuts and theme application.
- PseudocodeTerminal.jsx β C++-style pseudocode, highlights lines based on logs.
- TeachingLogs.jsx β VSCode-like terminal showing algorithm messages.
- FrontierPanel.jsx β new addition! shows contents of BFS queue / DFS stack / Dijkstra-A* priority queue live.
- GraphCanvas.jsx β interactive SVG-based graph editor (nodes, edges, weights).
- mazeGenerators.js β provides randomized mazes for teaching Grid mode.
- Right-click context menu for nodes/edges (Set Start/End, Edit Weight, Delete)
- Directed edges toggle
- Graph save/load slots (localStorage + JSON import/export)
- A* heuristic selection (Manhattan/Euclidean/Zero)
- Classroom presets for teaching
- React + Vite
- Zustand (state management)
- TailwindCSS (styling)
# install dependencies
npm install
# run locally
npm run dev
# build for production
npm run buildThis project is designed as a teaching-first visualization tool.
It balances interactivity (edit grids/graphs live) with instructional clarity (pseudocode, logs, frontier visualization).
Perfect for classroom demos, self-study, or interview prep.