CHAPTER 1. GRAPH THEORY 17 Week 2 1.2 Definitions and Basic Properties Recall the definition of a graph on p. 9 (Week 2). We now define a number of other basic graph theoretic concepts. Memorize them! Graphs Definition 1.1 A (simple) graph = ( ) consists of a finite nonempty set and a set of two-element subsets of . The set is called the vertex set of . The elements of are the vertices of and are drawn as dots or points. The singular form of “vertices” is vertex. The set is the edge set of . The elements of are the edges of and are drawn as (not necessarily straight) lines. To emphasize the graph we often write () and () instead of and . The number of vertices is the order , and the number of edges is the size of . If = { } is an edge, we simply write = , and say that and are adjacent vertices or is adjacent to ; and are incident with , is incident with and , and joins and . We also call and the ends of . The number of edges incident with a vertex is called the degree of and is denoted deg . If deg is an even number, then is called an even vertex; if deg is an odd number, then is called an odd vertex. A vertex of degree 0 is an isolated vertex, a vertex of degree 1 is a pendant vertex, and a vertex that is adjacent to all other vertices is a universal vertex. Fundamental Law of Graph Theory: Draw a Picture! Fact 1.1 If = ( ) is a graph of order , then 0 ≤ || ≤ ¡¢ . 2 Proof. If = ∅, then || = 0. Otherwise, the maximum size of occurs when every 2element subset of is an edge. There are ways to choose a vertex , and − 1 ways to choose another vertex 6= so that is an edge. This accounts for ( − 1) edges. But the edge ¡¢ is the same as , that is, ¡we Hence there are ¢ have counted each edge¡twice. ¢ (−1) = 2 2-element subsets and thus 2 edges. Hence 0 ≤ || ≤ 2 . ¨ 2 CHAPTER 1. GRAPH THEORY 18 a G a b e d c H b e d c Figure 1.4: Graphs and with () = () = { }, () = { }, () = { } Fact 1.2 Every graph of order at least two has at least two vertices of the same degree. Proof. Suppose has order ≥ 2. Since 0 ≤ deg ≤ − 1 for any vertex of , there are possibilities for the degrees of vertices of . • Suppose deg = 0 for some ∈ . Then is not adjacent to any vertex of , which is the same as saying that no vertex of is adjacent to . Then 0 ≤ deg ≤ − 2 for each vertex of , so there are only − 1 possibilities for the degrees of vertices of . • Suppose no vertex satisfies deg = 0. Then 1 ≤ deg ≤ − 1 for each vertex of , and again there are only − 1 possibilities for the degrees of vertices of . Since has vertices, the pigeonhole principle implies that there are two vertices of the same degree. ¨ Practice Questions: Do them NOW! Exercises, p. 15: 1, 3, 9 Subgraphs Memorize! Definition 1.2 A graph is a subgraph of a graph if () ⊆ () and () ⊆ (). If () = (), then is called a spanning subgraph of . Note that must be a graph — it cannot have edges of if it doesn’t also have the ends of the edges as vertices. The graphs and in Figure 1.5 are subgraphs of ; is a spanning subgraph of and is not. CHAPTER 1. GRAPH THEORY 19 a a g b g e G c f c f e d g b H b c f d F d Figure 1.5: A graph with spanning subgraph and nonspanning subgraph K1 K2 K3 K4 Figure 1.6: The complete graphs 1 , 2 , 3 and 4 Notation The subgraph of = ( ) obtained by deleting a vertex is denoted by \{} (in the textbook) or simply by − . The subgraph of obtained by deleting an edge is denoted by \{} (in the textbook) or simply by − . Complete Graphs Definition 1.3 The graph of order in which every pair of vertices are adjacent, is called the complete graph of order and is denoted . The complete graph 3 is also called a triangle. Memorize! As shown in Fact 1.1, has Example ¡¢ 2 edges. The graphs 1 , 2 , 3 and 4 are shown in Figure 1.6. How many spanning subgraphs does have? ¡ ¢ • has 2 edges. Any spanning subgraph of also has vertices, and all we have to decide is whether a given edge is to¡be ¢ in a spanning subgraph or not. Thus for each edge there are two options, so has 2 2 = 2(−1)2 spanning subgraphs. CHAPTER 1. GRAPH THEORY 20 K3,3 Figure 1.7: The complete bipartite graph 33 Bipartite Graphs Definition 1.4 A graph = ( ) is called a bipartite graph if there exists a partition, called a bipartition, {1 2 } of such that each edge in joins a vertex in 1 and a vertex in 2 . The sets 1 and 2 are called the partite sets of . If every vertex in 1 is adjacent to every vertex in 2 , then is called a complete bipartite graph and is denoted , where |1 | = and |2 | = . Memorize! Example Form a graph as follows. Draw a circle in the plane. Draw an even number ≥ 4 vertices on the (line of the) circle. The line segments formed are the edges of the graph. Label the vertices in order, say counterclockwise, of their appearance on the circle with the integers 1 2 3 . The odd labels form 1 and the even labels for 2 , and the only edges join vertices in 1 to vertices in 2 . Hence is bipartite. Question: What happens if you add an odd number of vertices? The graph 33 is shown in Figure 1.7. Practice Questions: Do them NOW! Exercises, p. 15: 5, 6, 7, 15, 16 A Theorem by Euler Memorize! Proposition 1.1 The sum of the degrees of the vertices of a graph is an even number, equal to twice the number of edges. That is, for any graph = ( ), X deg = 2|| ∈ Proof. Add the degrees of all the vertices. Each edge is counted twice — once at each end (or twice at the same end if it is a loop, in the case of a pseudograph). ¥ CHAPTER 1. GRAPH THEORY 21 Examples 1. Each vertex of has degree − 1, because it is adjacent to each vertex other than itself. Thus has ( − 1)2 edges — another proof of Fact 1.1, because any graph of order is a spanning subgraph of . 2. Consider with bipartition (1 2 ), where |1 | = and |2 | = .PEach of the vertices in 1 has degree and each vertex in 2 has degree , thus ∈1 ∪2 deg = + = 2, and so has size . Of course, one may also argue that the edges incident with the vertices in 1 account for all the edges, and obtain |( )| = more directly. Corollary 1.1 Any graph has an even number of odd vertices. Memorize! Proof. Let = { ∈ : deg is even} and = { ∈ : deg is odd}. By Proposition 1.1, X X X deg = deg + deg (1.1) 2|| = ∈ ∈ ∈ P Since the left side of (1.1) is even, the right side is even too. Since ∈ deg is even, so is P deg . Since the sum of odd numbers is even iff there is an even number of summands, ∈ the result follows. ¥ Definition 1.5 Suppose 1 2 are the degrees of a graph , ordered so that 1 ≥ 2 ≥ · · · ≥ . Then 1 2 is called the degree sequence of . Memorize! Examples 1. The degree sequence of the graph in Figure 1.5 is 4 4 3 3 2 2 2. 2. The degree sequence of 34 is 4 4 4 3 3 3 3. 3. No graph has degree sequence 7 6 5 4 3 2 1. Why not? 4. No graph has degree sequence 6 5 4 3 3 2 1 1. Why not? Practice Questions: Do them NOW! True/False, p. 14 Exercises, pp. 15—16: 12, 13, 14, 18, 20 CHAPTER 1. GRAPH THEORY a b c 22 r s t d e p x u y q v z Figure 1.8: Three isomorphic graphs 1.3 Isomorphism In this section we discuss what it means to say that “two graphs are essentially the same”. Consider the graphs and in Figure 1.4. At a first glance they don’t look the same, but can be redrawn to look like : consider the pentagon with no crossed edges and labels , in this order. More formally, let be the function from () to () defined by () = () = () = () = () = Clearly, is a bijection from () to (). Moreover, () () = ∈ () () () = ∈ () () () = ∈ () ()() = ∈ () and ()() = ∈ () Thus also preserves adjacencies, that is, ∈ () if and only if () () ∈ (). Definition 1.6 Two graphs and are isomorphic, written ∼ = , if there exists a bijection (1 − 1 and onto function) : () → () such that for all ∈ (), ∈ () if and only if ()() ∈ () Such a function is called an isomorphism. Memorize! Abusing notation somewhat, we also say that : → is an isomorphism. Examples 1. The three graphs in Figure 1.8 are all isomorphic, and each is isomorphic to 23 . 2. Are the graphs and in Figure 1.9 isomorphic? • Note that | ()| = | ()| = 6 and |()| = |()| = 9. To show that ∼ = , we need to redraw to look like or to define an isomorphism from to . To show that À , we need to find a property of one graph that is not a property of the other. CHAPTER 1. GRAPH THEORY 23 1 1 6 2 4 2 5 H G 6 5 3 4 3 Figure 1.9: Two nonisomorphic graphs Note that {1 2 3} forms a triangle of , but for any choice of ∈ {1 2 3 4 5 6}, { } does not form a triangle of . Thus À . The relation on the set of all graphs defined by ( ) ∈ if and only if and are isomorphic, is an equivalence relation, and the equivalence classes are collections of graphs which are “the same” in this sense. We frequently draw pictures of graphs without labelling the vertices. These unlabelled graphs are understood to represent any of the possible graphs obtained by giving names to the vertices. In general, when the number of vertices is large, determining whether two graphs are isomorphic is a very difficult problem. Proposition 1.2 If and are isomorphic graphs, then they have the same • order • size • number of triangles • degree sequences. The converse of this statement is not true. Practice Questions True/False, p. 20 Exercises, pp. 20—22: 1, 3, 4(b), 8(a). CHAPTER 1. GRAPH THEORY 1.4 24 Eulerian Circuits Walks, Trails, Paths, Circuits and Cycles Memorize! Definition 1.7 A walk (or 0 - walk) in a (simple) graph is a sequence 0 1 2 3 of vertices such that consecutive vertices are adjacent. The length of a walk is the number of edges in the walk, one less than the number of vertices. The length of the 0 - walk above is . A trail is a walk in which no edge is repeated. A path is a walk in which no vertex is repeated, thus no edge is repeated either. The graph that consists of a path on vertices is denoted . A - walk is open if 6= and closed if = . A closed trail is also called a circuit, and a cycle is a circuit in which the only repeated vertex is the first vertex, this being the same as the last vertex. The graph that consists of a cycle on vertices is denoted . The cycle is even if is even, and odd if is odd. Note • Every path is a trail (to repeat an edge you must repeat one of its ends) and every trail is a walk. • There are walks that are not trails, and trails that are not paths. • If ∈ (), then “” is a perfectly good - walk; it has length 0. a b g c f e d Figure 1.10: A graph with an - walk CHAPTER 1. GRAPH THEORY 25 Examples 1. is an - walk in the graph in Figure 1.10. 2. is an - trail but not a path in the graph in Figure 1.10, while and are - paths. 3. The graphs and in Figure 1.4 are both isomorphic to 5 . Fact 1.3 If a graph has a - walk, then it has an - path. Proof. Consider a shortest - walk = 0 1 −1 = in . If this walk is not a path, then there are indices and with 1 ≤ ≤ such that = : = 0 1 +1 +1 −1 = | {z } delete But then the walk 0 1 +1 −1 is a shorter - walk in , a contradiction. ¨ We prove two more facts before discussing special types of trails, circuits and cycles. Fact 1.4 If deg ≥ for each ∈ , then has a path of length . Proof. Consider a longest path : 0 1 in . Note that has length . Since is a longest path, 0 is not adjacent to any vertices in − {1 2 }, otherwise there exists a longer path. Since deg 0 ≥ , 0 is adjacent to at least vertices in {1 2 }. Therefore ≥ , and so a longest path in has at least edges. ¨ Fact 1.5 If deg ≥ 2 for each ∈ , then has a cycle. Proof. Let : 0 1 be a longest path in . By Fact 1.4, ≥ 2, and as in the proof above, 0 is adjacent to at least one vertex on other than 1 . Then 0 1 0 is a cycle of . ¨ Eulerian Trails and Circuits Memorize! Definition 1.8 An Euler or Eulerian trail in a graph or pseudograph is a trail that uses every vertex in () and every edge in (). An Euler or Eulerian circuit is a circuit that uses every vertex in () and every edge in (). CHAPTER 1. GRAPH THEORY 26 Example For the graph in Figure 1.13, is a circuit and is an Euler circuit. Connected Graph, Eulerian Graph Memorize! Definition 1.9 A graph = ( ) is called connected if there exists a - path in for all ∈ . If is not connected, it is called disconnected. In this case the maximal connected subgraphs of are called the components of . If is connected and has an Eulerian circuit, we call an Eulerian graph. Usually graphs are drawn so that it is obvious whether they are connected or not. However, one has to look more carefully to see that the graph in Figure 1.11 is disconnected: there is no - path, for example. The graph has two components: the subgraphs induced by { } and { }, respectively. Having defined connected graphs, we digress briefly to give a well-known and useful characterization of bipartite graphs. Fact 1.6 A graph is bipartite iff it contains no odd cycles. Memorize! Rather than proving this, we look at an algorithm that takes any graph and either finds the partition or finds an odd cycle. • It is not hard to see that if is bipartite, then all cycles have even length. • Method for finding a partition of () when is bipartite: For each component of , a f b e c d Figure 1.11: A disconnected graph CHAPTER 1. GRAPH THEORY • 27 pick any vertex , put into 1 , put all vertices adjacent to in 2 , put all vertices adjacent to a vertex in 2 in 1 , etc. If during this procedure some vertex is put into both 1 and 2 , then there is an odd cycle in . Otherwise, we find a bipartition of (). ¨ Example 2 start 1 3 4 6 5 7 8 1 2 3 4 7 5 8 6 Figure 1.12: Constructing a bipartition Theorem 1.1 A graph is Eulerian iff it is connected and every vertex has even, positive degree. Memorize! b G c a d f e Figure 1.13: An Eulerian graph Theorem 1.2 A graph has an Eulerian trail between two different vertices and iff it is connected and all vertices except and are even, while and are odd. Memorize! Practice Questions True/False, p. 27 Exercises, pp. 27—29: 1, 3(a), 4(a), 8(a), 10, 15, 22.