Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Introduction
The very basics
Infinite looping
Processing graphs with recursive CTE
25. Graphs - real life example
Summary

Instruction

Very well! Since you already know the table, you can tackle this exercise.

Let's say we have a salesman who needs to travel between certain cities in the UK, as shown in the picture below.

recursion

There are 6 cities and multiple connections between them, some of which are shown in the picture. The salesman needs to travel starting from London, and visit each city.

Exercise

Our salesman starts his journey in London and then wants to visit each city. In which direction should he go? In which city should he finish his journey? Let's help him by calculating the shortest path that will visit all cities. Run the template, see the results and don't worry about the details now.