SlideShare a Scribd company logo
1 of 34
Download to read offline
Trees
A.B.M. Ashikur Rahman
Wee-3: Trees 1
Definition
• A connected acyclic graph
Wee-3: Trees 2
Properties of Tree
• Theorem 3.1 – There is one and only one path between every pair of
vertices in a tree, T.
• Theorem 3.2 – If in a graph G there is one and only one path between
every pair of vertices, G is a tree.
• Theorem 3.3 – A tree with n vertices has n-1 edges.
Wee-3: Trees 3
Properties of Tree
• Theorem 3.4 – Any connected graph with n vertices and n-1 edges is a
tree.
• Theorem 3.5 – A graph is a tree if and only if it is minimally connected.
• Theorem 3.6 – A graph G with n vertices, n-1 edges and no circuits is
connected.
Wee-3: Trees 4
Summary of the Properties
• A graph G with n vertices is called a tree if –
• G is connected & is circuitless, or
• G is connected & has n-1 edges, or
• G is circuitless and has n-1 edges, or
• There is exactly one path between every pair of vertices in G, or
• G is a minimally connected graph.
Wee-3: Trees 5
Properties of tree
Question: Cycle in tree. Possible?
Answer:
Wee-3: Trees 6
In graph theory: Nope.
In jungle: May be.
Pendant Vertices in a Tree
• Theorem 3.7 – In any tree (with two or more vertices), there are at
least two pendant vertices.
• Finding monotonically increasing
subsequence of
4, 1, 13, 7, 0, 2, 8, 11, 3
Wee-3: Trees 7
Distance & Centers in a Tree
• Distance
• distance d(vi, vj) between two of its vertices vi and vj is the length of the
shortest path
• Metric – is a function f that satisfies the conditions below
• Nonnegativity: f(x,y) ≥ 0, and f(x,y) = 0 if and only if x = y.
• Symmetry: f(x,y) = f(y,x).
• Triangle inequality: f(x,y) ≤ f(x,z) + f(z,y) for any z.
Wee-3: Trees 8
Distance & Centers in a Tree
• Theorem 3.8 – The distance between vertices of a connected graph is a
metric.
• Eccentricity(also referred to as assosiated number or separation) E(v)
of a vertex v in a graph G is distance from v to the vertex farthest from
v in G; that is
• Center : A vertex with minimum eccentricity in graph G is called a
center of G.
Wee-3: Trees 9
Distance & Centers in a Tree
• Theorem 3.9 – Every tree has either one or two centers.
• Radius & Diameter
Wee-3: Trees 10
Rooted & Binary Trees
• Rooted trees with 4 vertices
• Binary Trees
• Internal Vertex
Wee-3: Trees 11
Properties Binary Trees
• The number of vertices n in a binary tree is always odd. This because
there is exactly one vertex of even degree and the remaining n-1
vertices are of odd degrees. Since the number of vertices of odd degree
is even, n-1 is even. Hence n is odd.
• Let p be the number of pendant vertices in a binary tree T. Then n-p-1
is the number of vertices of degree three. Therefore the number of
edges in T equals
Hence
Wee-3: Trees 12
Properties Binary Trees
• Height : The maximum level, lmax, of any vertex in a binary tree is
called the height of the tree.
Wee-3: Trees 13
Weighted Path Length
• Minimize: ∑wjlj
• A Coke machine is to identify, by a sequence of tests, the coin that is put
into the machine. Only pennies, nickels, dimes, and quarters can go
through the slot. Let us assume that the probabilities of a coin being a
penny, a nickel, a dime, and a quarter are .05, .15, .5, and .30,
respectively. Each test has the effect of partitioning the four types of coins
into two complementary sets and asserting the unknown coin to be in one
of the two sets. Thus for four coins we have 23 - 1 such tests. If the time
taken for each test is the same, what sequence of tests will minimize the
expected time taken by the Coke machine to identify the coin?
Wee-3: Trees 14
Weighted Path Length
• Minimize: ∑wjlj
Wee-3: Trees 15
Counting Trees
• On 1857, Arthur Cayley discovered tree while studying structural
isomers of saturated hydrocarbons CkH2k+2 molecule.
• The total number of vertices in such a graph is n = 3k + 2
• And total number of edge
• e = .5 x ( sum of degree )
• e = .5 x ( 4k + 2k +2)
• e = 3k + 1
This structure is tree.
Wee-3: Trees 16
Counting Trees
• When
• n = 4
• 16 labeled trees
• 2 unlabeled trees
Wee-3: Trees 17
Cayley’s Theorem
• Theorem 3.10 – The number of labeled trees with n(≥2) vertices is nn-2.
• Proof:
• Let the n vertices of the tree T be labeled 1, 2, 3, .., n.
• Remove the pendant vertex(and the edge incident on it) having the smallest
label.
• Repeat until n-2 steps or only 2 vertices are left.
• The tree T defines the sequence : (b1, b2, …, bn-2) uniquely.
Wee-3: Trees 18
Cayley’s Theorem
• Remove a1 = 2, get b1 = 1
• Remove a2 = 4, get b2 = 1
• Remove a3 = 1, get b3 = 3
• Remove a4 = 3, get b4 = 5
• Remove a5 = 6, get b5 = 5
• Remove a6 = 7, get b6 = 5
• Remove a7 = 5, get b7 = 9
• Only vertex 8 and 9 are left
• So our sequence of b = (1,1,3,5,5,5,9); is only unique to this labeled graph
Wee-3: Trees 19
5
24
3
7
6
8
9
1
Cayley’s Theorem
• Conversely given a sequence b of n-2 labels, an n-vertex tree can be
constructed uniquely
• First construct the sequence of a = (1, 2, 3, …, n).
• Pick the first number in sequence a which is not in b and pair them.
• Remove both the vertices from the list.
• Continue pairing until sequence of b has no element left.
• Finally join the last two remaining vertices of sequence a.
Wee-3: Trees 20
Cayley’s Theorem
Reconstruction:
b = (1,1,3,5,5,5,9)
a = (1,2,3,4,5,6,7,8,9)
*Follow the class lecture for reconstruction process
Wee-3: Trees 21
Cayley’s Theorem & Proof
• For example, given a sequence (4, 4, 3, 1, 1)
• Given sequence is the sequence of b
• So, we construct a = (1, 2, 3, 4, 5, 6, 7)
• Pair (2, 4) as a1 = 2, b1 = 4
• Pair (5, 4) as a2 = 5, b2 = 4
• Pair (4, 3) as a3 = 4, b3 = 3
• Pair (3, 1) as a4 = 3, b4 = 1
• Pair (6, 1) as a5 = 6, b5 = 1
• Finally pair (1, 7)
Wee-3: Trees 22
Cayley’s Theorem & Proof
• For each of the n-2 element in sequence b we can choose any one of
the n numbers, thus froming nn-2; (n-2) tuples, each defining a distinct
labeled tree of n vertices.
• Since each tree defines one of the sequence uniquely, there is a 1-to-1
correspondence between the trees and the nn-2 sequences.
• Thus the theorem is proved.
Wee-3: Trees 23
Spanning Trees
Wee-3: Trees 24
• A tree T is said to be a spanning tree of connected graph G if T is a
subgraph of G and T contains all vertices of G.
• Maxiaml Tree/Subgraph, skeleton
• Sppaning forest of disconnected graph
• Finding Spanning Tree
• Find Circuits
• delete an edge from the circuit
• continue
Spanning Trees
• Theroem 3.11 – Every connected graph has at least one spanning tree.
Wee-3: Trees 25
• Branch (an edge which is part of
spanning tree T and graph G),
• Chord (an edge which is not part of
spanning tree T but of graph G)
Spanning Trees
• Theroem 3.12 – With respect to any of its spanning trees, a connected
graph of n vertices and e edges has n-1 tree branches and e-n+1
chords.
• Electrical network with e edges and n nodes, how to be sure that we don’t have
a circuit?
• How many walls have to be broken to
drain the lands?
Wee-3: Trees 26
Spanning Trees: Rank & Nullity
• n, e, k are independent of each other except for two constrains
• n-k ≥ 0
• e-n+k ≥ 0
• Rank, r = n-k; number of branches
• Nullity, μ = e-n+k; number of chords
• Rank + Nullity = total number of edges
Wee-3: Trees 27
Fundamental Circuits
• Theroem 3.13 – A connected graph G is a tree if and only if adding an
edge between any two vertices in G creates exactly one circuit.
• Consider a spanning tree T in a connected graph G. Adding any chord
to T will create exactly one circuit. Such a circuit, formed by adding a
chord to a spanning tree, is called a fundamental circuit.
• How many fundamental circuits does a graph have?
Wee-3: Trees 28
Fundamental Circuits
• Has 8 fundamental circuits
• A circuit may be fundamental with respect to a spanning tree but not
other spanning tree of the same graph
• Has 75 total circuits
• A set of edges comprising
a circuit will not be
fundamental if it has
more than one chord
Wee-3: Trees 29
Finding All Spanning Tree
• Cyclic interchange:
• start with a given spanning tree
• add a chord forming a fundamental circuit
• delete an appropriate branch
Wee-3: Trees 30
Cyclic interchange
Wee-3: Trees 31
• Can we start from any spanning tree and get a desired spanning tree by
a number of cyclic exchanges?
• Can we get all spanning trees of a given graph in this fashion?
• How long will we have to continue exchanging edges?
• Is there a preferred spanning tree for starting?
Cyclic interchange
Wee-3: Trees 32
• The distance between two spanning trees of a graph G is defined as
the number of edges of G present in one tree but not in the other
• Written as d(Ti ,Tj)
d(Ti ,Tj) =
1
2
N(Ti ⊕ Tj )
*N(g) denote the number of edges in a graph g
Metric
Wee-3: Trees 33
The distance between the spanning trees of a graph is a metric. That is,
it satisfies-
1. d(Ti, Tj) ≥ 0 and d(Ti, Tj) = 0 if and only if Ti = Tj,
2. d(Ti, Tj) = d(Tj, Ti),
3. d(Ti, Tj) ≤ d(Ti, Tk) + d(Tk, Tj).
Spanning Trees In A Weighted Graph
• Edges have weights
• Minimal spanning tree
• Kruskal’s or Prim’s algorithm
Wee-3: Trees 34

