Added caching to graph data calculations.