GraphAlgs banner

GraphAlgs

6 devlogs
8h 51m 36s

Some graph traversal algorithms that I’m implementing in C++ to refresh my knowledge of C++ and the algorithms used in my exam board. All three algorithms are linked nicely in a helper function that handles all the printing.

This project uses AI

Copilot for debugging and teaching me C++ again. Claude helped me with the mathematics for force-directed placement for the graph visualisation

Demo Repository

Loading README...

Olly

So, I now have the graph’s edges showing in a GUI. I asked Claude to tell me how I could implement having the graph in a fluid and natural way; it told me to use force-directed placement which makes the nodes repel each other like magnets, and the edges act like springs pulling it back together. The physics of it are really nice!

Attachment
0
Olly

I have installed a new library called SFML - Simple and Fast Media Library. I chose this library because a Reddit thread suggested that it is quite similar to PyGame which from a quick glance at the documentation, it does. And after 15 mins of trying to get a Noto Sans font file load, I now have a Hello World window!

Attachment
0
Olly

Shipped this project!

Hours: 5.67
Cookies: 🍪 125
Multiplier: 21.97 cookies/hr

I’m happy with the way this turned out, it runs fast (it’s C++ duh!). The ascii art looks cool on startup and in my README, shoutout to the website that I got it from (credit in my README). The traversals and path finding work, and my proficiency in modern C++ is way better now. I think in my next version, I might look to add a GUI for the user to visualise the graph, and interactively add and remove parts of the graph!

Olly

I have now added a README, some sweet ascii art to the program and the README, and the breadth first search algorithm!

Attachment
Attachment
0
Olly

I have now implemented a depth first search algorithm into my application! I had an issue where the program would segfault when I ran it. Turns out I missed that I was creating a vector of integers and then treating them like a vector of booleans :p

While I was making that algorithm, I made this nice simple CLI that users can now use to interact with the graph simulation. I have made a nice printMenu() function that means that I don’t have a big print statement clogging up my main function. Also there is a BFS (breadth-first search) option, but that will be implemented next!

Attachment
0
Olly

My Dijkstra’s algorithm now works nicely! The next item on the agenda will be a nice CLI to allow users to easily add to/remove from and modify the graph and select which algorithms they’d like to run

Attachment
0
Olly

I now have my own Stack, Queue and Priority Queue classes. I use inheritance on the priority queue class, as it is almost the exact same as the normal queue class, except for pushing, as it makes sure that all of the elements are ordered correctly. There is no output for these yet, however my graph class works, and I have made a method that prints the graph to show you guys!

Attachment
0