How would you optimize a memory-intensive graph traversal algorithm to run within strict execution time limits?