Sie sind auf Seite 1von 9

Camp 2013 - Graph theory, invariants and periodic patterns

Henk HOLLMANN SPMS-MAS #05-04, NTU, Singapore email: henk.hollmann@ntu.edu.sg; hdlh@xs4all.nl May 24, 2013

Graph theory and examples of algorithmic invariants

We begin with an intuitive introduction to graphs and directed graphs. A graph is a pair G = (V, E ) of a nite set V (the vertices ) and a nite set E (the edges , where each edge e is associated with a pair of (not necessarily distinct) vertices called the endpoints of e. If an edge e has both endpoints equal to a vertex v , then the edge is called a loop at v . If two edges e1 , e2 have the same endpoints, then we speak of a multiple edge. A graph is called simple if it has no loops and multiple edges; in that case, we can think of E as a subset of V , that is, each edge is a 2 pair of vertices. A vertex v is called incident to an edge e if v is an endpoint of e; two vertices are called adjacent if there is an edge to which they are both incident.

Figure 1: A graph with vertices x, y, z, u, a loop at v and a multiple edge {w, z } A walk in a graph G = (V, e) is a sequence v0 , e1 , v1 , e2 , v2 , . . . , ek , vk where v0 , . . . , vk are vertices, e1 , . . . , ek are edges, such that ei has endpoints vi1 and vi (1 i n). The number k is called the length of the walk.The walk is called closed if v0 = vk ; if these are the only vertices that repeat, then the closed walk is called a cycle . If all the vertices v0 , . . . , vk are distinct, then the walk is called a path . The graph G is connected if there is a path between every two vertices. Being connected is an equivalence relation ; the equivalence classes are called the connected components . A cycle is a walk in the graph The valency or degree d(v ) of a vertex v is the number of edges incident to v ; here we adopt the convention that a loop at v contributes 2 to the degree of v . A vertex of degree 1 is called a leaf . The graph is regular if the degree in each point is the same. A classical application of the pigeon-hole principle is the following. Problem 1 Every simple graph with at least two vertices has two vertices of the same degree. The single most important result in graph theory is the Handshaking Lemma . Be sure to remember this one! 1

Lemma 1.1 [Handshaking Lemma] The sum of the degrees in a graph equals twice the number of edges. That is, if G = (V, E ) is a graph, then d(v ) = 2|E |.
v V

Proof: The proof is one of the most straightforward applications of the double counting method. Consider ags of the form (v, e) with v a vertex, e an edge, and v incident with e, that is, with v an endpoint of e. For the number F of ags, we nd on the one hand that F = v d(v ), and on the other hand F = |E |2 since every edge (also a loop!) has two endpoints, so contributes 2 to F . 2 Problem 2 Suppose we have a collection of n points in the plane with the property that any two points are at distance at least 1. Show that there are at most 3n pairs of points with distance exactly 1 between them. A graph G = (V, E ) is called bipartite if it is possible to partition the vertex set V into two disjoint parts V = A B in such a way that all edges have one endpoint in each of A, B . The parts A and B are called the partite sets . A well-known and easily proved result states that a graph is bipartite if and only if it does not contain any closed walks of odd size. A tree is a graph that is connected and has no cycles, that is, for every pair of vertices there is a unique path between them. Note that a tree is simple since both a loop and a multiple edge produce a cycle. Lemma 1.2 If G = (V, E ) is a tree, then |E | = |V | 1. Proof: The lemma obviously holds if |V | 2. Now suppose that |V | 3. Every tree has a leaf . (Why? If not, then keep on walking until you encounter a vertex already met earlier; this gives a cycle.) Remove the leaf together with the (unique) edge e incident to it. The remaining graph G = (V , E ) with V = V {v } and E = E {e} is again connected without cycles, hence a tree. Now apply induction. 2 The invariant for the above proof is |V | |E |. It remains invariant (= does not change) during the operation of removing a leaf together with the corresponding vertex of degree 1. Trees are very interesting graphs, and there are many nice problems involving trees. We give a few examples. Problem 3 A vertex in a graph is called odd (or even )if its degree is odd (or even). Show that a tree T has only odd vertices if and only if for every edge e, both components of T e (the graph obtained from T by removing edge e) have odd order.

Problem 4 Note that every tree is bipartite (it has no cycles at all). Show that every tree has a leaf in its larger partite set (and in both if they have the same size). A graph is planar if it can be embedded in the plane, a planar embedding , such that edges are non-crossing. Consider a planar embedding without crossing edges of a planar graph G = (V, E ). Such an embedding partitions the plane into faces , connected regions of the plane minus the graph. Note that one of the faces is innite while all others are nite. Theorem 1.3 [Eulers formula] If a connected planar graph G = (V, E ) is embedded without crossing edges, and with set of faces F , then |V | |E | + |F | = 2. Proof: Consider = |V | |E | + |F |. If G is a tree, then |F | = 1 (no cycles), so = 2. If G has cycles, then consider the eect of removing an edge on a cycle. This has the eect that |F |and |E | get one smaller wile |V | remains unchanged, hence is invariant. 2 This theorem has various interesting applications. First of all, it can be used to determine all the Platonic solids . For our purpose, a Platonic solid is a convex polyhedron; the faces are polygons, each containing the same number n of vertices, and the same number m of faces meet at each vertex. (Given such a solid, it can be deformed such that the faces are congruent regular polytopes.) There are exactly ve such solids; each named after its number F of faces: the tetrahedron (F = 4), the cube or hexahedron (F = 6), the octahedron (F = 8), the dodecahedron (F = 12), and the icosahedron (F = 20). They are named after Plato, a famous Greek philosopher and mathematician. Example 1.4 Problem: nd all Platonic solids. Solution: imagine a ball around the solid. Project it onto the ball, then cut the ball open around one face and spread it out in the plane by deforming it, to that the face that was cut open becomes the innite face. In this way, we obtain a planar graph where the faces of the solid become the faces of the graph; the graph is regular of degree m and each face contains n edges and n vertices. Suppose the resulting graph has V vertices, E edges, and F faces. Eulers formula states that V E + F = 2. By the Handshaking Lemma (Yes, there it is!), we have 2E = mV. Next, we use double counting to relate E and F . Consider ags of the form (e, f ) with e an edge, f a face, and e f . Each edge is part of a face of the solid, hence on a cycle of the graph; as a consequence, the faces on both side of the edge are distinct, so the edge is contained in two faces. On the other hand, each face contains n edges. So we conclude that 2E = nF. 3

Combining the three formula, we nd that E= 1 1 1 + m n 2


1

1 1 +n >1 . Now E is a positive integer, so the right-hand side is a positive integer and, in particular, m 2 Obviously, m, n 3, and since 1/2 1/6 = 1/3, we have that m, n 5. So we quickly nd that the only possibilities are the following.

m = n = 3, in which case E = 6, V = 4, F = 4; this is the tetrahedron. m = 3, n = 4, in which case E = 12, V = 8, F = 6; this is the cube. m = 3, n = 5, in which case E = 30, V = 20, F = 12; this is the dodecahedron. m = 4, n = 3, in which case E = 12, V = 6, F = 8; this is the octahedron. m = 5, n = 3, in which case E = 30, V = 12, F = 20; this is the icosahedron. Problem 5 [The utility problem] (a) Suppose that three houses need to be connected to the gas, water, and electric companies. Is there a way to make all nine connections without any of the lines crossing each other? The corresponding utility graph, the complete bipartite graph K3 , 3, has six vertices, grouped into two sets of three (representing the three houses and the three companies), with an edge between any two vertices from dierent groups and no edges between vertices in the same group. So the problem asks whether K3,3 is planar or not. Use Eulers formula to show that K3,3 is in fact not a planar graph. (b) Similarly, use Eulers formula to show that K5 , the complete graph on 5 vertices with an edge between any two of them, is nonplanar. Hint: every face of a potential embedding contains at least three edges... Let G = (V, E ) be a graph. A subgraph of G is a graph H = (V , E ) with V V and E E ; the subgraph H is called spanning if V = V . A spanning tree of a graph is a spanning subgraph that is also a tree. Obviously, if a graph has a spanning tree, then it is necessarily connected. The following converse is very important for practical applications and problem solving, so be sure to remember this one too! Theorem 1.5 Every connected graph has at least one spanning tree.

Proof: There are many algorithms to construct a spanning tree. Here is a simple one: Start with a connected graph G; at each step, remove an edge that is contained in a cycle; stop if no such edges are left. The resulting subgraph T of G is spanning (no vertices were removed), connected (since only edges are removed that are on a cycle), and has no cycles by the halting condition; so by denition, T is a tree. 2 Every time when the wortd connected occurs in a problem about graphs, you should think of using a spanning tree! Similarly, every time the words the same occur in a problem, you should think of the pigeonhole principle! The next practice problem provides a good illustration. Problem 6 Let G be a simple connected graph with n 4 points and 2n 3 edges. Show that G has two cycles of the same length. Problem 7 Let T be a tree on an even number of vertices. Show that T has a un ique (i.e., exactly one) spanning subgraph in which the degree of every vertex is odd.

1.1

Directed graphs and Euler graphs

A directed graph or digraph is a pair G = (V, E ) of a nite set V (the vertices ) and a nite set E (the directed edges or arcs ), where each directed edge e has a begin or tail vertex t(e) and an end or head vertex h(e); we say that edge e is directed from t(e) to h(e). The underlying undirected graph

Figure 2: A directed graph with vertices a, b, c, d, e with a loop at c is the graph G obtained from G by replacing each directed edge by an undirected one. A directed graph is called connected if its underlying undirected graph is connected. Directed walks, paths, and cycles are dened in the obvious way. 5

Let G = (V, E ) be a directed graph. The out-degree d+ (v ) of a vertex v V is the number of edges directed outwards from v , that is, the number of edges e E for which t(e) = v . Similarly, the in-degree d (v ) is the number of edges directed towards v , that is, the number of edges e E for which h(e) = v . Lemma 1.6 [Handshaking Lemma for directed graphs] Let G = (V, E ) be a directed graph. Then d+ ( v ) =
v V v V

d (v ) = |E |.

Proof: By double counting both the ags (v, e) with v = t(e) and the ags (v, e) with v = t(e). Or, what is essentially the same argument, by the observation that each edge contributes exactly 1 to both of the degree sums. 2 Denition 1.7 A directed graph G = (V, E ) is called balanced if the in-degree and out-degree in every vertex are equal, that is, if d+ (v ) = d (v ) for every v V . A directed graph is called Eulerian if the graph is both balanced and connected. A Eulerian circuit for a directed graph G = (V, E ) is a closed walk in G that uses every edge of the graph exactly once . Since such a closed walk enters and leaves each vertex the same number of times, a directed graph possessing a Eulerian circuit is necessarily balanced and connected, i.e., Eulerian. Probably the most important and useful result for directed graphs is the following converse. Theorem 1.8 A directed graph G = (V, E ) has a Eulerian circuit if and only if it the graph is Eulerian. Proof: (Sketch) Let G be Eulerian. We build up an Eulerian circuit C for G as follows. Initially, C = , and no edge is marked. At each stage of the algorithm, we chose an unmarked edge e with tail v = t(e) (we choose v C except initially, when C is still empty), and start a directed walk W from this edge. Each time that we extend W , we mark the new edge; we continue until we reach v . Indeed, the balanced condition ensures that we will never get stuck except possibly at v . Then we combine the closed walk W and the current circuit C into a larger circuit C . If we cannot extend the circuit any further, then since G is connected, every edge must be included in C . 2 A typical application is the following. Problem 8 Let G be a nite group of order |G| = n, generated by two elements a, b in G. Prove or disprove: there is a sequence g1 , g2 , . . . , g2n of group elements such that 1. Every element of the group occurs exactly twice in the sequence; 2. For 1 i 2n, we have gi+1 {gi a, gi b} (here g2n+1 = g1 ). 6

1.2

Periodicity and recurrent relations

Example 1.9 Let a and m be positive integers. Show that the sequence a, a2 , a3 , . . . is eventually periodic modulo m. Solution: The sequence modulo m can be obtained as follows: a1 = a and an aan1 mod m for all n 2. By the pigeon-hole principle, among the numbers a1 , . . . , am+1 , two must be the same. Now if ai = aj with 1 i < j m + 1, then ai+1 = aj +1 , and, in general, ai+k = aj +k for all k 0. So the sequence is eventually periodic, with period j i. Remark: as an example, if m = 12 and a = 2, then the sequence an is 2, 4, 8, 4, 8, 4, 8, ... 2 Example 1.10 (a) The Fibonacci numbers are dened by F1 = F2 = 1 and Fn = Fn1 + Fn2 . Show that the sequence fn = Fn mod 10 is eventually periodic. Then show that it is periodic. (b) Show that for some n 1, the n-th Fibonacci number Fn ends in 2013 zeros. Proof of (a): Consider pairs (Fn , Fn+1 ). Modulo 10, there are at most 100 possibilities for such pairs, so among these pairs for n = 1, . . . , 101, two must be the same modulo10. Now as in the previous problem, if (Fi , Fi+1 ) and (Fj , Fj +1 ) are equal modulo 10, for 1 i < j , then from the recurrent relation we see that also (Fi+k , Fi+k+1 ) and (Fj +k , Fj +k+1 ) are equal modulo 10 for all k 0, and in particular we see that the sequence is eventually periodic, with period j i. Since we can also go backward (we have Fn = Fn+2 Fn+1 , the previous relation in fact holds for all k , and the sequence is periodic. Remark 1: in fact, Fn+60 Fn mod 10. Remark 2: We now see that a similar thing holds much more general. Dene a sequence {an }n1 by letting a1 = 1 , . . . , ar = r , and an = c1 an1 + c2 an2 + + cr anr , for certain constants 1 , . . . , r (the initial values) and certain other constants c1 , . . . , cr that determine the recurrent relation for the sequence. We say that the sequence satises a recurrent relation of order r. Then, if all constants are integer and if m is also integer, then the sequence an mod m is eventually periodic (since the r-tuples (an , . . . , an+r1 ) repeat modulo m after at most mr + 1 steps), and is even periodic if cr and m are relatively prime (then you can go backwards, verify that for yourself). Proof of (b): for any m, there exist n and k such that Fn+k Fn and Fn+k1 Fn1 , where all are modulo m. Hence Fn+k Fn holds for every n. In particular, Fk F0 = 0. 2 7

Extra invariance and periodicity problems


Problem 9 We play the following game on a sequence 101, 102, . . . , 200. A move consists of chosing two numbers a, b in the sequence, remove them, and replace them by the single number ab + a + b. When we have made 99 moves, one number remains. Determine the possible values of this number. Problem 10 Consider the array of numbers 1 1 1 1 1 2 3 2 1 1 3 6 7 6 3 1 1 4 10 16 19 16 10 4 1 . . . where each number is the sum of the three numbers above, above diagonally left, and above diagonally right (empty places contribute 0). Show that every row except the rst two contains an even number. Problem 11 The sequence f0 , f1 , . . . of Fibonacci numbers is dened by f0 = 0, f1 = 1, fn+2 = m fn + fn+1 (n 0). The sequence F0 , F1 , . . . of Fermat numbers is dened by Fm = 22 for m 0. Determine all pairs (n, m) of nonnegative integers for which fn = Fm .

An extra, completely dierent problem that I like


Something bizar to end with: Problem 12 Let {xn } (n Z) be a two-sided innite sequence of reals for which |xn | = xn1 + xn+1 holds for every n Z. Show that the sequence is periodic, with period 9.

Das könnte Ihnen auch gefallen