Distance Vector Routing Algorithm
• Distance Vector Routing Algorithm is a type of dynamic routing algorithm used to
determine the best path for data packets to travel across a network.
• The algorithm is often associated with the Bellman-Ford algorithm, which is used to
compute the shortest paths in a network.
• The main aim of routing is to transmit the packets from one router to another router
in a network until the packets reach their final destination. In this process, a routing
table is created, which contains the information regarding routes that data packets
follow.
• Now, various routing algorithms are there which are used to decide the best optimal
route that the incoming data packet must be transmitted.
• The best or optimal path is the path from the source to the destination router,
having the least cost. For example, refer to the routers shown below.
If a packet needs to be transmitted from Router-1 to Router-2, then it can follow two paths.
• Directly from Router-1 to Router-2, the cost of this traveling is 6.
• It can also go from Router-1 to Router-2, via Router-3: Router-1 –> Router-3 –>
Router-2. The cost of this traveling is (2 + 3) = 5.
So, the data packet will be sent from the second path i.e. Router-1 –> Router-3 –>
Router-2.
• Routing algorithms can be grouped into two major classes:
1) nonadaptive (Static Routing)
2) adaptive. (Dynamic Routing)
Different Routing Algorithms
• Shortest path algorithm
• Flooding
• Distance vector routing
• Link state routing
• Hierarchical Routing
Working Steps:
1. Initialization of Distance Vector: Each router maintains a table that holds the
following information for each destination in the network:
• Destination: The node or router you're trying to reach.
• Cost: The distance or cost (e.g., number of hops) to reach the destination.
• Next Hop: The neighboring node/router to send data to in order to reach the
destination.
Each router initializes its distance vector with the cost of reaching its directly
connected neighbors. For any destination that is not directly connected, the cost is
set to infinity.
2. Exchange of Distance Vectors: Routers periodically send their distance vector tables
to their immediate neighbors.
3. Update Table: Upon receiving distance vectors from neighbors, each router updates
its own routing table using the Bellman-Ford equation.
Bellman-Ford Equation: The algorithm updates its routing table using the following
rule:
4. Convergence: This process continues until all routers have consistent and stable
routing tables.