graph class for C++