Vector Network Simulation

Analysis of Graph Traversal Algorithms on Road Topologies

Network Topology

Nodes: 0 | Edges: 0
âš™ī¸
Generating Network...
Key: Grey = Roads | Red = Traffic Jams | Dots = Intersections

Algorithm Logic

Dijkstra's Algorithm Optimal

Strategy: Explores the network like a "flood," visiting every nearby road first before moving further away. It guarantees the shortest route but is slow because it checks unnecessary roads.

function Dijkstra(start, goal):
  pq.push(start, 0)
  while pq not empty:
    current = pq.pop()
    if current == goal: return path
    for neighbor in neighbors:
      // Cost is accumulation of edge weights
      new_cost = cost[current] + weight(edge)
      if new_cost < cost[neighbor]:
        cost[neighbor] = new_cost
        pq.push(neighbor, new_cost)
A* (A-Star) Search Balanced

Strategy: A smarter version of Dijkstra. It uses a "Heuristic" (GPS straight-line distance) to guess which roads lead to the destination, prioritizing them to save time.

function A_Star(start, goal):
  pq.push(start, 0)
  while pq not empty:
    current = pq.pop()
    if current == goal: return path
    for neighbor in neighbors:
      new_cost = cost[current] + weight
      // Priority includes geometric distance estimate
      prio = new_cost + heuristic(neighbor, goal)
      if new_cost < cost[neighbor]:
        pq.push(neighbor, prio)
Bidirectional A* Fastest

Strategy: Starts two teams of searchers: one from the Start and one from the Goal. When they meet in the middle, the path is complete. This cuts the search area in half.

function Bidirectional(start, goal):
  f_pq.push(start, 0); b_pq.push(goal, 0)
  while both not empty:
    // Expand both wavefronts
    if expand(f_pq) meets b_visited: return path
    if expand(b_pq) meets f_visited: return path
Greedy Best-First Sub-Optimal

Strategy: The "Impatient Driver." It always picks the next intersection that is physically closest to the destination, ignoring traffic reports. Fast, but often gets stuck in bad routes.

function Greedy(start, goal):
  // Ignores 'Cost', only uses 'Heuristic'
  pq.push(start, heuristic(start, goal))
  while pq not empty:
    current = pq.pop() 
    if current == goal: return path
Breadth-First Search Unweighted

Strategy: The "Blind Explorer." It looks for the route with the fewest *turns* (intersections), completely ignoring road length and traffic. Terrible for real-world navigation.

function BFS(start, goal):
  queue.push(start)
  while queue not empty:
    current = queue.pop()
    if current == goal: return path
    for neighbor in neighbors:
      if not visited:
        mark_visited(neighbor)
        queue.push(neighbor)

Control Center

â„šī¸ Step 1: Click on any Intersection to set START.

Route Metrics

Algorithm Time Cost Nodes
- No Route Selected -

Statistical Benchmark

Runs 30 random scenarios to measure consistency and average error rates (RMSE).

Algo Avg Time Avg Cost RMSE
- Waiting for Batch -