Update graph.h

Fixed annoying syntax errors and for loops