Graph Theory Lecture Notes 7a

http://www-math.ucdenver.edu/~wcherowi/courses/m4408/gtaln7.html

Graph Theory Lecture Notes 7
Counting Spanning Trees
Two labeled trees are the same if their edge-sets are identical. The number of spanning trees of Kn is nn-2, for n Prüfer Encoding A Prüfer sequence of length n-2, for n allowed. 2, is any sequence of integers between 1 and n, with repetitions 2, this is Cayley's Formula.

A labeled tree gives a Prüfer sequence by: Repeat n-2 times: Pick the 1-valent vertex with the smallest label, call it v. Put the label of v's neighbor in the output sequence. Remove v from the tree. Prüfer Decoding A Prüfer sequence determines a labeled tree by: Let L be the ordered list of numbers 1, 2, ..., n. Let P be the Prüfer sequence. Start with n labeled isolated vertices. Repeat n-2 times: Let k be the smallest number in L which is not in P. Let j be the first number in P. Add the edge kj to the graph. Remove k from L and the first number in P. When this is completed there will be two numbers left in L, add the edge corresponding to these two numbers. Prüfer coding and decoding are inverse operations, that means that there is a one-to-one correspondence between labeled trees with n vertices and Prüfer sequences of length n-2. Cayley's formula now follows from counting Prüfer sequences of length n-2.

Finding Minimum Spanning Trees
Let G be a connected graph with weights assigned to its edges. We wish to find the spanning tree with the smallest sum of weights. Prim's Algorithm: Grow a tree by picking the frontier edge with the smallest weight. This is an example of a greedy algorithm.

Finding the Shortest Path

1 of 2

3/25/2013 3:08 PM

ucdenver. but not all equal we can use Dijkstra's algorithm (for situations where negative weights are used. calculate P(e) = dist[x] + wt(e). If the weights are all equal.edu/~wcherowi/courses/m4408/gtaln7. where x is the vertex of e that is in the tree (and therefore has been labeled) and wt(e) is the weight of edge e. Start by setting dist[s]:=0. This can be done by using a breadth-first search starting at s. the path from s to t whose total edge-weight is minimum. the problem reduces to finding the s-t path of shortest length. this label will be denoted dist[x]. For a given vertex x. Dijkstra's Algorithm In this tree growing algorithm. 2 of 2 3/25/2013 3:08 PM . for each frontier edge e.Graph Theory Lecture Notes 7a http://www-math. At each step of the tree growing process. When the weights are non-negative. Choose the frontier edge with the smallest P(e) value to add to the tree and label the new vertex with P(e). vertices that are added to the tree are labeled with their "distance" from the starting vertex s.html Let G be a connected graph with weights assigned to its edges. We wish to find for any two vertices s and t. Floyd's algorithm can be used). and ending when t is reached.