Working with graphs using C++ language