# Lab 7 (Routing Algorithms) Solution

\$35.00 \$29.05

Category:

## Description

1. Write a program that uses Dijkstra’s algorithm to compute the least cost path from a given node to every other node in the network. Your program should take 3 arguments: the rst argument is n | number of nodes in the network, the second argument is s | the source node,

 and the third argument is is the name of the le which contains the cost (a positive integer less than 10; 000) between every pair of nodes in the network. Note that every node need not be connected to every other node in the network. Your program should have a run-time complexity of at-most O(n2), and should output the least cost path (along with the path price) from s to every other node in the network. 
1. Write a program to simulate the Distance Vector (DV) routing algorithm. Your program should take 2 arguments: the rst argument is n | number of nodes in the network, and the second argument is the name of the le which contains the cost (a positive integer less than 10; 000) between every pair of nodes in the network. Note that every node need not be connected to every other node in the network. Note that your program should be able to demonstrate the

 possibly random local routing table updates that can happen in DV, and should terminate and print the local routing table at every node after convergence has occurred. 

End of paper