Graph Theory and Cayley s Formula Chad Casarotto August 10, 2006 Contents 1 Introducton 1 2 Bascs and Defntons 1 Cayley s Formula 4 4 Prüfer Encodng A Forest of Trees 7 1 Introducton In ths paper, I wll outlne the bascs of graph theory n an attempt to explore Cayley s Formula. Cayley s Formula s one of the most smple and elegant results n graph theory, and as a result, t lends tself to many beautful proofs. I wll examne a couple of these proofs and show how they exemplfy dfferent methods that are often used for all types of mathematcs problems. 2 Bascs and Defntons Not surprsngly, graph theory s the study of thngs called graphs. So what s a graph? A graph can be thought of as a fnte set of vertces {v 1, v 2,..., v n } and a set of relatons between each par of vertces. Each of the ( n 2) pars of vertces s ether adjacent or not adjacent. If a par of vertces s adjacent, 1
we say there s an edge connectng the two vertces, and they are called neghbors. The above defnton lends tself to a convenent vsualzaton. The n vertces can be consdered as n dstnct ponts n a plane, such as R 2, and edges can be consdered as lnes between adjacent vertces. An example of a graph can be seen below. a d c b e f g A graph wth 7 vertces and 10 edges It s ths vsualzed verson of a graph that wll be used from here on. (Note: what s beng defned here s formally called a smple graph; other types of graphs may have edges wth arrows, multple edges between vertces, or loops from a vertex to tself.) Let s defne some features of graphs: A walk of length k s a sequence of vertces v 0, v 1,... v k such that v s adjacent to v +1 for each (for ths we shall wrte: v v +1 ). A closed walk s a walk of length k such that v 0 = v k. A cycle s a closed walk where none of the vertces repeat except for the frst and the last (.e. j v v j except when (, j) = (0, k)). Example: n the above graph, the sequence b, f, g, b forms a cycle of length, denoted C. 2
A complete graph on n vertces s a graph such that v v j j. In other words, every vertex s adjacent to every other vertex. Example: n the above graph, the vertces b, e, f, g and the edges between them form the complete graph on 4 vertces, denoted K 4. A graph s sad to be connected f for all pars of vertces (v, v j ) there exsts a walk that begns at v and ends at v j. (Note: the above graph s connected.) A tree on n vertces s a connected graph that contans no cycles. Below s an example of a tree wth 8 vertces. x The degree of a vertex s defned as the number of vertces t s adjacent to (.e. the number edges attached to t). Example: n the above tree, the pont x has degree 4, denoted d(x) = 4. Proposton: Every fnte tree has at least two vertces of degree 1. Proof. Notce that any tree must have at least one vertex wth degree 1 because f every vertex had degree of at least 2, then one would always be able to contnue any walk untl a cycle s formed. Now let us assume that we have a tree wth exactly one vertex of degree 1. If one removes ths vertex of degree 1, the resultng graph must also be a tree snce a cycle cannot be added by removng a vertex. In the resultng tree, ether the frst vertex s neghbor s now of degree 1 or the resultng graph s not a tree and we have a contradcton. If the latter, our proof s done. If the former, we must be able to remove vertces untl a contradcton occurs, and there s no vertex of degree 1. We must be able to do ths because f we could contnue to remove vertces n ths way, our graph must be somethng equvalent to a straght path, and a straght path has two vertces of degree 1, namely the endponts.
We have shown that a tree must have at least one vertex of degree 1 and that t cannot have exactly one, so t must have at least two. Cayley s Formula Usng the above defntons, we can now begn to dscuss Cayley s formula and ts proofs. Cayley s Formula tells us how many dfferent trees we can construct on n vertces. We can thnk about ths process as begnnng wth n vertces and then placng edges to make a tree. Another way to thnk about t nvolves begnnng wth the complete graph on n vertces, K n, and then removng edges n order to make a tree. Cayley s formula tells us how many dfferent ways we can do ths. These are called spannng trees on n vertces, and we wll denote the set of these spannng trees by T n. The followng s a dagram of all of elements of T 4 : a b a b c d c d Notce that the fgures n each row are just rotatons of the frst one. Each of these graphs s dstnct because each has a dfferent set of adjacences. For example, a c n the frst graph above, but a c n the second graph. Agan, these graphs can be obtaned by addng edges to 4 vertces or from takng edges away from K 4. 4
In ts smplest form, Cayley s Formula says: T n = n n 2 (1) From our above example, we can see that T 4 = 16 = 4 2. It s trval that there s only one tree on 2 vertces (so T 2 = 1 = 2 0 ). Also, the only possble tree type on vertces s a V and the 2 other trees are just rotatons of that (so T = = 1 ). We can see that Cayley s Formula holds for small n, but how can we prove that t s true for all n? We shall see how we can do ths n dfferent ways n the followng sectons. 4 Prüfer Encodng The most straght forward method of showng that a set has a certan number of elements s to fnd a bjecton between that set and some other set wth a known number of elements. In ths case, we are gong to fnd a bjecton between the set of Prüfer sequences and the set of spannng trees. A Prüfer sequence s a sequence of n 2 numbers, each beng one of the numbers 1 through n. We should ntally note that ndeed there are n n 2 Prüfer sequences for any gven n. The followng s an algorthm that can be used to encode any tree nto a Prüfer sequence: 1. Take any tree, T T n, whose vertces are labeled from 1 to n n any manner. 2. Take the vertex wth the smallest label whose degree s equal to 1, delete t from the tree and wrte down the value of ts only neghbor. (Note: above we showed that any tree must have at least two vertces of degree 1.). Repeat ths process wth the new, smaller tree. Contnue untl only one vertex remans. Ths algorthm wll gve us a sequence of n 1 terms, but we know that the last term wll always be the number n because even f ntally d(n) = 1, there wll always be another vertex of degree 1 wth a smaller label. Snce we already know the number of vertces on our graph by the length of our sequence, we can drop the last term as t s redundant. So now we have a sequence of n 2 elements encoded from our tree. Below s an example of encodng a tree on 6 vertces:
4 2 1 6 Sequence:... 4 1 6 4 2 4 1 1 6 6 Sequence:,... Sequence:, 1,... 1 6 6 Seq:, 1, 1,... Seq:, 1, 1,,... Seq:, 1, 1,, 6 After encodng our tree, we end up wth the sequence:, 1, 1,, 6; then we can drop the endng 6 and end wth our Prüfer Sequence and denote t by P. P =, 1, 1,. So what should make us thnk that ths s the only tree that gves us ths sequence? Frst, we must notce that all of the vertces of degree 1 do not occur n P. Wth a lttle thought we can see that ths s true for any tree, as the vertces of degree 1 wll never be wrtten down as the neghbors of other degree 1 vertces (except when vertex n s of degree 1, but ths wll never end up n our sequence). In fact, t follows from ths that every vertex has degree equal to 1 + a, where a s the number of tmes that vertex appears n our sequence. Ths way of analyzng a Prüfer Sequence provdes us wth a way of reconstructng an encoded tree. The algorthm goes as follows: 1. Fnd the smallest number from 1 to n that s not n the sequence P and attach the vertex wth that number to the vertex wth the frst number n P. (We know that n = 2 + number of elements n P.) 2. Remove the frst number of P from the sequence. Repeat ths process consderng only the numbers whose vertces have not yet attaned ther correct degree.. Do ths untl there are no numbers left n P. Remember to attach the last number n P to vertex n. 6
Let s reconstruct our orgnal tree from our sequence, P =, 1, 1, : P =,1,1, 2 P =1,1, 2 P =1, 2 4 P = 2 4 2 P = 4 1 1 1 6 1 Followng the above steps, we have now reconstructed our orgnal tree on 6 vertces. It may be orented dfferently, but all of the vertces are adjacent to ther correct neghbors, and so we have the correct tree back. Snce there were no ambgutes on how to encode the tree or decode the sequence, we can see that for every tree there s exactly one correspondng Prüfer Sequence, and for each Prüfer Sequence there s exactly one correspondng tree. More formally, the encodng functon can be thought of as takng a member of the set of spannng trees on n vertces, T n, to the set of Prüfer Sequences wth n 2 terms, P n. Decodng would then be the nverse of the encodng functon, and we have seen that composng these two functons results n the dentty map. If we let f be the encodng functon, then the above statements can be summarzed as follows: f : T n P n, f 1 : P n T n, and f 1 f = Id. Snce we have found a bjectve functon between T n and P n, we know that they must have the same number of elements. We know that P n = n n 2, and so T n = n n 2. A Forest of Trees Another common way of provng somethng n mathematcs s to prove somethng more general of whch what you want to prove s a specfc case. We can use ths method to prove Cayley s formula as well. Frst, we must defne what a forest s. A forest on n vertces s a graph that contans no cycles, but does not need to be connected lke a tree. In fact, a forest can be thought of as a group of smaller trees, hence the name forest. 7
Now, we are gong to defne a specfc famly of forests that we wll denote T n,k. Let A be an arbtrary set of k vertces chosen from the vertces 1, 2,..., n. We are gong to defne T n,k to be the set of all forests on n vertces that have k trees such that each element of A s n a dfferent tree. The followng s the set T 4,2 where A = {1, 2}. 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 4 4 4 4 4 4 4 4 There are a couple thngs that we should note before we move on. Frst, we should notce that a pont by tself s a tree on 1 vertex. Second, we should notce that f we are countng the number of elements n T n,k, t does not matter what elements are n A; only the number of elements n A matters, whch we have defned as k. Let s take a look at T n,k, specfcally vertex 1: 1 2 k... }{{} In ths pcture, we are just lookng at vertex 1; each vertex, 1 through k, s part of ts own tree. Vertex 1 can be adjacent to of the remanng n k vertces, and can range from 0 to n k. If we delete vertex 1 from our graph, we get (k 1)+() vertces that must be n separate trees. (Note that none of the vertces can be adjacent to each other because that would form a cycle.) If we now sum up the number of trees we get from deletng vertex 1 across all possble values of, we can obtan a value for T n,k. Formally we have: T n,k = T n 1,(k 1)+ (2) =0 We obtan the bnomal coeffcent because the vertces can be chosen n that many ways from the n k vertces. In certan cases where the above summaton may not be defned, we defne those values. We set T 0,0 = 1 and T n,0 = 0 for n > 0. Note that T 0,0 = 1 s necessary so that T n,n = 1. 8
Proposton: T n,k = kn n k 1 Proof. We want to prove our proposton usng equaton (2) and nducton: T n,k = T n 1,(k 1)+ Equaton (2) =0 = (k 1 + )(n 1) (n 1) (k 1+) 1 Proposton =0 Swtch the order of the summaton lettng = (n k) T n,k = (n 1 )(n 1) 1 =0 = (n 1) (n 1) 1 =0 ( n k = =0 =1 ) (n 1) (1) n k =1 (n k)! (n 1) 1 ()!(n k )! 1 = (n 1) (1) n k (n k) (n 1) 1 1 =0 ( n k = =0 ) (n 1) (1) n k (n k) =1 n k 1 =0 ( n k 1 ) (n 1) (1) n k 1 = (n 1 + 1) n k (n k)(n 1 + 1) n k 1 Bnomal Theorem T n,k = n n k n n k + kn n k 1 = kn n k 1 Now that we have proven the more general case, we can look at how t proves Cayley s Formula. Cayley s Formula descrbes cases where there s exactly 1 tree on n vertces, so T n = T n,1. Pluggng n and 1 nto the formula we proved gves us T n = T n,1 = n n 2 provng Cayley s Formula. 9
References: [1] Baba, László. Lectures and Dscrete Mathematcs. [2] Agner, Martn and Günter Zegler. Proofs from THE BOOK. c 2001. 10