d 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 - (you can download the n
Objectives: Find the shortest path in the Airline Network program using DFS
Write a program to find the shortest route in an airline network from a given start city to a given destination city using Depth First Search.
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 - (you can download the network file download)
Los_Angeles
3 3 4 6
San_Francisco
3 1 3 4
Denver
3 1 2 7
Chicago
2 3 8
Boston
2 4 6
New_York
3 4 7 8
Miami
3 8 3 5
New_Orleans
2 1 7
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).
- The first digit is the number of out-degrees; other digits are the destinations of out-degrees.
Example: New Orleans - 2 1 7: New Orleans connects to LA (1) and MIA (7).
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images