Graph Theory
Total Page:16
File Type:pdf, Size:1020Kb
Combinatorics: The Fine Art of Counting Week 9 Lecture Notes – Graph Theory For completeness I have included the definitions from last week’s lecture which we will be using in today’s lecture along with statements of the theorems we proved. Definitions Graph: A graph G = (V, E) consists of an arbitrary set of objects V called vertices and a set E which contains unordered pairs of distinct elements of V called edges. Adjacent: Two vertices in a graph are adjacent if there is an edge containing both of them. Two edges are adjacent if they contain a common vertex. Adjacent vertices are called neighbors. Degree: For any vertex v in a graph, the degree of the vertex is equal to the number of edges which contain the vertex. The degree of v is denoted by d(v). Regular Graph: A graph in which every vertex has the same degree is called a regular graph. If all vertices have degree k, the graph is said to be k-regular. Complete Graph: The complete graph on n vertices Kn consists of the vertex set V = {v1,v2,…,vn} and the edge set E containing all pairs (vi,vj) of vertices in V. Isomorphic: Two graphs are isomorphic if there exists a one-to-one correspondence between their vertex sets (i.e. a re-labeling) which induces a one-to-one correspondence between their edge sets. More formally, if L is a re-labeling which maps the vertices of G to the vertices of H, then the edge set of H is precisely the set of edges (L(v),L(w)) where (v,w) is an edge in G. Sub-graph: A graph G1 = (V1, E1) is a sub-graph of G2 = (V2, E2) whenever V1 ⊆ V2 and E1 ⊆ E2. Path: A path of length n is the graph Pn on n+1 vertices {v0, v1, v2, …, vn} with n edges (v0,v1), (v1,v2), …, (vn-1,vn). Cycle: A cycle of length n is the graph Cn on n vertices {v0, v2, …, vn-1} with n edges (v0,v1), (v1,v2), …, (vn-1,v0). We say that a given graph contains a path (or cycle) of length n if it contains a sub-graph which is isomorphic to Pn (or Cn). Connected: A graph that contains a path between every pair of vertices is connected. Every graph consists of one or more disjoint connected sub-graphs called the connected components. Distance: The distance between two connected vertices is the length of the shortest path between the vertices. Diameter: The diameter of a connected graph is the maximum distance between any two vertices in the graph. 1 Forests and Trees: A graph which does not contain a cycle is called a forest. If it is a connected graph, it is called a tree. The connected components of a forest are trees. End-points and Isolated Vertices: An end-point is a vertex with degree 1. An isolated vertex is a vertex with degree 0. Hamiltonian Graph: A graph which contains a Hamiltonian cycle, i.e. a cycle which includes all the vertices, is said to be Hamiltonian. Walks, Trails, and Circuits: A walk in a graph is a sequence of adjacent edges. A trail is a walk with distinct edges. A circuit is a trail in which the first and last edge are adjacent. Eulerian Graph: A trail which includes all of the edges of a graph and visits every vertex is called an Eulerian Tour. If a graph contains an Eulerian tour which is a circuit, i.e. an Eulerian circuit, the graph is simply said to be Eulerian. Theorems Proven Last Week Theorem 1: The sum of the degrees of all the vertices in a graph is equal to twice the number of edges, i.e. Σd(v) = 2|E| Theorem 2: Every tree with at least one edge contains two end-points Theorem 3: A graph with n vertices is a tree if and only if it is connected and has n-1 edges. Theorem 4: A graph is Eulerian if and only if it is a connected graph in which every vertex has even degree. Corollary 4.1: A graph contains an Eulerian tour if and only if it is a connected graph with at most two vertices of odd degree. New Material We begin with a simple corollary to theorem 3 which follows almost immediately. Corollary 3.1: A graph with n vertices and at least n edges contains a cycle. Proof: Let G be a graph with n vertices. If G is connected then by theorem 3 it is not a tree, so it contains a cycle. If G is not connected, one of its connected components has at least as many edges as vertices so this component is not a tree and must contain a cycle, hence G contains a cycle. QED This simple fact has a lot of practical applications, e.g. the sleepy mathematicians USAMO problem mentioned previously. In many situations it may be difficult to find a particular cycle, but just by counting edges we can prove that a cycle must exist. There are a few more basic facts about trees that are useful to know. Theorem 5: A graph is a tree if and only if there is a unique path between any two vertices. Proof: We have two things to prove, the “if” and the “only if”. Suppose G is a tree containing vertices v and w. G is connected so there is a path from v and w, we simply need to show that this path must be unique. Suppose there were two distinct paths from v and w. Starting from v, let s be the first vertex where these paths diverge. s could be equal to v, but it cannot be equal to 2 w since the paths must diverge somewhere. Let t be the first vertex where the paths meet again – there must be such a vertex since they meet at w. The two segments of the paths between s and t are disjoint, so together they form a cycle containing s and t which contradicts our supposition that G is a tree. Thus the path from v to w must be unique. Conversely, suppose G is a graph which contains a unique path between any two vertices. G is clearly connected. G cannot contain a cycle, because a cycle contains two distinct paths between any pair of vertices in it. Therefore G is a tree. QED Trees are very nice graphs to work with. Unfortunately, not all graphs are trees. However all connected graphs contain a tree which includes all the vertices. Such a graph is called a spanning tree. Spanning Trees: A spanning sub-graph of G is a sub-graph H which includes all the vertices of G. In the case where H is a tree, H is called a spanning tree. Theorem 6: Every connected graph contains a spanning tree. Proof: Let G be a connected graph. If G is a tree we are done, otherwise G must contain a cycle. Removing an edge from this cycle will result in a connected graph with the same vertex set as G but fewer edges. We can continue in this manner until there are no more cycles (there are only a finite number of edges to remove), at which point the remaining graph must be a tree. QED This proof gives us one way to construct a spanning tree, namely by removing edges from cycles. This is not a particular good method if the graph contains a lot of edges. A more efficient approach is to simply pick a vertex to be a seedling, and then “grow” the spanning tree by connecting vertices one at a time. As long as not all the vertices are in the tree, there must be a vertex in the tree which has a neighboring vertex not in the tree – simply pick one such vertex, connect it to the tree with a single edge, and repeat until all the vertices are in the tree. Spanning trees are useful in a lot of situations – efficiently broadcasting a message to all nodes in a network is but one example. We now look at perhaps the simplest case of graphs which aren’t trees, graphs where every vertex has degree 2. Theorem 7: A graph is 2-regular if and only if all its connected components are cycles. Proof: One direction of the theorem is trivial – a graph whose connected components are all cycles is clearly 2-regular. We prove the other direction by induction on the number of vertices in the graph. The base case is K3 which is 2-regular and has one connected component which is a cycle. For a graph with n > 3 vertices, note that by Theorem 1, a 2-regular graph with n vertices has n edges and by Corollary 3.1 such a graph must contain a cycle. Since the graph is 2- regular, none of the vertices in this cycle can be contained in any other edges, so the cycle is a connected component. The remainder of the graph (if any) is 2-regular and has less than n vertices so the inductive hypothesis applies. QED The theorem above is a very special instance of a much more general result regarding graphs which can be decomposed into cycles, but first we need to define exactly what we mean by this. Decomposition: A decomposition of a graph G is a partitioning of the edges of the graph among a collection of sub-graphs H1, H2, H3, …, Hn.