Added abstraction to the graph classes