Pathfinder is a CLI tool that finds all the shortest paths between nodes.
This projects demonstrates a pathfinding application that:
- Reads from a specified file (see tests folder)
- Creates a weighted graph from the input
- Runs it through a pathfinding algorithm (Dijkstra's in this case)
- Displays the results in the console
- Handles errors gracefully throughout app's lifecycle
The idea was to learn more about graphs and pathfinding algorithms to build an application around it.
- C
- Make
- libmx (custom library)
- Valgrind
These instructions will help you configure and compile this project to run it on your machine.
Before trying to compile the application, make sure you have clang compiler and Make installed on your system:
- On Linux (Ubuntu):
sudo apt install build-essential clang
- On macOS:
xcode-select --install
You can skip this section if you are not using Linux.
Linux and macOS use a different header and function in order to get the size of allocated memory.
To successfully compile the program on Linux, navigate to libmx/inc/libmx.h
. Open the header file and replace #include <malloc/malloc.h>
with #include <malloc.h>
. Then go to libmx/src/realloc.c and replace malloc_size
function with malloc_usable_size
.
After cloning the repository, navigate to pathfinder root directory and simply run 'make' command:
make
The application should now be ready to run.
Run the application with ./pathfinder
command. This should result with usage output.
Specify the file you want to read in order to compute the paths. You can create your own files, or use test files from 'tests' folder:
./pathfinder tests/medium.txt
Output Example:
