Algorithm Analytics
Empirical scaling of the route solvers on synthetic cities up to 10,000 intersections, plus whole-network analysis of FlowGrid Metro.
Runtime vs graph size
Median wall-clock time (log scale) · source and target on opposite sides of a jittered grid city
Search effort
Vertices expanded before reaching the target — A*'s heuristic prunes the search
Benchmark results
| V | E | Dijkstra | A* | BFS | Bellman–Ford | A* pruning | Exact solvers agree |
|---|---|---|---|---|---|---|---|
Minimum spanning tree
Kruskal + disjoint-set union on road length — the cheapest network that still connects every junction (priority maintenance / fibre backbone)
Graph centre & closeness
Best site for a city-wide response hub: the junction with the smallest worst-case travel time
All-pairs travel-time matrix
Floyd–Warshall dynamic programming · free-flow minutes between every pair of junctions
Hover a cell to see the trip.
Complexity reference
Theoretical bounds of every algorithm in FlowGrid (V vertices, E edges, k phases/paths, n observations)
| Algorithm | Module | Technique | Time | Space | Guarantee |
|---|---|---|---|---|---|
| Dijkstra | algorithms/dijkstra.py | Greedy, binary heap | O((V+E) log V) | O(V) | Optimal for w ≥ 0 |
| A* search | algorithms/astar.py | Best-first with heuristic | O((V+E) log V) | O(V) | Optimal with consistent h |
| Bellman–Ford | algorithms/bellman_ford.py | Dynamic programming | O(V·E) | O(V) | Handles w < 0, detects negative cycles |
| BFS | algorithms/bfs.py | Level-order traversal | O(V+E) | O(V) | Fewest edges |
| Yen's k-shortest | algorithms/yen.py | Spur-path deviation | O(k·V·(V+E) log V) | O(k·V) | k loop-free paths in cost order |
| Floyd–Warshall | algorithms/floyd_warshall.py | Dynamic programming | O(V³) | O(V²) | All-pairs optimum |
| Kruskal + DSU | algorithms/kruskal.py | Greedy, union by rank + path halving | O(E log E) | O(V) | Minimum spanning tree |
| Bounded proportional split | algorithms/traffic_signal.py | Greedy, exact breakpoint solve | O(k log k) | O(k) | Sum = budget, min ≤ gᵢ ≤ max |
| Webster timing | algorithms/traffic_signal.py | Analytical optimisation | O(k) | O(k) | Delay-minimising cycle (approx.) |
| Holt-Winters | algorithms/forecast.py | Exponential smoothing + grid search | O(n·|grid|) | O(m) | Back-tested vs seasonal naive |