SkillAgentSearch skills...

ShortestPathFinder

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

Install / Use

/learn @qossayrida/ShortestPathFinder
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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

<p align="center"> <img src="https://github.com/qossayrida/longestIncreasingSubsequence/assets/59481839/0386b071-f032-4144-8652-bd5c2c12430b" alt="Map of cities"> </p>

🔗 Links

facebook

Whatsapp

linkedin

twitter

View on GitHub
GitHub Stars6
CategoryDevelopment
Updated1y ago
Forks1

Languages

C

Security Score

60/100

Audited on Jan 26, 2025

No findings