finish ex-1.c for graph.c, valgrind success