Implemented all methods for the Graph data structure.