CAMPUS//ROUTE
Smart Wi-Fi Routing
C1 · Problem Understanding & Algorithm Selection

A student's walk is a
graph routing problem.

From the Front Gate to the Back Gate, a student's device must relay its connection through campus Wi‑Fi access points — each with different signal, latency, congestion and bandwidth. Choosing the best relay path at every hop is a weighted shortest-path problem on a multistage graph.

"How do you find the cheapest path through a network that keeps changing — without seeing the whole road ahead?"

CAMPUS//ROUTE models campus buildings as graph nodes, connections as weighted edges, and network conditions as live edge costs. Three different algorithms — Greedy, Dynamic Programming, and Backtracking — each attempt to solve it, using fundamentally different strategies. Their results are real: no routes are hardcoded.

Concept 01

Why is this a graph?

The campus is divided into stages (clusters of buildings). The device must pass through each stage exactly once, choosing one access point per stage. This creates a layered Directed Acyclic Graph (DAG) — also called a multistage graph.

G = (V, E) · V = buildings · E = connections · w(e) = network cost
Concept 02

How is edge cost computed?

Each hop's cost combines the destination router's quality — latency, signal loss, congestion penalty, packet loss — plus a lane-switch penalty if crossing sides of the road, and an RF interference factor between routers.

cost(u→v) = latency×0.5 + (100−signal)×0.4 + congestion + packetLoss×1.5 − bandwidth×0.08 + interference + lanePenalty
Concept 03

What is the objective?

Minimise the total accumulated cost across all 6 intermediate stages from Front Gate to Back Gate. A locally cheap hop can force a globally expensive route — which is exactly where Greedy fails and DP/Backtracking succeed.

Minimise: Σ cost(nodeᵢ → nodeᵢ₊₁) for i = 0 to 7
Campus network — Front Gate → Back Gate (hover any building)
Strong AP Congested Weak / Offline
Algorithm 1 · Greedy

Local best, every step

What is it?
At each stage, greedily picks the cheapest immediate hop without considering what comes after it. Makes one pass through the graph: O(n·k).
Why selected?
Fastest possible routing decision. Used in real-time systems where speed beats accuracy. Good for low-latency environments where conditions don't vary dramatically.
⚠ Limitation: Can choose a cheap first hop that leads to expensive later hops. Not guaranteed to find the optimal total-cost route.
Algorithm 2 · Dynamic Programming

Optimal substructure

What is it?
Fills a DP table backward from the Back Gate. dp[v] = best total cost from v to destination. Each subproblem is solved once and reused. Guarantees optimal result.
Why selected?
This problem has overlapping subproblems and optimal substructure — both DP prerequisites. The multistage DAG structure makes DP perfectly suited.
✓ Strength: Always finds the globally optimal route. Each state computed exactly once — no redundant recalculation.
Algorithm 3 · Backtracking

Explore, prune, backtrack

What is it?
Recursively explores all paths. If a partial path's cost already exceeds the best complete path found so far, that branch is pruned (branch-and-bound). Explores the full search tree.
Why selected?
Demonstrates exhaustive exploration with intelligent pruning. Shows the contrast between exponential search space and practical pruning efficiency.
✓ Strength: Optimal result. Visible search tree shows exactly which paths were rejected and why — great for understanding the problem space.

Live Simulation

Watch each algorithm think — decision by decision — through the campus network.

GreedyO(n·k) · myopic
Dynamic ProgrammingO(n·k²) · optimal
BacktrackingO(k^n) worst · optimal
Ready — select algorithm and press Run

Network Conditions

editable — change and re-run

Adjust signal, latency, congestion or take a router offline. Press Run Algorithm to see the route adapt.

—
Total Cost
—
Hops
—
States Explored
—
States Pruned
—
Exec Time

Live Decision Feed

GREEDY
Press Run Algorithm to watch the algorithm reason through each stage.

Algorithm Lab

Examine the internal data structures each algorithm builds — search trees, DP tables, ranked choices.

Greedy
Dynamic Prog.
Backtracking

Run Summary

Final Route

How it thinks

Internal Structure

Complexity & Performance Analysis

C3 — Theoretical Big-O derived from the actual implementation, plus observed browser runtime.

Visual Complexity Comparison — Operations as n (stages) grows

* Observed times measured at page load on current hardware. Theoretical vs observed diverge because: (1) browser JS engine optimisations, (2) small constant n=6 stages, k≤3 choices/stage. For larger n the theoretical differences become decisive.

Theoretical vs Observed — Why they differ

Big-O notation describes asymptotic growth as input size approaches infinity. For this simulation, n=6 stages and k≤3 nodes per stage — so even O(kn) backtracking with k=3, n=6 is only 36=729 operations in the absolute worst case. At this scale, constant factors dominate and all three algorithms complete in under 1ms. The theoretical complexity matters when the campus grows: with n=50 stages, Backtracking becomes completely impractical while DP remains efficient. Always distinguish "this takes 0.03ms in this demo" from "this is O(kn) and would be unusable at scale."

Algorithm Comparison Lab

Run any two algorithms on identical network conditions — see exactly where they diverge and why.

Both routes — same network conditions
Route A Route B Shared hops

Challenge Mode

Beat the optimal algorithm — read the network, build your route, and submit it.

⚠ Campus Network Alert

Build your route — pick one access point per stage

tap a building