Then, when we consider a new path, we add the new state to the set of already explored states, and then when we are expanding the path and adding in new states to the end of it, we don't add that in if we have already seen that new state in either the frontier or the explored.