Question: Calculate the paths of a simulated network using the three following algorithms from the supplied text, comparing run times of each Table 4 . 4
Calculate the paths of a simulated network using the three following algorithms from the supplied text, comparing run times of each
Table DistanceVector Routing Algorithm for A Node
DistanceVectorRouting
Initialize create initial vectors for the node
Dmyself
for y to N
if ymathrm is a neighbor
Dycmyselfy
else
Dyinfty
send vector D D DN to all neighbors
Update improve the vector with the vector received from a neighbor
repeat forever
wait for a vector D
for y to N
Dymin Dycmyselfw D
if any change in the vector
send vector D DDN to all neighbors
End of Distance Vector
Dijkstra's Algorithm
Initialization
Tree root Tree is made only of the root
for y to N N is the number of nodes
if ymathrm is the root
Dy D y is shortest distance from root to node y
else if ymathrm is a neighbor
Dycrooty cxy is cost between nodes x and y in LSDB
else
Dyinfty
Calculation
repeat
find a node w with Dw minimum among all nodes not in the Tree
Update distances for all neighbor of w
for every node x which is neighbor of w and not in the Tree
D x operatorname m i n D x D w c w x
until all nodes included in the Tree
End of Dijkstra
Table Pathvector algorithm for a node
PathVectorRouting
Initialization
for y l to N
if y is myself
Path y myself
else if y is a neighbor
Pathy myself neighbor node
else
Path y empty
Send vector Path Path Pathy to all neighbors
Update
repeat forever
wait for a vector Path from a neighbor w
for y l to N
if Path $ includes myself
discard the path Avoid any loop
else
If there is a change in the vector
Send vector Path Path Pathy to all neighbors
End of Path Vector
Inputoutput format and testing:
Your program should take a text file as input, which describes the network topology. The first line of the text file is a single number, which stands for the number of nodes in the network. With a network of n nodes, we assume the nodes have the following IDs: ldots n All subsequent lines in the input file are in the format of n n cost which stands for a link between node n and node n with cost cost. Note that cost can be a floating point number. These three numbers are separated by single spaces in each line of the input file. All the links are bidirectional. So a link of n n cost infers a link of n n cost All links are sorted in ascending order with n as the primary order and n as the secondary order.
As output, your program should print out the shortest path to all network nodes with the complete path and the cost.
Let's look at an example with the network topology shown in the following figure.
Distance Vector Routing:
shortest path to node is with cost
shortest path to node is with cost
shortest path to node is with cost
shortest path to node is with cost
shortest path to node is with cost
Time Elapsed: seconds
Djikstra's Algorithm:
Repeat for the other algorithms
Note that we will use DIFFERENT network topology in our testing. Note that we will use DIFFERENT network topology in our testing.
Turnin:
You are asked to turn in a single source file and a README file. The source file should be named if you use C if you use C and a if you use Java, and Distance.py if you use Python. In the case of Java, the main method class should also be in Distance such that your program can be launched as after compile. No matter what programming language you choose to use, your program should take two parameters on startup. The first parameter is the path of a text file describing the network topology. The second parameter is the ID of the source node. For example, if your program is written in Java, you should be able to run your program using "java Distance network. dat to find shortest paths from node in the network topology specified by network.dat.
The README file should contain a description of your design, and a detailed analysis of the complexity of your program. If your program requires any special compilation flag to build, you need to specify the full build command in the README file. Alternatively, you can provide a makefile, which is strongly preferred.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
