Module V - Graph Theory Notes.
Module V - Graph Theory Notes.
𝑣3 a 𝑣6
h
e
𝑣2
𝑣4 b
g
f c
𝒗𝟏 d 𝑣5
𝑣3
h
a 𝑣6 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ
0 0 0 1 0 1 0 0
e 𝑣1
𝑣2
𝑣4 0 0 0 0 1 1 1 1
b 𝑣2
0 0 0 0 0 0 0 1
f
g
c 𝑣3 1 1 1 0 1 0 0 0
𝑣4
𝑣5 0 0 1 1 0 0 1 0
𝒗𝟏 d 𝑣5
𝑣6 1 1 0 0 0 0 0 0
𝑣3
h
a 𝑣6 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ
0 0 0 1 0 1 0 0
e 𝑣1
𝒗𝟐
𝑣4 0 0 0 0 1 1 1 1
b 𝑣2
0 0 0 0 0 0 0 1
f
g
c 𝑣3 1 1 1 0 1 0 0 0
𝑣4
𝑣5 0 0 1 1 0 0 1 0
𝒗𝟏 d 𝑣5
𝑣6 1 1 0 0 0 0 0 0
𝒗𝟑
h
a 𝑣6 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ
0 0 0 1 0 1 0 0
e 𝑣1
𝑣2
𝑣4 0 0 0 0 1 1 1 1
b 𝑣2
0 0 0 0 0 0 0 1
f
g
c 𝑣3 1 1 1 0 1 0 0 0
𝑣4
𝑣5 0 0 1 1 0 0 1 0
𝒗𝟏 d 𝑣5
𝑣6 1 1 0 0 0 0 0 0
𝑣3
h
a 𝑣6 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ
0 0 0 1 0 1 0 0
e 𝑣1
𝑣2
𝒗𝟒 0 0 0 0 1 1 1 1
b 𝑣2
0 0 0 0 0 0 0 1
f
g
c 𝑣3 1 1 1 0 1 0 0 0
𝑣4
𝑣5 0 0 1 1 0 0 1 0
𝒗𝟏 d 𝑣5
𝑣6 1 1 0 0 0 0 0 0
𝑣3
h
a 𝑣6 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ
0 0 0 1 0 1 0 0
e 𝑣1
𝑣2
𝑣4 0 0 0 0 1 1 1 1
b 𝑣2
0 0 0 0 0 0 0 1
f
g
c 𝑣3 1 1 1 0 1 0 0 0
𝑣4
𝑣5 0 0 1 1 0 0 1 0
𝒗𝟏 d 𝒗𝟓
𝑣6 1 1 0 0 0 0 0 0
𝑣3
h
a 𝒗𝟔 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ
0 0 0 1 0 1 0 0
e 𝑣1
𝑣2
𝑣4 0 0 0 0 1 1 1 1
b 𝑣2
0 0 0 0 0 0 0 1
f
g
c 𝑣3 1 1 1 0 1 0 0 0
𝑣4
𝑣5 0 0 1 1 0 0 1 0
𝒗𝟏 d 𝑣5
𝑣6 1 1 0 0 0 0 0 0
1 1 0 0 0 0
1 1 1 0 1 0
0 0 1 1 0 0
0 0 0 1 1 1
0 0 0 0 0 1
Q1.
• Given the incidence matrix of G, draw the graph of G.
1 1 0 0 0 0
1 1 1 0 1 0
0 0 1 1 0 0
1 a 0 0 0 1 1 1
0 0 0 0 0 1
b 2
c e 5
3 f
d 4
Q2.
• Construct the incidence matrix A for the graph shown below
𝑒1 𝑣2 𝑒2 𝑣3
𝑣1
𝑒6 𝑒3
𝑒5 𝑒4
𝑣5 𝑣4
Q2.
• Construct the incidence matrix M for the graph shown below
𝑒1 𝑣2 𝑒2 𝑣3
𝑣1
𝑒6 𝑒3 e1 e2 e3 e4 e5 e6
𝑒5 𝑒4
𝑣5 𝑣4 v1 1 0 0 0 0 1
v2 1 1 0 1 1 0
M= v3 0 1 1 0 0 0
v4 0 0 1 1 0 0
v5 0 0 0 0 1 1
Q3.
• Consider the following disconnected graph G with two components.
Find the incidence matrix of G.
𝑣4 𝑒3 𝑣3 𝑣6
𝑒6 𝑒9
𝑒4 𝑒5 𝑒2 𝑣5
𝑒8 𝑣8
𝑣1 𝑒7
𝑒1 𝑣2 𝑣7
Q3.
• Consider the following disconnected graph G with two components.
Find the incidence matrix of G.
𝑣4 𝑒3 𝑣3 𝑣6
e1 e2 e3 e4 e5 e6 e7 e8 e9
𝑒6 𝑒9 v1 1 0 0 1 0 0 0 0 0
𝑒4 𝑒5 𝑒2 𝑣9
𝑒8 v2 1 1 0 0 1 0 0 0 0
𝑣8
v3 0 1 1 0 0 0 0 0 0
𝑣1 𝑒7 A(G) = v4 0 0 1 1 1 0 0 0 0
𝑒1 𝑣2 𝑣7 v5 0 0 0 0 0 1 1 0 0
v6 0 0 0 0 0 1 0 1 1
v7 0 0 0 0 0 0 1 1 0
v8 0 0 0 0 0 0 0 0 1
Circuit Matrix
• Let the number of different circuits in a graph G be q and the number
of edges in G be e. Then the circuit matrix 𝐵 = 𝑏𝑖𝑗 of G is a q by e,
(0,1) matrix defined as follows
𝑏𝑖𝑗 = 1, if 𝑖 𝑡ℎ circuit includes 𝑗𝑡ℎ edge, and
= 0, otherwise.
1 0 0 1 1 0 0 0 0 0
0 1 1 0 1 0 0 0 0 0
𝐵 𝐺 = 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 1 1 1 0 0
0 0 0 0 0 0 0 0 0 1
Theorem:
• Let B and A be respectively the circuit
matrix and the incidence matrix of a self
loop free graph, whose columns are 𝑣3
arranged using the same order of edges.
a
Then every row of B is orthogonal to h 𝑣6
𝒗𝟏 d 𝑣5
1 0 0 0
0 0 0 1 0 1 0 0 1 0 0 0 0 0 2 2
0 0 0 0 1 1 1 1 0 1 0 1 0 2 2 2
• 𝐴𝐵𝑇 = 0 0 0 0 0 0 0 1 × 0 0 1 1=0 0 0 0
1 1 1 0 1 0 0 0 0 1 0 1 2 2 0 2
0 0 1 1 0 0 1 0 0 0 1 1 0 2 2 2
1 1 0 0 0 0 0 0 0 1 1 0 2 0 0 0
0 0 0 0
≡ 0 𝑚𝑜𝑑2 .
Problem
• Verify 𝐴𝐵𝑇 = 𝐵𝐴𝑇 ≡ 0 𝑚𝑜𝑑2 , where B and A be respectively the
circuit matrix and the incidence matrix of the given graph
𝑣1 𝑒1 𝑣2 𝑒2 𝑣3
𝑒4 𝑒6
𝑒5 𝑒3
𝑣5
𝑣4
Path matrix
• Another (0,1) matrix often convenient to use in communication and
transportation networks is the path matrix.
• A path matrix is defined for a specific pair of vertices in a graph, say
(x,y) and is written as P(x,y).
• The rows in P(x,y) corresponds to different paths between the
vertices x and y and the column corresponds to the edges in G i.e. the
path matrix for (x,y) vertices is
1 𝑖𝑓 𝑗 𝑡ℎ 𝑒𝑑𝑔𝑒 𝑙𝑖𝑒𝑠 𝑖𝑛 𝑖 𝑡ℎ 𝑝𝑎𝑡ℎ
• 𝑝 𝑥, 𝑦 = 𝑃𝑖𝑗 where 𝑃𝑖𝑗 = ቊ
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Example
𝑣3
• Consider all paths from 𝑣3 to 𝑣4 , there are 3
different paths {h,e},{h,g,c},{h,f,d,c} h
a 𝑣6
2.
𝑣4 𝑣6 0 1 0 1 0 0 0 0
𝑒3 𝑣3
𝑒6 1 0 1 1 0 0 0 0
𝑒9 0 1 0 1 0 0 0 0
𝑒4 𝑒5 𝑣5 𝑣8 1 1 1 0 0 0 0 0
𝑒2 𝑒8
0 0 0 0 0 1 1 0
𝑒7 0 0 0 0 1 0 1 1
𝑣2 𝑣7 0 0 0 0 1 1 0 0
𝑣1 𝑒1
0 0 0 0 0 1 0 0
Observation about the adjacency matrix X of
a graph G
• The entries along the principal diagonal of X are all 0’s iff the graph
has no self-loops. A self-loop at the 𝑖 𝑡ℎ vertex corresponds to 𝑥𝑖𝑖 = 1
• The definition of adjacency matrix makes no provision for parallel
edges. This is why the adjacency matrix X was defined for graphs
without parallel edges.
• If the graph has no self loops (and no parallel) the degree of a vertex
equals the number of 1’s in the corresponding row or column of X.
• A graph G is disconnected and is in two components 𝑔1 and 𝑔2 iff its
adjacency matrix X(G) can be partitioned as 𝑋(𝑔1 ) 0
𝑋 𝐺 =
0 𝑋(𝑔2 )
• A graph G that requires 𝜅 different colors for its proper coloring and
no less is called a 𝜅 -chromatic graph and the number 𝜅 is called the
chromatic number of G.
• From the figure we can identify that the graph is 3-chromatic.
Basic fulfilling conditions
• In coloring graphs, there is no point in considering disconnected
graphs. (because coloring vertices in one component of a
disconnected graph has no effect on the coloring of the other
components).
• Therefore, we should consider coloring of connected graphs only.
• We should also consider only simple connected graphs (Self – loops
should be disregarded)
Coloring of Graph – Important observations
• A graph consisting of only isolated vertices is 1-chromatic.
• A graph with one or more edges (not a self-loop) is at least 2-
chromatic. (called bichromatic)
• A complete graph of n vertices is n-chromatic, as all its vertices are
adjacent. Hence a graph containing a complete graph of ‘r’ vertices is
at least ‘r’-chromatic.
• A graph consisting of simple one circuit with n>=3 vertices is 2 –
chromatic if n is even and 3-chromatic if n is odd.
Theorem 1: Every tree with two or more
vertices is 2-chromatic
Proof:
• Select any vertex ‘v’ in the given tree T.
• Consider T as a rooted tree at vertex ‘v’.
• Paint ‘v’ with color 1.
• Paint all vertices adjacent to ‘v’ with color 2.
• Now, paint the vertices adjacent to these (colored as 2) with color 1.
• Continue this process till every vertex in T is colored.
• What we find is alternate colors for all vertices along a path.
• There we can say; a tree is 2-chromatic, but not every 2-chromatic graph is
a tree.
Proper coloring of a tree
Theorem 2: A graph with at least one edge is 2-chromatic if
and only if it has no circuits of odd length.
Proof:
• Let G be a connected graph with circuits of only even lengths.
• Consider a spanning tree T in G.
• Using the coloring procedure and the theorem 1, we will color T with 2
colors. Add the chords to T one by one.
• Since G has no circuits of odd length, the end vertices of every chord being
replaced are different colored in T.
• Thus G is colored with 2 colors, with no adjacent vertices having the same
color. Therefore G is 2-chromatic.
• Conversely, if G has a circuit of odd length, we will need at least 3 colors for
that circuit.
Chromatic Polynomial
• We have seen, that a given graph G of n vertices can be properly
colored in many different ways using a sufficient large number of
colors.
• This property of a graph is expressed by means of a polynomial. This
polynomial is called the chromatic polynomial of G
• Definition:
• The value of the chromatic polynomial 𝑃𝑛 (𝜆) of a graph with 𝑛 vertices gives
the number of ways of properly coloring the graph, using 𝜆 or fewer colors.
Chromatic Polynomial
• Let 𝑐𝑖 be the different ways of properly coloring G using 𝑖 different colors.
𝜆 𝜆
• Since 𝑖 colors can be chosen out of 𝜆 colors in different ways, there are 𝑐𝑖
𝑖 𝑖
different ways of properly coloring G using exactly 𝑖 colors out of 𝜆 colors.
• Since 𝑖 can be any positive integer from 1 to 𝑛 ( it is not possible to use more than 𝑛
colors on 𝑛 vertices), the chromatic polynomial is a sum of these terms. That is
𝑛 𝜆 𝜆(𝜆−1) 𝜆(𝜆−1)(𝜆−2) 𝜆 𝜆−1 …(𝜆−𝑛+1)
• 𝑃𝑛 𝜆 = σ𝑖=1 𝑐𝑖 = 𝑐1 𝜆 + 𝑐2 + 𝑐3 + ⋯ + 𝑐𝑛
𝑖 2! 3! 𝑛!
• Note: Each 𝑐𝑖 is evaluated individually for a given graph. For example, any graph with
one edge requires at least 2 colors for proper coloring and hecnce 𝑐1 = 0.
• A graph with 𝑛 vertices and using 𝑛 colors can be properly colored in 𝑛! Different ways.
That is 𝑐𝑛 = 𝑛!
Theorem 4: A graph of 𝑛 vertices is a complete graph iff its
chromatic polynomial is 𝑃𝑛 𝜆 = 𝜆 𝜆 − 1 … 𝜆 − 𝑛 + 1 .
Proof:
• With 𝜆 colors there are 𝜆 different ways of coloring any selected
vertex.
• A second vertex can be properly colored in exactly in 𝜆 − 1
different ways, third in 𝜆 − 2 different ways,…, and the 𝑛th in
𝜆 − 𝑛 + 1 ways iff every vertex is adjacent to every other vertices.
• Which is possible if and only if the graph is complete.
Theorem 5: An 𝑛 −vertex graph is a tree iff its chromatic
polynomial 𝑃𝑛 𝜆 = 𝜆 𝜆 − 1 (𝑛−1)
Proof:
• Proof of this theorem can be done by induction on number of vertices of
the graph.
• When 𝑛 = 1, that is an isolated vertex can be colored using 𝜆 colors hence
the chromatic polynomial 𝑃𝑛 𝜆 = 𝑃1 𝜆 = 𝜆.
• When 𝑛 = 2, 𝑃2 𝜆 = 𝜆 𝜆 − 1 . 𝜆 𝜆−1
• Assume that the result is true for all trees with number of vertices ≤ 𝑘
vertices.
• ∴ the chromatic polynomial 𝑃𝑛 𝜆 = 𝑃𝑘 𝜆 = 𝜆 𝜆 − 1 (𝑘−1) .
Proof continuation
• Consider a tree with 𝑘 + 1 vertices we know that a tree
with more than 2 vertices have 2 pendant vertices.
• If we remove a pendant vertex along with the edge of the
tree with 𝑘 + 1 vertices we are left with a tree with k
vertices. ∴ the resulting tree will have 𝜆(𝜆 −
1)(𝑘−1) different ways of coloring.
• ∴ after coloring all the vertices, the removed pendent
vertex can be colored in 𝜆 − 1 different ways.
• Hence the chromatic polynomial of the tree with 𝑘 + 1
vertices is 𝑃𝑘 𝜆 = 𝜆 𝜆 − 1 (𝑘−1) 𝜆 − 1 = 𝜆 𝜆 − 1 𝑘 .
Find the chromatic polynomial of the
following graphs
1.
• 1. For a tree with n vertices has chromatic
polynomial 𝑃𝑛 𝜆 = 𝜆 𝜆 − 1 (𝑛−1) .
Hence 𝑃5 𝜆 = 𝜆 𝜆 − 1 4
2. 𝑃7 𝜆 = 𝜆 𝜆 − 1 6
2.
Find the chromatic polynomial of the graph G.
• For the given graph n = 4, since the graph contain a
triangle minimum 3 colors are needed for proper
coloring. Hence 𝑐1 = 𝑐2 = 0, 𝑐3 = 3!, 𝑐4 = 4!
σ𝑛𝑖=1 𝜆
• 𝑃𝑛 𝜆 = 𝑐𝑖 ,n=4
𝑖
4 𝜆 𝜆 𝜆
• 𝑃4 𝜆 = σ𝑖=1 𝑐𝑖 =6 + 24
𝑖 3 4
G 𝜆(𝜆−1)(𝜆−2) 𝜆 𝜆−1 (𝜆−2)(𝜆−3)
=3! + 4!
3! 4!
= 𝜆 𝜆 − 1 𝜆 − 2 2.
Find the chromatic polynomial of the graph G.
G • Since G has a triangle, we need at least 3 colors for proper
coloring. ∴ 𝑐1 = 𝑐2 = 0. Now 3 colors can be assigned to
a the vertices of the graph in 3! different ways, ∴ 𝑐3 = 6.
• To find 𝑐4 , out of 4 colors 3 can be selected and assigned to
the vertices a,b,c in 4𝑃3 = 24 different ways. Now the vertex
‘d’ will have two choice , 4th color or take the color of the
vertex ‘b’.
b c d e
• ∴ 𝑐4 = 2 × 24 = 48 ways and 𝑐5 = 5!
𝑃𝑛 𝜆 = σ𝑛𝑖=1 𝑐𝑖
𝜆
𝜆 𝜆 𝜆
+5! 𝜆
,n=5
𝜆
𝑖 • 𝑃5 𝜆 = σ5𝑖=1 𝑐𝑖 =6 + 48
𝑃5 𝜆 = σ𝑖=15 𝑐𝑖
𝑖
, we have 𝑖 3 4 5
to find 𝑐1 , 𝑐2 ,…, 𝑐5 . 𝜆(𝜆−1)(𝜆−2) 𝜆 𝜆−1 (𝜆−2)(𝜆−3)
= 3! + 48 +
𝜆 𝜆−1 3!
(𝜆−2)(𝜆−3))(𝜆−4) 4!
5!
5!
= 𝜆 𝜆 − 1 (𝜆 − 2) 𝜆 − 3 (𝜆2 − 5𝜆 + 7)
Find the chromatic polynomial of the graph G.
• Since G contains a complete graph of 4
vertices, we need at least 4 colors for proper
a b coloring. ∴ 𝑐1 = 𝑐2 = 𝑐3 = 0. Now 4 colors
can be assigned to the 4 vertices of the graph
in 4! different ways.
c
• There will be two choices for the vertex ‘c’.
The vertex ‘c’ can be colored with color of the
e d
vertex ‘a’ or the color of the vertex ‘e’ ∴ 𝑐4 =
2 × 24 = 48 ways and 𝑐5 = 5!
𝜆 𝜆
• 𝑃5 𝜆 = σ5𝑖=1 𝑐𝑖 = 48 +5! 𝜆 .
𝑖 4 5
Decomposition Theorem
• Given G be a graph with n vertices. Let x and y be two non-adjacent
vertices in G. From G, we can compute two graphs G1 and G2 as
• G1 be a simple graph obtained from G by adding an edge between x
and y.
• G2 be a simple graph obtained from G by fusing the vertices x and y
together and replacing the parallel edges with single edge. Then the
chromatic polynomial of G
• Decomposition of the graph can be done till all the vertices become
adjacent.
• 𝑃𝑛 𝜆 of G = 𝑃𝑛 𝜆 of G1 + 𝑃𝑛−1 𝜆 of G2
Find the chromatic polynomial for the
following graph.
a a (a, d)
c d c d c
b b b
G
𝐺21
a a a
(b,d)
c d c d
b b c
G1 G2 𝐺22
Matching/Independent edge set
• Let G be a graph with no self loop. A subset M of the
edge set E of a graph G is called a matching in G if no
two edges in M are adjacent in G.
𝑣1 𝑣4 𝑒4 𝑣5
• Consider the graph in the figure, then 𝐸 𝐺 =
𝑒1 , 𝑒2 , 𝑒3 , 𝑒4 . Here 𝑀1 = 𝑒1 , 𝑒3 , 𝑀2 = 𝑒2 , 𝑒4 , 𝑀3 = 𝑒1 𝑒3
{𝑒1 , 𝑒4 } are matching. But 𝑀4 = {𝑒2 , 𝑒3 , 𝑒4 } is not a 𝑣2 𝑣3
𝑒2
matching.
G
M-Saturated vertex
• Let M be a matching in a graph G. A vertex ‘v’ is said to be M-
saturated if there is an edge in M incident with ‘v’.
• Otherwise ‘v’ is said to be M-unsaturated.
• In the above example 𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 are M1-saturated and 𝑣5 is
unsaturated with respect to M1.
• Now consider the matching M2, The vertices 𝑣2 , 𝑣3 , 𝑣4 , 𝑣5 are M2 –
saturated and 𝑣1 is unsaturated with respect to M2.
Perfect Matching
• A matching M in the graph G is said to be perfect if it saturates every
vertex of G.
• Consider the graph G, here 𝑀1 = {𝑒1 , 𝑒3 } is a perfect 𝑣1 𝑣4
matching as it saturates 𝑒1 𝑒3
all the vertices 𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 of G. 𝑣2 𝑒2 𝑣3
G
Coverings
• In a graph G, a set E of edges is said to cover G if every vertex in G is
incident on at least one edge of E. A set of edges that covers a graph
G is said to be an edge covering, a covering subgraph, or simply a
covering of G.
• A graph G is trivially its own covering.
• A spanning tree in a connected graph is another covering.
• A Hamiltonian circuit (if it exists) in a graph is also a covering.
Minimal covering
• A covering from which no edge can be removed without destroying
its ability to cover the graph.
Observations
1. A covering exist for a graph if and only if the graph has no isolated vertex.
𝑛
2. A covering of n-vertex graph will have at least edges. ( 𝑥 denotes the smallest
2
integer not less than 𝑥).
3. Every pendent edge in a graph will included in every covering of graph.
4. Every covering contain minimal covering.
5. If we denote the remaining edges of the graph by (𝐺 − 𝐸), the set of edges in E is a
covering if and only if, for every vertex v, the degree of the vertex in
(𝐺 − 𝐸) ≤ (degree of the vertex v in G)-1.
6. No minimal covering can contain a circuit. Therefore, a minimal covering of an n-
vertex graph can contain no more than (n – 1) edges.
7. A graph, in general, has many minimal coverings, and they may be of different sizes.
The number of edges in a minimal covering of smallest size is called the covering
number of the graph.
4 color theorem
• In graph-theory, the four color theorem states that the vertices of
every planer graph can be colored with at most four colors so that no
two adjacent vertices receive the same color. i.e. Every planar graph is
four-colourable.
• The four – color came into focus during 1852 when attempt was
made to color the counties of England with color representation. They
found that using only 4 colors sufficed for this work. But it could not
be generalized.
Issues with 4 color problem.
• When it came to applying this theorem with other countries, there
arose issues.
• Like for example, representing the countries with a part outside its
boundary is not feasible. E.g. Alaska as part of the United States, since
it is not a continuous boundary.
• So if we required the entire country in such instance to be covered
with the same color, then four colors are always not sufficient.
• In this case, region represented by A is the same
country but not continuous. Hence 5 colors are
needed. This is the four color problem.
• The 5 color theorem was proposed in 1879 when an attempt was made
to color a map and the 4 color theorem failed. Hence we say that the 5
color theorem is implied by the 4 color theorem.
Greedy coloring algorithm
• In the study of graph coloring problems in mathematics and computer
science, a greedy coloring is a coloring of the vertices of a graph
formed by a greedy algorithm that considers the vertices of the graph
in sequence and assigns each vertex its first available color.
Basic Greedy Coloring Algorithm:
• From here,
• Minimum number of colors used to color the given graph are 3.
• Therefore, Chromatic Number of the given graph = 3.
• The given graph may be properly colored using 3 colors as shown
below
Find chromatic number of the following
graph
Example for non isomorphic graph with same
chromatic polynomial.