Storing graph as pointer
Fixed return type