DONE: graph routines I