modified the MGraph.cpp and MGraph.hpp files