COMPUTER SCIENCE & TECHNOLOGY • NETWORKING
Network Packet Routing
Explore shortest-path routing as congestion and link failures change a small network.
Explore network routing
Add congestion or remove a link and watch the shortest route across the network update.
LEARN WITH THE SIMULATION
Understand Network Packet Routing by experimenting.
Packet routing can be modeled as a shortest-path problem on a weighted network graph. This laboratory exposes the graph directly: nodes are routers, edge labels are link costs, the selected A→F route is highlighted, congestion raises the cost of specific links and failures remove links entirely. The important idea is not that one path is physically shortest, but that the routing algorithm selects the currently lowest total cost under the modeled topology.
BUILD THE IDEA
What you should understand first
- Interpret routers and links as a weighted graph and compute total route cost from edge weights.
- Explain why a path with more hops can still beat a shorter-hop path when its summed cost is lower.
- Observe how congestion changes edge weights without necessarily disconnecting the graph.
- Distinguish rerouting around an expensive link from rerouting around a failed link that is unavailable.
TRY IT YOURSELF
How much congestion is required before the shortest-cost route changes?
- Start with no failed link and record the baseline A→F path and total cost.
- Increase congestion gradually while watching the labels on affected links.
- Identify the exact point where a different path becomes cheaper and the highlighted route switches.
- Reset, fail one link on the baseline path, and compare the resulting detour with the congestion-driven reroute.
Dijkstra's algorithm responds to total path cost, not to geometric appearance or hop count alone. Congestion can make an available link unattractive, while a failure removes it from consideration entirely. The selected path changes when another finite route has lower aggregate cost.
WHY IT WORKS 01
Dijkstra optimizes a sum, not a picture
The algorithm assigns each candidate path a total equal to the sum of its link costs. A path drawn with fewer edges or a straighter geometric shape has no special privilege. If congestion increases the cost of one corridor enough, a visually longer route can become the mathematically cheapest route.
WHY IT WORKS 02
Congestion and failure are different graph changes
Congestion leaves a link available but raises its cost, so the link may still be chosen if every alternative is worse. A failure removes the link from the graph. That difference matters operationally because a high-cost path can recover immediately when conditions improve, while a failed edge cannot carry traffic until connectivity is restored.
WHY IT WORKS 03
A routing table is a consequence of a model
The highlighted path is correct only for the current graph, weights and optimization rule. Real routing protocols distribute topology or reachability information, converge after changes and may apply policy before pure numerical cost. The simulation isolates the shortest-path core so learners can see exactly which assumptions produce the route.
DO NOT MIX THESE UP
Common misconception
Hop count is not the same thing as latency or routing cost. A route with more hops may still have lower modeled cost. Real Internet routing is also not one global Dijkstra calculation: protocols operate at different scopes and may incorporate policy, administrative preference, bandwidth, reliability and other constraints that this small graph omits.
PRACTICE CHALLENGE
Can you force a reroute and explain the exact cost inequality that caused it?
- Record the baseline route and cost with congestion at zero.
- Increase congestion until the highlighted path changes, or fail one relevant edge.
- Add the edge costs on both the old and new paths.
- Explain why the new path wins even if it contains more hops.
Reveal the reasoning
A reroute occurs when the old path is removed or when its updated summed cost becomes larger than the cost of another available route. The decision is therefore an inequality between path totals, not a preference for fewer hops by itself.
MODEL BOUNDARIES
What this simulation assumes
Every simulation simplifies reality or a mathematical system. These are the assumptions and limits to keep in mind while interpreting the results.
Model assumptions
- The network is a small fixed graph with scalar edge costs.
- Routing selects a minimum-cost path using the model’s current link weights.
- Congestion is represented by a simplified additive cost on selected links.
Model limitations
- Real networks use distributed protocols, queues, changing traffic and policy constraints.
- Packet loss, latency variation, bandwidth limits and protocol overhead are not simulated in full.
CONNECT IT
Where this matters
- Link-state routing concepts
- Data-center and enterprise network design
- Shortest-path algorithm education
- Failure and congestion resilience reasoning
WORDS THAT MATTER
Key vocabulary
- Router
- Network node that forwards packets toward other networks or destinations.
- Link cost
- Numeric weight assigned to a connection and used by the modeled shortest-path calculation.
- Shortest path
- Available route whose link-cost sum is minimal under the current graph.
- Congestion
- Modeled condition that increases selected link costs without removing those links.
- Link failure
- Condition in which an edge is removed from the usable topology.
- Dijkstra's algorithm
- Shortest-path algorithm that finds minimum-cost routes from a source when edge weights are nonnegative.
NEXT STEP