Add timeouts, cache graph function