This is a personal project that is intended to display some of the algorithms that I have leaned over time but also my skills in designing software. For this project I have decided to use the following technologies:
- C++ as the go to programming language
- Raylib 4.0.0 as the graphics library + RayGui 3.1
- CMake to compile everything
- Visual Studio Code as the code editor
- Clang-Format in order to properly format the code
- Github Actions for the pipelines
- StackEdit for creating the
.md
files - Draw.io for creating the diagrams
This is, at the time of developing the code, my biggest project. 😁
For more details that also cover code, please read the the Design Document.
Keep in mind that the project has two versions. The first one contains a visualizer of some of the most important sorting algorithms and did not have all the features of a fully fleshed program. The second one contains more algorithms that the first one and will incorporate algorithms from 4 fields. |Sorting | Search | GraphInterface | |--|--|--|--| | Insertion Sort | Linear Search | Dijkstra's algorithm | | Heap Sort | Binary Search | BFS & DFS | | Selection Sort | Jump Search | A* | | Merge Sort | Interpolation Search | Kruskal’s algorithm | | Quick Sort | | Topological sorting | | Bubble Sort | | |
- How to Install and Run the Project
- How to Use the Project
- Structure of code
- Included Tests
- CI/CD
- Credits
In order to run the project you will use the next commands in the repo's route, after downloading the files:
mkdir build && cd build
cmake .. && make
./visualiser
CMake will automatically download Raylib from GitHub when building the project.
After running the compiler and launching project (as mentioned above) you should be ready to visualize the algorithms.
The project has a main interface, from where you will be able to select from 4 different options:
Sorting Algorithms
, Search Algorithms
, and GraphInterface Algorithms
.
As presented above, the Sorting Algorithms
page will contain 6 different algorithms.
This page will have the following features:
- a
randomize button
, that will randomize the array; - an
add button
, that will add one pillar to the array. Note the maximum number of pillars is 100; - a
subtract button
, that will remove one pillar from the array. Note that the minimum number of pillars is 20; - a
start/stop button
; - a
back button
, that will take you back to the main menu; - a
drop-down menu
, from which you can select the desired algorithm; - the main drawing canvas (under the header), in which all the pillars will be animated
As presented above, the Search Algorithms
page will contain 5 different algorithms. This page will have the same functionality and buttons to the one containing the Sorting Algorithms
. This page will also contain another button that will sort everything, in order to provide an example of what happens when the array is not sorted.
As presented above, the GraphInterface Algorithms
page will contain 7 different algorithms. There will also be a starting graph that should be enough for starting to play with the algorithms.
This page will have the following features:
- an
add node
mode, that will allow you do add a node on the canvas (the value of the node will be selected in a special place in the header); - an
add edge
mode, that will allow the use to select a starting and a ending node for the edge. In order to select the weight you will have to type this in the header. In order to select if the edge is directed or undirected, you will also need to select a toggle option in the header; - a
remove
mode, that will allow the user to remove any edges or nodes. Note that if you delete a node, all edges that come out of or point to that node will also be deleted; - a
clear
button that will clear the canvas; - a
select
mode, that will allow the user to select a starting and a finishing node; - a
start/stop button
that will select two random nodes (if no nodes are selected as starting or ending) and animate the distance between them; - a
back button
, that will take the user back to the main menu; - a
drop-down menu
, from which you can select the desired algorithm; - the main drawing canvas (under the header), in which everything will be animated
Keep in mind that, even if some algorithms don't work with some graphs (i.e.: Dijkstra with a graph that has a negative weight edge), my implementation will allow such cases to exist in order to better understand the error. A warning will appear wo that the user is informed about this fact.
The repo folder will contain some important files:
src
folder -> containing the C++ filesinclude
folder -> containing all the header fileslibs
folder -> containing the Raylib 4.0.0 libraryassets
-> any assets additional that the project will needCMakeLists.txt
-> the CMake file that will compile the projectassets/diagram.png
-> a diagram of the structure of the projectassets/DesignDocument.md
-> a design document that will go into more detain over everything
├── assets
│ └── diagram.png
├── CMakeLists.txt
├── include
│ ├── raygui.h
│ └── raylib.h
├── libs
│ └── libraylib.so.400
├── README.md
├── DesignDocument.md
└── src
| └── main.cpp
For more details that also cover code, please read the the Design Document.
NA
NA
NA