Question: Question 4 : By using the class weightedGraphType provided ( weightedGraph . h ) , write a C + + code to create a weighted

Question 4:
By using the class weightedGraphType provided (weightedGraph.h), write a C++ code to create a
weighted graph containing the following edges and outputs the shortest distance from a given node to
every other node in the graph.
V(G)={0,1,2,3,4}
E(G)={(0,1, Weight 10),(0,3,2),(0,4,6),(1,2,5),(2,1,3),(3,1,12),(3,4,3),(4,1,10),(4,3,2)}
The input file should consist of the number of vertices in the graph in the first line and the vertices that
are adjacent to the vertex in the following lines as described in the textbook.
Example input file contents:
5
014-999
12-999
23-999
00011643-999
111025-999
22038-999
the number of vertices
Vertex 0:1,4 are adjacent
Vertex 0: adjacent vertex edge (0,0) weighto
adjacent vertex edge (0,1) weight 16
adjacent vertex 4(edge (0,4) weight 3
Submit the source code, and copy and paste the screenshot of the output here.
Question 4 : By using the class weightedGraphType

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!