Optimize graph generation

Made some minor optimizations to the game graph generation algorithm.