2 Tree and Fundamental Circuits
2 Tree and Fundamental Circuits
Circuits
• Tree is a connected simple graph without any circuits.
• As a graph must have at least one vertex, and therefore so must a
tree. A tree without any vertices is called null tree.
• Similarly, considering only finite graphs, our trees are also finite.
• a tree has to be a simple graph, that is, having neither a self-loop
nor parallel edges.
𝐸 𝑣 = max 𝑑(𝑣, 𝑣𝑖 )
𝑣𝑖 ∈ 𝐺
• A vertex with minimum eccentricity in graph G is called a center of
graph G.
• The tree with two vertices having the same minimum eccentricity
has two centers (bicenters).
1
𝑝+3 𝑛−𝑝−1 +2 =𝑛−1
2
𝑛+1
𝑝=
2
• A nonpendant vertex in a tree is called an internal vertex.
• The number of internal vertices in a binary tree is one less than
the number of pendant vertices.
• In a binary tree a vertex vi is said to be at level li if vi is at a distance
of li from the root. The root is at level 0.
• The maximum number of vertices possible in a k-level binary tree
is
20 + 21 + … + 2𝑘 = 2𝑘+1 − 1 ≥ 𝑛
• The maximum level, lmax of any vertex in a binary tree is call the
height of the tree.
• The minimum possible height of an n-vertex binary tree is
𝑚𝑖𝑛𝑙𝑚𝑎𝑥 = 𝑙𝑜𝑔2 𝑛 + 1 − 1
• The maximum possible height of an n-vertex binary tree is
𝑛−1
𝑚𝑎𝑥𝑙𝑚𝑎𝑥 =
2
• The path length of a tree, can be defined as the sum of the path
lengths from the root to all pendant vertices.
• The path length for the below given tree is 1 + 3 + 4 + 4 + 3 + 4 + 4
= 23.
• Where lj is the level of pendant vertex vj, and the sum is taken over
all pendant vertices.
Examples
• How many edges does a full binary tree with 1000 internal
vertices have?
• Suppose 1000 people enter a chess tournament. Use a rooted tree
model of the tournament to determine how many games must be
played to determine a champion, if a player is eliminated after one
loss and games are played until only one entrant has not lost.
(Assume there are no ties.)
• Given N coins, all may be genuine or only one coin is defective. We
need a decision tree with atleast (2N + 1) leaves correspond to the
outputs. Because there can be N leaves to be lighter, or N leaves to
be heavier or one genuine case, on total (2N + 1) leaves.
• As explained earlier ternary tree at level k, can have utmost
3k leaves and we need a tree with leaves of 3k > (2N + 1).
• In other words, we need atleast k > log3(2N + 1) weighing to find the
defective one.
On Counting Trees
• Arthur Cayley discovered trees while trying to count the number
of structural isomers of the saturated hydrocarbons CkH2k+2.
• Corresponding to their chemical valences, a carbon atom was
represented by a vertex of degree four and a hydrogen atom by a
vertex of degree one (pendent vertices).
• The total number of vertices in such a graph is
𝑛 = 3𝑘 + 2
• And total number of edges is
1 1
𝑒 = 𝑠𝑢𝑚 𝑜𝑓 𝑑𝑒𝑔𝑟𝑒𝑒𝑠 = 4𝑘 + 2𝑘 + 2 = 3𝑘 + 1
2 2
• Since the graph is connected and the number of edges is one less
than the number of vertices, it is a tree.
• Thus the problem of counting isomers of a given hydrocarbon
becomes the problem of counting trees (with certain qualifying
properties).
• The question: What is the number of different trees that one can
construct with n distinct (or labeled) vertices?
• n = 4.
• A graph in which each vertex is assigned a unique name or label as
shown in the fig. 3.15 is called a labeled graph.
• The difference between labeled and unlabelled graph is very
important when we are counting the number of different graphs.
• No. of different graphs with 4 unlabelled vertices are only two.
Theorem:
The number of labeled trees with n vertices (n ≥ 2) is nn-2.
Cayley’s Formula
• Theorem: There are nn-2 labeled trees with n vertices ( n ≥ 2).
• Proof: Let the n vertices of a tree T be labeled 1,2,3,….,n.
• Remove the pendant vertex (and the edge incident on it) having the
smallest label, which is, say a1. Suppose that b1 was the vertex adjacent
to a1. Add b1 to the resultant sequence.
• Among the remaining n-1 vertices let a2 be the pendant vertex with the
smallest label, and b2 be the vertex adjacent to a2. Remove the edge
(a2,b2).
• This operation is repeated on the remaining n-2 vertices and the
process is stopped after n-2 steps, when only two vertices are left.
• The tree uniquely defines the sequence
(b1,b2,…, bn-2) → (1)
• E.g.
• Conversely, given a sequence n-2 labels, an n-vertex tree can be
constructed uniquely, as follows:
1,2,3,…,n → (2)
• Determine the first number from the sequence (2) that does not
appear in sequence (1).
• This number clearly is a1. And thus the edge (a1,b1) is defined.
• Remove b1 from (1) and a1 from (2).
• Repeat the process until the sequence (1) is empty.
• Finally the last two vertices in (2) are joined.
• E.g. Given the sequence (4,4,3,1,1), construct the spanning tree.
Construct all the spanning trees using
Cayley’s formula for K4.
Generating Prufer Code from the tree
1. Find the smallest leaf node of the given tree. Let it be x. Let the
neighbor of x be y.
2. Add the value of y in a list.
3. Remove node x from the tree.
4. Repeat step 1 to 3 until there are only 2 nodes remaining.
5. The list contains the Prufer Code.
Example are leaf nodes and the blue nodes are the smallest leaf node
for the tree.
Example