trees trees
play

Trees Trees CSE, IIT KGP Trees and Spanning Trees Trees and - PowerPoint PPT Presentation

Trees Trees CSE, IIT KGP Trees and Spanning Trees Trees and Spanning Trees A graph having no cycles is A graph having no cycles is acyclic acyclic. . A A forest forest is an is an acyclic acyclic graph. graph. A A


  1. Trees Trees CSE, IIT KGP

  2. Trees and Spanning Trees Trees and Spanning Trees • A graph having no cycles is A graph having no cycles is acyclic acyclic. . • • A A forest forest is an is an acyclic acyclic graph. graph. • • A A leaf leaf is a vertex of degree 1. is a vertex of degree 1. • • A A spanning sub spanning sub- -graph graph of G is a sub of G is a sub- -graph graph • with vertex set V(G). with vertex set V(G). • A A spanning tree spanning tree is a spanning sub is a spanning sub- -graph graph • that is a tree. that is a tree. CSE, IIT KGP

  3. Distances Distances • If G has a If G has a u,v u,v- - path, then the distance from path, then the distance from • u to to v v , written , written d d G (u,v) or simply or simply d(u,v), d(u,v), is the is the u G (u,v) least length of a u,v u,v- - path. path. least length of a ∝ d(u,v) = ∝ – If G has no such path, then If G has no such path, then d(u,v) = – CSE, IIT KGP

  4. Tree: Characterization Tree: Characterization ≥ 1) is a tree vertex graph G (with n ≥ • An n An n- -vertex graph G (with n 1) is a tree iff iff: : • – G is connected and has no cycles G is connected and has no cycles – G is connected and has n − − 1 edges – G is connected and has n 1 edges – − 1 edges and no cycles n − – G has G has n 1 edges and no cycles – u,v ∈ ∈ V(G), – For For u,v V(G), G has exactly one G has exactly one u,v u,v- - path path – CSE, IIT KGP

  5. Some results … Some results … • Every tree with at least two vertices has at Every tree with at least two vertices has at • least two leaves. least two leaves. – Deleting a leaf from a tree with Deleting a leaf from a tree with n n vertices vertices – produces a tree with n n- -1 1 vertices. vertices. produces a tree with • If T is a tree with If T is a tree with k k edges and G is a simple edges and G is a simple • δ (G) ≥ k, graph with δ (G) ≥ k, then T is a sub then T is a sub- -graph graph graph with of G. of G. CSE, IIT KGP

  6. Some results … Some results … ′ are two spanning trees of a If T and T ′ • If T and T are two spanning trees of a • ∈ E(T) − E(T ′ ), e ∈ E(T) − E(T ′ connected graph G and e ), connected graph G and ′ ∈ ∈ E(T ′ ) − E(T) e ′ E(T ′ ) − then there is an edge e E(T) such such then there is an edge − e + e ′ is a spanning tree of G. T − e + e ′ that T is a spanning tree of G. that CSE, IIT KGP

  7. Diameter and Radius Diameter and Radius ε (u), written ε • The The eccentricity eccentricity of a vertex of a vertex u, u, written (u), • is the maximum of its distances to other is the maximum of its distances to other vertices. vertices. • In a graph G, the In a graph G, the diameter, diameter, diamG diamG, and the , and the • radius, radG radG, are the maximum and , are the maximum and radius, minimum of the vertex eccentricities minimum of the vertex eccentricities respectively. respectively. • The The center center of G is the of G is the subgraph subgraph induced by induced by • the vertices of minimum eccentricity. the vertices of minimum eccentricity. CSE, IIT KGP

  8. Counting Trees Counting Trees 2 trees with vertex set [n]. − 2 n − • There are There are n n n trees with vertex set [n]. • CSE, IIT KGP

  9. Prü üfer fer Code / Sequence Code / Sequence Pr Algorithm: Production of f(T) = {a Production of f(T) = {a 1 , …, a n } Algorithm: 1 , …, a 2 } n- -2 ⊆ ℵ ℵ . A tree T with vertex set S ⊆ Input: A tree T with vertex set S . Input: th step, delete the least Iteration: At the At the i i th step, delete the least Iteration: remaining leaf, and let a a i be the neighbor neighbor of of remaining leaf, and let i be the this leaf. this leaf. CSE, IIT KGP

Recommend


More recommend