Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—ΊοΈ ClearHowGuide Route Algorithm Explorer

Interactive browser-based route-search visualizer for Breadth-First Search, Dijkstra, A* and bidirectional Dijkstra.

It uses synthetic road networks to make search behavior visible. It is an educational simulator and does not reproduce Google Maps' proprietary routing system.

πŸš€ Live tool

Official live version

https://clearhowguide.com/en/tools/route-algorithm-explorer/

Full guide

https://clearhowguide.com/en/science/how-google-maps-finds-fastest-route/

🧭 What it does

Use the same graph, start point, destination and edge costs, then compare how different algorithms search.

You can:

  • choose start and destination nodes;
  • switch between City Grid, Highway Network, River & Bridges and BFS Trap;
  • run Breadth-First Search, Dijkstra, A* or bidirectional search;
  • animate the search frontier;
  • pause, resume, step and reset;
  • inspect nodes explored, maximum frontier, path edges, path cost and coverage;
  • race all four algorithms on the same graph;
  • add traffic by changing edge weights;
  • block roads;
  • randomize and reset traffic;
  • inspect algorithm internals in Advanced mode;
  • share reproducible experiments through URL parameters;
  • generate embeddable experiments;
  • export results as SVG or PNG;
  • compare many routes with the Benchmark Lab.

✨ Educational presets

  • The BFS Trap β€” fewest edges does not necessarily mean lowest weighted cost.
  • Dijkstra's Expanding Wave β€” watch uninformed weighted search spread.
  • A Gets a Compass* β€” see how an admissible heuristic can focus the search.
  • Meet in the Middle β€” compare two weighted frontiers searching from both ends.
  • Traffic Changes the Winner β€” change edge costs and watch the preferred path move.

πŸ“Š Metrics

The explorer emphasizes search work, not device-dependent browser timing:

  • Nodes explored
  • Maximum frontier
  • Path edges
  • Path cost
  • Search coverage
  • Local computation time (diagnostic only)

Nodes explored means nodes removed from the frontier and expanded by the algorithm.

🧠 Algorithms

Breadth-First Search

Minimizes the number of edges. On weighted road networks this can differ from the minimum-cost path.

Dijkstra

Expands the unsettled node with the lowest accumulated non-negative path cost.

A*

Uses:

f(n) = g(n) + h(n)

The explorer uses an admissible straight-line lower-bound heuristic.

Bidirectional search

The interface calls this Bidirectional Search. Internally, weighted graphs use bidirectional Dijkstra.

See ALGORITHMS.md for methodology details.

🏁 Benchmark Lab

The standalone explorer can run reproducible route samples and compare Dijkstra, A* and bidirectional Dijkstra.

Results describe this synthetic network and this implementation. They are not universal performance benchmarks and are not Google Maps benchmarks.

See BENCHMARKING.md.

πŸ”— Reproducible sharing

Experiment state can be encoded in the URL, including:

  • map preset;
  • seed;
  • start;
  • destination;
  • algorithm;
  • UI mode;
  • traffic overrides;
  • blocked roads.

This makes a specific experiment shareable and reproducible.

🌐 Embed on your website

The official hosted embed is designed for articles, lessons, blogs and course material.

See EMBEDDING.md.

πŸ” Privacy

The explorer runs route-search calculations locally in the browser.

The project does not require an account, database, Google Maps API, geocoding service or routing backend.

See PRIVACY.md.

β™Ώ Accessibility

The UI is designed to avoid communicating state through color alone and supports reduced-motion preferences.

See ACCESSIBILITY.md.

πŸ—οΈ Architecture

algorithms/
    ↓
graph + priority queue + runner
    ↓
render / share / export / benchmark
    ↓
app.ts
    ↓
RouteAlgorithmExplorer.astro
    ↓
standalone / embed / ClearHowGuide article

πŸ§ͺ Run locally

Requirements:

  • Node.js 22+
  • npm

Install:

npm install

Development:

npm run dev

Open:

http://localhost:4321/en/tools/route-algorithm-explorer/

βœ… Run checks

Algorithm tests:

npm test

Expected result:

Route Explorer algorithm tests passed: 121 cases.

Production build:

npm run build

πŸ“ Repository structure

route-algorithm-explorer/
β”œβ”€β”€ .github/
β”œβ”€β”€ examples/
β”œβ”€β”€ scripts/
β”‚   └── test-route-explorer.mjs
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── RouteAlgorithmExplorer.astro
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   └── route-explorer/
β”‚   β”‚       β”œβ”€β”€ algorithms/
β”‚   β”‚       β”œβ”€β”€ app.ts
β”‚   β”‚       β”œβ”€β”€ benchmark.ts
β”‚   β”‚       β”œβ”€β”€ export.ts
β”‚   β”‚       β”œβ”€β”€ graph.ts
β”‚   β”‚       β”œβ”€β”€ presets.ts
β”‚   β”‚       β”œβ”€β”€ priorityQueue.ts
β”‚   β”‚       β”œβ”€β”€ render.ts
β”‚   β”‚       β”œβ”€β”€ runner.ts
β”‚   β”‚       β”œβ”€β”€ share.ts
β”‚   β”‚       └── types.ts
β”‚   └── pages/
β”œβ”€β”€ ACCESSIBILITY.md
β”œβ”€β”€ ALGORITHMS.md
β”œβ”€β”€ BENCHMARKING.md
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ CITATION.cff
β”œβ”€β”€ CODE_OF_CONDUCT.md
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ EMBEDDING.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ PRIVACY.md
β”œβ”€β”€ SECURITY.md
β”œβ”€β”€ SUPPORT.md
└── THIRD_PARTY_LICENSES.md

⚠️ Important limitations

  • Synthetic graphs are educational abstractions, not real road maps.
  • The tool does not reconstruct or claim to know Google Maps' proprietary routing implementation.
  • Browser timing varies by device, browser and current workload.
  • BFS minimizes edge count, not weighted travel cost.
  • Benchmark results are implementation- and graph-specific.
  • Traffic values are synthetic unless explicitly set by the user.

🀝 Contributing

Contributions are welcome. See CONTRIBUTING.md and CODE_OF_CONDUCT.md.

πŸ›‘οΈ Security

Please report security issues responsibly. See SECURITY.md.

πŸ’¬ Support

See SUPPORT.md.

πŸ“š Citation

Citation metadata is available in CITATION.cff.

πŸ“„ License

ClearHowGuide Route Algorithm Explorer is released under the MIT License.

See LICENSE.

πŸ”— Used by

ClearHowGuide:

https://clearhowguide.com/en/tools/route-algorithm-explorer/

Article:

https://clearhowguide.com/en/science/how-google-maps-finds-fastest-route/

About

Interactive route-search visualizer for BFS, Dijkstra, A*, and bidirectional Dijkstra, with traffic editing, sharing, embeds and benchmarks.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages