Computer Network - Distance Vector Routing Algorithm
Computer Network - Distance Vector Routing Algorithm
https://www.javatpoint.com/distance-vector-routing-algorithm 1/8
5/10/2021 Computer Network | Distance Vector Routing Algorithm - javatpoint
Where the minv is the equation taken for all x neighbors. After traveling
from x to v, if we consider the least-cost path from v to y, the path cost will
be c(x,v)+dv(y). The least cost from x to y is the minimum of c(x,v)+dv(y)
With the Distance Vector Routing algorithm, the node x contains the
following routing information:
For each neighbor v, the cost c(x,v) is the path cost from x to directly
attached neighbor, v.
to all destinations, y, in N.
The node x has updated its own distance vector table by using the above
equation and sends its updated table to all its neighbors so that they can
update their own distance vectors.
Algorithm
At each node x,
Initialization
loop
wait(until I receive any distance vector from some neighbor w)
for each y in N:
Dx(y) = minv{c(x,v)+Dv(y)}
https://www.javatpoint.com/distance-vector-routing-algorithm 2/8
5/10/2021 Computer Network | Distance Vector Routing Algorithm - javatpoint
forever
Note: In Distance vector algorithm, node x update its table when it either
see any cost change in one directly linked nodes or receives any vector
update from some neighbor.
Sharing Information
In the above figure, each cloud represents the network, and the
number inside the cloud represents the network ID.
All the LANs are connected by routers, and they are represented in
boxes labeled as A, B, C, D, E, F.
In the above figure, we observe that the router sends the knowledge to the
immediate neighbors. The neighbors add this knowledge to their own
knowledge and sends the updated table to their own neighbors. In this way,
routers get its own information plus the new information about the
neighbors.
Routing Table
Two process occurs:
Initially, the routing table is created for each router that contains atleast
three types of information such as Network ID, the cost and the next hop.
⇧
https://www.javatpoint.com/distance-vector-routing-algorithm 3/8
5/10/2021 Computer Network | Distance Vector Routing Algorithm - javatpoint
NET ID: The Network ID defines the final destination of the packet.
Cost: The cost is the number of hops that packet must take to get
there.
In the above figure, the original routing tables are shown of all the
routers. In a routing table, the first column represents the network
ID, the second column represents the cost of the link, and the third
column is empty.
For Example:
The routing table of B shows how the packets can move to the
networks 1 and 4.
After adjustment, A then combines this table with its own table to
create a combined table.
https://www.javatpoint.com/distance-vector-routing-algorithm 4/8
5/10/2021 Computer Network | Distance Vector Routing Algorithm - javatpoint
The combined table may contain some duplicate data. In the above
figure, the combined table of router A contains the duplicate data, so
it keeps only those data which has the lowest cost. For example, A
can send the data to network 1 in two ways. The first, which uses no
next router, so it costs one hop. The second requires two hops (A to
B, then B to Network 1). The first option has the lowest cost,
therefore it is kept and the second one is dropped.
The process of creating the routing table continues for all routers.
Every router receives the information from the neighbors, and update
the routing table.
← Prev Next →
https://www.javatpoint.com/distance-vector-routing-algorithm 5/8
5/10/2021 Computer Network | Distance Vector Routing Algorithm - javatpoint
MongoDB Gimp
Solr
Teradata PhoneGap
Tutorial Tutorial
Verilog
Teradata PhoneGap
Preparation
Interview Company
Questions Interview
Questions
Interview
Company
Trending Technologies
https://www.javatpoint.com/distance-vector-routing-algorithm 6/8
5/10/2021 Computer Network | Distance Vector Routing Algorithm - javatpoint
B.Tech / MCA
DS
OS C. Network Compiler D.
https://www.javatpoint.com/distance-vector-routing-algorithm 7/8
5/10/2021 Computer Network | Distance Vector Routing Algorithm - javatpoint
.Net
Data Mining
Tutorial
Data Mining
https://www.javatpoint.com/distance-vector-routing-algorithm 8/8