Traverse maze & pathfinding visualizer
C++ original
Ready
  • Start
  • Goal
  • Wall
  • Weight ×5
  • Frontier
  • Explored
  • Path
Cells explored0
Path length—
Path cost—
Compute time—
// learn & faq

How does a computer find its way?

Traverse is an interactive playground for the algorithms behind maze solvers, game AI and route planners. Build a maze, pick an algorithm, and watch it search, one cell at a time.

// 01

What is it, and what is it for?

Finding a route from A to B is one of the most common problems in computing. Your phone does it for directions, a game does it for every enemy chasing you, a robot vacuum does it for your living room. Code on paper hides how these algorithms think. Traverse shows it.

Learn

See what BFS, Dijkstra or A* actually do instead of reading pseudocode. Great before an exam or an interview.

Compare

Run different algorithms on the same maze and compare how many cells they explore and how good their path is.

Experiment

Draw walls, add expensive terrain, move the goal, and watch the path change live as you edit.

// 02

How to use it

  1. 1

    Build a maze

    Pick a generator and press Generate maze, or start from an empty board with Clear board.

  2. 2

    Find the path

    Choose a pathfinding algorithm and press Find path. The tags under it tell you whether it guarantees the shortest route.

  3. 3

    Control the replay

    Use the bar above the grid to pause, go one step at a time, skip to the end, or change the speed.

  4. 4

    Play with it

    Left-drag draws with the selected tool, right-drag erases. Drag the start or goal to move them. After a search, every change re-solves instantly.

// 03

Reading the grid

Every color has a meaning. Together they show what the algorithm knows at each moment.

Start & Goal
Where the search begins and where it's trying to go. Drag them anywhere.
Wall
Blocked. Nothing can pass through.
Weight
Passable but expensive. Stepping on it costs 5 instead of 1, like mud or a traffic jam.
Frontier
Cells the algorithm has discovered but not examined yet. Its "to do" list.
Explored
Cells the algorithm has fully examined. Fewer explored cells means less work.
Path
The final route from start to goal that the algorithm found.
// 04

The algorithms

Pathfinding

They all differ in which cell they look at next. That one decision explains all the differences you see on the grid.

AlgorithmShortest pathUses weightsPicks next cell fromTimeBest for

Time complexity in big-O notation: V is the number of cells, E the number of connections between them.

Maze generation

Every "perfect" maze has exactly one route between any two cells, but each generator leaves its own fingerprint. Try generating each one and compare the corridors.

// 05

Frequently asked questions

Why does A* explore fewer cells than Dijkstra but find the same path?

Dijkstra spreads out evenly in every direction because it doesn't know where the goal is. A* adds a guess (the heuristic): the straight-line grid distance to the goal. It prefers cells that look closer, so it wastes less time going the wrong way. The guess never overestimates, so A* still returns the optimal route.

Why is the path from DFS so long and twisty?

Depth-first search always keeps going down the current corridor and only backs up at a dead end. It stops at the first route that reaches the goal, not the best one. That's why the "Shortest path" tag shows ✕ for it.

What is the difference between path length and path cost?

Length counts steps. Cost adds up what each step costs: 1 for a normal cell, 5 for a weighted one. Without weights they're the same number. With weighted terrain, Dijkstra and A* may take a longer route that's cheaper overall, while BFS takes the shortest route even if it walks straight through the mud.

What does "Compute time" measure?

Only the algorithm itself. Each algorithm first runs to completion in a fraction of a millisecond and records every step it took. The animation then replays that recording at the speed you choose. So the animation speed doesn't affect the time shown.

What does "Extra loops" do?

Generated mazes are "perfect": exactly one route between any two points, so every algorithm finds the same path. Extra loops knock out a few random walls to create alternative routes. That's where the differences between shortest-path algorithms and the rest really show.

Why is the grid always an odd number of cells wide?

Walls here are whole cells rather than thin lines. The maze needs "rooms" on odd coordinates with walls between them, surrounded by an outer wall. That only works with odd dimensions.

Is this how Google Maps works?

Same family of ideas, much bigger scale. Road networks have millions of intersections, so real route planners use Dijkstra and A* variants together with heavy preprocessing (for example contraction hierarchies) to answer in milliseconds. The core idea of expanding the cheapest option first is exactly what you see here.

Can I use it on my phone?

Yes. The layout adapts to small screens and you can draw with your finger. On touch screens there's no right-click, so use the Erase tool to remove walls.

Which keyboard shortcuts are there?
GGenerate a maze VFind path SpacePlay / pause →One step FSkip to the end CClear the path 1 2 3Wall / weight / erase tool
How was it built?

Plain HTML, CSS and JavaScript with no frameworks or libraries. It started as a C++/SFML desktop app (the original) and was rebuilt for the web with more algorithms, live editing and replay controls. The source code is on GitHub.