Moved Graph implementation to Graph class