preview

Bellman-Ford Deliverout Analysis

Good Essays

This part of your exam is worth 30 points.
Using the provided network diagram, write a program that finds the shortest path routing using the Bellman-Ford algorithm. Your program should represent the fact that your node is U. Show how the iterative process generates the routing table for your node. One of the keys to your program will be in determining when the iterative process is done. Deliverables
1. Provide an output that shows the routing table for your node after each iteration. Add a second table with two columns. One that shows the destination from your node and the second column indicating the number of hops to reach that node.
OUTPUT:

The screenshot of the output of the running program is attached below. The distance …show more content…

Below shown is how the output looks:

2. Provide a Word document with screenshots that explains how your program incorporates the Bellman-Ford algorithm. Ensure you explain and show how you incorporated the iterative process and determined when the routing table for your node was optimum. You can incorporate your outputs into this document; however, you must identify where in your source code you print the results required in deliverable 1 above.
This algorithm calculates the shortest path using the bottom-up approach. The Bellman Ford algorithm using a relaxation formula and calculates the path between each edge and iterates for V-1 times using this formula to finally calculate the shortest path. We are assuming that there are no negative weight cycle in the network.
It starts by calculating the shortest path between one node at first, then it checks for the path between two nodes, and so on proceeds in each iteration. I have put the outer loop as V-1, where V is the total number of vertices that is present in the network. In our case, V=6. Therefore, there must be V-1, which is 5 iterations to obtain the optimal shortest path to each of the node from the source node.

The below shown highlighted screenshot is the comparison relaxation formula used to check at each edge.

If we iterate through all the edges one more time, and still get the shortest path, this means that there is a negative weight cycle in the network. Hence,

Get Access