This simulation lets you compare the two families of algorithms that decide how packets actually travel across a network of routers: Distance-Vector, based on the Bellman-Ford algorithm and used historically by protocols like RIP, and Link-State, based on Dijkstra's shortest-path algorithm and used by protocols like OSPF. Each router only knows its own directly connected links and their costs; the two approaches differ in how that local information spreads until every router agrees on the best route to every destination.
Distance-Vector routers exchange their full distance tables with neighbours each round, gradually converging via Bellman-Ford — and if you cut a link, stale routes can bounce upward toward an artificial "infinity" cap of 16 hops, reproducing the classic count-to-infinity problem. Link-State routers instead flood the entire topology to everyone, then each independently runs Dijkstra's algorithm to compute the shortest-path tree in a single pass.
Pick Distance-Vector or Link-State with the algorithm radio buttons, choose a Source and Destination router from the dropdowns, and load a Ring, Mesh, Star or Random topology preset. Use Step round to advance one exchange at a time or Auto-run to let it converge on its own, then press Send packet to animate a packet following the current best path. Switch to Add node, Add link or Cut link edit mode to reshape the network directly on the canvas and watch the routing recover.
RIP's original design capped "infinity" at just 16 hops specifically to make the count-to-infinity problem resolve quickly rather than looping for a long time, at the cost of limiting RIP networks to 15 usable hops. Real-world link-state protocols like OSPF avoid this entirely by having every router build an identical map of the whole network before computing anything, which is also why OSPF converges in seconds while BGP-style routing across the wider internet can take minutes.
Distance-Vector routers only ever exchange summarised distance tables with their direct neighbours and run Bellman-Ford round by round, so convergence takes several rounds and depends on how the network is connected. Link-State routers first flood complete topology information to every other router, so each one ends up with an identical map and can compute the shortest-path tree with Dijkstra's algorithm in a single pass, without needing further rounds of exchange.
When a link that was part of a route fails, a Distance-Vector router that hasn't yet heard the bad news may still advertise a route through the broken path to its neighbours, who add their own cost and advertise it onward, slowly inflating the apparent distance instead of immediately recognising the destination is unreachable. The simulation caps this rising number at an "infinity" value of 16, matching how RIP historically limited networks to 15 usable hops specifically to bound how long this problem can drag on.
Ring and Star topologies have few alternate paths, so cutting a link can leave some nodes briefly unreachable until the remaining path is found. Mesh and Random topologies have more redundant links, so Distance-Vector and Link-State usually converge faster after a failure because there are more alternative routes available for the algorithms to fall back on.
Add node places a new router wherever you click; Add link lets you click two existing routers to connect them with a randomly weighted link; Cut link toggles a clicked link between working and broken. Any of these changes forces both routing algorithms to reconverge from scratch, so you can watch Distance-Vector re-run Bellman-Ford or Link-State reflood and rerun Dijkstra on the new topology.
It takes whatever path the currently selected algorithm has computed as the best route from Source to Destination and animates a small blue marker travelling along it, edge by edge, at the current animation speed. If no valid path exists — for example if a cut link has left the destination unreachable — the status readout shows "Unreachable" instead of routing a packet.
Internet routing is the process by which data packets find their path through a network of interconnected devices from source to destination. Routers exchange information about network topology using routing protocols, building forwarding tables that specify the next hop for each destination address. The internet's hierarchical architecture separates routing within autonomous systems (Interior Gateway Protocols) from routing between them (Border Gateway Protocol).
The Border Gateway Protocol (BGP) is the de facto inter-domain routing protocol of the internet, connecting over 70,000 autonomous systems (ISPs, universities, enterprises, cloud providers). BGP is a path-vector protocol: each AS advertises routes with the full AS path to the destination. Routers select best paths based on policies incorporating path length, local preference, MED attributes, and business relationships (customer/provider/peer).
Interior routing protocols include OSPF (Open Shortest Path First), which floods link-state advertisements throughout the AS and computes shortest paths via Dijkstra's algorithm, and IS-IS, widely used by large ISPs. Historically, RIP (Routing Information Protocol) used distance-vector with hop-count metrics, but its slow convergence and 15-hop maximum limit its use today. Modern networks use MPLS (Multiprotocol Label Switching) to forward packets based on labels rather than IP lookups, enabling traffic engineering.
An autonomous system is a network or group of networks under a single administrative authority, identified by an ASN (Autonomous System Number). The internet's routing is hierarchical: within an AS, interior protocols handle routing; between ASes, BGP handles inter-domain routing. This division allows the internet to scale to billions of devices.
BGP applies a deterministic sequence of tie-breaking rules: highest local preference wins first; then fewest AS-path hops; then lowest MED (multi-exit discriminator); then prefer eBGP over iBGP routes; then lowest IGP metric to next hop; and finally various tie-breakers. Network operators configure local preference and route policies to reflect commercial and performance objectives.
A BGP route leak occurs when an AS accidentally or maliciously advertises routes it should not, redirecting traffic through unintended paths. A BGP hijack is the deliberate announcement of more specific prefixes to attract traffic destined for another network. High-profile hijacks have redirected internet traffic through Russia, China, and other countries, exposing security vulnerabilities in BGP's trust model.
OSPF is a link-state IGP used within a single autonomous system. Each router floods link-state advertisements to all others, builds a complete topology map, and runs Dijkstra's algorithm to compute shortest paths. BGP is a path-vector EGP used between ASes, with policy-based selection rather than pure shortest-path. OSPF converges in seconds; BGP can take minutes.
MPLS adds short fixed-length labels to packets at the network edge. Core routers forward packets based on labels (simple table lookups) rather than longest-prefix IP matches, enabling faster forwarding, traffic engineering (directing traffic along specific paths), virtual private networks (MPLS VPNs), and quality-of-service guarantees. It decouples the forwarding plane from the IP routing plane.