This repository contains C++ implementation of many fundamental graph algorithms in the simplest way possible, mainly in a non-OOP style. These codes were written about four years ago when I was teaching algorithms to students interested in the olympiad in informatics.
The focus was to show how an algorithm works, and mostly these codes are some scratches for those who want to learn or practice and build their versions for their own need.
In most of the codes above, N is the number of nodes, and M is the number of edges. In order to get the input, the code starts by getting N, the count of nodes, and M, the count of edges, in the first line; then, in the following M lines, the input should be contained with vertices V and U, which means the is an edge between V and U (i.e., U and V are adjacent). Note, in some codes related to Directed Graphs, the edges are from the first node in line to the second one.
An input example is provided below:
4 3
1 2
2 3
3 1
The first line means a graph with four nodes and three edges, and each of the three following lines introduces an edge between two vertices.