More Related Content

What's hot

Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmAcad
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applicationsManikanta satyala
 
Dijkstra’S Algorithm
Dijkstra’S AlgorithmDijkstra’S Algorithm
Dijkstra’S Algorithmami_01
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest pathArafat Hossan
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2showslidedump
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmGaurav Kolekar
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph TheoryYosuke Mizutani
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Darwish Ahmad
 

What's hot (20)

Graph theory
Graph theory Graph theory
Graph theory
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
Hamilton path and euler path
Hamilton path and euler pathHamilton path and euler path
Hamilton path and euler path
 
Prim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithmPrim Algorithm and kruskal algorithm
Prim Algorithm and kruskal algorithm
 
Trees and graphs
Trees and graphsTrees and graphs
Trees and graphs
 
MATCHING GRAPH THEORY
MATCHING GRAPH THEORYMATCHING GRAPH THEORY
MATCHING GRAPH THEORY
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applications
 
Bipartite graph
Bipartite graphBipartite graph
Bipartite graph
 
Trees
Trees Trees
Trees
 
Dijkstra’S Algorithm
Dijkstra’S AlgorithmDijkstra’S Algorithm
Dijkstra’S Algorithm
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest path
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2
 
Tree and graph
Tree and graphTree and graph
Tree and graph
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Graph
GraphGraph
Graph
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring
 

