Modelling
Routers are modelled as nodes and links are modelled as edges. Edges have associated metrics:
- Cost of the link: delay, monetary costs, distance etc.
- Available resources: current capacity etc.
Dijkstra calculates the least-cost path.
Assumptions
Each router has a complete network picture: topology, link costs etc.
To do this, each router reliably floods information about its neighbors to every other router. All routers should have consistent information.
Flooding can sometimes cause broadcast storms; controlled flooding or spanning-tree broadcasts are used to prevent this.
Dijkstra’s Algorithm
After flooding, each router independently calculates the least-cost path from itself to every other router using Dijkstra’s algorithm and generates a forwarding table for every destination.
Definitions:
-
: source node -
: nodes whose least-cost path is already known; initially . One node is added to each iteration -
: cost of edge between and -
: current minimum cost of path from to node . Initially: -
if is adjacent to -
otherwise
-
-
: parent/predecessor node of - vertex before along the shortest path from to
Until all nodes are in
- Find the smallest
where is not in - Add
to - For all
adjacent to and not in : -
- i.e. see if the cost of
plus the cost between and is less the current cost of
- i.e. see if the cost of
-
Running this algorithm, a forwarding table can be generating, mapping some destination to the next hop.
Complexity:
- If a min-heap is used, getting the least-cost node
not in is - For each iteration,
needs to be updated for all of ’s neighbors:
Oscillation with Link-State Routing
Since routers have a complete network picture, if one router finds a cheaper path through node