Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 the number of vertices Vertex 0: 1,4 are adjacent 12-999 23-999 00011643-999 11025-999 22038-999 Vertex 0: adjacent vertex 0 (edge (0,0))-> weighto adjacent vertex 1 (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. I
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