Reduce stack by reusing graphs