Updated Graph implementation