Presentation is loading. Please wait.

Presentation is loading. Please wait.

Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree.

Similar presentations


Presentation on theme: "Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree."— Presentation transcript:

1 Trees and Distance

2 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree 1 Spanning subgraph of G : a subgraph with vertex set V(G) Spanning tree : a spanning subgraph that is a tree Star : a tree consisting of one vertex adjacent to all the others.

3 Properties of trees Lemma : every tree with at least two vertices has at least two leaves. Deleting a leaf from an n-vertex tree produces a tree with n-1 vertices. Theorem : (A) G is connected and has no cycles (B) G is connected and has n-1 edges (C) G has n-1 edges and no cycles (D) For u,v  V(G), G has exactly one u,v-path

4 Proof theorem A -> B,C : by induction on n. B-> A,C : delete edges from cycles of G one by one …. C -> A,B : let G has k components. e(G i ) = n(G i )-1. e(G)=  i [n(G i )-1]=n-k …. A->D : if some pair of vertices is connected by more than one path, it will form a cycle. D->A : if G has a cycle, then G has more than one u,v – path.

5 Properties of trees Corollary : (a) every edge of a tree is a cut edge. (b) adding one edge to a tree forms exactly one cycle. (c) every connected graph contains a spanning tree. Proposition : if T,T ’ are spanning trees of G and e  E(T)-E(T ’ ), then there is an edge e ’  E(T ’ )-E(T) such that T-e+e ’ is a spanning tree of G.

6 Properties of trees Proposition : if T is a tree with k edges and G is a simple graph with  (G)  k, then T is a subgraph of G.

7 Distance in trees and graphs d(u,v) : is the least length of a u,v-path Diameter : max u,v  V(G) d(u,v) Eccentricity of a vertex u,  (u) : max u,v  V(G) d(u,v) Radius of G : is min u  V(G)  (u)

8 Distance in trees and graphs Theorem : if G is a simple graph, then diamG  3 -> diamĜ  3 Proof :  u,v have no common neighbor. x  V(G)-{u,v} has at least one of {u,v} as a nonneighbor. This makes x adjacent in Ĝ to at least one of {u,v}. uv  E(Ĝ)….

9 Distance in trees and graphs Center of G : the subgraph induced by the vertices of minimum eccentricity. Theorem : the center of a tree is a vertex or an edge.

10 Wiener index Wiener index of G : D(G) =  u,v  V(G) d G (u,v) Theorem : among trees with n vertices, the Wiener index D(T) is minimized by stars and maximized by paths,both uniquely.

11 2.2 spanning trees and enumeration Pr ü fer code : 12 34 56 7 8 {7} {7,4} {7,4,4} {7,4,4,1} {7,4,4,1,7} {7,4,4,1,7,1}

12 Pr ü fer code 12 34 56 7 8 {7,4,4,1,7,1} {4,4,1,7,1} {4,1,7,1} {1,7,1} {7,1} {1}

13 enumeration Corollary : given positive integers d 1, …, d n summing to 2n-2, there are exactly (n-2)!/  (d i -1)! Trees with vertex set [n] such that vertex i has degree d i, for each i.

14 Spanning trees in graphs Proposition : Let  (G) denote the number of spanning trees of a graph G. If e  E(G) is not a loop, then  (G)=  (G-e)+  (G ‧ e)

15 Matrix tree theorem

16 Decomposition and graceful labelings A graceful labeling of a graph G with m edges is a function f:V(G)->{0, …,m} such that distinct vertices receive distinct numbers and {|f(u)-f(v)|:uv  E(G} ={1, …,m}. Conjecture : every tree has a graceful labeling. Theorem : if a tree T with m edges has a graceful labeling, then K 2m+1 has a decomposition into 2m+1 copies of T.

17 caterpillar Caterpillar : a tree in which a single path is incident to (or contains) every edge. Theorem : A tree is a caterpillar iff it does not contain the tree Y above. Y

18 Branchings and eulerian digraphs Branching(out-tree) : an orientation of a tree having a root of indegree 0 and all other vertices of indegree 1. Theorem : directed matrix tree theorem : the number of spanning out-trees of G rooted at v i is the value of each cofactor in the ith row of Q - (Q - =D - -A ’ ). 0 0 0 Q - = -1 1 0 -1 -1 2 0 0 0 A ’ = 1 0 0 1 1 0 0 0 0 D - = 0 1 0 0 0 2

19 Eulerian circuit in directed graph Lemma : in a strong digraph, every vertex is the root of an out-tree. Eulerian circuit in directed graph algorithm :

20 2.3 Optimization and Trees Theorem : in a Eulerian digraph with d i =d + (v i )=d - (v i ) the number of Eulerian circuits is c  i (d i -1)!, where c counts the in- trees to or out-trees from any vertex. Weighted graph : a graph with numerical labels on the edges

21 Minimum spanning tree Kruskal ’ s Algorithm : 1 8 7 11 10 12 53 6 9 2 4

22 Shortest paths Distance d(u,z) in a weighted graph is the minimum sum of the weights on the edges in a u,z-path. Dijkstra ’ s algorithm : 1 4 3 4 5 e 6 5 d 2 u a c b 1 3 5 6 8 {u,a} a b c d e s 1 3    1 3 5 6  1 3 5 6  1 3 5 6 8 {u,a, b,c,d} {u,a,b} {u,a, b,c} {u,a,b,c,d,e}

23 Chinese Postman Problem BFS algorithm Chinese Postman Problem 1 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 7 7

24 Trees in computer science Binary tree : a rooted tree where each vertex has at most two children. K-ary tree allows each vertex up to k children. Prefix-code Huffman ’ s algorithm


Download ppt "Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree."

Similar presentations


Ads by Google