Royal Institution Masterclass in Mathematics – Problem sheet one: Finding Eulerian circuits Standard questions (30 minutes) Q1 For the following graph, G, determine whether the graph is Eulerian. If the graph is Eulerian trace a circuit (same start and end point) that starts and finishes at node x1, and which uses each edge exactly once. x7 x6 x2 x5 x4 x1 x3 Solution (indicative) A quick check of the graph shows that all nodes have even degree, so a Eulerian circuit does exist. There are a number of edge orderings that are possible, so one indicative solution is shown below (although your ordering may be different depending on which edge is chosen at each point): x1→x3→x4→x6→x3→x5→x4→x2→x5→x6→x7→x2→x1→x7→x5→x1 Q2 Can you put together a logical argument as to why the number of nodes with odd-degree has to be zero or two when determining whether a graph is Eulerian (hint: think about entrances and exits) Solution The answer is fairly simple, but requires a little thought – if we are looking to complete a circuit we must enter and exit the intermediate vertices the same number of times, otherwise I get stranded at that point. At either end point, I need to either enter the vertex one more time than I leave it, or vice versa, hence I can have at exactly two vertices where this takes place, or all vertices have even degree (as for the example above) otherwise I will not end up at the same end point (circuit). Q3 For the graph, G, below find a Eulerian circuit starting and ending at vertex x3 – trace this path and show your working out. x4 x3 x1 x6 x5 x7 x2 Solution (indicative) A quick check of the graph shows that all nodes have even degree, so a Eulerian circuit does exist. There are a number of edge orderings that are possible, so one indicative solution is shown below (although your ordering may be different depending on which edge is chosen at each point): x3→x1→x2→x7→x6→x3→x2→x6→x5→x4→x3 Q4 For the graph, G below, determine whether there is a Eulerian circuit – if one does not exist, show how the graph might be expanded (that is, additional edges added) to allow a Eulerian circuit to be found. x6 x5 x7 x3 x4 x2 x1 Solution It can be seen from the graph above that two vertices have odd degree – this means that the graph is Eulerian, but we cannot find a Eulerian circuit. In this case we could find a path starting at x5 and ending at x4. We can simple add in the dotted edge x5->x4 to make the Eulerian circuit: x5→x6→x7→x3→x6→x4→x5→x1→x2→x4→x5 Q5 If we now add directions to each of the edges, as shown in the graph below, find a Eulerian circuit – In a directed graph, there is a Eulerian circuit if the number of edges entering a node is the same as the number of edges leaving – trace out the circuit that you find – you are free to choose your start/end point, but remember that you are looking for a circuit. x2 x1 x3 x5 x4 x6 x7 Solution (indicative) I have chosen to start and end at vertex x1 – students may choose another start/end vertex, but as long as the circuit starts and ends at this vertex, and each edge is followed in the correct direction, then this is a valid solution: x1→x2→x3→x7→x6→x5→x1→x4→x6→x1 Additional questions (if you don’t finish these in class then you can do them at home) Q6 For the directed graph below, trace out a Eulerian circuit that begins and ends at x6 x2 x1 x5 x3 x4 x6 Solution (indicative) The starting point is vertex x5 – students may choose different edge selections at each point, but as the circuit starts and ends at this vertex, and each edge is followed in the correct direction, then this is a valid solution: x5→x2→x1→x6→x3→x5→x4→x3→x1→x5 Q7 Can you turn the method that you have been using in the questions above into an algorithm (set of written steps) that someone can follow in order to find a Eulerian circuit? (You can gain help from the adults in the room). Try and write out your method and then use it on one of the questions above to test the correctness. Solution (outline) There is no single ‘correct’ method. However, the initial test should assess the degress of the nodes, checking whether there are zero, or two, nodes with odd degree. If the answer to this is no, then the graph cannot be Eulerian. If the graph passes this test then it is a case of traversing the edges of the graph, at each point choosing an edge, checking whether it has already been visited (in which case choose another). At each point we change the edge to being visited, and add it to the set of edges that have been visited, and choose the edge point of the current edge to be the start point for the next edge. We check before adding an edge whether the set of edges visited is exactly the same as the number of edges in the graph, if so our job should be done, and we should have found our Eulerian circuit. This is a challenging question – and help (and a Raspberry Pi) will be on hand to help students who reach this question to develop their algorithm.