Algorithm
The steps of generic search on \(G = (V, E)\), given
- a starting vertex \(v_1 \in V\) and
- a goal predicate \(g : (v_1, \ldots, v_k) \to \mathbb{B}\)
are:
- start with the frontier \(F = \{(v_1)\}\) and seen vertices \(S = \{v_1\}\)
- if \(|F| = 0\), return empty-handed (\(\bot\))
- remove some path \(p = (v_1, \ldots, v_k)\) from \(F\)
- when the goal predicate \(g(p)\) is true , return \(p\) as the solution
- select \(N = \{(v_1, v_2, \ldots, v_k, v^*) : v^* \notin S \land (v_k, v^*) \in E\}\)
- for each \(n \in N\), insert \(n\) to \(F\)
- for each \((v_1, v_2, \ldots, v_k, v^*) \in N\), insert \(v^*\) to \(S\)
- go to step 2.