Rewrite graph.cpp, graph.h