0% found this document useful (0 votes)
28 views60 pages

Graph DiscreteMath SKSaha

graph theory
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views60 pages

Graph DiscreteMath SKSaha

graph theory
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Graph Theory

Instructor
Sujan Kumar Saha
Associate Professor
CSE, NIT Dgp
([email protected])
These slides are made for classroom teaching only,
Concepts and figures primarily taken from the book:
GRAPH THEORY, by Narsingh Deo, PHI
The KÖnigsberg Bridge Problem
➢ Solved by Euler in 1736. (1st paper of graph theory)
➢ Königsberg is a city on the Pregel river in Prussia
➢ The city occupied 2 islands + areas on both banks
➢ Problem: Whether start from home, cross every
bridge exactly once, and return home.

Graph Theory Ch. 1. Fundamental Concept 2


Seating Problem
➢ n members on lunch in a round table --- will seat
such a way that each member have different
neighbours each day ---- how many such
arrangements possible?

Try with 5 vertices


and find how many
possibilities?

September 3, 2024 SKSaha 3


What Is a Graph?

➢ A graph G is a triple consisting of:


❖ A vertex set V(G )
❖ An edge set E(G )
❖ A relation between an edge and a pair of vertices

Graph Theory Ch. 1. Fundamental Concept 4


Loop, Multiple edges

➢ Loop : An edge whose endpoints are equal


➢ Parallel edges : Edges have the same pair of
endpoints (also known as, multiple edges)
➢ Simple Graph : No Parallel edges and Loops

Parallel
edges
loop
It is a simple graph.

Graph Theory Ch. 1. Fundamental Concept 5


Adjacent, neighbors

➢ Two vertices are adjacent and are neighbors if


they are the endpoints of an edge
A B
➢ Example:
❖ A and B are adjacent
❖ A and D are not adjacent
C D

➢ Finite graph : a graph whose vertex set and edge


set are finite
❖ Otherwise, infinite graph.

Graph Theory Ch. 1. Fundamental Concept 6


Incidence and Degree

➢ Incident: When a vertex vi is an end vertex of an edge ej,


then vi and ej are incident to each other.
➢ Adjacent: Two non-parallel edges are adjacent if they are
incident on a common vertex. Similarly for vertices.
➢ Degree: The number of edges incident on a vertex vi, with
self loop counted twice, is called the degree of the vertex.

✓ e2 and e7 → incident to v4
✓ e2 and e7 → are adjacent
✓ e4 and e5 → not adjacent
✓ v4 and v5 → are adjacent
✓ d(v2) = 4
✓ d(v1) = 3

Graph Theory Ch. 1. Fundamental Concept 7


Degree of a Graph
➢ Sum of degree of all vertices is twice number of edges.

➢ Theorem: The number of vertices of odd degree in a graph is


always even.
Proof: Consider vertices of odd degree and even degree
separately, then,

The whole part is even (2*e). The first part is always even.
So,

As each of d(vk) is odd, total number of terms must be even to


make the sum an even number.
September 3, 2024 SKSaha 8
More definitions

➢ Regular Graph: A graph with all vertices are of equal degree.


➢ Isolated Vertex: A vertex having no incident edge.
❖ Vertex of degree zero.
➢ Pendant Vertex: A vertex of degree one.
➢ Null Graph: The edge set is empty, graph without edge.
❖ Edge set can be empty but vertex set must be non-empty

September 3, 2024 SKSaha 9


1.12. Prove: Max no. edges in simple graph with n vertices is n(n-1)/2

The graph is simple, no parallel edge or loop exist. Therefore,


maximum degree of each vertex will be one less than the total
number of vertices.
degree, d(v) = n – 1

We know that the sum of the degree in a simple graph is,


∑d(v)=2E (E is the number of edges)

Here d(v) = n - 1 and we have n vertices in total


∑d(v) = n (n - 1)

So, n (n - 1) = 2E
Then, E = n (n − 1 ) / 2 proved.
September 3, 2024 SKSaha 10
More Problems

➢ Prove that a connected graph with n vertices has at


