Skip to content

Shortest path finder using Dijkstra's algorithm for graph traversal.

Notifications You must be signed in to change notification settings

qossayrida/ShortestPathFinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Shortest Path Finder

Description

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.

Features

  • 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.txt and exits the program.

Usage

  1. Clone the repository to your local machine.
  2. Compile the code.
  3. Run the executable file.
  4. Follow the on-screen instructions to load cities, enter the source and destination cities, and view the shortest path.
  5. Choose the 'Exit' option to save the shortest path information to shortest_distance.txt and exit the program.

Files

  • 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.

Map of cities in the attached file

Map of cities

🔗 Links

facebook

Whatsapp

linkedin

twitter

About

Shortest path finder using Dijkstra's algorithm for graph traversal.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages