 So yesterday we started talking about walks and we went on trails and paths and today I want to extend that by just talking about an oiler's walk. Now remember walk is I just walk walk walk I can revisit nodes. I can revisit edges. It doesn't really doesn't really matter now There's this concept in again of a closed walk and that is just where the start and the end is Exactly the same node. So I can run from home run run run come back Can I stop at home again? That would be a walk or I can be dropped off somewhere Run and let Uber pick me up on the other side That would be a walk, but it's not closed because my start and end is not exactly the same So a walk remember as I mentioned revisit edges revisit Nodes an oilers walk is very special and that is where all the edges All the edges are used all of them and just once So I can't retrace I can't retrace now Let's stick to these closed ones so I can start and I can walk I can walk and I can walk and I'm back where I started So it's closed because I started an end of this all the edges were used and They were just used just once and there's a theorem that goes with this because look look at something very special that happened here What is the degree of this one? It's two It's two the degree of this one's two the degree of this one is two And so there's a theorem that states well first of all Let's just make sure that we're not talking this connected because I can have this this one and I can have This one so there's no ways to to use to start some way and get to that one So we are restricting ourselves to connected graphs. So if we have a connected graph and all the vertices all Right nodes Sometimes I like nodes more sometimes I like vertices more at the moment. I'm in kind of a nodes. I like nodes so if all the nodes have an even Even degree if all the nodes in a connected graph have an even degree then that is an oiler's walk I Mean if you think about it Just look at an isolated if I were to try and prove that if I look at an isolated if it's even it means any time I come in I can leave and I might go to others and then I might visit it again as long as I can leave again As long as I can leave again and as long as soon as I come in and it's odd I Can't leave I Can't leave so that's quite easy to see in that way around so if they all if they are all even all of them in a connected graph then I am going to be able to get an oiler's walk and Conversely an oiler's walk Will have all of the nodes have an even number of Edges so you can prove it both way around so in short that is an oiler's walk a very simple concept So here we are in Mathematica. Let's have a look at these Eulerian walks or Oiler Euler walk. I'm going to create a graph G and let's do one that we have on the head on the board so it's going to be a graph and Let's just do the undirected edge list here So one was connected to two and two was connected to three and What did we have two was connected to five and remember that's for these undirected edges It's escape you escape so two was connected to five and three was connected to four and Four was connected to five four was connected to five Close my list of edges there, and I want the vertex labels I want the name of those so there we have just slightly differently from what we had on the board But we have our graph there now. There's a function called called Eulerian graph q that's a question. I'm asking is graph g does it contain and Eulerian is this an Eulerian graph and you'll see it's falsely What Mathematica is doing here? It is looking at a closed walk It's looking can I find a closed walk not an open walk? And if it's only if it's closed will it fulfill this definition of an Eulerian graph? So it's a closed there must be a closed walk. So if I were just to try and find Eulerian cycle it's called here cycle because it's closed it starts and stops at the end So that's the keyword that Mathematica uses and we see I get back the empty set. There is nothing That would be that would be an Eulerian cycle a closed Eulerian walk in other words Let's make another graph. I'm also going to call a g So it's going to overwrite that part in the memory and put in a new object in this new object It's also going to be a graph and this time I'm going to go for complete graph in five nodes Let's make vertex labels the name once again, and there we go Now we can ask ourselves is this an Eulerian walk a closed Eulerian walk so I can say Eulerian Eulerian graph q and I just pass the argument g and it says to I can With this complete graph visit all of the edges only once let's find one of The possible ones and what mathematicians going to do if it finds more than one is this good to return the first one So I'm going to say find I'm going to say find Eulerian cycle in g for me, please and if we do that there's the first one it found so let's chase it out So it's one two five two four two three back to five to two to four to one and two three and To two and then back to one so it looks like yes We started and ended at one so this is a closed and we used all the edges and we only use them once And if we look at it, we see one two three four one two three four one two three four one two three four one two three four Indeed all my nodes have an order or a number of edges Which are even so we know that this was always going to be an Eulerian cycle Play around with some of these and have a look at these functions learn more about them