Question
Write C/C++ a program that inputs a weighted undirected graph and finds the shortest path between two vertices using Dijkstras algorithm, using indices to order
Write C/C++ a program that inputs a weighted undirected graph and finds the shortest path between two vertices using Dijkstras algorithm, using indices to order the branching. The program should take three command-line arguments: the name of the graph file, followed by a source vertex, followed by a destination vertex. It should output to standard output the vertices in a shortest path in order, including both the source and destination vertices, as well as the total weight of the path. You may assume that any input graphs will have no negative-weight edges. A user should see something very similar to the following when invoking your program.
> ./dijkstra graph.txt 2 3
2 5 6 1 0 3
3.51
>
Graph.txt:
7 9 //Represents number of vertices and edges, respectively.
0 3 1 0 1 .51 5 0 3.0 2 5 0.2 5 6 0.8 1 6 1.0 2 4 1.30 4 3 3 3 1 3
Step 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