Mental model
RouteLab separates finding a route from showing how that route was found.
A graph contains nodes and directed edges. Each edge exposes one or more finite costs—weight, distance, or travel time. A run selects a start, goal, cost model, algorithm, and optional heuristic. The algorithm returns both a result and an ordered semantic trace.
Algorithm execution time is measured independently from animation duration. Playback speed never changes the algorithm result.
Trace architecture
Every event carries enough information to replay state, explain the current decision, and associate it with a conceptual source-code section. Timeline navigation folds events into an inspectable snapshot.
initializeCreates the start state, distance map, and frontier.enqueue / dequeueRecords frontier changes and deterministic priorities.inspectEdgeMarks the candidate edge currently under consideration.relaxEdgeCompares a candidate route with the best known distance.updateDistance / setParentPersists the improved cost and predecessor.reconstructPathEmits the final connected route from start to goal.finishReports path cost, outcome, and aggregate run metrics.Algorithm guarantees
Compatibility is enforced before a run. BFS is limited to equal-cost graphs, Dijkstra-family searches reject negative weights, and Floyd–Warshall is capped to small graphs.
| Algorithm | Time | Requirement | Guarantee |
|---|---|---|---|
| Breadth-first search | O(V + E) | Unweighted only | Shortest by edge count |
| Dijkstra | O((V + E) log V) | Nonnegative costs | Optimal |
| A* | O((V + E) log V)* | Admissible heuristic | Optimal when admissible |
| Greedy best-first | O((V + E) log V) | Heuristic available | Not guaranteed |
| Bidirectional Dijkstra | O((V + E) log V) | Nonnegative costs | Optimal |
| Bellman–Ford | O(VE) | Negative edges allowed | Optimal or negative cycle |
| Floyd–Warshall | O(V³) | Small graphs | All-pairs optimal |
f(n) = g(n) + h(n)For A*, g is cost already paid and h estimates what remains. A zero heuristic visibly reduces A* to Dijkstra.
Playback controls
The Lab keeps every primary action available by pointer and keyboard. Form fields use native controls and the graph has a structured nonvisual alternative.
Scenario data model
Imports accept JSON data only. A scenario declares its schema version, bounded nodes and edges, explicit start and goal IDs, deterministic seed, compatibility metadata, and learning objectives. The fragment below illustrates core graph fields; use the Lab’s Export action for a complete importable document.
{
"schemaVersion": 1,
"id": "custom-seed-42",
"name": "My bounded graph",
"graph": {
"nodes": [{ "id": "A", "x": 80, "y": 120, "label": "Start" }],
"edges": [{ "id": "A-B", "fromId": "A", "toId": "B", "weight": 4 }]
},
"startId": "A",
"goalId": "B",
"seed": 42
}Security boundary
RouteLab treats labels, imported files, URL state, and graph metadata as hostile data. It never evaluates expressions, runs submitted code, dynamically imports user paths, or fetches user-provided URLs.
Strict schema
Finite numbers, unique IDs, valid references, version checks, and closed object shapes.
Hard limits
File bytes, labels, nodes, edges, share state, trace history, and all-pairs graph size.
Plain text
No unsafe HTML, external SVG, user styles, event handlers, or arbitrary URL requests.
Client-only import
Custom files remain on the device and are not uploaded or logged by RouteLab.
Accessibility
RouteLab targets WCAG 2.2 AA with visible focus, semantic landmarks, live playback announcements, reduced-motion behavior, 44-pixel touch targets, and redundant state encodings.
- ✓ The visualization includes a current-state summary and node/edge tables.
- ✓ Current, frontier, visited, and path states use labels and shape—not color alone.
- ✓ Native scroll remains available; reduced motion removes automated transitions.
- ✓ Code panes are read-only, focusable, scrollable, and never trap keyboard focus.