least n−1 edges
✓ We will prove the contrapositive, i.e., a graph G
with m ≤ n−2 edges is disconnected. From the result
of the previous problem, we know that the number
of components of G is at least
n − m ≥ n − (n − 2) = 2
means that G is disconnected. This proves the claim.

➢ What is the maximum number of vertices in a


connected graph of n edges?

September 3, 2024 SKSaha 11


Isomorphism

➢ Two graphs are equivalent.


❖ One to one correspondence between their vertices and
edges – so that incidence relationship is preserved.

September 3, 2024 SKSaha 12


Isomorphism?

➢ Two isomorphic graphs must have:


❖ Same number of vertices
❖ Same number of edges
❖ Equal number of vertices of a given degree.
➢ Is it complete?

These graphs are Not Isomorphic! --- why?


❖ 2 pendant vertices are adjacent to x (degree 3) – but
one pendant with y (degree 3)
❖ No clear list so far. Open problem!
September 3, 2024 SKSaha 13
Subgraph

➢ A graph g is subgraph of another graph G if


❖ All the vertices and edges in g – are also in G
❖ Each edge of g has same end vertices as in G.
➢ Edge Disjoint Subgraph
❖ Two subgraphs g1 and g2 of G are edge disjoint if
❖ They do not have any edge in common

September 3, 2024 SKSaha 14


Walk and Path

➢ Walk: a finite alternating sequence of vertices and edges,


beginning and ending with vertices, such that each edge is
incident with the vertices preceding and following it.
❖ No edge appears more than once in a walk.
❖ A vertex may appear more than once.
❖ Beginning and ends vertices are called its terminal vertices.
❖ If, begin vertex = end vertex, it is called a closed walk
❖ Otherwise, open walk.
➢ Path: An open walk in which no vertex appears more than
once is called a path (or simple path or elementary path).
❖ The number of edges in a path is called the length of a path
❖ Self-loop can be included in a walk but not in a path
❖ Terminal vertices of a path are of degree one, and the rest of the
vertices (called intermediate vertices) are of degree two
September 3, 2024 SKSaha 15
Circuit

➢ A closed walk in which no vertex (except the initial and the


final vertex) appears more than once is called a circuit.
➢ Every vertex in a circuit is of degree two
➢ Every self-loop is a circuit.

September 3, 2024 SKSaha 16


Connected Graph and Components

➢ A graph G is said to be connected if there is at least one path


between every pair of vertices in G.
➢ Otherwise, G is disconnected.
➢ A disconnected graph consists of two or more connected
graphs; each of these connected subgraphs is called a
component.
➢ A component itself is a graph.

September 3, 2024 SKSaha 17


Theorem 3

A simple graph with n vertices and k components can have at


most (n - k)(n - k + 1)/2 edges.

Maximum number of edges in the ith component of G is ni * (ni - 1) / 2. In the


whole graph, Maximum number of edges is sum of edges in each component.

September 3, 2024 SKSaha 18


Theorem 3: proof (other way)

➢ The maximum number of edges is achieved when


all of the components except one have one vertex.
➢ So, k-1 components have no edges at all, single
vertex.
➢ Sum of vertices is k – 1.
➢ The kth component contains (n - (k-1)) vertices.
#edges = n (n − 1 ) / 2, no. of vertices = n

➢ So, it has, (n - k)(n - k + 1)/2 edges.

September 3, 2024 SKSaha 19


Theorem on Connected Components

Prove that every graph with n vertices and k edges has at least
n − k connected components.
Proof by induction on k the number of edges.
➢ Base case: for k=0 the claim holds as we have n isolated
vertices and thus, n (= n−0) connected components.
➢ Inductive Hypothesis: suppose the claim holds for all k ≥ 0.
So, graph with n vertices & k edges at least n−k components.

n =6, k =3, n =6, k =3, n =6, k =3,


3 components 3 components 4 components

September 3, 2024 SKSaha 20


Theorem Contd..

➢ Inductive Step: Suppose we now have k+1 edges.


