START
and another
as the FINISH
.
The task is to find a route from START
to FINISH
.
Write pseudo-code for an algorithm to implement this.
Assume that you can `paint' selected roads and villages whatever colour
you like, and that you can loop over all villages or over the roads
out of a particular village -- exactly how this is to be done in C or
QBasic or whatever will depend on details of how the network is
represented within the computer.
You can assume that it will be enough to paint the route a particular
colour [`When this terminates, you get from START
to
FINISH
by following the yellow brick road'].
There may not be any such route, or there may be lots of valid routes.
Brownie points: Estimate the efficiency of your algorithm. [A maze constructor and solver is one of the standard screensavers on some of the PCs -- if you watch very quickly you can see how it's done.]
More brownie points: Show that the associated decision problem [`Does this network possess a route ...'] is in NP.