Avoiding Loops
Even if cycles do not occur in the solution, they may cause a nuisance for any search process that is not prepared for them.
Therefore, it is important to keep track of which vertices have been visited during a search.
We’ll maintain two lists: OPEN and CLOSED.
OPEN will hold the set of vertices that have been discovered so far but that have not yet been examined.
CLOSED will hold the vertices that have already been examined.