SAED stands for Synopsys Armenia Educational Department, the university where I received my bachelor's degree.
This project is course work that I have done during SAED's discrete mathematics course.
The program finds a spanning tree in the user's inputted graph.
For program-correct work, you must have Graphviz on your computer.
- Get graph edges by reading the input file
input.txt
- Build an adjacency matrix for the given graph.
- By using the adjacency matrix, make a simple graph from the given graph.
- Check if the simple graph is connected or not, because a given graph must be connected.
- If the graph is connected, find the spanning tree using the DFS algorithm.
- Visualize the inputted graph and the spanning tree with Graphviz.
Input example Output example
- Start by updating the packages list:
sudo apt update
- Install the G++ compiler if you don't have:
sudo apt install build-essential
- Check installation with the command:
g++ --version
- Make must be installed with the build-essential package; check it:
make --version
- Install the make package if you don't have:
sudo apt install make
- Install Graphviz if you don't have:
sudo apt install graphviz
- Check installation with the command:
dot -V
- Clone this repo:
git clone https://github.com/dpetrosy/SAED_graph_project.git
- Go to directory:
cd graph_course_project
- Run the make and build program:
make
- Run executable:
./graph.exe
Congrats! Now you can see your inputted graph and found the spanning tree :)
You can change the input.txt
file and see how the program works 😎