Visual walkthrough — Distance vector routing — RIP, Bellman-Ford, count-to-infinity
This is the visual companion to the parent topic. If a word here feels heavy, it also links out to Bellman-Ford Algorithm, Principle of Optimality and Dynamic Programming.
Step 1 — What is a "network" and a "cost"?
WHAT. Before any math, picture the world routers live in. Draw a few nodes (circles = routers) joined by links (lines = cables). Each link has a cost — a plain number written on the line. Think of cost as "how expensive / slow / how many hops it is to cross this cable."
WHY. A router cannot see the whole drawing. It can only feel the links plugged directly into it — it knows the number on its own cables and nothing else. Everything past that first hop is a rumour it must be told.
PICTURE. Look at the figure: node (burnt orange) can directly read the cost on its cable to and on its cable to . The dashed cloud shows everything cannot see by itself.
Step 2 — Every journey out of starts by choosing a first neighbour
WHAT. Take any destination (with ). Whatever the cheapest route is, it has to physically leave through one of 's cables — i.e. through one neighbour .
WHY. There's no teleporting. The very first move of any path is "step onto one neighbouring node." So the giant question "what is the cheapest route to ?" splits into a small menu of choices: "the cheapest route that starts by going to neighbour ," "...that starts with ," and so on.
PICTURE. The figure fans out from : one plum arrow commits to leaving via , one teal arrow commits to leaving via . Each arrow is one entry on the menu. The real shortest path is hiding inside one of these branches.
Step 3 — Cost of committing to neighbour
WHAT. Suppose we've decided our route leaves through . Its total cost is exactly:
WHY. Once we're standing on , our history no longer matters — only "how cheaply can finish the trip to ?" And by definition the cheapest can finish is . So the whole via- cost is: the one cable to arrive + 's own best effort onward.
PICTURE. The figure lays the two pieces end to end like train segments: a short orange segment from to , then a longer teal segment from to . Their lengths literally add.
Step 4 — Pick the cheapest option: the Bellman-Ford equation
WHAT. We don't know in advance which neighbour is best, so we compute the via- cost for every neighbour and keep the smallest.
WHY the ? "Cheapest" means "smallest number." The symbol simply says: try each neighbour from the set (all of 's direct neighbours), and grab the lowest total. This is the tool that chooses — no other operation compares a whole set and returns the smallest.
PICTURE. The figure shows a little bar chart: one bar per neighbour, height = its via-cost. A plum highlight marks the shortest bar — that height is , and that neighbour becomes the next-hop.
Step 5 — Why is keeping only the minimum actually correct?
WHAT. We only stored (a single number) for each neighbour, throwing away the details of how gets to . Is that safe?
WHY — the Principle of Optimality. Yes, because a shortest path's pieces are themselves shortest. Suppose the true best route is . Cut off the first hop; the remaining tail must be 's own shortest route to . If it weren't, we could swap in a cheaper tail and beat our supposed "shortest" total — a contradiction.
PICTURE. The figure shows a full path with the tail highlighted. A little "swap-in a cheaper tail?" balloon is crossed out — it would contradict optimality. So the single number is all we ever need from .
Step 6 — The distributed twist: rumours instead of truth
WHAT. In a real router, does not know the true . It only has the latest number told it, which we write . So the router actually runs:
WHY. Neighbours broadcast their whole vector every so often (in RIP, every 30 s over UDP port 520). Between broadcasts works off possibly-stale numbers. When any changes, re-broadcasts, and the wave continues.
PICTURE. The figure shows the same –– line as three rounds of message passing. Round 0: only nodes touching know its cost. Round 1: their neighbours learn. Round 2: everyone within 2 hops knows. Knowledge spreads one hop per exchange.
Step 7 — Edge case: good news is fast, bad news is slow
WHAT. So far every rumour improved things. Now watch a link die. On the line –– (all costs 1), the cable – snaps.
WHY it breaks. should now say " is unreachable." But just told "I reach at cost 2" — and has forgotten that 's route to went back through . So believes a phantom path and computes . Then trusts 's and jumps to . They ping-pong upward.
PICTURE. The figure traces the disaster: the broken – cable in red, and a curling arrow showing , the loop the phantom route secretly contains. Beside it, the climbing numbers .
Step 8 — The fix in a picture: split horizon
WHAT. Rule: never advertise a route back to the neighbour you learned it from. Since learned via , tells that "" (poison reverse states it out loud as cost ).
WHY. This deletes the phantom option before it can be chosen. When – dies, looks for an alternative, sees only 's honest "", and immediately marks unreachable — no climb.
PICTURE. The figure contrasts the two worlds: on the left, 's stale "" leaks back and starts the climb; on the right, split horizon shows sending "" back to , so the bad number is never injected.
The one-picture summary
Everything above, compressed: split the journey by first neighbour (Step 2) → each option costs one cable + a reported onward cost (Step 3) → take the (Step 4), justified by optimality (Step 5) → run it on rumours (Step 6) → beware phantom loops on link death (Step 7) → cure with split horizon + a -cap (Step 8).
Recall Feynman retelling — say it in plain words
Imagine everyone in a city only knows how far their next-door neighbours claim to be from a landmark. To find your own distance, you ask each neighbour "how far are you, and how far is my cable to you?" — add those two numbers, and keep the smallest answer. That "keep the smallest" is safe because the tail of a shortest trip is itself a shortest trip, so a single number per neighbour is all you need. Neighbours shout their numbers periodically, so knowledge spreads one street per round; after enough rounds the whole city is correct. The one danger: if a road closes, someone might repeat your own old number back to you as if it were a fresh route, and the two of you bounce a phantom distance higher and higher. Two cures: never quote a route back to whoever told you it (split horizon), and declare "16 = unreachable" so any leftover bouncing stops fast.
Recall Quick self-check
Which operation actually chooses the next-hop in Bellman-Ford? ::: The over neighbours — it returns the smallest via-cost, and the neighbour that achieved it becomes the next-hop. Why can neighbour send just one number instead of its whole map? ::: Principle of optimality — only (its best onward cost) can matter to ; the internal path details never change 's decision. In count-to-infinity, is the Bellman-Ford wrong? ::: No — it correctly minimises poisoned input. The bug is a phantom route fed back to its source; fix the data with split horizon.
Related: Routing Tables and Next-Hop Forwarding · Link-State Routing (OSPF) · BGP