✓ We want to prove that a graph, G, with n vertices and k +

1 edges has at least n − (k + 1) connected components.


✓ Consider a subgraph G′ of G obtained by removing any

arbitrary edge from G. The graph G′ has n vertices and k


edges. By induction hypothesis, G′ has at least n − k
connected components.
✓ Now add the edge to G′. Two cases:

➢ Case 1) Add the edge to connect two components. The


number of connected components decreased by 1. Then the
number of connected components is n−k−1=n−(k+1).
➢ Case 2) We add an edge within a connected component.
Then we have same number of connected components as G′.
n−k ≥ n−(k+1). ---- so, at least n−(k+1) components… proved
September 3, 2024 SKSaha 21
Euler Graph

➢ If in a graph G, there exists a closed walk running through


every edge of G exactly once, then such a walk is called an
Euler line or Euler circuit.
➢ A graph that consists of an Euler line is called an Euler graph.
➢ Euler graph is always connected.
➢ Tips: find if the graph can be drawn in one continuous line
without retracing and without lifting the pencil.

September 3, 2024 SKSaha 22


Theorem 4

Prove: A given connected graph G is an Euler graph if and only


if all vertices of G are of even degree.
Necessary: Let G be a graph that has an Euler circuit.
❖ Every time we arrive at a vertex during our traversal of G,
we enter via one edge and exit via another.
❖ Thus there must be an even number of edges at every vertex.

❖ Therefore, every vertex of G has even degree.

Sufficient: Assume each vertex of G has an even degree, then


show that G is Eulerian.
❖ We construct a walk starting at an arbitrary vertex v and
visit edges of G -- no edge is traced more than once.
❖ We continue tracing as far as possible.
❖ Since every vertex is of even degree, we can exit from every
vertex we enter; the tracing will stop at v. (Contd..)
September 3, 2024 SKSaha 23
Theorem 4 : contd..

❖ And since v is also of even degree, we shall eventually reach


v when the tracing comes to an end.
❖ If this closed walk h includes all edges of G, G is Euler graph.
❖ If not, remove all the edges in h from G to get subgraph h’.
❖ Degrees of the vertices of h' are also even.
❖ h' must touch h at least at one vertex a, as G is connected.
❖ Starting from a, again construct a new walk in graph h’.
❖ Since even degree, this walk in h' must terminate at vertex a.
❖ This walk in h' can be combined with h to form a new walk,
which starts and ends at vertex v and has more edges than h.
❖ This process can be repeated until we obtain a closed walk
that traverses all the edges of G.
❖ Thus G is an Euler graph.
September 3, 2024 SKSaha 24
Operation on Graph

➢ The union of two graphs G1 = (V1, E1) and G2 = (V2 , E2 ) is another


graph G3 (written as G3 = G1 U G2 ) whose vertex set V3 = V1 U V2 and
the edge set E3 = E1 U E2.
➢ The intersection G1 ∩ G2 of graphs is a graph G4 consisting only of those
vertices and edges that are in both G 1 and G2.
➢ The ring sum G1 ⊕ G2 is a graph consisting of the vertex set V1 U V2
and of edges that are either in G1 or G2 , but not in both.

September 3, 2024 SKSaha 25


Hamiltonian Circuit
➢ A Hamiltonian circuit in a connected graph is defined as a
closed walk that traverses every vertex of G exactly once,
except the starting vertex, at which the walk also terminates.
❖ Hamiltonian circuit in a graph of n vertices consists of exactly n edges.
➢ What is a necessary and sufficient condition for a connected
graph G to have a Hamiltonian circuit? (Hamilton, 1859)

September 3, 2024 SKSaha 26


Hamiltonian Path
➢ If we remove any one edge from a Hamiltonian circuit, we
are left with a path. This path is called a Hamiltonian path.
❖ Hamiltonian path in a graph G traverses every vertex of G.
❖ The length of a Hamiltonian path (if it exists) in a connected graph of
n vertices is n – l
➢ Every graph that has a Hamiltonian circuit also has a
Hamiltonian path. (subgraph)
➢ There are many graphs with Hamiltonian paths that have no
Hamiltonian circuits. (Draw such a Graph)

