Question
Objective: Find the least cost forwarding path for all routers using Dijkstras algorithm. Requirements: 1. Create a C code to find the least cost forwarding
Objective:
Find the least cost forwarding path for all routers using Dijkstras algorithm.
Requirements:
1. Create a C code to find the least cost forwarding path for a given set of six routers
2. Use Dijkstras algorithm to find the least cost path. The algorithm will generate its least cost routing paths
3. The program should read a file (router.txt) for the cost information and find the least cost forwarding path for them, then write them to an output file.
Procedure:
1. Open the router.txt file and read the cost between the routers. Your code should be able to support at least six routers
2. Use the Dijkstras algorithm to find the least cost forwarding path between the routers
4. The format of the input file is s d c Where s is the source, d is the destination, and c is the cost between source and destination.
5. Write to a file (output.txt) and print to the console the forwarding table for all the routers that were computed using Dijkstras algorithm. The output file will have the destination router and least cost link connecting it
6. The output file format shows only the output for two routers u and v but you should generate least cost path for all routers. An example is below:
Input File Format Output File Format: u v 2 u w 5 u x 1 v x 2 v (u, v) w (u, x) x (u, x) y (u, x) z (u, x) x y 1 u (v, u) w (v, w) x (v, x) y (v, x) z (v, x) w y 1 w z 5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started