update graph.cpp