September 3, 2024 SKSaha 27


Hamiltonian Circuit

➢ Draw a Graph that is Hamiltonian but not Eulerian.

September 3, 2024 SKSaha 28


Hamiltonian Circuit

➢ Does Petersen Graph contain Hamiltonian Path or Circuit?

➢ Any complete graphs of three or more vertices contains


Hamiltonian Circuit. (How to prove?)

September 3, 2024 SKSaha 29


Theorem on HC

➢ Let G be a (finite and simple) graph with n ≥ 3


vertices. We denote by deg(v) the degree of a
vertex v in G.
➢ Dirac's theorem: when each vertex has degree at
least n/2, the graph is Hamiltonian
➢ Ore's theorem: if deg(v) + deg(w) ≥ n for every
pair of distinct non-adjacent vertices v and w of
G, then G is Hamiltonian.

➢ Proof:

September 3, 2024 SKSaha 30


Planar Graph
➢ A graph G is said to be planar if there exists some
geometric representation of G which can be drawn on a
plane such that no two of its edges intersect.
➢ A graph that cannot be drawn on a plane without a
crossover between its edges is called nonplanar.
➢ A drawing of a geometric representation of a graph on any
surface such that no edges intersect is called embedding.
➢ Thus, a geometric graph G is planar if there exists a graph
isomorphic to G that is embedded in a plane.
➢ An embedding of a planar graph G on a plane is called a
plane representation of G.

Graph Theory 31
Kuratowski’s 2 Graphs: K5
The complete graph of five vertices? Planar?

▪ Finally, we have yet to draw


an edge between v 1 and v4.
▪ This edge cannot be placed
inside or outside the
pentagon without a
crossover.
▪ Thus the graph is not planar.

September 3, 2024 SKSaha 32


Kuratowski’s 2 Graphs: K3,3
➢ A regular connected graph with six vertices and nine edges
➢ Kuratowski's second graph is also nonplanar.
➢ Removal of one edge or a vertex makes both Kuratowski’s
graph planar.
➢ Kuratowski's first graph is the nonplanar graph with the
smallest number of vertices, and Kuratowski's second graph
is the nonplanar graph with the smallest number of edges.
Thus both are the simplest nonplanar graphs.

September 3, 2024 SKSaha 33


Region

➢ A plane representation of a graph divides the plane into


regions (also called windows, faces, or meshes)
➢ A region is characterized by the set of edges (or the set of
vertices) forming its boundary.
➢ Thus a region is a property of a specific plane representation
of a graph and not of an abstract graph per se.
➢ The portion of the plane lying outside a graph embedded in
a plane is infinite in its extent (e.g., 4). Such a region is called
the infinite, unbounded or exterior region for that plane.
➢ representation.

September 3, 2024 SKSaha 34


Region

➢ Given a plane graph G, a region or face is a maximal area S


such that x, y Є S implies that x, y can be joined by a curve
which does not meet any edge of the embedding.
➢ A graph with 7 faces/regions.

✓ A planar embedding G' of a graph G


can be transformed into another
embedding such that any specified face
becomes the exterior face.

September 3, 2024 SKSaha 35


Euler’s Theorem

A connected planar graph with v vertices and e edges has


(e - v + 2) regions.
➢ It will suffice to prove the theorem for a simple graph, because adding a
self-loop or a parallel edge simply adds one region to the graph and
simultaneously increases the value of e by one.
➢ Proof by induction on the number of edges in the graph.
➢ Base: If e = 0, the graph consists of a single vertex with a
single region surrounding it. So we have region = 0 − 1 + 2 =
1 which is clearly right.
➢ Induction: Suppose the formula works for all graphs with no
more than n edges. Let G be a graph with n + 1 edges.
➢ Case 1: G doesn’t contain a cycle. So, G is a tree.
For a tree, e - v = - 1. Then, e – v + 2 = 1.
A tree has one region, so, the formula works for trees.
September 3, 2024 SKSaha 36
Euler’s Theorem contd..

