added graph implementation and modified abstraction