Similar to Graph Theory: Trees

Similar to Graph Theory: Trees (20)

B.TECH Math project
B.TECH Math projectB.TECH Math project
B.TECH Math project
 
Ds lec 5_chap4
Ds lec 5_chap4Ds lec 5_chap4
Ds lec 5_chap4
 
Unit ix graph
Unit   ix    graph Unit   ix    graph
Unit ix graph
 
7 Trees.pptx
7 Trees.pptx7 Trees.pptx
7 Trees.pptx
 
ANALYTIC-GEOMETRY(4).pptx
ANALYTIC-GEOMETRY(4).pptxANALYTIC-GEOMETRY(4).pptx
ANALYTIC-GEOMETRY(4).pptx
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
 
Lecture_1_matrix_operations.pdf
Lecture_1_matrix_operations.pdfLecture_1_matrix_operations.pdf
Lecture_1_matrix_operations.pdf
 
Area and Perimeter.pptx
Area and Perimeter.pptxArea and Perimeter.pptx
Area and Perimeter.pptx
 
lecture10 date structure types of graph and terminology
lecture10 date structure types of graph and terminologylecture10 date structure types of graph and terminology
lecture10 date structure types of graph and terminology
 
Problems in parallel computations of tree functions
Problems in parallel computations of tree functionsProblems in parallel computations of tree functions
Problems in parallel computations of tree functions
 
LEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdfLEC 12-DSALGO-GRAPHS(final12).pdf
LEC 12-DSALGO-GRAPHS(final12).pdf
 
Graph Algorithms
Graph AlgorithmsGraph Algorithms
Graph Algorithms
 
Lec33
Lec33Lec33
Lec33
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
 
graph theory
graph theory graph theory
graph theory
 
Minimum enclosingdisk
Minimum enclosingdiskMinimum enclosingdisk
Minimum enclosingdisk
 
Unit V - ppt.pptx
Unit V - ppt.pptxUnit V - ppt.pptx
Unit V - ppt.pptx
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
 
Ram minimum spanning tree
Ram   minimum spanning treeRam   minimum spanning tree
Ram minimum spanning tree
 

More from Ashikur Rahman

Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsAshikur Rahman
 
SOP writing: What, Why & How
SOP writing: What, Why & HowSOP writing: What, Why & How
SOP writing: What, Why & HowAshikur Rahman
 
Graph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual GraphGraph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual GraphAshikur Rahman
 
Graph Theory: Connectivity & Isomorphism
Graph Theory: Connectivity & Isomorphism Graph Theory: Connectivity & Isomorphism
Graph Theory: Connectivity & Isomorphism Ashikur Rahman
 
Graph Theory: Cut-Set and Cut-Vertices
Graph Theory: Cut-Set and Cut-VerticesGraph Theory: Cut-Set and Cut-Vertices
Graph Theory: Cut-Set and Cut-VerticesAshikur Rahman
 
Graph Theory: Paths & Cycles
Graph Theory: Paths & CyclesGraph Theory: Paths & Cycles
Graph Theory: Paths & CyclesAshikur Rahman
 
Cybercrimes and Cybercriminals
Cybercrimes and CybercriminalsCybercrimes and Cybercriminals
Cybercrimes and CybercriminalsAshikur Rahman
 
E-Marketing and Advertising Concepts
E-Marketing and Advertising ConceptsE-Marketing and Advertising Concepts
E-Marketing and Advertising ConceptsAshikur Rahman
 
Outlier analysis,Chapter-12, Data Mining: Concepts and Techniques
Outlier analysis,Chapter-12, Data Mining: Concepts and TechniquesOutlier analysis,Chapter-12, Data Mining: Concepts and Techniques
Outlier analysis,Chapter-12, Data Mining: Concepts and TechniquesAshikur Rahman
 
Machine learning algorithms for data mining
Machine learning algorithms for data miningMachine learning algorithms for data mining
Machine learning algorithms for data miningAshikur Rahman
 
Signature verification Using SIFT Features
Signature verification Using SIFT FeaturesSignature verification Using SIFT Features
Signature verification Using SIFT FeaturesAshikur Rahman
 

More from Ashikur Rahman (11)

Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphs
 
SOP writing: What, Why & How
SOP writing: What, Why & HowSOP writing: What, Why & How
SOP writing: What, Why & How
 
