There are 640 different routes. A general formula for puzzles of this
kind is not practicable. We have obviously only to consider the
variations of route between B and E. Here there are nine sections or
"lines," but it is impossible for a train, under the conditions, to
traverse more than seven of these lines in any route. In the following
table by "directions" is meant the order of stations irrespective of
"routes." Thus, the "direction" BCDE gives nine "routes," because there
are three ways of getting from B to C, and three ways of getting from D
to E. But the "direction" BDCE admits of no variation; therefore yields
only one route.
2 two-line directions of 3 routes -- 6
1 three-line " " 1 " -- 1
1 " " " 9 " -- 9
2 four-line " " 6 " -- 12
2 " " " 18 " -- 36
6 five-line " " 6 " -- 36
2 " " " 18 " -- 36
2 six-line " " 36 " -- 72
12 seven-line " " 36 " -- 432
----
Total 640
We thus see that there are just 640 different routes in all, which is the
correct answer to the puzzle.