How techprep-gh/pathfinding-visualizer works
Pathfinding Visualizer is a browser-based React app for choosing a maze and search algorithm, then watching traversal and the resulting route animate on an editable grid. The main workflow runs from the navigation controls through dispatchers to maze or pathfinding algorithms, with shared grid and tile state rendered by the grid view. The graph preserves the documented algorithm families; source excerpts and the index establish many imports, but not every runtime detail, so unsupported links are omitted.
Main entry points: Nav.tsx Navigation controls · helpers.ts Grid helpers · App.tsx App shell · runPathfindingAlgorithm.ts Search dispatcher
Components 28
User interface
- App shell
src/App.tsx - Navigation controls
src/components/Nav.tsx - Grid view
src/components/Grid.tsx - Tile view
src/components/Tile.tsx - Select control
src/components/Select.tsx - Play control
src/components/PlayButton.tsx
Application state
- Pathfinding state
src/context/PathfindingContext.tsx - Tile state
src/context/TileContext.tsx - Speed state
src/context/SpeedContext.tsx - Pathfinding hook
src/hooks/usePathfinding.tsx - Tile hook
src/hooks/useTile.tsx - Speed hook
src/hooks/useSpeed.tsx
Visualization workflow
- Search dispatcher
src/utils/runPathfindingAlgorithm.ts - Maze dispatcher
src/utils/runMazeAlgorithm.ts - Path animation
src/utils/animatePath.ts - Grid reset
src/utils/resetGrid.ts
Pathfinding algorithms
- A-star
src/lib/algorithms/pathfinding/aStar.ts - Breadth-first search
src/lib/algorithms/pathfinding/bfs.ts - Depth-first search
src/lib/algorithms/pathfinding/dfs.ts - Dijkstra
src/lib/algorithms/pathfinding/dijkstra.ts
Maze algorithms
- Binary-tree maze
src/lib/algorithms/maze/binaryTree.ts - Recursive division
src/lib/algorithms/maze/recursiveDivision.ts - Horizontal division
src/lib/algorithms/maze/horizontalDivision.ts - Vertical division
src/lib/algorithms/maze/verticalDivision.ts
Shared algorithm logic
- Neighbor lookup
src/utils/getUntraversedNeighbors.ts - Search heuristics
src/utils/heuristics.ts - Grid helpers
src/utils/helpers.ts
Other components
- App user
Connections 41
- App user → Navigation controls: chooses options
src/components/Nav.tsx - App user → Grid view: edits grid
src/components/Grid.tsx - App shell → Navigation controls: renders
src/App.tsx - App shell → Grid view: renders
src/App.tsx - App shell → Pathfinding state: provides state
src/App.tsx - App shell → Tile state: provides state
src/App.tsx - App shell → Speed state: provides state
src/App.tsx - Grid view → Tile view: renders
src/components/Grid.tsx - Grid view → Pathfinding hook: reads state
src/components/Grid.tsx - Navigation controls → Pathfinding hook: reads state
src/components/Nav.tsx - Navigation controls → Tile hook: reads state
src/components/Nav.tsx - Navigation controls → Speed hook: reads state
src/components/Nav.tsx - Pathfinding hook → Pathfinding state: reads context
src/hooks/usePathfinding.tsx - Tile hook → Tile state: reads context
src/hooks/useTile.tsx - Speed hook → Speed state: reads context
src/hooks/useSpeed.tsx - Navigation controls → Select control: renders
src/components/Nav.tsx - Navigation controls → Play control: renders
src/components/Nav.tsx - Navigation controls → Maze dispatcher: runs maze
src/components/Nav.tsx - Navigation controls → Search dispatcher: runs search
src/components/Nav.tsx - Navigation controls → Path animation: animates result
src/components/Nav.tsx - Navigation controls → Grid reset: resets grid
src/components/Nav.tsx - Search dispatcher → A-star: dispatches
src/utils/runPathfindingAlgorithm.ts - Search dispatcher → Breadth-first search: dispatches
src/utils/runPathfindingAlgorithm.ts - Search dispatcher → Depth-first search: dispatches
src/utils/runPathfindingAlgorithm.ts - Search dispatcher → Dijkstra: dispatches
src/utils/runPathfindingAlgorithm.ts - Maze dispatcher → Binary-tree maze: dispatches
src/utils/runMazeAlgorithm.ts - Maze dispatcher → Recursive division: dispatches
src/utils/runMazeAlgorithm.ts - Recursive division → Horizontal division: divides recursively
src/lib/algorithms/maze/recursiveDivision.ts - Recursive division → Vertical division: divides recursively
src/lib/algorithms/maze/recursiveDivision.ts - A-star → Neighbor lookup: gets neighbors
src/lib/algorithms/pathfinding/aStar.ts - A-star → Search heuristics: uses costs
src/lib/algorithms/pathfinding/aStar.ts - A-star → Grid helpers: uses queue helpers
src/lib/algorithms/pathfinding/aStar.ts - Breadth-first search → Neighbor lookup: gets neighbors
src/lib/algorithms/pathfinding/bfs.ts - Breadth-first search → Grid helpers: uses helpers
src/lib/algorithms/pathfinding/bfs.ts - Depth-first search → Neighbor lookup: gets neighbors
src/lib/algorithms/pathfinding/dfs.ts - Depth-first search → Grid helpers: uses helpers
src/lib/algorithms/pathfinding/dfs.ts - Dijkstra → Neighbor lookup: gets neighbors
src/lib/algorithms/pathfinding/dijkstra.ts - Dijkstra → Grid helpers: uses helpers
src/lib/algorithms/pathfinding/dijkstra.ts - Binary-tree maze → Grid helpers: uses helpers
src/lib/algorithms/maze/binaryTree.ts - Horizontal division → Grid helpers: uses helpers
src/lib/algorithms/maze/horizontalDivision.ts - Vertical division → Grid helpers: uses helpers
src/lib/algorithms/maze/verticalDivision.ts