This repository contains code for a Route Optimizer that implements Dijkstra's algorithm to find the shortest path between nodes in a graph and generates visualizations of the graph.
The Route Optimizer project aims to optimize routes and find the shortest path between nodes in a graph. It provides functionality to load input data, generate graphs, calculate weights, and visualize the resulting graph.
To use the Route Optimizer, follow these steps:
- Install the gnuplot based on your operation system here: http://www.gnuplot.info/download.html and follow the instruction
- Clone the repository:
- Build the project (if required) using your preferred build system.
- Run the program:
$ git clone <repository_url>
$ cd <repository_directory> // look for where main.exe file located to
$ ./main.exe
Note: if you can't run the program. Remember to check the directory path for the files.
-
Shortest Path Calculation:
The
algorithm.cpp
file contains an implementation of Dijkstra's algorithm, which can find the shortest path between nodes in a graph. -
Graph Generation:
The
graph.cpp
file provides functionality to generate a graph based on input data and save it as an image file.
To find the shortest path between nodes:
- Modify the input data in the appropriate files (
pnts.txt
andedges.txt
) to represent your graph. - Compile and run the program.
- The program will calculate and display the shortest path between nodes using Dijkstra's algorithm.
To generate a graph:
- Modify the input data in the appropriate files (
pnts.txt
andedges.txt
) to represent your graph. - Compile and run the program.
- The program will generate a visualization of the graph and save it as an image file (
graph.png
).
- algorithm.cpp: Contains the implementation of Dijkstra's algorithm to find the shortest path.
- graph.cpp: Provides functionality to generate a graph and visualize it.
- pnts.txt: Input file containing the coordinates and labels of the graph's nodes.
- edges.txt: Input file containing the edges of the graph.
Contributions to this project are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and test them thoroughly.
- Commit your changes and push them to your forked repository.
- Submit a pull request, describing the changes you've made.
This project is licensed under the MIT License. See the LICENSE file for more information.
If you have any questions or suggestions regarding this project, feel free to contact me:
- Email: [email protected]