Skip to content

C++ implementation of some of the most well-known graph algorithms in the simplest way. Mostly in non-OOP style because the algorithms itself and its performance were the main points.

Notifications You must be signed in to change notification settings

arabporr/Graph_Algorithms

Repository files navigation

Fundamental Graph Algorithms

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.

Input style

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.

Releases

No releases published

Packages

No packages published

Languages