Interactive Simulation & Algorithm Demo

BayRoute — Real-World Road Graph & Global Pathfinding Visualizer

Dynamic real-world route planning and graph search visualizer on authentic Google Maps roads — type any two addresses or click anywhere on Earth to watch Dijkstra, A*, Bidirectional A*, Greedy, and BFS explore physical highways and streets in real time.

BayRoute · Real-World Road Graph & Global Pathfinding Visualizer

🗺️ High-Res GIS Map

Enter any two addresses on Earth or click anywhere on the map. Watch search frontiers navigate physical highways, bridges, and city streets step by step with real-time algorithm comparisons.

Quick Trips:
Speed:
💡 Click map to set pins · Hover over explored roads to inspect g(n) & h(n) costs
Nodes Explored0Closed Set (Settled)
Frontier Queue0Open Set Memory
Trip DistanceActual Highway Miles
Estimated TimeSpeed Limits & Toll Spans
OptimalityEvaluating...O((V + E) log V)
🛣️ Turn-by-Turn Route ScheduleCalculating driving steps on real roads...

How Graph Search Algorithms Power Real GPS Routing

The San Francisco Bay Area provides a classic benchmark for graph search: water bodies act as natural topological barriers, forcing paths through narrow bridge chokepoints (the Bay Bridge, Golden Gate Bridge, San Mateo Bridge, and Dumbarton Bridge). Explore how each algorithm navigates these spatial constraints:

Dijkstra's Algorithm

Optimal

Guarantees the mathematically optimal shortest path by exploring outward in uniform cost contours without any directional heuristic guidance. Explores equally in all directions.

Time Complexity:O((V + E) log V)
Space Complexity:O(V)
Optimal:Yes (Shortest Path)
  • Optimal shortest travel time
  • Concentric wavefront expansion
  • Min-Heap Priority Queue on cumulative g(n)

A* Search

Heuristic

Combines actual path cost g(n) with an admissible straight-line distance heuristic h(n). Pulls the exploration cone directly toward the destination, drastically reducing explored nodes.

Time Complexity:O(E)
Space Complexity:O(V)
Optimal:Yes (Shortest Path)
  • Mathematically optimal path
  • Tear-drop directed search cone
  • f(n) = g(n) + h(n) evaluation

Bidirectional A*

Bidirectional

Executes two concurrent A* searches: one forward from the start, and one backward from the destination. When their frontiers collide, the search space volume is reduced by up to an order of magnitude.

Time Complexity:O(b^(d/2))
Space Complexity:O(b^(d/2))
Optimal:Yes (Shortest Path)
  • Simultaneous dual search cones
  • Exponential search volume reduction
  • Meets on intermediate bridges/highways

Greedy Best-First

Heuristic

Evaluates only h(n), aggressively charging directly toward the target. In open terrain it is lightning fast, but around geographic obstacles (like the SF Bay) it can get trapped along shorelines before finding bridge ramps.

Time Complexity:O(V + E)
Space Complexity:O(V)
Optimal:No (Suboptimal / Heuristic)
  • Ultra-fast forward rush
  • Can be fooled by water barriers
  • f(n) = h(n) heuristic only

Breadth-First Search (BFS)

Unweighted

Traverses the graph layer by layer using a FIFO queue. Minimizes the total number of road segment hops, but ignores speed limits and physical mileage, illustrating why weighted search is essential for navigation.

Time Complexity:O(V + E)
Space Complexity:O(V)
Optimal:No (Suboptimal / Heuristic)
  • Minimizes intersection hop count
  • Uniform topological rings
  • FIFO Queue (unweighted)

Depth-First Search (DFS)

Exhaustive

Explores as deep as possible down each arterial branch before backtracking. Included for educational contrast to demonstrate why unguided depth search produces wild, circuitous paths across multiple counties.

Time Complexity:O(V + E)
Space Complexity:O(V)
Optimal:No (Suboptimal / Heuristic)
  • Highly suboptimal zigzag paths
  • LIFO Stack exploration
  • Demonstrates unguided tree traversal