A connected planar graph with n vertices and e edges has


(e - v + 2) regions. i.e., r = e – v + 2 or, v – e + r = 2
➢ Case 2: G contains at least one cycle.

Pick an edge p on a cycle. Remove p to create a new graph G′.


Since the cycle separates the plane into two regions, the regions
to either side of p must be distinct.
When we remove the edge p, we merge these two regions.
So, G′ has one fewer regions than G.
Since G′ has n edges, the formula works for G′ by the induction
hypothesis. That is r′ = e′ − v′ + 2.
But v′ = v (no vertex deleted), e′ = e − 1, and r′ = r − 1.
Substituting, we get, r – 1 = (e − 1) – v + 2 = e – v + 1.
so, r=e–v+2 …. Proved!
September 3, 2024 SKSaha 37
Corollary

In any simple, connected planar graph with f regions, n


vertices, and e edges (e > 2), the following inequalities hold:

➢ Proof: Since each region is bounded by at least three


edges and each edge belongs to exactly two regions,
2e >= 3f or e >= 3/2 f
➢ Substituting for f from Euler's formula, f = e – n + 2
e >= 3/2(e – n + 2)
– 1/2e >= – 3/2 n + 3
e <= 3n – 6.

September 3, 2024 SKSaha 38


Planarity of a Graph

➢ K5 -- the complete graph of five vertices.


n = 5, e = 10, 3n – 6 = 15 – 6 = 9
So, e > 3n – 6 ------formula not satisfied! Non-planar!
➢ But the formula is necessary, not sufficient. Check for K3,3

n=6, e = 9, 3n – 6 = 18 – 6 = 12 ----- formula satisfied.


But the graph actually is non-planar.
➢ Why ‘3’ in the formula?

➢ Minimum number of edges in a face.

➢ However, if we observe the graph, no region in this graph


can be bounded with fewer than four edges.
➢ Hence, if this graph were planar, we would have

2e >= 4f and then, e >= 2(e – n + 2) or, e <= 2n – 4.


2n – 4 = 8, edges should be 8 or less, but e=9. So, not satisfied!
September 3, 2024 SKSaha 39
Elementary Reduction

Step 1: Since a disconnected graph is planar if and only if each of


its components is planar, we need consider only one component
at a time.
Step 2: Since addition or removal of self-loops does not affect
planarity, remove all self-loops.
Step 3: Since parallel edges also do not affect planarity, eliminate
edges in parallel by removing all but one edge between every
pair of vertices.
Step 4: Elimination of a vertex of degree two by merging two
edges in series does not affect planarity. Therefore, eliminate all
edges in series.
Repeated application of Steps 3 and 4 will usually reduce a
graph drastically.

September 3, 2024 SKSaha 40


Elementary Reduction

September 3, 2024 SKSaha 41


Planarity

➢ Let the nonseparable connected graph G, be reduced to a


new graph H after the repeated application of steps 3 and
➢ Graph H is
1. A single edge, or
2. A complete graph of four vertices, or
3. A nonseparable, simple graph with n > 5 and e > 7.
➢ We need to investigate only simple, connected, nonseparable
graphs of at least five vertices and with every vertex of
degree three or more.
➢ Next, we can check to see if e < 3n - 6.
➢ If this inequality is not satisfied, the graph H is nonplanar.
➢ If the inequality is satisfied, we have to test the graph further
with the Kuratowski's theorem.

September 3, 2024 SKSaha 42


Kuratowski's theorem

➢ Homeomorphic Graphs: Two graphs are homeomorphic if


one graph can be obtained from the other by the creation of
edges in series (i.e., by insertion of vertices of degree two) or
by the merger of edges in series.

➢ A graph G is planar iff every graph that is homeomorphic to


G is planar.
➢ A necessary and sufficient condition for a graph G to be
planar is that G does not contain either of Kuratowski's two
graphs or any graph homeomorphic to either of them.
➢ OR, A graph is planar if and only if it has no sub-graph
homeomorphic to K5 or to K3,3.
September 3, 2024 SKSaha 43
A non-planar graph: subgraph homomorphic to K3,3

