dado — "I actually tried to work out a trip just like this once, and discovered there are a lot of different paths you can take, but certain parts of the sequence are heavily constrained."Problems such as these are addressed in a branch of mathematics called Graph Theory. It has many real-world applications (such as determining optimal truck delivery routes) in the fields of Operations Research and Management Science. To try your hand at some simple tutorials from a prof at the University of Tennessee, see Graph Theory Tutorials.