DMGT-module6 and 7
DMGT-module6 and 7
Module 7
Overview
Trees Chromatic number
Spanning trees Chromatic partitioning
Spanning tree algorithms Chromatic polynomial
Tree traversals Matching
Fundamental cycles and Four colour problem
cut-sets
Bipartite graphs
Trees
Definition
A connected graph without any cycles is called a tree.
1. Obviously a tree has to be a simple graph, since loops and parallel
edges from cycles.
𝐺5
Properties of Trees
1. An undirected graph is a tree 𝑖𝑓𝑓 there is a unique simple
path between every pair of vertices.
G:
a a
b c
b c
e d e f g
d
h i j k
f g h
𝑇2
𝑇1
Properties
1. The number n of vertices of a full binary tree is odd and the
(𝑛+1)
number of pendant vertices (leaves) of the tree is equal to .
2
G: T:
G G−𝑒1 T
Properties
1. Every connected graph has at least one spanning tree
2. An edge in a spanning tree 𝑻 − 𝑩𝒓𝒂𝒏𝒄𝒉 of 𝑇
3. An edge that is not in a given spanning tree 𝑻 − 𝑪𝒉𝒐𝒓𝒅 of 𝑇
4. For a spanning tree 𝑇 of a connected graph 𝐺 with 𝑛 vertices and
𝑚 edges, there are 𝑛 − 1 tree branches and 𝑚 − 𝑛 + 1 chords
5. Number of branches = 𝑟 = Rank
6. Number of chords = 𝜇 = Nullity (Cyclomatic number)
Minimum Spanning Trees
𝐺 - Weighted graph with weights on the edges
Minimum Spanning Tree:
A spanning tree with smallest weight in a weighted graph 𝐺.
𝐺: 𝑇:
𝑑 c 𝑐
3
We first arrange the edges in the increasing order of the edges and
proceed as per Kruskal’s algorithm.
Included in the If not included,
Edges Weight
spanning tree or not circuit formed
𝑎𝑒 2 Yes −
𝑐𝑑 3 Yes −
𝑎𝑐 4 Yes −
𝑐𝑒 4 No 𝑎−𝑒−𝑐−𝑎
𝑎𝑏 6 Yes −
𝑏𝑐 6 No 𝑎−𝑏−𝑐−𝑎
𝑏𝑒 6 - −
𝑑𝑒 7 - −
𝑎𝑑 8 - −
𝑏𝑑 8 - −
Since there are 5 vertices in the graph, we should stop the procedure
for finding the edges of the minimum spanning tree, when 4 edges have
been found out.
The edges of the minimum spanning tree are 𝑎𝑒, 𝑐𝑑, 𝑎𝑐 and 𝑎𝑏,
whose total length is 15.
G: b a e d c
Tree Traversal
A traversal in a tree is a process to traverse (walk along) a tree in a
systematic manner so that each vertex is visited and processed
exactly once.
Postorder traversal:
T: a
b c
𝑇1 𝑇2
d e f
𝑇1 and 𝑇2 are the subtrees of the given binary tree 𝑇 with 𝑏 and 𝑐 as the
roots respectively,
The preorder traversal of 𝑇 visits the root 𝑎 first and then
traverses 𝑇1 and 𝑇2 in preorder.
b c
𝑇1 𝑇2
d e f
The inorder traversal of 𝑇 traverses 𝑇1 in inorder first, then
visits the root 𝑎 and finally traversal 𝑇2 in inorder.
But the inorder traversal of 𝑇1 processes 𝑑, 𝑏 and 𝑒 in that
order and the inorder traversal of 𝑇2 processes 𝑐 and then 𝑓.
Thus, the inorder traversal of 𝑇 is 𝑑 𝑏 𝑒 𝑎 𝑐 𝑓.
T: a
b c
𝑇1 𝑇2
d e f
The postorder traversal of 𝑇 processes 𝑇1 , then 𝑇2 in postorder
and finally visits 𝑎.
T: a
b c
𝑇1 𝑇2
d e f
Expression Trees
Binary trees can be used to represent algebraic expressions, as such
representation facilitate the computer evaluation of expressions.
The operation at each internal vertex operates on its left and right
subtrees from left to right.
We can represent expression in three different ways by using binary
trees. They are known as 𝑰𝒏𝒇𝒊𝒙, 𝑷𝒓𝒆𝒇𝒊𝒙 𝑎𝑛𝑑 𝑷𝒐𝒔𝒕𝒇𝒊𝒙 𝑓𝑜𝑟𝑚𝑠 of
an expression.
Infix Notation:
The Standard of representing an expression in which the operator is
placed between its operands is called the infix form of the
expression. 𝐺: *
Here the expression (( 𝒂 + 𝒃) ∗ (𝒄/𝒅))
+ /
is the binary tree represented of 𝐺.
𝑎 𝑏 𝑐 𝑑
Prefix Notation:
+ /
𝑎 𝑏 𝑐 𝑑
Postfix Notation:
+ /
𝑎 𝑏 𝑐 𝑑
Fundamental Circuits
Let T be a spanning tree in a connected graph G. Adding any one
chord to T will create a cycle.
𝑇: 𝑇 + 𝑒1 :
G: a b G: a b G: a b
d c d c d c
4 colors 3 colors 2 colors
Partitioning
Grouping the vertices into different sets based on the colors.
There are 4 partitions namely {a}, 𝑏 , 𝑐 , 𝑑
There are 3 partitions namely 𝑎, 𝑐 , 𝑏 , 𝑑
There are 2 partitions namely 𝑎, 𝑐 , {𝑏, 𝑑}
Chromatic number
Proper coloring: Coloring all the vertices of a graph such that no
two adjacent vertices receive the same color (EASY)
Minimum number of colors needed for proper coloring a graph 𝐺 is
called chromatic number of 𝐺 (denoted by 𝜅(𝐺)). The graph 𝐺 is
called -chromatic graph. (DIFFICULT)
A graph with only isolated vertices - 1-chromatic
A path on 𝑛 vertices - 2-chromatic
A tree with 2 or more vertices- 2- chromatic
A bipartite graph - 2-chromatic
A complete graph on 𝑛 vertices - 𝑛-chromatic
Try this!
Characterization of 2-chromatic graphs
Theorem:
A graph 𝐺 is 2-chromatic if and only if 𝐺 is bipartite.
Chromatic Polynomial
𝑃(𝐺, 𝝀) is the chromatic polynomial of a graph 𝐺 on 𝑛 vertices equal
to the number of different ways of properly coloring the graph
using at most 𝞴 colors.
𝑮:
𝞴 𝞴−𝟏 𝞴−𝟏 𝞴−𝟏 𝞴−𝟏 𝞴−𝟏 𝞴−𝟏 𝞴−𝟏
𝑃 𝐺, 𝝀 = 𝞴(𝞴 − 1)7
Theorem:
Let 𝐺 be a path on 𝑛 vertices then 𝑃 𝐺, 𝝀 = 𝞴 𝞴 −1 𝑛−1
Theorem:
An 𝑛-vertex graph is a tree (or a Path) if and only if its chromatic
polynomial is 𝑃(𝑃𝑛 , 𝝀) = 𝝀 (𝝀 − 1)𝑛−1
Theorem:
Let 𝐺 be an empty graph on 𝑛 vertices then 𝑃 𝐺, 𝞴 = 𝞴𝑛
𝑮: 𝞴 𝞴
𝞴 𝞴
𝑃 𝐺, 𝞴 = 𝞴5
Theorem:
Let 𝐺 be a complete graph on 𝑛 vertices then
𝑮: 𝞴
𝞴−𝟑
𝞴−𝟐 𝞴−𝟏
𝑮
𝑮𝟏 𝑮𝟐 𝞴
𝞴−𝟑
𝞴−𝟐 𝞴−𝟏
𝑃 𝐺, 𝝀 = 𝑃 𝐺1 , 𝞴 𝑃 𝐺2 , 𝞴
= 𝞴(𝞴 − 1)3 𝞴(𝞴 − 1)(𝞴 − 2)(𝞴 − 3)
= 𝞴2 (𝞴 − 1)4 (𝞴 − 2)(𝞴 − 3)
Decomposition Theorem:
Let 𝑒 be any edge in 𝐺, where 𝑢 and 𝑣 are end vertices of 𝐺.
Let 𝐺𝑒 be a graph obtained by deleting the edge 𝑒 from 𝐺.
Let 𝐺𝑒′ be a simple graph obtained from 𝐺 by fusing the
vertices 𝑢 and 𝑣 together and replacing sets of parallel edges
with single edges.
Then 𝑃 𝐺, 𝝀 = 𝑃 𝐺𝑒 , 𝝀 − 𝑃(𝐺𝑒′ , 𝝀)
𝑮 𝑥 𝑢
𝑒
𝑤
𝑦 𝑣
𝑥 𝑢 𝑥 𝑢=𝑤
𝑯𝟏 ≅ 𝑮 𝒆 𝑤 𝑒 𝑯𝟐 ≅ 𝑮′𝒆
𝑦 𝑣 𝑦 𝑣
𝑥 𝑢 𝑥 𝑢=𝑣
𝑯𝟑 ≅ 𝑮 𝒆 𝑯𝟒 ≅ 𝑮′𝒆
𝑦 𝑣 𝑦
𝑃 𝐺, 𝝀 = 𝑃 𝐺𝑒 , 𝝀 − 𝑃(𝐺𝑒′ , 𝝀)
= 𝑃 𝐻1 , 𝝀 − 𝑃(𝐻2 , 𝝀)
= 𝑃 𝐻1 , 𝝀 − 𝑃 𝐻3 , 𝝀 − 𝑃(𝐻4 , 𝝀)
𝑷(𝑮, 𝝀) = 𝝀 𝝀 − 𝟏 𝟒 − 𝝀 𝝀−𝟏 𝟑 − 𝝀(𝝀 − 𝟏)(𝝀 − 𝟐)
Matching
A set of edges in which no two vertices are adjacent in 𝐺
G: e Here,
e
G:
a b Here {(𝑎, 𝑒), (𝑎, 𝑑), (𝑏, 𝑓), (𝑐, 𝑓)}
f is an edge cover
d c
G: e
d c
Four Color Theorem
The four-color theorem states that any map in a plane can be colored
using four-colors in such a way that regions sharing a common
boundary (other than a single point) do not share the same color.
f
a b
e
d c
G:
a b
e f
d c