Question: C + + AND PLEASE ADD COMMENTS IN THE CODE, THANKS! Objectives: Find the shortest path in the Airline Network program using DFS algorithm An

C++ AND PLEASE ADD COMMENTS IN THE CODE, THANKS!
Objectives: Find the shortest path in the Airline Network program using DFS algorithm
An unweighted digraph represented by its adjacency list is used for the network, and the information needed to construct is read from a network file.
Network file content:
Los_Angeles
3346
San_Francisco
3134
Denver
3127
Chicago
238
Boston
246
New_York
3478
Miami
3835
New_Orleans
217
Network file details
The order of cities are arranged from LA(1), SAN(2), DEN(3), CHI(4), BOS(5), NYK(6), MIA(7), NOL(8).
First digit is the number of out-degrees; other digits are the destinations of out-degrees.
Sample outputAirline Map
Enter name of network file: c:
etworkfile.txt
The Digraph's Adjacency-List Representation:
1: Los_Angeles--346
2: San_Francisco--134
3: Denver--123
4: Chicago--38
5: Boston--46
6: New_York--478
7: Miami--835
8: New_Orleans--17
Number of start city? 1
Number of destination? 2
Shortest path from Los Angeles to San Francisco is:
1 Los_Angeles
|
v
3 Denver
|
v
2 San_Francisco
More (Y or N)?Y
Number of start city? 6
Number of destination? 4
Shortest path from New York to Chicago is:
6 New_York
|
v
4 Chicago
More (Y or N)?y
C + + AND PLEASE ADD COMMENTS IN THE CODE,

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!