Its definition is a straightforward exercise in structural processing. Develop the function neighbors . If it finds a route from any of the neighbors, it produces a route from that neighbor to the final destination. But, if none of the neighbors is connected to the destination, the function produces false . The answer in this case must therefore be false .
Figure contains the complete definition of find-route .
If find-route indeed produces a route, that route is the answer. Otherwise, if find-route fails and produces false , the function recurs. A particularly good example is exercise , which concerns a backtracking function for family trees. The function first searches one branch of a family tree for a blue-eyed ancestor and, if this search produces false , it searches the other half of the tree. Since graphs generalize trees, comparing the two functions is an instructive exercise.