almost done with this graph problem