Download as pdf
Download as pdf
You are on page 1of 10
——— CHAPTER FIVE 5 EULERIAN GRAPHS oo 5.1 Introduction Probably the oldest and best known ofall problems in graph theory is the problem of the seven Konigsberg bridges. “he Kénigsberg bridges problem. In the eighteenth century, the medieval city of KGnigsberg in Eastern Prussia contained a central island called Kneiphof, around hich the river Pregel flowed before dividing into two. ‘The four parts of the city Were interconnected by seven bridges, as shown in Figure 5.1. The legend says that it ni Ives by trying to find a route crossing each bridge exactly once, and returning to the starting point. Can this be done? ¢ ~ a | nag | Kneiphof D = Konigsberg aN Figure 5.1, The bridges of Kénigsberg. Dry as they might, the citizens of KGnigsberg could find no route crossing each bridge exactly once and returning to the starting point, and they all came to believe that such & route was not possible. However, it was not until Leonhard Euler [3] investigated the Problem that is was proved to be impossible. Although Euler's proof in 1736 was not written in the language of graphs, the ideas in it are essentially graph-thcoretical in natune Before proceeding further, we introduce the concept of a multigraph, Peknition. A muitigraph is a graph in which one allows more than one edge (but a finite number) to join pairs of vertices. 42 ‘We can now express the KGnigsberg bridges problem in terms of a multigraph by taking the four land areas as vertices and the seven bridges as edges joining the corresponding pairs of vertices. This gives the multigraph M shown in Figure 5.2. The Kénigaberg bridges problem is now reduced to determing whether this multigraph M has a trail that contains all its edges. Figure 5.2. The multigraph of the Kénigsberg bridges. We use Buler’s reasoning to show why such a trail does not exist in M. Suppose, to the contrary, that M contains such a trail T. Then T'can be represented by a sequence of ight letters (from {A, B,C, D}), in which each pair of consecutive letters in the sequence represents one edge. Since five bridges lead to region A, Euler observed that the letter hhas to appear at least three times - twice to indicate an entrance to and exit from land area Ay and once to denote either an entrance to 4 or exit from A. Similarly, since T accounts for all the edges of M, each of the letters B, C, and D must appear at least twice in the sequence, However, this means that at least nine letters are needed in the sequence, which Produces a contradiction. Thus our assumption that T' exists must have been falee. ‘The townfolk’s suspicion that no walk through K@nigsberg would traverse each bridge exactly once was therefore well-founded. —— ee 5.2 Eulerian graphs ‘The Kénigsberg bridges problem introduces us quite naturally to two new concepts, Recall that a circuit is a closed trail, and that in a closed trail the initial vertex is the same as the final vertex while in an open trail the initial vertex is different from the final vertex. Definitions. An eulerian cireuit of a connected (multi)graph G is a circuit of G that contains all the edges of @. A (multi)graph with an euletian circuit is called an eulerian (rulti)graph . An eulerian trial of a connected (multi)graph G is an open ‘rail of G that contains all the edges of G. The graph HT of Figure 5.3 is eulerian since it contains an euletian circuit (for example, Cia, 656, 6,d,¢, F.95 hy i,915, hye, 04ksf,5,€,,a). Note, however, that H does not contain an eulerian trail. The graph G of Figure 5.3 has an eulerian trail T: v,,w,2,v, 2,2, y, 2, but no eulerian circuit. 43, Figure 5.3. Graphs with eulerian trails and eulerian circuits, The rule that Euler presented (in different terminology) is: to test whether a given Ceanected (multijgraph is euleian, look at the degrees of the vertices: if they are all von then the graph is eulerian; if not, then the graph is not eulerian. That is, necessary condition for a graph to be eulerian is that every vertex has even degree. In Bvler's original Paper [8] he stated that this condition is also sufficient. However, the fist published proof of this result was given by Hierholzer [6] in 1873, Theorem 5-1 A connected maltigraph G is eulerian if and ony ifthe degree of every vertex is even. Proof If G has an eulerian cicuit then we can travel along that circuit, using each edge Sree and feturn to our original starting point v (say). Whenever we pass through « vertee OfG, there is a contribution of 2 toward the degree of that vertex - including the faitel Vertes vy since each of the initial and the final occurrences of v in the eiteuit contsibute 1 to the degree of v. Since each edge of G is used just once, the degree of each vertex ie she sum of a number of 2s - that is, an even number. Noxt we consider the sufficiency. Suppose that every vertex of G has even degree. We Proceed by induction on the size 9 of a (nontrivial) connected multigtaph in which every, wii pve. Ita 2, then the multigraph consists of two vertices joined by two edges, jth has an eulerian circuit. Assume that every nontrivial connected multigraph of sng less than q 2 3 and having only even vertices contains an euletian circuit, and let & be seca ‘a multigraph of size q. 1G has order 2, then the two vertices are joined by an even number (atleast 4) of edges, and G is eulerian. So we may assume that G’has ordet at least 3, otherwise there nothing Xf 21 is connected, then, by the inductive hypothesis, HT contains an eulerian cizuit C. ‘We can now find an eulerian circuit of G by replacing an edge uw on C by the deleted edges wv and ow. On the other hand, if 1 is disconnected, then H contains two components, namely a Be nena attaining w aad w and a (possibly trivial) component Hy containing, v- By the inductive hypothesis, Hy contains an eulerian circuit C, and, if Hy is nontrivie, ie Soutains an culetian circuit Cy. We can now find an eulesian circuit of G by replacing an ie tv on Cy by the deleted edge uv, then taking the eulerian circuit Cy (it existe) at v, and returning to w along the deleted edge vw. 0 44 A characterization of graphs containing eulerian trails can now be presented, Theorem 5.2 Let G be a nontrivial connected multigraph. ‘Then G eontaing an culerian trail if and only if G has exactly two vertices of add degree. Furthermore, the trail begins at ‘one of these odd vertices and terminates at the other. Let w and v be the starting and finishing rorces of the trail. If we add an edge ¢ joining the vertices u and u, we get an ealen® Fniseaeh in which, by Theorem 5.1, every vertex must have even degree, Itwe now resecce G by removing the edge e, we see that wand v are the only two vertices of ea degree, Conversely, suppose that G has exactly two odd vertices u and v. If we add an edge ¢ ining the vertices u and v, we get a connected multigraph in which every vertex ion Gren degree. By Theorem 5.1, this graph is eulerian, and must therefore possess am evlerins Gircuit. Removal of the edge ¢ from this circuit produces an open tral which inclndac every edge of G. Thus, G has an oulerian circuit. Furthermore, this trail begine at one of aoe and terminates at the other. O Xt followe from Theorem 5.1 and Theorem 5.2 that the multigraph of Figure 5:2 containe neither an eulerian trail nor an eulerian circuit, Exercises 5-1 In present day K@nigsberg (Kalingrad), there are two additional bridges, one between regions B and C, and one between regions B and D. Is it now possi to devise « ran over all bridges of Knigsberg without recrossing any of them? -2 Show how the citizens of Kénigsberg could have built two new bridges is such a way that they could have taken their tour and returned to thelr starting point, 5.3 For what positive integers n are the following graphs eulerian? @C. OKn (0) Kans 5:4 Decide whether each of the following graphs has an eulerian circuit, eulesian trail, or neither. ao SS 5.5 Show that if a multigraph @ has 2k vertices of odd degree, then the smallest number of continuous penstrokes needed to cover all the edges of G if. 45 5.3. Fleury’s algorithm Jn this section we consider an algorithm designed to produce eulerian circuits. ‘The di advantage of the proof of Theorem 4.1 is that itis not constructive, in the sense that it ict an eulerian curcuit in a given multigraph. One way of constructing an eulerian circuit is to use the following algorithm due to Fleury (see Leas (8) (which we state without proof). A proof of Fleury's algorithm may be found in BJ or (9). Algorithm 5.1 (Fleury) IfG is an eulerian graph, then the following steps can ahoays be carried out, and produce an eulerian curcuit in G: STEP 1. Choose a starting vertez 2. STEP 2. At each stage, traverse any available edge, choosing « bridge only if there is no alternative. STEP 3. After traversing cach edge, erase it (erasing any vertices of degree 0 which result), and then choose another available edge, STEP 4. Stop when there are no more edges, This algorithin is very easy to apply. At each stage, we choose a bridge only as a last Trent ike postponing of the use of bridges is really the critical feature ofthis algorithee “This feature is clearly essential, since once we have traversed a bridge, we cennot return to the part of the graph we have just left, Figure 5.4. Starting ot 2, we may choose the edge 2a, followed by ab, Erasing these edges (and the vertex a) gives us the graph shown in Figure 5.4(5). We cannot use the edge bs since itis & bridge, so we choose the edge be, followed by ed and db. Erasing these edges (and the Yertices ¢ and d) gives us the graph shown in Figure 5.4(c). Now there is n0 alternative - we have to traverse the bridge bz. Traversing the cycle 2,¢, f,z completes the eulerian cious ‘The circuit is therefore x, 0,6, ,,b,2,¢, f,z. 2 46 7 Exercises 5.6 Using Pleury’s algorithm, find an euleran circuit in the accompanying graph G. % % v6 5.4 The Chinese postman problem 2 famous problem in graph theory is the so-alled Chinese postman problem. (The word Chinese refers to the problem, not the postman! The problem was formulated iw 160 by Meigu Guan.) It may be stated as follows. The Chinese postman problem. A postman collects mail atthe post office, wishes to deliver the mail along all the streets in his area, and then return to the Post office, He must, of course, cover each street in his area at least once. How can tle sewer be of the walk.) Definition. For a connected weighted graph G, a closed walk that uses each edge at Teast once is called a tour of G. An optimal tour is a tour of minimum weight in G. Using this definition, the Chinese postman problem becomes: The Chinese postman problem. For a connected weighted graph G, find an optimal tour in G. i, the map of the postman’s area happens to correspond to an eulerian graph, then there +: no difficulty with this problem - the postman simply chooses an eulesian cireatt (using 47 Fleary’s algorithm), and such a ciruit will involve the smallest total ‘distance. What usually happens in practice, of course, is that the postman needs to visit sone Parts of the route ‘more than once, and wants to minimize the amount of reteacing, snow clearing routes in Zarich some years ago. Since snow-elesting equipment ¢ expensive to operate, it was necessary to arrange Possible. Other cities have initiated si streets. consider the particular case of a graph with just two vertices of odd degree, Suppose that G is a connected weighted graph with exactly two vertices w and v of odd Gesree. Let T be a tour of G. For each edge ¢ of G, let m(e) +1 be the sumbon of times 7 Braverses the edge ¢ (where we may have m(e) = 0). We now form anew graph G* from G ae follows: Let G be obtained from G by joining the ends ofthe edge « by m(e) new edges ci alght we) for each edge e of G with m(e) > 0, Now T may be trerwin ee into an culerian circuit T of Gv: ifan edge e needs to be traversed n tines by Tin G, then there these

You might also like