Graph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual GraphGraph Theory: Planarity & Dual Graph
Graph Theory: Planarity & Dual Graph
 
Graph Theory: Connectivity & Isomorphism
Graph Theory: Connectivity & Isomorphism Graph Theory: Connectivity & Isomorphism
Graph Theory: Connectivity & Isomorphism
 
Graph Theory: Cut-Set and Cut-Vertices
Graph Theory: Cut-Set and Cut-VerticesGraph Theory: Cut-Set and Cut-Vertices
Graph Theory: Cut-Set and Cut-Vertices
 
Graph Theory: Paths & Cycles
Graph Theory: Paths & CyclesGraph Theory: Paths & Cycles
Graph Theory: Paths & Cycles
 
Cybercrimes and Cybercriminals
Cybercrimes and CybercriminalsCybercrimes and Cybercriminals
Cybercrimes and Cybercriminals
 
E-Marketing and Advertising Concepts
E-Marketing and Advertising ConceptsE-Marketing and Advertising Concepts
E-Marketing and Advertising Concepts
 
Outlier analysis,Chapter-12, Data Mining: Concepts and Techniques
Outlier analysis,Chapter-12, Data Mining: Concepts and TechniquesOutlier analysis,Chapter-12, Data Mining: Concepts and Techniques
Outlier analysis,Chapter-12, Data Mining: Concepts and Techniques
 
Machine learning algorithms for data mining
Machine learning algorithms for data miningMachine learning algorithms for data mining
Machine learning algorithms for data mining
 
Signature verification Using SIFT Features
Signature verification Using SIFT FeaturesSignature verification Using SIFT Features
Signature verification Using SIFT Features
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 

Recently uploaded (20)

9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

