Implementation of some graph algorithms in C++