The field of graph theory arguably began with the following question.

The Bridges of Konigsberg

the city of Konigsberg (now Kaliningrad) was built on both sides of a river, and contained two large islands. The 4 sectors of the city were connected by seven bridges, as follows (picture from Wikipedia):

Konigsberg in Euler's time

A group of friends enjoyed strolling through the city, and created a game: could they take a walk in the city, crossing every bridge exactly once, and return to where they started from? Eventually, Euler proved that such a walk is not possible, and in doing so founded graph theory.

Eulerian Cycles

Before presenting Euler’s proof, let us formulate the question precisely in terms of graph theory, which will also generalize the problem.

We can produce a graph , which we will callt he Kingsberg graph, that represents the city of Konigsberg as follows. There will be four vertices, representing the four land-masses are vertices. Every bridge will be represented by an edge.

Then, the question reduces to finding a closed walk in the graph that will uses every edge exactly once. In particular, this walk will not use any edge more than once and hence will be a trail (though it may repeat vertices).

Definition: Eulerian cycle

Let be any graph. An Eulerian cycle or Eulerian tour is a walk in that visits every edge exactly once.

The citizens Konigsberg were asking whether an Eulerian cycle existed in . Euler did more: he gave simple criterion to tell whether or not any connected graph has an Eulerian tour. We will now state and prove his result.

Theorem

A connected graph (without loops) has an Eulerian cycle if and only if every vertex of has even degree.

Proof

First, we show this condition is necessary. Let be a connected graph, and suppose that it has an Eulerian cycle . Let be any vertex in ; we must show that has even degree. We will do this by pairing up the edges incident to .

Since is a closed walked, we may assume that it does not start at . Then consider the first time that the walk visits – it will enter by some edge , and leave by some other edge . We pair these two edges up.

The walk may visit multiple times; each time it does, it must enter from one edge, and leave from another edge. Each time the walk visits , we will pair up the edge the walk entered with the edge left by. Since by supposition the walk uses every edge of exactly once, we see that every edge incident to will be paired up with exactly one other edge in this way, and hence must have even degree.

We now show that this condition is sufficient. That is, we suppose that every vertex of has even degree; we must show that has an Eulerian cycle. We will proceed by induction on the number of edges of .

Any connected graph with 0 edges consists of just a vertex, and hence trivially has an Eulerian cycle.

Now, for the inductive step, we suppose that has edges, and further suppose that we know Euler’s theorem is true for all graphs with less than edges – that is, suppose that every connected graph with less than edges, all of whose vertices have even degree has an Eulerian walk.

We first claim that has some closed trail. Start at any vertex . Since is connected, has at least one edge so we start our trail with . Since every vertex has an even degree, there must be another edge out of , say leading to .

We continue building a trail in by randomly selecting an unused edge of at our current vertex. Since every vertex has even degree, and whenever our trail visits a vertex we use up edges two at a time (coming and going), we see that whenever we arrive at a vertex , there must be another edge leaving it to continue our trail – unless perhaps we hit our starting vertex , where we have only used one edge up. Thus, if we randomly start building a trail we must eventually return to our starting vertex and obtain a closed trail.

Now, given our graph , we know it has some closed trail . If uses every edge of , we are done. If not, we consider the new graph obtained by deleting every edge of (but not the vertices). Note that every vertex of has even degree. Second, may not be connected, but each connected component of has fewer edges that and hence has an Eulerian tour by supposition. Together, and the visit every edge of exactly once. We can stitch them together into one closed path as follows – each shares at least one vertex with . We trace the path , but the first time we visit vertex we insert the path before continuing along .