Computer and Communication Networks (paperback)
7.2. Least-Cost- Path Algorithms
In practice, the majority of Internet routing methods are based on least-cost algorithms. In such algorithms, a link cost is proportional to the links's current traffic load. However, the link cost may not always be proportional to the current load. The link cost is defined on both directions between each pair of nodes. Several least-cost-path algorithms have been developed for packet-switched networks. In particular, Dijkstra's algorithm and the Bellman-Ford algorithm are the most effective and widely used algorithms. 7.2.1. Dijkstra's Algorithm
Dijkstra's algorithm is a centralized routing algorithm that maintains information in a central location. The objective is to find the least-cost path from a given source node to all other nodes. This algorithm determines least-cost paths from a source node to a destination node by optimizing the cost in multiple iterations. Dijkstra's algorithm is as follows : Begin Dijkstra's Algorithm
If any two nodes i and j are not connected directly, the cost for that link is infinity, indicated by ² ij =x. Steps 2 and 3 are repeated until paths are assigned to all nodes. At step 1, k represents s , and ² sj computes the cost of the least-cost path from s to node j . At step 2, we want to find x among the neighboring nodes but not in k such that the cost is minimized. At step 3, we simply update the least-cost path. The algorithm ends when all nodes have been visited and included in the algorithm.
7.2.2. Bellman-Ford Algorithm
The Bellman-Ford algorithm finds the least-cost path from a source to a destination by passing through no more than
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
² sj ( 0) | = | x, for all j | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
² ss ( | = | 0, for all |
Least-cost path:
for any node j
² sj (
If any two nodes i and j are not connected directly, ² ij (
Example. | Use the Bellman-Ford algorithm to find the least-cost path from node A to node B in Figure 7.2. | ||||||||||||||||||||||||||||||||||||||||||
Solution. | Table 7.2 shows the details of least-cost-path iterations. For iteration Table 7.2. Use of the Bellman-Ford algorithm
|
We can now compare these two algorithms. In step 2 of Bellman-Ford, the calculation of the link cost to any node j requires knowledge of the link cost to all neighboring nodes. In step 3 of Dijkstra's algorithm, each node requires knowledge of the network topology at each time of iteration. The performance of each algorithm varies network to network and depends on the topology and size of a particular network. The comparison of these two algorithms, therefore, depends on the speed of each to achieve its objective at its corresponding step given a network under routing. A simulation can clarify the efficiency of each algorithm given a certain network topology.