Graph Theory: Trees

  • 2. Definition • A connected acyclic graph Wee-3: Trees 2
  • 3. Properties of Tree • Theorem 3.1 – There is one and only one path between every pair of vertices in a tree, T. • Theorem 3.2 – If in a graph G there is one and only one path between every pair of vertices, G is a tree. • Theorem 3.3 – A tree with n vertices has n-1 edges. Wee-3: Trees 3
  • 4. Properties of Tree • Theorem 3.4 – Any connected graph with n vertices and n-1 edges is a tree. • Theorem 3.5 – A graph is a tree if and only if it is minimally connected. • Theorem 3.6 – A graph G with n vertices, n-1 edges and no circuits is connected. Wee-3: Trees 4
  • 5. Summary of the Properties • A graph G with n vertices is called a tree if – • G is connected & is circuitless, or • G is connected & has n-1 edges, or • G is circuitless and has n-1 edges, or • There is exactly one path between every pair of vertices in G, or • G is a minimally connected graph. Wee-3: Trees 5
  • 6. Properties of tree Question: Cycle in tree. Possible? Answer: Wee-3: Trees 6 In graph theory: Nope. In jungle: May be.
  • 7. Pendant Vertices in a Tree • Theorem 3.7 – In any tree (with two or more vertices), there are at least two pendant vertices. • Finding monotonically increasing subsequence of 4, 1, 13, 7, 0, 2, 8, 11, 3 Wee-3: Trees 7
  • 8. Distance & Centers in a Tree • Distance • distance d(vi, vj) between two of its vertices vi and vj is the length of the shortest path • Metric – is a function f that satisfies the conditions below • Nonnegativity: f(x,y) ≥ 0, and f(x,y) = 0 if and only if x = y. • Symmetry: f(x,y) = f(y,x). • Triangle inequality: f(x,y) ≤ f(x,z) + f(z,y) for any z. Wee-3: Trees 8
  • 9. Distance & Centers in a Tree • Theorem 3.8 – The distance between vertices of a connected graph is a metric. • Eccentricity(also referred to as assosiated number or separation) E(v) of a vertex v in a graph G is distance from v to the vertex farthest from v in G; that is • Center : A vertex with minimum eccentricity in graph G is called a center of G. Wee-3: Trees 9
  • 10. Distance & Centers in a Tree • Theorem 3.9 – Every tree has either one or two centers. • Radius & Diameter Wee-3: Trees 10
  • 11. Rooted & Binary Trees • Rooted trees with 4 vertices • Binary Trees • Internal Vertex Wee-3: Trees 11
  • 12. Properties Binary Trees • The number of vertices n in a binary tree is always odd. This because there is exactly one vertex of even degree and the remaining n-1 vertices are of odd degrees. Since the number of vertices of odd degree is even, n-1 is even. Hence n is odd. • Let p be the number of pendant vertices in a binary tree T. Then n-p-1 is the number of vertices of degree three. Therefore the number of edges in T equals Hence Wee-3: Trees 12
  • 13. Properties Binary Trees • Height : The maximum level, lmax, of any vertex in a binary tree is called the height of the tree. Wee-3: Trees 13
  • 14. Weighted Path Length • Minimize: ∑wjlj • A Coke machine is to identify, by a sequence of tests, the coin that is put into the machine. Only pennies, nickels, dimes, and quarters can go through the slot. Let us assume that the probabilities of a coin being a penny, a nickel, a dime, and a quarter are .05, .15, .5, and .30, respectively. Each test has the effect of partitioning the four types of coins into two complementary sets and asserting the unknown coin to be in one of the two sets. Thus for four coins we have 23 - 1 such tests. If the time taken for each test is the same, what sequence of tests will minimize the expected time taken by the Coke machine to identify the coin? Wee-3: Trees 14
  • 15. Weighted Path Length • Minimize: ∑wjlj Wee-3: Trees 15
  • 16. Counting Trees • On 1857, Arthur Cayley discovered tree while studying structural isomers of saturated hydrocarbons CkH2k+2 molecule. • The total number of vertices in such a graph is n = 3k + 2 • And total number of edge • e = .5 x ( sum of degree ) • e = .5 x ( 4k + 2k +2) • e = 3k + 1 This structure is tree. Wee-3: Trees 16
  • 17. Counting Trees • When • n = 4 • 16 labeled trees • 2 unlabeled trees Wee-3: Trees 17
  • 18. Cayley’s Theorem • Theorem 3.10 – The number of labeled trees with n(≥2) vertices is nn-2. • Proof: • Let the n vertices of the tree T be labeled 1, 2, 3, .., n. • Remove the pendant vertex(and the edge incident on it) having the smallest label. • Repeat until n-2 steps or only 2 vertices are left. • The tree T defines the sequence : (b1, b2, …, bn-2) uniquely. Wee-3: Trees 18
  • 19. Cayley’s Theorem • Remove a1 = 2, get b1 = 1 • Remove a2 = 4, get b2 = 1 • Remove a3 = 1, get b3 = 3 • Remove a4 = 3, get b4 = 5 • Remove a5 = 6, get b5 = 5 • Remove a6 = 7, get b6 = 5 • Remove a7 = 5, get b7 = 9 • Only vertex 8 and 9 are left • So our sequence of b = (1,1,3,5,5,5,9); is only unique to this labeled graph Wee-3: Trees 19 5 24 3 7 6 8 9 1
  • 20. Cayley’s Theorem • Conversely given a sequence b of n-2 labels, an n-vertex tree can be constructed uniquely • First construct the sequence of a = (1, 2, 3, …, n). • Pick the first number in sequence a which is not in b and pair them. • Remove both the vertices from the list. • Continue pairing until sequence of b has no element left. • Finally join the last two remaining vertices of sequence a. Wee-3: Trees 20
  • 21. Cayley’s Theorem Reconstruction: b = (1,1,3,5,5,5,9) a = (1,2,3,4,5,6,7,8,9) *Follow the class lecture for reconstruction process Wee-3: Trees 21
  • 22. Cayley’s Theorem & Proof • For example, given a sequence (4, 4, 3, 1, 1) • Given sequence is the sequence of b • So, we construct a = (1, 2, 3, 4, 5, 6, 7) • Pair (2, 4) as a1 = 2, b1 = 4 • Pair (5, 4) as a2 = 5, b2 = 4 • Pair (4, 3) as a3 = 4, b3 = 3 • Pair (3, 1) as a4 = 3, b4 = 1 • Pair (6, 1) as a5 = 6, b5 = 1 • Finally pair (1, 7) Wee-3: Trees 22
  • 23. Cayley’s Theorem & Proof • For each of the n-2 element in sequence b we can choose any one of the n numbers, thus froming nn-2; (n-2) tuples, each defining a distinct labeled tree of n vertices. • Since each tree defines one of the sequence uniquely, there is a 1-to-1 correspondence between the trees and the nn-2 sequences. • Thus the theorem is proved. Wee-3: Trees 23
  • 24. Spanning Trees Wee-3: Trees 24 • A tree T is said to be a spanning tree of connected graph G if T is a subgraph of G and T contains all vertices of G. • Maxiaml Tree/Subgraph, skeleton • Sppaning forest of disconnected graph • Finding Spanning Tree • Find Circuits • delete an edge from the circuit • continue
  • 25. Spanning Trees • Theroem 3.11 – Every connected graph has at least one spanning tree. Wee-3: Trees 25 • Branch (an edge which is part of spanning tree T and graph G), • Chord (an edge which is not part of spanning tree T but of graph G)
  • 26. Spanning Trees • Theroem 3.12 – With respect to any of its spanning trees, a connected graph of n vertices and e edges has n-1 tree branches and e-n+1 chords. • Electrical network with e edges and n nodes, how to be sure that we don’t have a circuit? • How many walls have to be broken to drain the lands? Wee-3: Trees 26
  • 27. Spanning Trees: Rank & Nullity • n, e, k are independent of each other except for two constrains • n-k ≥ 0 • e-n+k ≥ 0 • Rank, r = n-k; number of branches • Nullity, μ = e-n+k; number of chords • Rank + Nullity = total number of edges Wee-3: Trees 27
  • 28. Fundamental Circuits • Theroem 3.13 – A connected graph G is a tree if and only if adding an edge between any two vertices in G creates exactly one circuit. • Consider a spanning tree T in a connected graph G. Adding any chord to T will create exactly one circuit. Such a circuit, formed by adding a chord to a spanning tree, is called a fundamental circuit. • How many fundamental circuits does a graph have? Wee-3: Trees 28
  • 29. Fundamental Circuits • Has 8 fundamental circuits • A circuit may be fundamental with respect to a spanning tree but not other spanning tree of the same graph • Has 75 total circuits • A set of edges comprising a circuit will not be fundamental if it has more than one chord Wee-3: Trees 29
  • 30. Finding All Spanning Tree • Cyclic interchange: • start with a given spanning tree • add a chord forming a fundamental circuit • delete an appropriate branch Wee-3: Trees 30
  • 31. Cyclic interchange Wee-3: Trees 31 • Can we start from any spanning tree and get a desired spanning tree by a number of cyclic exchanges? • Can we get all spanning trees of a given graph in this fashion? • How long will we have to continue exchanging edges? • Is there a preferred spanning tree for starting?
  • 32. Cyclic interchange Wee-3: Trees 32 • The distance between two spanning trees of a graph G is defined as the number of edges of G present in one tree but not in the other • Written as d(Ti ,Tj) d(Ti ,Tj) = 1 2 N(Ti ⊕ Tj ) *N(g) denote the number of edges in a graph g
  • 33. Metric Wee-3: Trees 33 The distance between the spanning trees of a graph is a metric. That is, it satisfies- 1. d(Ti, Tj) ≥ 0 and d(Ti, Tj) = 0 if and only if Ti = Tj, 2. d(Ti, Tj) = d(Tj, Ti), 3. d(Ti, Tj) ≤ d(Ti, Tk) + d(Tk, Tj).
  • 34. Spanning Trees In A Weighted Graph • Edges have weights • Minimal spanning tree • Kruskal’s or Prim’s algorithm Wee-3: Trees 34