Distance Vector Routing: Detailed Explanation of the Example

Distance Vector Routing: Detailed Explanation of the Example

Verified Sources
Nov 3, 2026

Distance vector routing is a distributed routing method where each router maintains a routing table containing, for every destination, an estimated path cost (the “distance”) and the next hop that provides that best cost. Routers periodically exchange their distance vectors with neighbors, and then recompute best routes using the Bellman-Ford update rule.

In this course section, we explain how the algorithm works on the provided diagram by walking through the neighbor-to-neighbor distance-vector exchanges and the resulting updates. The key conceptual pipeline is:

Key definitions used throughout

  • distance vector
  • next hop
  • count-to-infinity
  • split horizon
  • poison reverse

Distance Vector Routing (Concepts + Updates)

1) How distance vector computes routes

Assume routers exchange their distance vectors. Let router xx estimate its cost to destination dd as Dx(d)D_x(d). If router xx has neighbor yy with link cost c(x,y)c(x,y), then router xx can propose a route to dd through yy with cost:

cost via y=c(x,y)+Dy(d)\text{cost via }y = c(x,y) + D_y(d)

Router xx then chooses the minimum proposed cost over all neighbors yy:

Dx(d)=min⁡y∈Neighbors(x)[c(x,y)+Dy(d)]D_x(d) = \min_{y \in \text{Neighbors}(x)} \left[c(x,y) + D_y(d)\right]

This is the distributed version of the Bellman-Ford relaxation step. Distances improve as updated information “propagates” through the network over time.

Callout:

  • Routers do not compute globally shortest paths in one shot.
  • They gradually converge by repeatedly relaxing estimates when new neighbor vectors arrive.

2

Footnotes

  1. Distance vector routing - Wikipedia - Overview of DV routing, neighbor exchanges, and concepts like loops. ↩

  2. Bellman–Ford algorithm - Wikipedia - Shows the shortest-path dynamic programming/relaxation rule used conceptually by DV. ↩

Step-by-step walkthrough of the example (distance-vector iteration)

  1. 1
    Step 1

    Identify the routers (nodes) and the bidirectional or directed links (edges), along with their link costs. For each node xx, list its immediate neighbors and the corresponding c(x,y)c(x,y) values.

  2. 2
    Step 2

    For each router xx: set Dx(x)=0D_x(x)=0. For each directly connected neighbor yy, set Dx(y)=c(x,y)D_x(y)=c(x,y). For all other destinations dd, initialize Dx(d)=∞D_x(d)=\infty (unknown/unreachable).

  3. 3
    Step 3

    Every router sends its current vector {Dx(d)∣d is any destination}\{D_x(d) \mid d \text{ is any destination}\} to each neighbor.

  4. 4
    Step 4

    When router xx receives neighbor yy’s vector, compute candidate costs for every destination dd: c(x,y)+Dy(d)c(x,y)+D_y(d). Repeat for all neighbors yy.

  5. 5
    Step 5

    For each destination dd, set Dx(d)D_x(d) to the smallest candidate cost. Record the next hop as the neighbor yy that achieved the minimum.

  6. 6
    Step 6

    Continue exchanging and relaxing. Convergence occurs when no routing table entries change between successive rounds.

  7. 7
    Step 7

    "If the example demonstrates a link failure or change, observe transient behavior and (optionally) how techniques like split horizon and poison reverse mitigate count-to-infinity."

    Note: The exact numeric values depend on the link costs and node labels shown in your diagram. The method above is the universal procedure for producing the distance-vector tables for that specific topology.

2) Turning the diagram into distance-vector tables

In a typical distance-vector classroom example, we create a table per iteration showing Dx(d)D_x(d) (cost from xx to dd). In each iteration:

  • router xx uses its neighbors’ advertised costs to infer better paths;
  • the best path cost decreases (or stays the same) as information improves;
  • next-hop fields update to reflect which neighbor provided the minimum.

A compact way to represent this is with a matrix-like layout:

IterationRouterDestination ADestination B…
t=0t=0XDX(A)D_X(A)DX(B)D_X(B)…
t=1t=1XDX(A)D_X(A)DX(B)D_X(B)…
t=2t=2XDX(A)D_X(A)DX(B)D_X(B)…

And the update rule for each entry is always the same min-plus expression:

Dx(d)=min⁡y∈N(x)[c(x,y)+Dy(d)]D_x(d) = \min_{y \in N(x)} \left[c(x,y) + D_y(d)\right]

2

Footnotes

  1. Bellman–Ford algorithm - Wikipedia - Shows the shortest-path dynamic programming/relaxation rule used conceptually by DV. ↩

  2. Routing Information Protocol (RIP) - Wikipedia - RIP is a classic distance-vector protocol; includes exchange/update behavior. ↩

Pro Tip: how to do the example quickly by hand

Write one row per router per destination, but compute updates destination-by-destination: for a fixed destination dd, list the neighbors yy of xx and evaluate c(x,y)+Dy(d)c(x,y)+D_y(d), then pick the smallest.

3) Why distance vector eventually converges (and when it doesn’t behave well)

Distance vector converges because each router repeatedly applies a relaxation that improves estimates until they match the true shortest-path distances (under stable link costs and connectivity). This is closely related to the convergence behavior of Bellman-Ford.

However, distance vector can experience:

  • Slow convergence after topology changes (bad news takes time to propagate).
  • Routing loops, especially during failures, where nodes keep believing outdated routes.

A famous symptom is the count-to-infinity problem: when a route becomes invalid, routers may continue increasing the reported cost rather than immediately switching to an alternative.

2

Footnotes

  1. Distance vector routing - Wikipedia - Overview of DV routing, neighbor exchanges, and concepts like loops. ↩

  2. Count to infinity problem - Wikipedia - Explains slow convergence and routing loops in distance-vector protocols. ↩

Pro Tip / Warning: Count-to-infinity and mitigation

During a failure, DV may loop and increment distances slowly (count-to-infinity). Common mitigations are split horizon and poison reverse to reduce the chance of advertising routes back to the interface they came from.

Typical DV lifecycle over iterations

Initialize

t=0

Set Dx(x)=0D_x(x)=0, direct neighbors to link cost, and others to ∞\infty."

Exchange vectors

t=1..k

Neighbors share their current distance vectors."

Update routing tables

Relaxation rounds

For each destination, compute c(x,y)+Dy(d)c(x,y)+D_y(d) and take the min."

Stable shortest paths

Converged

Routing-table entries stop changing (if link costs are stable)."

Transient instability

Change occurs (optional)

May trigger temporary loops and count-to-infinity unless mitigated."

Distance-vector update intuition (example of candidate costs)

For a fixed router X and destination d, the algorithm compares candidate costs via each neighbor y.

Common pitfalls when explaining an example DV diagram

Knowledge Check

Question 1 of 4
Q1Single choice

In distance vector routing, router X computes its estimate to destination d using which rule?