 Today's lecture we will study Euler graphs and Hamiltonian graphs first Euler graphs if some closed walk in a graph contains all the edges of the graph then the walk is called an Euler line the graph is called an Euler graph now here we have to remember that the way we define walk it means that the vertices can be repeated but edges cannot be repeated so essentially I need a I need to traverse on the graph in such a way that I start from one point and come back to that same point so I have got a closed walk and in between I can come to a vertex more than once but I cannot repeat edges for example if I have a graph like this then of course it is a Euler graph because I can start from this point and then come back and come back over here I can attach another circuit over here and the complete thing is again a Euler graph because I can start let us say from this vertex come like this then move like this then move like this move like this move like this this and this so I get a closed walk which covers all the edges now there is one question that by looking at a graph can I quickly determine whether it is a it is an Euler graph or not the answer is surprisingly easy and it was proved by Euler who lived from 1707 to 1783 so Euler 1707 to 1783 prove the following a given connected graph G is an Euler graph if and only if vertices of G of even degree now the question is why now I will only give a sketch of the proof now let us suppose that I have an Euler graph let us suppose a graph like what we have seen before so what happens there is that I start from a vertex and then go to another vertex when I come to this vertex since it is an Euler graph I must be able to get out of it to another vertex from this also I should be able to get out of it and then like this so whenever I am entering a vertex I must have I must be able to get out of it through another edge and ultimately I come back to the original edge so in the original edge I go out like this wherever I come in I get out through another edge so always the edges are coming in pairs and eventually I am coming back to the original vertex this is why if I have an Euler graph then each vertex has to be has to have a even number as its degree now the connectedness is also assumed because of course otherwise I can have some isolated points but I am not considering that I am just considering connected graphs the question is that whether it is true in the converse direction that means suppose I have a graph with each element sorry each vertex have an having even degree will it be an Euler graph the answer is yes and the proof goes like this that suppose I start from a start from a vertex of that of a graph whose degrees are even so then I can always move out to another vertex let us say from V1 to V2 and from V2 I can move to another vertex let us say V3 because whenever I get in I will always have a different edge to get out because the vertices are of even degree and in this way if I start moving around then eventually I will come to V1 now the question is that whether I have covered all the edges now if I have covered all the edges then already I have got an Euler line but suppose I have not covered all the edges that means there are some edges left and there are so I have to search here some vertex where the degree is more than one suppose sorry more than two so suppose in the vertex V3 the degree is more than two that means there are some other edges coming out of it what I can do is that I can cut this graph out and start from V3 again and start traversing the graph I will do that and eventually I will come to V3 again I ask the same question suppose I have covered all the edges then then I have got an Euler line because I can go like this up to V3 and take this route and then like this move like this this and come back and if it if it if it does not cover all the edges then there will be somewhere in one of the in one of the vertices which has got degree more than two I can again start from that vertex and cover so in this way I can construct a Euler line therefore we have got a very nice characterization of Euler graphs a graph G is an Euler graph if and only if all vertices of G are of event degree this theorem has a very famous application which is called Konigsberg bridge problem and in fact Euler developed this theorem to solve Konigsberg bridge problem and in the process wrote the first paper in graph theory two islands C and D formed by the Pregel river in Konigsberg where connected each other the banks a and b by seven bridges so we draw the configuration we got a river flowing across a river across a city Konigsberg and the city is developed on both sides of the river and there are two islands so the banks are a and b which I shade over here and two islands C and D which are also shaded the islands are connected by bridges and there are some bridges connecting the banks to the islands so these are the bridges now the question is whether one can start from one of the banks or islands and traverse through the bridges traverse through each of the bridges exactly once and come back to the same point now people before Euler we are trying to solve this problem and did not get an answer what Euler proved is that this scenario can be mapped to a graph theoretic problem and then by the theorem that he proved the theorem that we saw just now it is absolutely clear that you cannot have an Euler line and hence it is not possible to traverse through all the bridges exactly once and come back to the same point now if we want to transform this problem to a graph theoretic problem then we get something like this the vertices are labeled as A, B, C, D corresponding to the land masses and the bridges by the edges so A to C there is one bridge and this is the second bridge C to B there is one bridge and this is the second bridge A to D we have got one bridge and B to D there is one bridge and there is a bridge connecting C to D what we see here is a degree of A is 3 degree of D is also 3 and so on so of course all the vertices are not of even degree so no question of getting an Euler line and therefore no question of being able to traverse each bridge exactly once starting from one of the land masses and coming back to the same land mass now as a consequence of the first theorem there is another theorem which I state without a proof it states that a connected graph G is an Euler graph if and only if can be decomposed into circuits so this is again another result which is more or less obvious so I leave it to you for proofs now as we have seen that this problem of whether a graph is an Euler graph or not has got a very concrete and definite answer there is another problem which is which sounds similar but which has been elusive from the beginning till now for that we come to the idea of Hamiltonian paths and circuits a circuit in a graph G is said to be Hamiltonian if it includes every vertex of G alternatively a Hamiltonian circuit in a connected graph is defined as a closed walk that traverses every vertex of G exactly once now what is a Hamiltonian path Hamiltonian path is an open walk in a graph G which traverses every vertex of G exactly once now if a graph has a Hamiltonian circuit then we will call that graph a Hamiltonian graph if a graph a Hamiltonian circuit then we will call it a Hamiltonian graph now let us look at some examples of Hamiltonian graph if we have a cycle like this of course this is a Hamiltonian graph because I can move like this this and this and come back so it is I have moved through all the vertices exactly once and come back to the same vertex now if I have something like this then it is not a Hamiltonian graph because let us say if I start from here I can come here here and I can come back over here but if I go from here to somewhere over here then I can never come back I can try from so whenever I reach over here I have no way that is here I have no way of going anywhere except for repeating one vertex so I do not have a Hamiltonian path sorry I do not have a Hamiltonian circuit but see I have a I have a Hamiltonian path because I can always start from here come here then traverse like this and traverse like this so I can traverse all the vertices exactly once so I have a by an open path so I have a I have a Hamiltonian path but I do not have a Hamiltonian circuit now there are some graphs for which we know that there are Hamiltonian circuits one famous graph is called a complete graph a simple graph in which there exists an edge between every pair of vertices is called a complete graph a complete graph with n vertices is denoted by k sub n a complete graph with n vertices is denoted by k sub n so well if we have K2 K2 is simply this K3 is simply a cycle and K4 is a graph like this now we can ask a question that what is the number of edges in a complete graph now the answer goes like this that if I have a complete graph then I can choose any two distinct vertices and I am sure to have an edge between those two vertices and a single edge because after all the graph is a simple graph therefore the number of edges is exactly equal to number of ways I can choose two objects from n objects which is n choose two and which is equal to n into n-1 divided by 2 so I can write that the total number of edges in a complete graph is n into n-1 divided by 2 now we will also note that a complete graph is Hamiltonian the reason is that I can always start from any vertex let us say I start from 1 and then I go to 2 and from 2 I will always be able to go to 3 because 2 3 are connected and like that I can keep on going up to n supposing that the complete graph is with n vertices and I have labeled the vertices from 1 to n and then from n I will always be able to come back to 1 so for example if we take K4 given above so here this is 1 and then suppose this is 2 then suppose this is 3 and from 3 I can always go to 4 this is 4 and I can always come back to 1 so thus it is complete and this works for any this works for any complete graph so the one Hamiltonian path is 1 2 3 4 5 and like that up to n and then n connected to 1 so I can ask a question now that how many edge disjoint Hamiltonian paths are there in a complete graph and we have a definite answer to that which is as follows so for n odd and n greater than or equal to 3 for a complete graph with n vertices we have got exactly n-1 divided by 2 edge disjoint Hamiltonian circuits now the question is how do we prove it if we think in this way that a Hamiltonian circuit in a graph with n vertices will have n edges a Hamiltonian circuit in a graph in a complete graph or basically in any graph in a graph with n vertices has n edges now I am looking for the number of edge disjoint Hamiltonian circuits in a complete graph a complete graph as we have already seen as n x n-1 divided by 2 many edges a complete graph with n vertices has n x n-1 divided by 2 many edges therefore since we are looking for edge disjoint Hamiltonian circuits the maximum number of edge disjoint Hamiltonian circuits that a complete graph with n vertices can have is n x n-1 divided by 2 the whole thing divided by n so the maximum number of edge disjoint Hamiltonian circuits in a complete graph is 1 by n x n n-1 divided by 2 so n by 2 n-1 by 2 now so we know the maximum number possible and our result says that that is exactly the number of distinct edge disjoint Hamiltonian circuits now how do we prove that and we take a way of writing the graph we start from 1 go to 2 from 2 we will go to 3 and from 3 we will come back to 4 then we will move to 5 and then we will move to 6 from 6 I will go to 7 from 7 to 8 from 8 to 9 and 9 I will go back to 1 and these vertices can be thought of being on a circle so we get a Hamiltonian circuit as 1 to 2 2 to 3 3 to 5 sorry 3 to 4 4 to 5 then 5 to 6 6 to 7 7 to 8 8 to 9 and 9 to 1 and what we will observe that instead of going from 1 to 2 if I go from rotate this whole thing and go from 1 to 3 and do similar things then we will get another Hamiltonian circuit and maximum number of times I can do is 1 2 3 4 in this case so I can get 4 distinct Hamiltonian circuits and that is the maximum number of circuits possible because 4 is equal to 9-1 by 2 in general if n is odd then this number will be n-1 by 2 and by writing the vertices in such a way we can show that we can get all the n-1 by 2 many distinct that is Hamiltonian circuits now we end today's lecture by stating one sufficient condition for a graph to be a Hamiltonian graph a sufficient condition for a simple graph to have a Hamiltonian circuit is that the degree of every vertex in G be at least n by 2 when n is the number of vertices of G now this was proved by Dirac in a paper entitled connectivity theorem for graphs published in quarterly Journal of Maths series 2 volume 3 1952 171 to 174 now a word of question this is a sufficient condition we know that if a graph has this property then definitely it will have a Hamiltonian path but there are graphs sorry if a graph has this property then definitely it will have a Hamiltonian circuit but there are graphs which are Hamiltonian that is which have Hamiltonian circuits but which do not satisfy this property this is the end of today's lecture thank you