September 3, 2024 SKSaha 44


Tree
➢ A Tree is a connected graph without any circuits
❖ A Tree must have at least one vertex
❖ Tree has neither a self-loop nor parallel edges
➢ An undirected graph in which any two vertices
are connected by exactly one path

Graph Theory 45
Theorem
Theorem: There is one and only one path between
every pair of vertices in a tree T.

Proof:
➢ Since T is a connected graph, there must exist at
least one path between every pair of vertices in T.
➢ Now suppose that between two vertices a and b of T
there are two distinct paths.
➢ The union of these two paths will contain a circuit.
➢ T cannot be a tree then.

September 3, 2024 SKSaha 46


Theorem: A tree with n vertices has n - 1 edges
Proof: By induction on the number of vertices.
➢ BASE: the theorem is true for n = 1 and 2.
➢ Assume, the theorem holds for all trees with #vertices < n.
➢ Let us now consider a tree T with n vertices.
➢ In T, let e_k be an edge with end vertices v_i and v_j
➢ There is no other path between v_i and v_j except e_k.
➢ Therefore, deletion of e_k from T will disconnect the graph.
➢ (T – e_k) consists of exactly two components (T1 & T2) , and
since no circuits, each of these components is a tree.
➢ T1 has n1 and T2 has n2 vertices. n1 + n2 = n.
➢ T1 has n1 – 1 edges, T2 has n2 – 1 edges. Sum = n1 + n2 – 2.
➢ Thus, (T – e_k) consists of n - 2 edges.
➢ Hence, T has exactly n – 1 edges.
September 3, 2024 SKSaha 47
Minimally Connected Graph

➢ A connected graph is said to be minimally connected if


removal of any one edge from it disconnects the graph.
➢ A minimally connected graph cannot have a circuit
❖ otherwise, we could remove one of the edges in the circuit and still
leave the graph connected.
➢ Thus a minimally connected graph is a tree.
➢ Theorem: A graph is a tree if and only if it is minimally
connected
➢ Let the graph G be minimally connected. Then, all nodes of G
are connected, and G has no cycles. Therefore is a tree.
➢ Conversely, let G be a tree. Then G is connected and contains
no cycles. Deletion of any edge from G disconnects the
graph. Hence G is minimally connected.

September 3, 2024 SKSaha 48


Summarize Tree

➢ A graph G with n vertices is called a tree if


❖ G is connected and is circuit less, or
❖ G is connected and has n - 1 edges, or
❖ G is circuit-less 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.

September 3, 2024 SKSaha 49


Pendant Vertex

➢ Tree has some number of pendant vertices.


➢ A non-pendant vertex in a tree is called an internal vertex

➢ A tree of n vertices we have n - 1 edges


➢ One edge adds two degrees (two adjacent vertices)
➢ Hence 2(n - 1) degrees to be divided among n vertices.
➢ Since no vertex can be of zero degree (connected), each
vertex contributes at least 1 to the sum.
➢ So, we must have at least two vertices of degree one in a tree.

➢ Theorem: In any tree (with two or more vertices), there are at


least two pendant vertices.

September 3, 2024 SKSaha 50


Another Proof

➢ Theorem: In any tree (with two or more vertices), there are at


least two pendant vertices.

➢ Let T be a tree with n (n > 1) vertices.


➢ The number of edges in T is n−1.
➢ Sum of degrees in T is 2(n−1), that is, ∑di = 2(n−1).
➢ Assume T has exactly one pendent vertex (v1), and all the
other (n−1) vertices have degree >= 2.
➢ Then sum of degrees is (at least)
d(v1)+d(v2)+. . .+d(vn) = 1+2+2+. . .+2 = 2(n−1) + 1.
➢ But ∑di = 2(n−1) → to make the sum 2(n-1) we need at least
one more vertex of degree one.
➢ Hence T has at least two vertices of degree one.
September 3, 2024 SKSaha 51
Distance

