Presentation is loading. Please wait.

Presentation is loading. Please wait.

Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees

Similar presentations


Presentation on theme: "Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees"— Presentation transcript:

1 Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees
on n vertices. Or it can be stated as: the complete graph Kn has nn-2spanning trees.

2 A spanning tree of a connected graph is a subgraph that is a tree.
Every tree with at least 2 vertices has at least 2 vertices of degree 1. 6 8 4 5 7 1 2 10 3 9 Consider the sequence:

3 Proof 1 (Prufer): Given a spanning tree T in Kn, let T1=T and generate a sequence of trees T1, T2,…, Tn-1 and two sequences of vertices as follows: Given Ti with n-i+1 vertices, i=1..n-1, let xi be the least indexed degree 1 vertex of Ti and delete xi and its incident edge {xi, yi} from Ti to obtain Ti+1 on n-i vertices. Thus T can be encoded as (y1,…, yn-2). Claim that the encoding is 1-1 and onto. Note that there are nn-2 such encodings. First we have yn-1 = n, since every tree has at least 2 vertices of degree 1 and n will never be the least indexed degree 1 vertex.

4 Second, xk,…, xn-1 and n are the vertices of Tk.
Third, {xi, yi}, i = k, …, n-1, are exactly the edges of Tk in some order. v occurs among y1,…, yn-2 degT(v) -1 times. Similarly, a vertex v in Tk occurs among yk,…, yn-2 is its degree in Tk less 1. The degree-1 vertices of Tk are those elements of V not in {x1,…, xk-1 } and {yk,…, yn-1 }. This implies that xk is the least degree-1 vertex of Tk not in the above sets. x1 is the least element of V not in the encoding of T and we can uniquely determine xk from the encoding and x1,…, xk-1.

5 D has 2 trees rooted at 1 and n and a number (say k) of circuits.
Proof 2: Consider a mapping f from {2, 3,...,n-1} to {1, 2,…, n}. There are nn-2 such mappings f. Construct a digraph D on the vertices 1 to n by defining the edge set {(i, f(i)): i=2,..n-1}. D has 2 trees rooted at 1 and n and a number (say k) of circuits. The rightmost element in the i-th component, denoted ri, is its minimal element (and li is its left neighbor). 21 1 4 5 3 7 12 19 6 20 16 9 17 10 11 2 13 14 8 15 18

6 The circuits are ordered by r1< r2 < … < rk.
Proof 2: The circuits are ordered by r1< r2 < … < rk. We obtain a tree by adding the edges {1, l1}, {r1, l2}, …, {rk-1, lk}, {rk, n} and deleting the edges {ri, li}. Let r0=1 and ri be the minimal number on the path from ri-1 to n. By traversing the path from 1 to n, we can recover the function f. 1 21 4 5 3 7 12 19 6 20 16 9 17 10 11 2 13 14 8 15 18

7 Proof 3: Recall the multinomial coefficient.
Denote the number of labeled trees with n vertices and degree sequence d1,...,dn by t(n; d1,...,dn) which is 0 if any di is 0. Replace n by n-2, k by n, ri by di-1 and xi by 1.

8 t(n;d1,...,dn): # of spanning trees
t(3; 1,2,1)=t(3; 2,1,1)=t(3;1,1,2)=1 t(4;2,1,1,1)=? t(4;3,1,1,1)= t(3;2,1,1) =1 t(4;2,2,1,1)= t(3;2,1,1) + t(3;1,2,1) 3 4 1 2 3 4

9 Proof 3:

10 If there are k components, then how many
edges are there? A graph with no polygon (cycle) as subgraph is called a forest. Each component of a forest is a tree. A weighted graph is a graph together with a function associated a real number c(e) to each edge e, c is called the weighted function. Given a weighted connected graph G, define the cost of a spanning tree T of G as c(T)= A spanning tree may represent a network of cities where c({x, y}) is the cost of erecting a telephone line joining cities x and y.

11 Minimum spanning tree problem is to find a spanning tree with the smallest weight.
Greedy algorithm: Input G: weighted and connected. 1. At each iteration, we have a set {e1,…, ei} of i independent edges, which has n-i components. 2. If i < n-1, let ei+1 be an edge with ends in different components and whose cost is minimum. 3. Stop when n-1 edges are chosen.

