Memoize createGraph() method