A Decentralised Routing Algorithm that constructs a forwarding table in each node by having nodes propagate information to their neighbours.
The algorithm is:
Distributed: Each node in a graph receives information from their neighbours, performs a computation and distributes the results to their neighbours.Iterative: The process continues until no more information is exchanged at which point the nodes will have learned the least-cost paths from them-self to other nodes.Asynchronous: Since the nodes need not operate in lockstep with each other.
The information distributed for each node in the graph is their distance-vector where is an estimate of the least-cost path from to . The distance vector is therefore a vector of least cost paths to other nodes in the network.
Each node maintains the following information:
- For each neighbour , the cost from directly attached to .
- Node ‘s distance vector .
- The distance vectors of its neighbours .
This distance vector is computed when receiving other neighbours distance vectors by using the The Bellman-Ford Equation. If this results in their distance-vector changing, then they broadcast their updated distance-vectors to neighbours. The same is done if a node experiences a change in its attached links.
As long as the nodes keep exchanging their distance-vectors then the least-cost estimates will converge to the actual least-cost estimate according to Bertsekas 1991.
Pseudo code
Runs at each node x:
# ─────────────────────────────────────────
# INITIALISATION
# ─────────────────────────────────────────
for y in N: # all destinations
Dx[y] = c(x, y) # cost to neighbour; infinity if y is not a neighbour
for w in neighbours(x):
Dw[y] = float('inf') for all y in N # neighbour costs unknown initially
for w in neighbours(x):
send(Dx, to=w) # send own distance vector Dx = {y: Dx[y] for y in N} to w
# ─────────────────────────────────────────
# MAIN LOOP
# ─────────────────────────────────────────
while True:
# Wait for a trigger
wait until (
link_cost_changed(to_neighbour=w)
or received_distance_vector(from_neighbour=w)
)
# Recompute distances using Bellman-Ford
for y in N:
Dx[y] = min(c(x, v) + Dv[y] for v in neighbours(x))
# Propagate updates if anything changed
if any(Dx[y] changed for y in N):
for w in neighbours(x):
send(Dx, to=w) # send Dx = {y: Dx[y] for y in N} to all neighboursCount-to-infinity Problem
Is a problem where many (not infinity but an unbounded value) iterations are needed to properly update the distance vectors as a result of an increase in link cost.
Se examples for demonstration.
Poisoned reverse
The three node example of the count-to-infinity problem can be avoided by the poisoned reverse technique. This works by having nodes that route through other nodes to a third node advertise a cost of infinity to the intermediary node, i.e. if routes through on its way to then informs that .
This however does not solve the count-to-infinity problem when the loop contains three or more nodes.
Examples
Three node graph

Count-to-infinity Problem
is changed from 4 to 60.
Before change
Before the link cost is changed we have .
t0: Change is discovered
detects link change and computes Of course we know that should be 50 but has not yet gained this information.
t1: y inform z of new cost
Node has computed a new cost to and informs of this change.
then use this new information to compute
t2: z inform y of new cost
Since node has updated its new cost to it informs of this change and computes .
t3: y informs z of new cost
Since has updated its new cost to it informs . This pattern repeats until and , where they increment their cost to by one, until they have reached and , which are the true least costs.