Introduction
An (undirected) graph is a pair of vertex set and edge set . Sometimes, we define only graph and use and to denote the set of vertices and edges respectively. An edge is an unordered pair of distinct vertices. Two vertices joined by an edge are said to be adjacent. A vertex and edge are said to be incident. Two vertices are neighbors if they are adjacent. The degree of vertex , denoted by , is the number of its neighbors. A graph is regular if all vertices have the same degree. Unless stated otherwise, the number of vertices and edges will be denoted by and respectively.
We can prove this by induction on . If , all vertices have degree and therefore the statement holds. Assume that this is true for . To show that it is true for , we remove edge from to get , so the graph has edges. Applying the induction hypothesis, we have that . Notice that the degrees of and only differ at and . In particular, , implying what we want to prove.
Proving by induction is considered somewhat boring, although very systematic and tends to be free of mistakes. A more fun way to prove the above statement is by counting. Consider each vertex placing a coin on every incident edge. Notice that the total number of coins placed on the edges is . Each edge gets two coins placed on it, so the total number of coins is also equal to . This means that the two quantities are equal, implying the lemma. For the purpose of these lecture notes, we will call this accounting method1.
In this exercise, you are asked to write three different proofs of the following fact: In every graph, the number of odd-degree vertices is even.
- Present a direct proof (hint: Use the Handshake's lemma)
- Induction on
- Induction on
This exercise will show that induction on different variables will not be equally hard.
The complement of is where is the complement with respect to the set of all pairs of vertices.
For any graph , .
A walk of length in is a sequence of vertices such that for all . A path is a walk with no repeated vertices. A graph is said to be connected if there exists a path between every pair of vertices. A closed walk in a graph is a walk with . A closed walk with no repeated vertices (other than ) is called a cycle.
Next, we define the relation on the set of vertices where if and only if there exists a walk from to . It is easy to verify that is an equivalence relation2.
Prove that defines an equivalence relation.
This allows us to partition into based on the equivalence classes. Each subset is called a connected component. A graph is connected if and only if it has exactly one connected component.
The distance between and in , denoted by , is the length of a shortest - path in .
Prove that the distance function is a metric. In particular, prove the following properties:
- if and only if .
- (Symmetry:) for all
- (Triangle inequality:) for all
We now reach the first highlight of this chapter (which we will give two proofs for).
An Eulerian tour of is a closed walk containing all vertices and all edges, each edge exactly once (while vertices can be repeated). A graph possessing an Eulerian tour is said to be Eulerian.
has Eulerian tour if and only if is connected and each vertex has even degree.
This kind of statement is called a characterization, that is, it asserts necessary and sufficient properties of Eulerian graphs. Mathematical characterization often implies "efficient certificates": An Eulerian graph can be certified by the existence of an Eulerian tour (and the validity of this certificate can be checked easily in linear time). Conversely, a non-Eulerian graph can be certified by a vertex with odd degree.
When we encounter an "if and only if" statement, we prove two implications. Notice that the direction is easy to prove. Therefore, our goal is to present two proofs for the converse.
First proof
The first proof is purely mathematical and does not directly yield an algorithm that finds an Eulerian tour (but it is possible to find one after some scrutiny). First, assume that is connected and each vertex has even degree. Take to be the longest possible walk in graph that does not repeat edges. We will argue that: (i) , and (ii) . This would imply that is an Eulerian tour.
To prove (i), assume for contradiction that . So must use an odd number of edges incident to , and there must be an edge incident to that is not used in . We can modify to start at and then follow exactly the same walk as , obtaining a walk of length (that does not repeat edges), which contradicts the fact that is longest.
To prove (ii), we first argue that . Assume for contradiction that . From connectedness of , there is an edge from some in and not in . We can again modify to start at and follow exactly the same walk as a rotation of starting at , a contradiction (here we need property (i); do you see why?). Next, we argue that . Assume otherwise that some edge (do you know why we can assume that the edge connects two vertices in the walk ?). We can modify to start at and follow exactly the same walk as a rotation of starting at , obtaining again a contradiction.
Remark that the key here is to define to be the longest walk no repeating edges (the remaining arguments are straightforward). This trick is very useful in discrete mathematics and we encourage the students to try to digest the proof properly and keep this trick in mind for future use. The final remark before we proceed to the second proof: Do you see how an efficient algorithm follows from this? In particular, given a connected graph that has even degree, the algorithm should output an Eulerian tour of .
Second proof
The second proof gives directly an efficient algorithm for finding an Eulerian tour in a graph. (It is in fact motivated by an algorithmic thinking). Let us try to start with the following simple subroutine that tries to find the longest walk no repeating edges greedily.
- where is an arbitrary vertex.
- while there is an unused edge that can extend do
- append the edge to
- return
It is quite easy to check that does not necessary return an Eulerian tour. But we can at least prove the following property (quite straightforward).
always returns a closed walk, i.e., the algorithm gets stuck at the same vertex it starts with. Recall that we are assuming to be connected an to have even degree.
Since is not necessarily optimal, what do we do? The idea is quite simple: Remove from and recurse on the remaining graph to find the tour and ``stitch'' and together to obtain the Eulerian tour. In particular, we look at the following algorithm.
- Let be the connected components obtained after deleting from .
- return
The algorithm makes use of the procedure whose purpose is to combine several disjoint closed walks together into a single walk that visits each edge appearing in the walks exactly once. It is relatively straightforward to implement .
The algorithm returns an Eulerian tour of .
This can be proved by induction on the number of edges . The base case when is trivial. Next, assume that the algorithm is correct up to input graphs with edges. Consider an input graph that has edges. Since each is connected and has even degree (why?), by the induction hypothesis, returns an Eulerian tour of , which we call . Finally, by the definition of , we obtain a closed walk that visits every edge exactly once, hence an Eulerian tour. This concludes the proof.
Draw the graphs in Figure 4 with a single line (i.e., you can neither lift your pen nor repeat the line (except while on a vertex) while drawing). Use arrows to indicate the direction of your drawing.
An Eulerian walk is a walk that visits all vertices and edges, each edge exactly once. Present a characterization of graphs that have an Eulerian walk but not an Eulerian tour. Prove that your characterization is correct.
Footnotes
-
This is the same as counting the number of persons. You can either count the number of heads, or the number of legs divided by two (assuming that everyone is alive, not decapitated, and nobody has lost their limbs...). ↩
-
A relation is called equivalence if it is reflexive (), symmetric () and transitive (). ↩