This project implements Dijkstra’s and Breadth First Search (BFS) algorithms to find the shortest path between two cities. The program reads data from a file named cities.txt and constructs the shortest path between a given source city (input from the user) and a destination city (also input from the user). It prints the full path using both algorithms and the total distance for Dijkstra’s algorithm.
- Load cities: Loads the file and constructs the graph.
- Enter source: Reads the source city.
- Enter destination: Prints the full route of the shortest path including the distance between each two cities and the total shortest cost for both algorithms (Dijkstra and BFS).
- Exit: Prints the information of step 3 to a file called
shortest_distance.txtand exits the program.
- Clone the repository to your local machine.
- Compile the code.
- Run the executable file.
- Follow the on-screen instructions to load cities, enter the source and destination cities, and view the shortest path.
- Choose the 'Exit' option to save the shortest path information to
shortest_distance.txtand exit the program.
cities.txt: Contains the data of cities and their connections.shortest_distance.txt: Stores the shortest path information when the user chooses the 'Exit' option.
