Early in the 18th century, the East Prussian city of K¨onigsberg (now called Kaliningrad and located in Russia) occupied both banks of the River Pregel and the island of Kneiphof, lying in the river at a point where it branches into two parts. There were seven bridges that spanned various sections of the river.
(See Figure 3.1.)
The K¨ onigsberg Bridge Problem
A popular puzzle, called theK¨onigsberg Bridge Problem, asked whether there was a route that crossed each of these bridges exactly once. Although such a route was long thought to be impossible, the first mathematical verification of this was presented by the famed mathematician Leonhard Euler (1707–1783) at the Petersburg Academy on 26 August 1735. Euler’s proof was contained in a
108 CHAPTER 3. EULERIAN AND HAMILTONIAN GRAPHS paper [76] that would turn out to be the beginning of graph theory. This paper appeared in the 1736 volume of the proceedings of the Petersburg Academy.
Euler’s paper, written in Latin, started as follows (translated into English):
In addition to that branch of geometry which is concerned with mag- nitudes, and which has always received the greatest attention, there is another branch, previously almost unknown, which Leibniz first mentioned, calling it the geometry of position. This branch is con- cerned only with the determination of position and its properties; it does not involve measurements, nor calculations made with them.
It has not yet been satisfactorily determined what kind of problems are relevant to this geometry of position, or what methods should be used in solving them. Hence, when a problem was recently men- tioned, which seemed geometrical but was so constructed that it did not require the measurement of distances, nor did calculation help at all, I had no doubt that it was concerned with the geometry of position – especially as its solution involved only position, and no calculation was of any use. I have therefore decided to give here the method which I have found for solving this kind of problem, as an example of the geometry of position.
Euler denoted the island Kneiphof in K¨onigsberg by the letter A and the other three land regions by B, C and D. The seven bridges that crossed the River Pregel were denoted bya,b,c,d,e,f andg (see Figure 3.1).
pppppppppppp pppppppppppp ppppppppppppp pppppppppppppp p
pppppppppppp pppppppppppp ppppppppppppp ppppppppppppp pppppppp
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
ppppppppppppppp pppppppppppppppppp pppppppppppppppp ppppppppppppppp ppppppppppppppp
.. .. . .. . .. .. .
pppppppppppppppppp .
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppp pppppppppppppppppppppp
...................
pppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
..
.................................................................................... ..............................................................................................................................................................................................................................
. . .. . .
................................................................................................................................................................................................................................................................................................................................................................
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppp
pppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppppp pppppppppppppppppp
.. . ......................................................................
....................
ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp....pppppppppppp......................................................... ... ................................................
. . . .
........................................................................ ...... ......................................................................... .. .. . .. . .. .
.....................................................................................................................................
.. .. .................
.........................................................................................................
.................................................................................................................................................................................................................
ppppppppppppppppppppppppppppppppppppppppppp pppppppppppp ppppppppppppppppppppppppppppppppppppppppppp
pppppppp
........ .............................................................
...............................................................................................................................................................................
..................................................................... ..
........................................................................
. . ....................................................................................................
a c
b e
B d g
A D
C
f
Figure 3.1: The bridges of K¨onigsberg
In his paper, Euler describes what must occur if there was a route that crossed each of the seven bridges exactly once. Such a route could be represented as a sequence of letters, each term of which is one of the letters A, B, C and D.
A particular term in this sequence would indicate that the route had reached that land region and the term immediately following it would indicate the land region to which the route had progressed after crossing a bridge. Since there are seven bridges, the sequence must consist of eight terms.
Because there are five bridges leading into (or out of) land region A (the island Kneiphof), each occurrence of A must indicate that either the route began at A, ended at A or had progressed to and then exited from A. Thus A must appear three times in the sequence. In a similar manner, each of B, C and D must appear twice in the sequence. However, this implies that such a sequence contains nine terms, which is impossible. Therefore, there is no route in K¨onigsberg that crosses each bridge exactly once.
As Euler mentioned in his paper, he also formulated a more general problem.
In order to describe and present a solution to the general problem, we turn to the modern-day approach in which both the K¨onigsberg Bridge Problem and its generalization are described in terms of graphs.
LetGbe a nontrivial connected graph. A circuitCofGthat contains every edge ofG(necessarily exactly once) is anEulerian circuit, while an open trail that contains every edge ofGis anEulerian trail. (Some refer to an Eulerian circuit as anEuler tour.) The graph G1 of Figure 3.2 contains an Eulerian trail while G2 contains an Eulerian circuit.
. .. . .. . . . .. . . . .. .. .. .. . ....
. .. . .. . . . .. . . . .. .. .. .. .
.... ...........................
.. .. .. . . .. . .. . .. .. .. .. .
...... ............................ .
.. . .. . . . . . . . . .. .. .. . ......
. .. .. .. . . . . . . .. .. .. .. . ....... .. .. .. . . .. . .. . .. .. .. .. . .....
.. .. .. .. . . . . .. .. . .. . .......
.. . .. .. . . . . . . .. .. .. ..
........ ............................. .. . . .. .. . . . . .. . .. .. . .. ......
.. .. .. . . .. .. . . .. .. .. . .. ....
.. .. . . .. . . . . .. . .. .. .. . ....
. .. .. .. . . . . . . . .. .. .. .........
.. .. .. . .. . . .. . .. .. .. .......
.. . .. .. . . . . . . .. .. .. .. ....... . .. .. .. . . . . . . .. . .. . .. ........ ................................................... ....................
....................................................................................................
....................
............ ........................................................... ................... .
.. ..................................................
. .. .. .. . .. .. .. . .. .. .. . .. .. .. . .. .. .. .. . .. .. .. . .. .. .. . .. ......................................................................................................................
. ...................................................................................................... . .. . .. .. .. .. . .. .. . .. .. .. . .. .. .. . .. .. . .. .. .. . .. .. .. . .. .. .. . .. .. . .. .. .. .. . .. .. . .. .. . .. .. .. .. . .. .. .. . .. .
. ...............................................
............................................ ......
......
. ................................................................. ......................
G1: G2:
Figure 3.2: Graphs with Eulerian trails and Eulerian circuits
These terms are defined in exactly the same way if Gis a nontrivial con- nected multigraph. In fact, the map of K¨onigsberg in Figure 3.1 can be rep- resented by the multigraph shown in Figure 3.3. Then the K¨onigsberg Bridge Problem can be reformulated as follows:
Does the multigraph shown in Figure 3.3 contain either an Eulerian circuit or an Eulerian trail?
As Euler showed (although not using this terminology, of course, nor even graphs), the answer to this question isno.
Characterizations of Eulerian Graphs
A connected graphGis calledEulerian ifGcontains an Eulerian circuit.
Thus the graphG2of Figure 3.2 is Eulerian. Simple but useful characterizations of both Eulerian graphs and graphs with Eulerian trails exist; in fact, in each case the characterization is attributed to Euler [76].
Theorem 3.1 A nontrivial connected graphGis Eulerian if and only if every vertex of Ghas even degree.
110 CHAPTER 3. EULERIAN AND HAMILTONIAN GRAPHS
. . .. . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .. . . . . . . . . . .. . . . . . . .. . . . .. . . . .. . . . .. . . .. . . .. . .. . .. . .. . .. . .. . .. . .. .. . .. .. . .. .. .. .. . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . .. .. .. .. . .. .. .. . .. .. . . .. ........................................................
.............
. .. .. .. . . . . . . .. .. .. ........
.. .. .. .. . . . . .. . .. .. . .. ......
. .. .. .. . . . . . . .. . .. . .. ........
. .. .. .. . . . . . . .. . .. . .. .. ....
................
....... .........
............................................................................................................................. .............
........ ........
...... ...............................................................................................................................................
A
C
D
B a
b c
d e
f g
Figure 3.3: The multigraph of K¨onigsberg
Proof. Assume first thatGis an Eulerian graph. ThenGcontains an Eulerian circuitC. Letvbe a vertex ofG. Suppose first thatvis not the initial vertex of C(and thus not the terminal vertex ofCeither). Since each occurrence ofv in Cindicates thatv is both entered and exited onCand produces a contribution of 2 to the degree of v, the degree of v is even. Next, suppose thatv is the initial and terminal vertex of C. As the initial vertex ofC, this represents a contribution of 1 to the degree of v. There is also a contribution of 1 to the degree ofvbecausevis the terminal vertex ofCas well. Every other occurrence ofv onC again represents a contribution of 2 to the degree ofv. Here toov is even.
We now turn to the converse. Let G be a nontrivial connected graph in which every vertex is even. Let u be a vertex ofG. First, we show that G contains a u−u circuit. Construct a trail T beginning at u that contains a maximum number of edges of G. We claim that T is, in fact, a circuit; for suppose thatT is au−v trail, where v6=u. Then there is an odd number of edges incident with v and belonging toT. Since the degree of v in Gis even, there is at least one edge incident withv that does not belong to T. Suppose that vw is such an edge. However then, T followed by w produces a trailT′ with initial vertexucontaining more edges than T, which is impossible. Thus T is a circuit with initial and terminal vertexu. We now denoteT byC.
IfCis an Eulerian circuit ofG, then the proof is complete. Hence we may assume that C does not contain all edges ofG. Since Gis connected, there is a vertex xonC that is incident with an edge that does not belong to C. Let H =G−E(C). Since every vertex on C is incident with an even number of edges onC, it follows that every vertex ofH is even. LetH′ be the component ofH containingx. Consequently, every vertex ofH′ has positive even degree.
By the same argument as before, H′ contains a circuit C′ with initial and terminal vertexx. By insertingC′at some occurrence ofxinC, au−ucircuit C′′ inGis produced having more edges thanC. This is a contradiction.
A characterization of connected graphs containing an Eulerian trail is also due to Euler.
Theorem 3.2 A connected graph G contains an Eulerian trail if and only if
exactly two vertices of Ghave odd degree. Furthermore, each Eulerian trail of Gbegins at one of these odd vertices and ends at the other.
Proof. IfGcontains an Eulerian trailu−vtrailT, then we construct a new connected graphH fromGby adding a new vertexwof degree 2 and joining it to uandv. Then T together with the two edgesuwand wv form an Eulerian circuit inH. By Theorem 3.1, every vertex ofH is even and so only uandv have odd degrees inG=H−w.
For the converse, letGbe a connected graph containing exactly two vertices uandv of odd degree. We show thatGcontains an Eulerian trailT, whereT is either au−v trail or av−utrail. Add a new vertexwof degree 2 toGand join it to uandv, calling the resulting graphH. Therefore,H is a connected graph all of whose vertices are even. By Theorem 3.1,H is an Eulerian graph containing an Eulerian circuit C. The circuit C necessarily containsuw and wv as consecutive edges. Deleting wfrom C results in an Eulerian trail ofG that begins atuor v and terminates at the other.
In the next-to-last paragraph of Euler’s paper, Euler wrote (again an English translation):
So whatever arrangement may be proposed, one can easily determine whether or not a journey can be made, crossing each bridge once, by the following rules:
If there are more than two areas to which an odd number of bridges lead, then such a journey is impossible.
If, however, the number of bridges is odd for exactly two areas, then the journey is possible if it starts in either of these areas.
If, finally, there are no areas to which an odd number of bridges lead, then the required journey can be accomplished from any starting point.
With these rules, the given problem can also be solved.
Euler ended his paper by writing:
When it has been determined that such a journey can be made, one still has to find how it should be arranged. For this I use the following rule: let those pairs of bridges which lead from one area to another be mentally removed, thereby considerably reducing the number of bridges; it is then an easy task to construct the required route across the remaining bridges, and the bridges which have been removed will not significantly alter the route found, as will become clear after a little thought. I do not therefore think it worthwhile to give any further details concerning the finding of the routes.
Consequently, in Euler’s paper, he actually only verified that every vertex being even is a necessary condition for a connected graph to be Eulerian and
112 CHAPTER 3. EULERIAN AND HAMILTONIAN GRAPHS that exactly two vertices being odd is a necessary condition for a connected graph to contain an Eulerian trail. Euler did not show that these are sufficient conditions. The first proof that these are also sufficient conditions would not be published for another 137 years, in an 1873 paper authored by Carl Hierholzer [118]. Hierholzer received his Ph.D. in 1870 and died in 1871. Thus his paper was published two years after his death. He had told colleagues of what he had done but died before he could write a paper containing this work. His colleagues wrote the paper on his behalf and had it published for him.
Theorems 3.1 and 3.2 hold for multigraphs as well as graphs. By these theorems then, the multigraph of Figure 3.3 contains neither an Eulerian trail nor an Eulerian circuit.
As we have now seen, if G is a nontrivial connected graph with no odd vertices, then G contains an Eulerian circuit. If G contains exactly two odd vertices, then Gcontains an Eulerian trail. If G contains more than two odd vertices, thenGcontains neither an Eulerian circuit nor an Eulerian trail. How- ever, the following result by Gary Chartrand, Albert D. Polimeni and M. James Stewart [38] shows that every connected graph with odd vertices must contain a certain number of trails of a certain type and of certain lengths.
Thedistance between two subgraphs F and H in a connected graph Gis min{d(u, v) :u∈V(F), v∈V(H)}.
Theorem 3.3 IfGis a connected graph containing2kodd vertices(k≥1), thenGcontainskpairwise edge-disjoint open trails connecting odd vertices and such that every edge of Glies on one of these trails and at most one of these trails has odd length.
Proof. Lety1, y2, . . . , yk andz1, z2, . . . , zk be the odd vertices ofG. We con- struct a new graphH fromGby addingknew verticesx1, x2, . . . , xk toGand joining xi to yi and zi for i = 1,2, . . . , k. Thus H is Eulerian and therefore contains an Eulerian circuit C. Since yixi and xizi are consecutive onC for i= 1,2, . . . , k, deleting the kvertices xi (1≤i≤k) fromH results in kpair- wise edge-disjoint trails inGconnecting odd vertices such that every edge ofG lies on one of these trails.
It remains to show that there arek such trails, at most one of which has odd length. Assume, to the contrary, that in any collection ofkpairwise edge- disjoint trails ofGconnecting odd vertices and such that every edge ofGlies on one of these trails, there are at least two trails of odd length. Among all such collections ofktrails, consider those collections containing a minimum number of trails of odd length; and, among those, consider one, say {T1, T2, . . . , Tk}, where the distance between some pair of trails of odd length is minimum. If two trailsTa andTb of odd length have a vertex in common, then they may be replaced by two trails Ta∗ and Tb∗ of even length connecting odd vertices such that
E(Ta)∪E(Tb) =E(Ta∗)∪E(Tb∗).
Otherwise, letTrandTsbe two trails of odd length where the distance between TrandTsattains this minimum distance. Suppose thatPis a path of minimum length connecting a vertexwr in Tr and a vertexwsin Ts, and letwrxbe the edge ofPincident withwr. Thenwrxbelongs to a trailTpamongT1, T2, . . . , Tk. Necessarily, Tp has even length. However, Tr and Tp have the vertex wr in common. So Tr and Tp may be replaced by trails Tr′ and Tp′ connecting odd vertices such thatTr′ has even length,Tp′ has odd length,
E(Tr)∪E(Tp) =E(Tr′)∪E(Tp′)
and wrxbelongs toTp′. Since the distance betweenTp′ andTs is less than the distance betweenTrandTs, this is a contradiction.
Eulerian graphs have several useful characterizations. We present two of these, the first of which is due to Oswald Veblen [226]. Veblen’s result charac- terizes Eulerian graphs in terms of their cycle structure.
Theorem 3.4 A nontrivial connected graph G is Eulerian if and only if G contains pairwise edge-disjoint cycles such that every edge of Glies on one of these cycles.
Proof. First suppose that G is Eulerian. We proceed by induction on the size mof G. Ifm= 3, thenG=K3 has the desired property. Assume, then, that every Eulerian graph of size less thanm, wherem≥4, contains pairwise edge-disjoint cycles such that every edge of the graph lies on one of these cycles.
LetG be an Eulerian graph of sizem. Since Gis Eulerian, every vertex ofG has even degree. ThusGis not a tree and soGcontains at least one cycleC. If G=Cm, then the proof is complete. Otherwise, there are edges ofGnot inC.
Removing the edges ofC fromGproduces a graphG′ in which every vertex is even. Thus each nontrivial component ofG′ is Eulerian and has fewer thanm edges. By the induction hypothesis, each nontrivial component ofG′ contains pairwise edge-disjoint cycles such that every edge of this component lies on one of these cycles. Now all of these cycles of the components ofG′, together with C, give the desired result.
For the converse, suppose thatGcontains pairwise edge-disjoint cycles such that every edge of Glies on one of these cycles. Then every vertexGis even and soGis Eulerian by Theorem 3.1.
The next characterization of Eulerian graphs also involves cycles. The ne- cessity of this result is due to Shunichi Toida [218] and the sufficiency to Terry A. McKee [156].
Theorem 3.5 A nontrivial connected graphGis Eulerian if and only if every edge ofG lies on an odd number of cycles inG.
Proof. First, let G be an Eulerian graph and lete = uv be an edge of G.
ThenG−eis connected. Consider the set of allu−vtrails for whichvappears
114 CHAPTER 3. EULERIAN AND HAMILTONIAN GRAPHS exactly once, namely as the terminal vertex. There is an odd number of edges possible for the initial edge of such a trail. Once the initial edge has been chosen and the trail has then proceeded to the next vertex, sayw, then again there is an odd number of choices for the edges that are incident with wbut different from uw. We continue this process until we arrive at vertexv. At each vertex different fromv in such a trail, there is an odd number of edges available for a continuation of the trail. Hence there is an odd number of these trails.
Suppose thatT1 is a u−v trail that is not a u−v path and T1 contains v only once. Then some vertexv1 (6=v) occurs at least twice onT1, implying that T1 contains a v1−v1 circuit, say C = (v1, v2, . . . , vk, v1). Hence, there exists au−vtrailT2identical toT1except thatC is replaced by the “reverse”
circuit C′ = (v1, vk, vk−1, . . . , v2, v1). This implies that the u−v trails that are notu−v paths occur in pairs. Therefore, there is an even number of such u−vtrails that are notu−vpaths and, consequently, there is an odd number ofu−vpaths in G−e. This, in turn, implies that there is an odd number of cycles containinge.
For the converse, suppose thatGis a nontrivial connected graph that is not Eulerian. We show that some edge ofG lies on an even number of cycles in G. IfGcontains a bridgef, then f lies on no cycles. So we may assume that G contains no bridges. SinceGis not Eulerian, Gcontains a vertex v of odd degree. For each edge eincident with v, denote by c(e) the number of cycles ofGcontaininge. Since each such cycle contains two edges incident withv, it follows that the sumPc(e), taken over all edgeseincident withv, equals twice the number of cycles containingv. Because there is an odd number of terms in this sum, somec(e) is even.
Exercises for Section 3.1
1. In present-day K¨onigsberg (Kaliningrad), there are two additional bridges, one between regions B and C and one between regions B and D. Is it now possible to devise a route over all bridges of K¨onigsberg without recrossing any of them?
2. In Euler’s solution of the K¨onigsberg Bridge Problem, he observed that if there was a route that crossed each bridge exactly once, then this route could be represented by a sequence of eight letters, each of which is one of the four land regions A, B, C and D shown in Figure 3.1. Show that it is impossible for any of these letters to appear only among the mid- dle six terms of the sequence. What conclusion can be made from this observation?
3. LetF andH be two disjoint connected non-Eulerian regular graphs and letG= (F+H)∨K1, that is,Gis obtained fromF andH by adding a new vertexv and joiningv to each vertex inF andH. Prove thatGis Eulerian.
4. LetGbe a connected graph of ordern≥6 that has neither an Eulerian circuit nor an Eulerian trail. A graph H is constructed by adding a new vertex v toGand joiningv to every odd vertex ofG. Prove or disprove:
H is Eulerian.
5. Find a necessary and sufficient condition for the Cartesian productGH of two nontrivial connected graphsGandH to be Eulerian.
6. Prove that if a graph of ordern≥6 has an Eulerianu−vtrail such that degu−degv≥n−2, thennmust be even.
7. Suppose that Gis an r-regular graph of order n such that bothG and its complement Gare connected. Is it possible that neither G nor Gis Eulerian?
8. Show that if T is a tree containing at least one vertex of degree 2, then T is not Eulerian.
9. Prove that an Eulerian graphGhas even size if and only ifGhas an even number of verticesv for which degv ≡2 (mod 4).
10. (a) Prove that every Eulerian graph of odd order has three vertices of the same degree.
(b) Prove that for each odd integer n ≥ 3, there exists exactly one Eulerian graph of order n containing exactly three vertices of the same degree and at most two vertices of any other degree.
11. LetGbe a connected graph with exactly two odd verticesuandv, where degu≥3 and degv≥3. Prove or disprove:
(a) There exist two edge-disjointu−v trails inG.
(b) If G is 2-edge-connected, then there exist two edge-disjoint u−v trails inGsuch that every edge ofGlies on one of these trails.