12 Thm With e1,…, en-1 chosen as above, the spanning tree T0 has the property that c(T0)  c(T) for any spanning tree T. Pf: Let T has edges a1,…an-1 with the weight increasing. Claim that c(ei)  c(ai) for i=1,…, n-1. If it is false, then there is some k such that c(ek) > c(ak)  c(ak-1) …. c(a1). Since none of ak,…,a1 was chosen at the point when ek was chosen, each of them must have both ends in the same component of G{e1,…, ek-1}. The # of components of G{a1,…,ak}  the # of components of G{e1,…,ek-1}, i.e., n-k+1. It contradicts that G{a1,…ak } is a forest. 

13 The operation of BFS on an undirected graph
1 1 v w x y v w x y Q Q s w r 1 1 (c) r s t u (d) r s t u 1 2 1 2 1 2 2 1 2 v w x y v w x y Q r t x Q t x v 1 2 2 1 2 2 (e) r s t u (f) r s t u 1 2 3 1 2 3 2 1 2 2 1 2 3 v w x y v w x y Q x v u Q v u y 2 2 3 2 3 3

14 (g) r s t u (h) r s t u 1 2 3 1 2 3 2 1 2 3 2 1 2 3 v w x y v w x y Q u y y 3 3 3 (i) r s t u 1 2 3 2 1 2 3 v w x y Q

15 Breadth-first search:
Initially, vertices are colored white. Discovered vertices are colored green. When done, discovered vertices are colored black. d[u] stores the distance from s to u. is a predecessor to u on its shortest path. Q is a first-in first-out queue.

16 Depth First Search: (a) (b) 1/ 1/ 2/ (c) (d) 1/ 2/ 1/ 2/ 3/ 4/ 3/ u v
ancestor descendent Discovery time (a) u v (b) u v 1/ 1/ 2/ x y x y (c) (d) u v u v 1/ 2/ 1/ 2/ 3/ 4/ 3/ x y x y

17 (e) (f) (g) 1/ 2/ 1/ 2/ 1/ 2/ 4/ 3/ 4/5 3/ 4/5 3/6 (h) (i) (j) 1/ 2/7
u v (f) u v (g) u v 1/ 2/ 1/ 2/ 1/ 2/ B B B 4/ 3/ 4/5 3/ 4/5 3/6 x y x y x y finish time (h) (i) u v (j) u v u v 1/ 2/7 1/ 2/7 1/8 2/7 B B F B F 4/5 3/6 4/5 3/6 4/5 3/6 y x y x y

18 Since G is finite, inductively, we can show y is a descendent of x.
Proposition 2.3. If vertices x and y are adjacent in G, then one of the them is a descendent of the other in any DFS tree T. Pf: Suppose x is discovered at time k and earlier than y in the DFS. Let u be the next discovered vertex after x. If u=y then we are done. If not then y is still waiting to be discovered. u x Since G is finite, inductively, we can show y is a descendent of x. y

19 Isthmus (or bridge) is an edge in a graph whose deletion results in a disconnected graph.
Proposition 2.4. Let {x, y} be an edge (not isthmus) of T in G. Let x be the parent of y. Then there is an edge in G but not in T joining some descendent a of y and some ancestor b of x. b x y a Assigning a direction to each edge of an undirected graph G is called an orientation of G. A walk in a digraph may be called strong when each edge is traversed by the walk according to its direction. A digraph is strongly connected if for any two vertices x and y, there is a strong walk from x to y.

20 Thm 2.5. G: finite, connected, no isthmus.
Then G admits a strong orientation. Pf. Goal: Construct a digraph D from G by choosing a direction for each edge. Find a DFS tree T and number the vertices from v0. Let e={vi, vj} be an edge of G with i < j. If e is in T, direct it from vi to vj , else from vj to vi. Need to show that D is strongly connected. There is a strong walk from v0 to any vertex x. It remains to show there is a strong walk from x to v0. By induction on the distance between x and v0 , and Prop 2.4. x v0


Download ppt "Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees"

Similar presentations


Ads by Google