correct graph implementation.