The method here is to work across the breadth of the tree, looking
at each of the alternatives in turn. When each has been explored,
then progress to the next level and work across the breadth of the
alternatives, and so on until there are no alternatives left.
The starting node is:
Stage Node Route so far
1 a a
We go to the next level and list the alternatives:
Stage Node Route so far
1.1 1 a -> 1
1.2
3 a
-> 3
1.3
6 a
-> 6
We go to the third level and list the alternatives:
Stage Node Route so far
1.1.1 2 a -> 1 -> 2
1.1.2
4 a
-> 1 -> 4
1.2.1
4 a
-> 3 -> 4
1.2.2
7 a
-> 3 -> 7
1.3.1
7 a
-> 6 -> 7
1.3.2
9 a
-> 6 -> 9
We go to the fourth level and list the alternatives:
Stage Node Route so far
1.1.1.1 5 a -> 1 -> 2 -> 5
1.1.2.1
5 a
-> 1 -> 4 -> 5
1.2.1.1
5 a
-> 3 -> 4 -> 5
1.2.2.1
8 a
-> 3 -> 7 -> 8
1.2.2.2
b a
-> 3 -> 7 -> b
1.3.1.1
8 a
-> 6 -> 7 -> 8
1.3.1.2
b a
-> 6 -> 7 -> b
1.3.2.1
b a
-> 6 -> 9 -> b
We go to the fifth level and list the alternatives:
Stage Node Route so far
1.1.1.1.1 8 a -> 1 -> 2 -> 5 -> 8
1.1.2.1.1
8 a
-> 1 -> 4 -> 5 -> 8
1.2.1.1.1
8 a
-> 3 -> 4 -> 5 -> 8
1.2.2.1.1
b a
-> 3 -> 7 -> 8 -> b
1.3.1.1.1
b a
-> 6 -> 7 -> 8 -> b
The sixth level is the final level:
Stage Node Route so far
1.1.1.1.1.1 b a -> 1 -> 2 -> 5 -> 8 -> b
1.1.2.1.1.1
b a
-> 1 -> 4 -> 5 -> 8
-> b
1.2.1.1.1.1
b a
-> 3 -> 4 -> 5 -> 8
-> b
Looking at the fourth level we can see that the shortest routes
are found first. We could decide to stop when we had found the first
solution (1.2.2.2) or to go on to found all possible solutions.
|