c++ classic realisation of data srtucture "graph"