Jazil Imran
← All work

06 / 06Networking2026

Routing Protocol Simulator

Link-state and distance-vector routing side by side, on a network you can break. Watch Dijkstra recover instantly and Bellman-Ford count to infinity.

2routing paradigms compared
O(log n)decrease_key, custom binary heap
0web dependencies in the engine

01 · Try it

Live · link-state (Dijkstra)click a link to fail it
25143136ABCDEF

Route A → F

A’s forwarding table

tonext hopcost

Live · distance-vector, count to infinity

A — B — C, every link cost 1. Break B–C and watch A and B each believe the other can still reach C.

Both run in your browser. The full simulator does the same in Python, with a hand-built binary heap, YAML topologies and packet tracing between any two routers.

02 · The problem

On a stable network, link-state and distance-vector routing produce identical tables. They solve the same problem. The differences only appear in how they converge and how they fail, and that is hard to see on a whiteboard.

I taught networking fundamentals to CCNA students for two years. This is the tool I wished I had for the lesson on routing loops.

03 · How it works

Scroll the steps. The scene follows.

25143136A0B2C3E6D6F9
min-heap pops

A · 0

B · 2

C · 3

E · 6

D · 6

F · 9

router A

to C: 2

via B

router B

to C: 1

via C

router C

to C: 0

via

B → A: “I reach C in 1”C → B: “I am C”

each router only knows what its neighbours tell it

ABCDEF

D–F fails · every table recomputes · packets take A → B → C → E → F

browserCytoscape.js · live graph
web layerFastAPI · one container
no web imports below this line
engine · pure Pythongraph · heap · dijkstra · distance_vector · forwarding
testsscenarios run on the engine alone

Illustrated from the project’s README and code. Values shown are examples.

  1. 01

    Link-state

    Each router holds the full topology and runs Dijkstra from itself, using a custom binary min-heap with an O(log n) decrease_key backed by a hash map. Predecessors become next-hop forwarding tables.

  2. 02

    Distance-vector

    A distributed Bellman-Ford where each router only knows its neighbours’ vectors and converges by exchanging them, with a split-horizon toggle to show the fix for routing loops.

  3. 03

    Break it on purpose

    Fail a link or change a cost and every table is recomputed, with packet paths traced hop by hop. Invalid input, like negative costs or failures that would disconnect the network, is rejected.

  4. 04

    The engine stands alone

    The routing engine is pure Python with no web dependencies, so the algorithms are tested in isolation. FastAPI serves the API and the frontend from one container.

04 · Architecture

The whole system, running.

YAML topologyvalidated on loadBinary min-heapO(log n) decrease_keyGraph modeladjacency listSimulatorlink eventsDijkstralink-stateDistance-vectorsplit-horizon toggleForwarding tablesnext hop per routerPacket tracehop by hopFastAPI + Cytoscapeone container

Built with

  • Python
  • FastAPI
  • Cytoscape.js
  • Docker
  • Azure Container Apps