Professional Documents
Culture Documents
http://www-math.ucdenver.edu/~wcherowi/courses/m4408/gtaln7.html
A labeled tree gives a Prfer 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. Prfer Decoding A Prfer sequence determines a labeled tree by: Let L be the ordered list of numbers 1, 2, ..., n. Let P be the Prfer 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. Prfer coding and decoding are inverse operations, that means that there is a one-to-one correspondence between labeled trees with n vertices and Prfer sequences of length n-2. Cayley's formula now follows from counting Prfer sequences of length n-2.
1 of 2
3/25/2013 3:08 PM
http://www-math.ucdenver.edu/~wcherowi/courses/m4408/gtaln7.html
Let G be a connected graph with weights assigned to its edges. We wish to find for any two vertices s and t, the path from s to t whose total edge-weight is minimum. If the weights are all equal, the problem reduces to finding the s-t path of shortest length. This can be done by using a breadth-first search starting at s, and ending when t is reached. When the weights are non-negative, but not all equal we can use Dijkstra's algorithm (for situations where negative weights are used, Floyd's algorithm can be used). Dijkstra's Algorithm In this tree growing algorithm, vertices that are added to the tree are labeled with their "distance" from the starting vertex s. For a given vertex x, this label will be denoted dist[x]. Start by setting dist[s]:=0. At each step of the tree growing process, for each frontier edge e, calculate P(e) = dist[x] + wt(e), 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. Choose the frontier edge with the smallest P(e) value to add to the tree and label the new vertex with P(e).
2 of 2
3/25/2013 3:08 PM