Graph uses heap instead of stack