Introduction
The very basics
Infinite looping
Processing trees with recursive CTEs
Processing graphs with recursive ctes
27. Graphs – real life examples
Summary

Instruction

Great! 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 visit each city, starting from London.

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 include all cities. Run the template, look at the results, and don't worry about the details now.