Now it solves the general case -- when the cities and the connections
between them form an arbitrary graph. This solution tries not to get
into loops and therefore does not generate all solutions when there is a
loop (in this case there would be infinitely many solutions).
Now it solves the general case -- when the cities and the connections between them form an arbitrary graph. This solution tries not to get into loops and therefore does not generate all solutions when there is a loop (in this case there would be infinitely many solutions).