fix some bugs in Graph.h