➢ In a connected graph G, the distance d(vi, vj) between two of


its vertices vi and vj is the length of the shortest path (i.e., the
number of edges in the shortest path) between them.
❖ In a graph that is not a tree, there are generally several paths between
a pair of vertices. We have to enumerate all these paths and find the
shortest one (can be multiple).
➢ 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.

September 3, 2024 SKSaha 52


Eccentricity and Centre

➢ The eccentricity E(v) of a vertex v in a graph G is the


distance from v to the vertex farthest from v in G; that is,
E(v) = max vi Є G d(v, vi)

➢ A vertex with minimum eccentricity in graph G is called a


center of G.
❖ 2 centers of the above graph.
➢ How many centers does a tree have?

September 3, 2024 SKSaha 53


Theorem: Every tree has either one or two centers

➢ The maximum distance, max d(v, vi), from a vertex v to any


other vertex vi occurs only when vi is a pendant vertex.
➢ Start with a tree T having more than two vertices.

➢ Tree T must have two or more pendant vertices.

➢ Delete all the pendant vertices from T. The resulting graph T'
is still a tree.
➢ Continue this process until there is left either a vertex (center
of T, only center) or an edge (with 2 vertices i.e. 2 centers)

September 3, 2024 SKSaha 54


Binary tree

➢ A tree in which one vertex (called the root) is distinguished


from all the others is called a rooted tree.
➢ A binary tree is defined as a tree in which there is exactly one
vertex of degree two and each of the remaining vertices is of
degree one or three.
❖ Obviously, a binary tree has three or more vertices.
➢ Degree 2 vertex is distinct from others, it serves as the root.
➢ Theorem: Every binary tree has an odd number of vertices.
➢ Proof: Apart from the root, every vertex in a binary tree is of
odd degree.
➢ We know, #vertices with odd degree is even number.
➢ Therefore when the root (which is of even degree) is added to
this number, the total number of vertices become odd.

September 3, 2024 SKSaha 55


Binary tree ..

➢ There are (n+1)/2 pendant vertices in any binary tree with n


vertices.
➢ Proof: Let T be a binary tree with n vertices.
➢ Let q be the number of pendant vertices in T.
➢ Therefore there are n−q internal vertices in T
➢ n−q−1 vertices are of degree 3.
➢ The number of edges in T = ½(root + pendant + internal)
= 1/2 [3(n−q−1) + 2 + q]
➢ But the number of edges in T is n−1 (as T is a tree).
➢ Hence, 1/2 [3(n−q−1)+2+q] = n−1
…..
q = (n+1)/2.

September 3, 2024 SKSaha 56


Binary Tree… level, height

➢ In a binary tree a vertex v is said to be at level L if v is at a


distance of L from the root.
❖ Thus the root is at level 0.
❖ There can be only one vertex (the root) at level 0, at most two vertices
at level 1, at most four vertices at level 2, and so on.
➢ Therefore, the maximum number of vertices possible in a k-
level binary tree is
20 + 21 + 22 + 23 + … + 2k = ….
➢ The maximum level Lmax of any vertex in a binary tree is
called the height of the tree.
➢ Minimum possible height of an n-vertex binary tree is
ceiling[log2 (n + 1) – 1]
➢ Maximum possible height is,
➢ ½(n - 1)
September 3, 2024 SKSaha 57
Labelled and unlabelled trees

➢ A graph in which each vertex is assigned a unique name or


label is called a labeled graph.
➢ If n = 4: we have ____ labelled trees and ____ unlabeled trees

September 3, 2024 SKSaha 58


Spanning Tree
➢ A tree T is said to be a spanning tree of a connected graph G
if T is a subgraph of G and T contains all vertices of G.
➢ Theorem: Every connected graph has at least one spanning
tree.
➢ Proof: G be a connected graph.
➢ If G has no cycles, then it is its own spanning tree.
➢ If G has cycles, then delete one edge from each cycles.
➢ G remains connected and cycle free and containing all the
vertices of G.
➢ So, it is the spanning tree.

September 3, 2024 SKSaha 59


End

You might also like