This repository contains solutions and exercises for the SPA3 course, focused on Graphs and Trees.
The exercises include implementation of various graph algorithms such as bipartite graph checks, DFS, BFS, cycle detection, topological sorting, and more.
- Vezbe 1
- Undirected graph implementation 🟢
- Loading graph from file 📂
- Find component starting from some vertex 🔍
- Find all components and print them 🌐
- Find path between 2 vertecies 🔗
- Print distance from one vertex to all other 📏
- Check if graph has cycles 🔄
- Vezbe 2
- Check if undirected graph is bipartite 🔵🟣
- Count number of components in directed graph 📊
- Print all components 🧩
- Check if cycle exists in graph and print one 🔄
- Topological sort if there is no cycle 🔄
- Java: Core language for implementing graph algorithms.
- Princeton's Graph Library algs4j: For directed graph representation and operations (Used in exercise 2 and forward).
To get started, clone this repository to your local machine:
- With git:
git clone https://github.com/momcilovicluka/spa3-vezbe.git
or
- With GitHub cli (superior way btw):
gh repo clone momcilovicluka/spa3-vezbe
After that, just open exercises in your editor of choice (i use neovim btw (i don't i just say because funny)) and make sure you also downloaded example graphs files and algs4j library
Feel free to fork this repo and submit pull requests with improvements, bug fixes, or additional exercises. Contributions are always welcome!