Depth-First Search
Set OPEN = ?S? ; Set CLOSED = ? ? ;
Initialize a hash table PRED. (for “predecessor”)
Put into PRED: (S, NULL);
While OPEN is not empty do {
Remove the first element of OPEN; call this V.
If Goal(V) then output the reverse of the linked list:
V, PRED(V), PRED(PRED(V)), etc., and return.
Find all W such that ? V,W ? ? E. Call this set L.
Remove from L any elements already on OPEN or CLOSED.
For each of the remaining elements V’ of L, put into PRED: (V’, V)
and put V’ onto OPEN at the front of the list.
Output “No solution” and return.