|
| 1 | +# Traverse — Algorithm Visualizer |
| 2 | + |
| 3 | +An interactive, static visualizer for graph traversal and sorting algorithms. Draw a board, add weighted terrain, generate a maze, and inspect each decision with full playback controls. |
| 4 | + |
| 5 | +The live demo and demo GIF will be added after the repository is connected to Vercel. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- BFS, DFS, Dijkstra, and A* pathfinding on a 50 × 25 grid |
| 10 | +- Click-and-drag walls, Shift-drag weighted cells, and draggable endpoints |
| 11 | +- Keyboard grid controls with arrow navigation and wall, weight, start, and target shortcuts |
| 12 | +- Randomized depth-first maze generation |
| 13 | +- Bubble, insertion, selection, merge, and quick sort |
| 14 | +- Play, pause, single-step, scrub, reset, and steps-per-second controls |
| 15 | +- Pure algorithm engines with no React or DOM dependencies |
| 16 | + |
| 17 | +## Architecture |
| 18 | + |
| 19 | +Every algorithm accepts plain data and returns a flat list of animation steps. The UI is only a player for that list. This keeps the engines deterministic and unit-testable, and makes timeline controls simple. |
| 20 | + |
| 21 | +The pathfinding grid renders once and stores cell elements in a ref map. During playback, only changed classes are updated inside a `requestAnimationFrame` loop. Sorting uses ordinary React state because its arrays are much smaller. |
| 22 | + |
| 23 | +## Complexity |
| 24 | + |
| 25 | +| Algorithm | Time | Notes | |
| 26 | +| --- | --- | --- | |
| 27 | +| BFS | O(V + E) | Shortest path on unweighted grids | |
| 28 | +| DFS | O(V + E) | Does not guarantee a shortest path | |
| 29 | +| Dijkstra | O((V + E) log V) | Optimal with non-negative weights | |
| 30 | +| A* | O((V + E) log V) worst case | Manhattan-distance heuristic | |
| 31 | +| Bubble sort | O(n²) | In-place, stable | |
| 32 | +| Insertion sort | O(n²) | Adaptive on nearly sorted input | |
| 33 | +| Selection sort | O(n²) | Minimizes swaps | |
| 34 | +| Merge sort | O(n log n) | Stable, O(n) auxiliary space | |
| 35 | +| Quick sort | O(n log n) average | O(n²) worst case | |
| 36 | + |
| 37 | +## Run locally |
| 38 | + |
| 39 | +```bash |
| 40 | +npm install |
| 41 | +npm run dev |
| 42 | +``` |
| 43 | + |
| 44 | +Open [http://localhost:3000](http://localhost:3000). |
| 45 | + |
| 46 | +```bash |
| 47 | +npm run lint |
| 48 | +npm run typecheck |
| 49 | +npm test |
| 50 | +npm run build |
| 51 | +``` |
| 52 | + |
| 53 | +## Deploy |
| 54 | + |
| 55 | +Import the repository into [Vercel](https://vercel.com/new). No environment variables, backend, or database are required. |
| 56 | + |
| 57 | +After deployment: |
| 58 | + |
| 59 | +1. Add the Vercel project URL near the top of this README. |
| 60 | +2. Record a short pathfinding-to-sorting demo as `docs/demo.gif`. |
| 61 | +3. Link the GIF to the live deployment. |
| 62 | + |
| 63 | +## Stack |
| 64 | + |
| 65 | +Next.js 15 App Router · React 19 · TypeScript · Tailwind CSS v4 · Vitest |
0 commit comments