We present high-level, generic, functional versions of three well known graph search algorithms; namely depth first, breadth first and best first search. We show how functional programming techniques can be employed to maximise reusability without compromising the conciseness, elegance or readability of their implementation. We demonstrate how all three search algorithms can be defined as instances of a more general scheme, and how this generalisation provides insights into new possibilities for search algorithms.
展开▼