Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago