0% found this document useful (0 votes)
320 views64 pages

Unit 5 Graph Question Bank Solution DM & GT Sem 4 Cseaiml 2022 Even

Uploaded by

amoghvaishnav92
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)
320 views64 pages

Unit 5 Graph Question Bank Solution DM & GT Sem 4 Cseaiml 2022 Even

Uploaded by

amoghvaishnav92
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/ 64

New L J Institute of Engineering and Technology Semester: IV (2022)

NEW L J INSTITUTE OF ENGINEERING &


TECHNOLOGY, BODAKDEV,AHMEDABAD

SEMESTER- 4 BRANCH- CSE[AIML]

SUBJECT NAME: DISCRETE MATHEMATICS &


GRAPH THEORY
SUBJECT CODE: 3144202

UNIT:5 GRAPH

“BEGIN AT THE BEGINNING AND GO ON


TILL YOU COME TO THE END;
THEN STOP”
Discrete Mathematics and Graph Theory (3144202) 2022 Page | 1
New L J Institute of Engineering and Technology Semester: IV (2022)

CHAPTER NO- 5 : GRAPHS, REACHABILITY,


CONNECTEDNESS & SHORTEST PATH PROBLEMS
TOPIC:1 GRAPHS
SHORT QUESTIONS
1 Define: Directed graph [NLJIET] 1
Solution:
Directed Graph / Digraph : A graph in which every edge is directed is called a directed
graph (Digraph)

2 Define: Isolated node [NLJIET] 1

Solution:
Isolated Vertex/node: A vertex of degree zero in a graph is called an isolated vertex.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 2


New L J Institute of Engineering and Technology Semester: IV (2022)

Every vertex in a null graph is an isolated vertex

An isolated vertex in graph G has no edge incident with it

3 Define: Mixed Graph [NLJIET] 1


Solution:

Mixed Graph: If some edge of a graph G are directed and some are undirected then G is
said to be a mixed graph

4 Define: Pendant vertex [NLJIET] 1


Solution:
Pendent Vertex: A vertex of a graph with degree one is called a pendent vertex( or end
vertex

5 Define : Complete Graph (Sep–2021) [NLJIET] 1


Solution:
Complete Graph: A simple Graph G in which every pair of distinct vertices are adjacent is
called a complete graph

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 3


New L J Institute of Engineering and Technology Semester: IV (2022)

6 Define Cyclic graph [NLJIET] 1


Solution:
Circuit: (Cycle) : A closed path begin and ends at same vertex is called a circuit or elementary
circuit

V0 , e1 , V1 , e2 ,..., Vn −1 , en , Vn . is circuit then V0 = Vn

7 Define Strongly connected graph [NLJIET] 1


Solution:
Strongly connected graph: A directed graph is said to be strongly connected if every two
vertices a and b in G there is a path from a to b and b to a.

8 Define Null graph [NLJIET] 1


Solution:
Null Graph (Empty Graph): A graph containing only isolated nodes is called a null graph.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 4


New L J Institute of Engineering and Technology Semester: IV (2022)

9 Define sub graph.(Feb–2021) [NLJIET] 1


Solution:

Sub graph:

If G = (V,E) and H = ( V1 , E1 ) are two graphs such that V1 ⊆ V and E1  E then H is


called a sub graph of G.

Properties of Sub graph

(1) Every graph is a sub graph of it self

(2) Null graph obtained by deleting all edges of G is also a sub graph of G

(3) A single edge along with end vertices is also a sub graph of G

(4) A sub graph of a sub graph of a graph G is a sub graph of G


DESCRIPTIVE QUESTIONS
1 Define Graph, Directed edge of graph, Diagraph, Mixed graph, In degree of a node, Cycle 7
and Length of a path with suitable example .[NLJIET]

Solution:
(1)Graph:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 5


New L J Institute of Engineering and Technology Semester: IV (2022)

Let V be the non-empty set of point and E be the set of lines between points, then
ordered pair (V, E) is known as graph.
• V=V(G)= {𝑣1 , 𝑣2 , 𝑣3 , ….} is a set of vertices.( node, junction, o-simplex)
• E =E(G)={𝑒1 , 𝑒2 , 𝑒3} , , ….} is a set of edges. (line, arc, branch , 1-simplex)

(2)Directed Edges:
In a directed graph G an edge ‘e’ which is associated with an ordered pair of nodes ‘u’ to
‘v’ is called directed edge of graph G.

(3) Directed Graph / Digraph:


A graph in which every edge is directed is called a directed graph (Digraph)

(4) Mixed Graph:


If some edge of a graph G are directed and some are undirected then G is said to be a
mixed graph.
Discrete Mathematics and Graph Theory (3144202) 2022 Page | 6
New L J Institute of Engineering and Technology Semester: IV (2022)

(5) In degree & Out degree:


In a directed graph G the no. of edge ending at a vertex V is called in degree of V &
The no. of edges beginning from vertex V called out degree of V.

• In degree is denoted by 𝑑+ (𝑉𝑖 ) or ⃗⃗⃗⃗⃗⃗⃗⃗⃗


𝑑(𝑉𝑖 ) or in degree (𝑉𝑖 )
• Out degree is denoted by 𝑑 − (𝑉 ) ⃖⃗⃗⃗⃗⃗⃗⃗⃗⃗
𝑖 or 𝑑(𝑉𝑖 ) or out degree (𝑉𝑖 )
• A self-loop contributes two degrees ( One out degree and One in degree)
• The sum of in degree and out degree is called the total degree of a vertex

VERTEX IN DEGREE OUT DEGREE


A 1 2
B 2 1
C 2 1
D 1 1
E 1 1
F 1 1
G 0 1

(6) Circuit: (Cycle)


A closed path begin and ends at same vertex is called a circuit or elementary circuit.

V0 , e1 , V1 , e2 ,..., Vn −1 , en , Vn . is circuit then V0 = Vn

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 7


New L J Institute of Engineering and Technology Semester: IV (2022)

Circuit:
𝑣6 − 𝑣4 − 𝑣5 − 𝑣6

𝑣1 − 𝑣2 − 𝑣3 − 𝑣4 − 𝑣1

(7)Length of a Path:
No. of edges in a path is called the length of path.
(1) Length of shortest circuit (if any) in G is called Girth of G, denoted by g(G)
(2) Length of longest circuit is called circumference of G, denoted by C(G)

Length of a path
a-c-d = 2
a-b-c-d = 3
2 Explain converse (reverse) of a digraph with an example. [NLJIET] 3

Solution:
Converse ( reversal/Directional dual) of a digraph:

The converse of a diagraph G = < V, E > to be a diagraph G = V, E  in which


• The relation E is the converse of the relation E.
• The diagram G is obtained from G by simply reversing the directions of the edges
in G.
The converse G is also called the reversal or directional dual of a diagraph G

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 8


New L J Institute of Engineering and Technology Semester: IV (2022)

3 Define simple graph, degree of a vertex and complete graph. (Oct–2020) [NLJIET] 3

Solution:

(1) Simple Graph:

A graph which has neither loop nor parallel edges is called a simple graph.

(2)Degree of a vertex:

In a directed graph G the no. of edge ending at a vertex V is called in degree of V &

The no. of edges beginning from vertex V is called out degree of V.

In degree is denoted by 𝑑+ (𝑉𝑖 ) or ⃗⃗⃗⃗⃗⃗⃗⃗⃗


𝑑(𝑉𝑖 ) or in degree (𝑉𝑖 )

Out degree is denoted by 𝑑− (𝑉𝑖 ) or ⃖⃗⃗⃗⃗⃗⃗⃗⃗⃗


𝑑(𝑉𝑖 ) or out degree (𝑉𝑖 )

• A self loop contributes two degrees

( One out degree and One in degree)

• The sum of in degree and out degree is called the total degree of vertex

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 9


New L J Institute of Engineering and Technology Semester: IV (2022)

VERTEX IN DEGREE OUT DEGREE TOTAL DEGREE

a 0 3 3

b 2 1 3

c 2 1 3

d 1 1 2

e 1 2 3

f 2 0 2

(3)Complete Graph:

A simple Graph G in which every pair of distinct vertices are adjacent is called a complete graph.

4 Draw di-graph and find in-degree and out-degree of each vertex from the given adjacency 7
matrix. Use adjacency matrix, find total no. of path of length 1 and 2 between each vertex.
1 1 1
A = [1 1 1] [NLJIET]
1 1 1

Solution:
Directed Graph / Digraph:

A graph in which every edge is directed is called a directed graph (Digraph)

Digraph of adjacency matrix

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 10


New L J Institute of Engineering and Technology Semester: IV (2022)

VERTEX IN DEGREE OUT DEGREE TOTAL DEGREE

𝒗𝟏 1 1 2

𝒗𝟐 1 1 2

𝒗𝟑 1 1 2

Path of Length 1

(𝟏)𝒗𝟏 − 𝒗𝟐 (𝟐)𝒗𝟐 − 𝒗𝟏 (𝟑)𝒗𝟏 − 𝒗𝟑 (𝟒)𝒗𝟑 − 𝒗𝟏 (𝟓)𝒗𝟑 − 𝒗𝟐 (𝟔)𝒗𝟐 − 𝒗𝟑

Path of Lengtrh 2

(𝟏)𝒗𝟏 − 𝒗𝟐 − 𝒗𝟏 (𝟐)𝒗𝟐 − 𝒗𝟏 − 𝒗𝟐 (𝟑)𝒗𝟏 − 𝒗𝟑 − 𝒗𝟏 (𝟒)𝒗𝟑 − 𝒗𝟏 − 𝒗𝟑


(𝟓)𝒗𝟑 − 𝒗𝟐 − 𝒗𝟑 (𝟔)𝒗𝟐 − 𝒗𝟑 − 𝒗𝟐
5 Define sub-graph. Find all sub-graphs for the given graph. [NLJIET] 7

Solution:
Sub graph:

If G = (V,E) and H = ( V1 , E1 ) are two graphs such that V1 ⊆ V and E1  E then H is


called a sub graph of G.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 11


New L J Institute of Engineering and Technology Semester: IV (2022)

6 How many nodes are necessary to construct a graph with exactly 8 edges in which each 3
node is of degree 2? [NLJIET]

Solution:

Given that |𝐸|= 8

We know that ∑𝑛𝑖=1 𝑑( 𝑉𝑖 ) = 2 |𝐸|

2 |𝐸| = 2 × 8

|𝐸| = 8

Number of vertices in G = 8
7 Draw a simple graph with 4 nodes and 7 edges if possible. If not give reason. [NLJIET] 3

Solution:

Let G be a simple graph with order 4 and size 7

i.e. |𝑉| = 4= n = no, of vertex

|𝐸|= 7 = no. of edges (Max. no. of edges in G)

By theorem,

Maximum number of edges in a simple graph with n vertices

𝑛(𝑛 − 1)
=
2
(4)(4 − 1)
=
2
= 6

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 12


New L J Institute of Engineering and Technology Semester: IV (2022)

Maximum number of edges G can have is 6

It is given that number of edges in G is 7

|𝐸|= 7 < 6

Which is Contradiction.

Hence,

Simple graph with order 4 and Size 7 does not exist.

8 Draw a graph which is regular but not bipartite. [NLJIET] 3

Solution:

9 Draw two complete bipartite graphs, which are not regular. [NLJIET] 3

Solution:

A complete bipartite graph 𝑲𝒎 ,𝒏 is not regular if 𝒎 ≠ 𝒏

(1) 𝐾3 ,4

(2)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 13


New L J Institute of Engineering and Technology Semester: IV (2022)

10 Define Isomorphic graph with example [NLJIET] 3

Solution:
Two graphs G1 and G2 are said to be isomorphic if −
• Their number of vertices are same.
• Their number of edges are same.
• If 𝑮𝟏 has n vertices of degree k then 𝑮𝟐 has n vertices of degree k.
• Adjacency is preserved.

Example: (1)Graphs E and F are isomorphic

(1)|V(E)| = |V(F)| = 6
(2)|E(E)| = |E(F)| = 8
(3) Adjacency is also preserved
In graphs E and F, 4 vertices are of degree 3 and 2 vertices are of degree 2
So, E is isomorphic to F

OR

(2) Graphs G and H are isomorphic.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 14


New L J Institute of Engineering and Technology Semester: IV (2022)

(1)|V(G)| = |V(H)| = 5
(2)|E(G)| = |E(H)| = 5

In graph G In graph H
d(y) = 2
d(a) = 2
d(b) = 2 d(v) = 2

d(c) = 2 d(x) = 2

d(d) = 2 d(z) = 2

d(e) = 2 d(w) = 2

(3) Adjacency is also preserved


Hence, G is isomorphic to H
11 Define Isomorphic graphs. What are the necessary conditions for two graphs to be 4
isomorphic? Are they sufficient also? Justify your answer [NLJIET]

Solution:
Two graphs G1 and G2 are said to be isomorphic if −
• Their number of vertices are same.
• Their number of edges are same.
• If 𝑮𝟏 has n vertices of degree k then 𝑮𝟐 has n vertices of degree k.
• Adjacency is preserved.

Necessary conditions for the graphs G1 and G2 to be isomorphic


If G1 ≡ G2 then
(1)|V(G1)| = |V(G2)|
(2)|E(G1)| = |E(G2)|
(3)Degree sequences of G1 and G2 are same.
If the vertices {𝑣1 , 𝑣2 , …𝑣𝑘 } form a cycle of length k in G1, then the vertices {f(𝑣1 ), f(𝑣2 ),…
f(𝑣𝑘 )} should form a cycle of length k in G2.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 15


New L J Institute of Engineering and Technology Semester: IV (2022)

All the above conditions are necessary for the graphs G1 and G2 to be isomorphic, but
not sufficient to prove that the graphs are isomorphic.
Sufficient conditions for the graphs G1 and G2 to be isomorphic.
• The adjacency matrices of G1 and G2 are same.
• Their complement graphs are isomorphic.
• The corresponding sub graphs of G1 and G2 (obtained by deleting some vertices
in G1 and their images in graph G2 are isomorphic..

12 Give an abstract definition of graph. When are two simple graphs said to be isomorphic? 7
Give an example of two simple digraphs having 4 nodes and 4 edges which are not
isomorphic [NLJIET]

Solution:

Graph:

Let V be the non-empty set of point and E be the set of lines between points, then

Ordered pair (V, E) is known as graph.

V=V(G)= {𝑣1 , 𝑣2 , 𝑣3 , ….} is set of vertices.( node, junction, o-simplex)

E =E(G)={𝑒1 , 𝑒2 , 𝑒3} , , ….} is set of edges. (line arc, branch , 1-simplex)

Two simple graphs are isomorphic if


Necessary Condition:
• Their number of vertices are same.
• Their number of edges are same.
• If 𝐺1 has n vertices of degree k then 𝐺2 has n vertices of degree k.
• Adjacency is preserved.
Sufficient Condition:
• The adjacency matrices of G1 and G2 are same.
• Their complement graphs are isomorphic.
• The corresponding sub graphs of G1 and G2 (obtained by deleting some vertices
in G1 and their images in graph G2 are isomorphic..

An example of two simple digraphs having 4 nodes and 4 edges which are not
isomorphic

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 16


New L J Institute of Engineering and Technology Semester: IV (2022)

Graph G Graph H

(1)|V(G)| = |V(H)| = 4
(2)|E(G)| = |E(H)| = 4

In graph G In graph H
d(𝒂′ ) = 2
d(a) = 2
d(b) = 2 d(𝒃′ )) = 3

d(c) = 2 d(𝒄′ ) = 1

d(d) = 2 d(𝒅′ ) = 2

A is correspondent to 𝑎′ and d is correspondent to 𝑑′


Adjacent vertices of ‘d’ are a and c having each of degree 2 respectively.

Adjacent vertices of ‘𝑑 ’ are 𝑎′ and 𝑐′ having degree 2 and 1 respectively. So,
(3) Adjacency is not preserved
Hence, G is not isomorphic to H

13 Define isomorphic graphs. State whether the following graphs are isomorphic or not. 4
[NLJIET]

Solution:

Isomorphic graphs

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 17


New L J Institute of Engineering and Technology Semester: IV (2022)

Two graphs G1 and G2 are said to be isomorphic if −


• Their number of vertices are same. . i.e. |V(G1)| = |V(G2)|
• Their number of edges are same. i.e. |E(G1)| = |E(G2)|
• An equal number of vertices with given degree

• Adjacency is preserved
Notation: G1 ≡ G2
To check Isomorphism:
(1) |V(G1)| = |V(G2) = 5|
(2) |E(G1)| = |E(G2)| = 6
(3) To check Adjacency:

In Graph 𝑮𝟏 In Graph 𝑮𝟐

𝒅(𝒖𝟏 ) = 𝟐 𝒅(𝒗𝟏 ) = 𝟐
𝒅(𝒖𝟐 ) = 𝟐 𝒅(𝒗𝟐 ) = 𝟒
𝒅(𝒖𝟑 ) = 𝟑 𝒅(𝒗𝟑 ) = 𝟑
𝒅(𝒖𝟒 ) = 𝟑 𝒅(𝒗𝟒 ) = 𝟏
𝒅(𝒖𝟓 ) = 𝟐 𝒅(𝒗𝟓 ) = 𝟐

In graph 𝑮𝟏

No. of vertices having 3 degree=2

No. of vertices having 2 degree=3

In graph 𝑮𝟐
No. of vertices having 4 degree=1
No. of vertices having 3 degree=1
No. of vertices having 2 degree=2
No. of vertices having 1 degree=1
Adjacency is not preserved,
So, G1 and G2 are not isomorphic.

14 Define isomorphic graphs. State whether the following digraphs are Isomorphic or not. 7
Justify your answer.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 18


New L J Institute of Engineering and Technology Semester: IV (2022)

[NLJIET]
Solution:
Two graphs G1 and G2 are said to be isomorphic if −
• Their number of vertices are same. . i.e. |V(G1)| = |V(G2)|
• Their number of edges are same. i.e. |E(G1)| = |E(G2)|
• An equal number of vertices with given degree
• Adjacency is preserved
Notation: G1 ≡ G2
To check Isomorphism:
(1) |V(G1)| = |V(G2) | = 6
(2) |E(G1)| = |E(G2)| = 9
(3) To check Adjacency:
In Graph G1
Vertex In degree Out degree

𝒖𝟏 𝑑𝑒𝑔+ (𝒖𝟏 ) = 𝟎 𝑑𝑒𝑔− (𝒖𝟏 ) = 𝟑

𝒖𝟐 𝑑𝑒𝑔+ (𝒖𝟐 ) = 𝟑 𝑑𝑒𝑔− (𝒖𝟐 ) = 𝟎

𝒖𝟑 𝑑𝑒𝑔+ (𝒖𝟑 ) = 𝟎 𝑑𝑒𝑔− (𝒖𝟑 ) = 𝟑

𝒖𝟒 𝑑𝑒𝑔+ (𝒖𝟒 ) = 𝟑 𝑑𝑒𝑔− (𝒖𝟒 ) = 𝟎

𝒖𝟓 𝑑𝑒𝑔+ (𝒖𝟓 ) = 𝟎 𝑑𝑒𝑔− (𝒖𝟓 ) = 𝟑

𝒖𝟔 𝑑𝑒𝑔+ (𝒖𝟔 ) = 𝟑 𝑑𝑒𝑔− (𝒖𝟔 ) = 𝟎

In Graph G2
Vertex In degree Out degree

𝒗𝟏 𝑑𝑒𝑔+ (𝒗𝟏 ) = 𝟎 𝑑𝑒𝑔− (𝒗𝟏 ) = 𝟑

𝒗𝟐 𝑑𝑒𝑔+ (𝒗𝟐 ) = 𝟑 𝑑𝑒𝑔− (𝒗𝟐 ) = 𝟎

𝒗𝟑 𝑑𝑒𝑔+ (𝒗𝟑 ) = 𝟎 𝑑𝑒𝑔− (𝒗𝟑 ) = 𝟑

𝒗𝟒 𝑑𝑒𝑔+ (𝒗𝟒 ) = 𝟑 𝑑𝑒𝑔− (𝒗𝟒 ) = 𝟎

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 19


New L J Institute of Engineering and Technology Semester: IV (2022)

𝒗𝟓 𝑑𝑒𝑔+ (𝒗𝟓 ) = 𝟎 𝑑𝑒𝑔− (𝒗𝟓 ) = 𝟑

𝒗𝟔 𝑑𝑒𝑔+ (𝒗𝟔 ) = 𝟑 𝑑𝑒𝑔− (𝒗𝟔 ) = 𝟎

𝑢1 is correspondent to 𝑣1
𝑢2 is correspondent to 𝑣2
𝑢3 is correspondent to 𝑣3
𝑢4 is correspondent to 𝑣4
𝑢5 is correspondent to 𝑣5
𝑢6 is correspondent to 𝑣6
Adjacency is preserved

So, G1 and G2 are isomorphic.

15 Define: Isomorphic Graph. State whether the following graphs are isomorphic or not: 7
[NLJIET] (Sep–2021) [NLJIET]

Solution:

Two graphs G1 and G2 are said to be isomorphic if −


• Their number of vertices are same. . i.e. |V(G1)| = |V(G2)|
• Their number of edges are same. i.e. |E(G1)| = |E(G2)|
• An equal number of vertices with given degree

• Adjacency is preserved
Notation: G1 ≡ G2
Solution-

Condition-01:

• Number of vertices in graph G1 = 8


• Number of vertices in graph G2 = 8
Discrete Mathematics and Graph Theory (3144202) 2022 Page | 20
New L J Institute of Engineering and Technology Semester: IV (2022)

Here,
• Both the graphs G1 and G2 have same number of vertices.
• So, Condition-01 satisfies

Condition-02:

• Number of edges in graph G1 = 10


• Number of edges in graph G2 = 10

Here,
• Both the graphs G1 and G2 have same number of edges.
• So, Condition-02 satisfies.

Condition-03:

• In graph G1, degree-3 vertices form a cycle of length 4.


• In graph G2, degree-3 vertices do not form a 4-cycle as the vertices are not adjacent.

Here,
• Both the graphs G1 and G2 do not contain same cycles in them.
• So, Condition-03 violates.

Since Condition-03 violates, so given graphs cannot be isomorphic.

OR

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 21


New L J Institute of Engineering and Technology Semester: IV (2022)

16 Define isomorphism of graphs and find whether K6 and K3,3 graphs are isomorphic or not. 5
[NLJIET]

Solution:
Two graphs G1 and G2 are said to be isomorphic if −
• Their number of vertices are same. . i.e. |V(G1)| = |V(G2)|
• Their number of edges are same. i.e. |E(G1)| = |E(G2)|
• An equal number of vertices with given degree
• Adjacency is preserved
Notation: G1 ≡ G2
To check Isomorphism:
𝑛(𝑛−1)
𝐾𝑛 has exactly edges
2

6(6−1) 30
∴ 𝐾6 = = = 15
2 2

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 22


New L J Institute of Engineering and Technology Semester: IV (2022)

𝐾6 have 15 edges

All 6 vertices are of degree 5

𝐾𝑚 ,𝑛 has mn edges

∴ 𝐾3 ,3 𝑖𝑠 𝑎 𝑐𝑜𝑚𝑝𝑙𝑒𝑡𝑒 𝑏𝑖𝑝𝑎𝑟𝑡𝑖𝑡𝑒 𝑔𝑟𝑎𝑝ℎ

∴ No. of edges = 3 × 3= 9

|E(G1)| ≠ |E(G2)|

Hence, K6 and K3,3 graphs are isomorphic

17 Define a path in graph. Define length of the path. What is difference between a simple path 3
and an elementary path? [NLJIET]

Solution:

(1)Path:

A path is a walk through a sequence of vertices V1 → V2 → V3 → ... → Vn −1 → Vn

• No. of edges in a path called the length of path.


• A loop can be included in a walk but not in path

(2)Length of a Path:

No. of edges in a path is called the length of path.

(1) Length of shortest circuit (if any) in G is called Girth of G, denoted by g(G)

(2) Length of longest circuit is called Circumference of G, denoted by C(G)

Difference between a simple path and an elementary path

A Simple Path: The path is called simple one if no edge is repeated in the path,

An Elementary Path: The path is called elementary one if no vertex is repeated in the
path,

Naturally, every elementary path of a diagraph is also simple.

For example, let’s consider the graph:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 23


New L J Institute of Engineering and Technology Semester: IV (2022)

Simple Path:

1−2−3

1−4−3

1−2−4−3

Elementary Path:

1 − 2 − 3 ⇒ Length of path = 2

1 − 4 − 3 ⇒ Length of path = 2

1 − 2 − 4 − 3 ⇒ Length of path = 3

𝟏 − 𝟐 − 𝟒 − 𝟏 − 𝟒 − 𝟑 is simple but not elementary path

18 Define adjacency matrix of a digraph. Obtain the adjacency matrix A of the given digraph. 7
Find the elementary paths of lengths 1 and 2 from v1 to v4 .[NLJIET]

Solution:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 24


New L J Institute of Engineering and Technology Semester: IV (2022)

Adjacency Matrix of directed Graph:

The adjacency matrix A = [𝑎𝑖𝑗 ] for a directed graph G with n vertices is an n × n matrix defined by

𝑎𝑖𝑗 = 1 If edge beginning at vertex 𝑉𝑖 end at 𝑉𝑗

= 0 otherwise

The adjacency matrix of Digraph G

0 1 0 1
0 0 1 1
A= 
0 1 0 1
 
0 1 0 0

Elementary path of length 1 from vertex 𝒗𝟏 to 𝒗𝟒

𝒗𝟏 - 𝒗𝟒

Elementary path of length 2 from vertex 𝒗𝟏 to 𝒗𝟒

𝒗𝟏 −𝒗𝟐 − 𝒗𝟒

19 Define Adjacency matrix and path matrix of a graph. Explain each with example. 4
[NLJIET]

Solution:
(1)Adjacency matrix of Non- Directed Graph

Let G be a graph with n vertices & no parallel edges. The adjacency matrix A = [𝑎𝑖𝑗 ] of
order n × n defined by

𝑎𝑖𝑗 = 1 If vertex 𝑉𝑖 is adjacent to 𝑉𝑗

= 0 otherwise

(2)Adjacency Matrix of directed Graph:

The adjacency matrix A = [𝑎𝑖𝑗 ] for a directed graph G with n vertices is an n × n matrix defined by

𝑎𝑖𝑗 = 1 If edge beginning at vertex 𝑉𝑖 end at 𝑉𝑗

= 0 otherwise

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 25


New L J Institute of Engineering and Technology Semester: IV (2022)

The adjacency matrix of Digraph G

0 0 0 1
1 0 0 0
A= 
1 1 0 1
 
0 1 1 0

Path Matrix(Reachability Matrix):

The Path matrix P = [𝑝𝑖𝑗 ] for a directed graph G with n vertices is an n × n matrix defined by

𝑝𝑖𝑗 = 1 If there exists a path from 𝑝𝑖 to 𝑝𝑗

= 0 otherwise

. The Warshall Algorithm is often used to compute the path matrix.

The adjacency matrix of Digraph G

1 1 1 1
1 1 1 1
P= 
1 1 1 1
 
1 1 1 1

Key difference between Adjacency Matrix and Path Matrix is that


• An adjacency matrix is about direct edge
• Where a path matrix is about whether can be traveled or not.
• Path matrix include both direct and indirect edges.

20 Define adjacency matrix of a graph and obtain the adjacency matrix (A) for the following 7
graph. State the in degree and out degree of all the vertices. Find A2, B2 and Path matrix P.
[NLJIET]

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 26


New L J Institute of Engineering and Technology Semester: IV (2022)

Solution:
1)Adjacency matrix of Non- Directed Graph

Let G be a graph with n vertices & no parallel edges. The adjacency matrix A = [𝑎𝑖𝑗 ] of
order n × n defined by

𝑎𝑖𝑗 = 1 If vertex 𝑉𝑖 is adjacent to 𝑉𝑗

= 0 otherwise

(2)Adjacency Matrix of directed Graph:

The adjacency matrix A = [𝑎𝑖𝑗 ]for a directed graph G with n vertices is an n × n matrix defined by

𝑎𝑖𝑗 = 1 If edge beginning at vertex 𝑉𝑖 end at 𝑉𝑗

= 0 otherwise

(2)The adjacency matrix of Digraph G

0 0 0 1
1 0 0 0
A= 
1 1 0 1
 
0 1 1 0

In Graph G
Vertex In degree Out degree

𝒗𝟏 𝑑𝑒𝑔+ (𝒗𝟏 ) = 𝟐 𝑑𝑒𝑔− (𝒗𝟏 ) = 𝟏

𝒗𝟐 𝑑𝑒𝑔+ (𝒗𝟐 ) = 𝟐 𝑑𝑒𝑔− (𝒗𝟐 ) = 𝟏

𝒗𝟑 𝑑𝑒𝑔+ (𝒗𝟑 ) = 𝟏 𝑑𝑒𝑔− (𝒗𝟑 ) = 𝟑

𝒗𝟒 𝑑𝑒𝑔+ (𝒗𝟒 ) = 𝟐 𝑑𝑒𝑔− (𝒗𝟒 ) = 𝟐

To find A2, B2 and Path matrix P

The adjacency matrix of digraph G

0 0 0 1 0
1 0 0 0 0
𝐴= 0 1 0 0 0
0 1 1 0 0
[0 0 1 0 0]
Discrete Mathematics and Graph Theory (3144202) 2022 Page | 27
New L J Institute of Engineering and Technology Semester: IV (2022)

Here Number of nodes in a given graph is |𝑉| = 5

Hence, 𝐵𝑛 = 𝐵5 = 𝐴 + 𝐴2 + 𝐴3 + 𝐴4 + 𝐴5

0 1 1 0 0
0 0 0 1 0

A = 1
2 0 0 0 0
 
1 1 0 0 0
0 1 0 0 0

1 1 0 0 0
0 1 1 0 0

A3 = 0 0 0 1 0
 
1 0 0 1 0
1 0 0 0 0

1 0 0 1 0
1 1 0 0 0

A = 0
4 1 1 0 0
 
0 1 1 1 0
0 0 0 1 0

0 1 1 1 0
1 0 0 1 0

A5 = 1 1 0 0 0
 
1 2 1 0 0
0 1 1 0 0

𝐴𝑙𝑙 𝑒𝑛𝑡𝑟𝑖𝑒𝑠 𝑜𝑓 𝐵𝑛 = 𝐵5 = 𝐴 + 𝐴2 + 𝐴3 + 𝐴4 + 𝐴5 ≠ 0

Hence, Path matrix is

1 1 1 1 1
1 1 1 1 1
𝑃= 1 1 1 1 1
1 1 1 1 1
[1 1 1 1 1]

21 A graph G has 15 edges, 3 vertices of degree 4 and other vertices of degree 3. Find the 3
number of vertices in G. (Oct–2020) [NLJIET]

Solution:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 28


New L J Institute of Engineering and Technology Semester: IV (2022)

For the graph , ∑ 𝑑(𝑉𝑖 ) = 2|𝐸|

𝑑(𝑉1 ) = 4

𝑑(𝑉2 ) = 4

𝑑(𝑉3 ) = 4 and |𝐸| = 15

Suppose there are x vertices of degree 3.

⇒ 4 + 4 + 4 + 3 × 𝑥 = 2 × 15

⇒ 12 + 3 × 𝑥 = 30

⇒ 3 × 𝑥 = 30 − 12 = 18

18
⇒𝑥= =6
3

Hence, number of vertices in G = 3 + 6 = 9

22 Define vertex disjoint and edge disjoint sub graphs by drawing the relevant graphs. 4
(Oct–2020) [NLJIET]
Solution:

(2)Disjoint sub graph

– It is of two types

(i) Edge- disjoint sub graph and

(ii) Vertex -disjoint sub graph.

Edge- disjoint sub graph– (G-e)

Let G be a graph and 𝐺1 and 𝐺2 be two sub graphs of G. Then 𝐺1 and 𝐺2 are called edge
disjoint if they have no edge in common

Symbolically, E(𝐺1 )∩E (𝐺2 ) = 

Vertex-disjoint sub graphs (G-V)

– Let G be a graph and 𝐺1 and 𝐺2 be two sub graphs of G. Then𝐺1 and 𝐺2 are called vertex-
disjoint sub graph of G if they have no vertex in common.

Symbolically, V(𝐺1 ) ∩V(𝐺2 ) = 

Figure

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 29


New L J Institute of Engineering and Technology Semester: IV (2022)

23 Define the following by drawing graphs (i) weak component (ii) unilateral component 4
(iii) strong component. (Oct–2020) [NLJIET]

Solution:

For a simple digraph,

• A maximal weakly connected sub graph is called a weak component


• A maximal unilaterally connected sub graph is called a unilateral component
• A maximal strongly connected sub graph is called a strong component.

For the diagraph,

{1,2,3}, {4}, {5}, {6} are strong components.

{1,2,3,4,5}, {6} are the unilateral components.

{1,2,3,4,5,6} is the weak component because the graph is weakly connected.

24 Prove that there are always an even number of vertices of odd degree in a graph 3
(Oct–2020) [NLJIET]
Discrete Mathematics and Graph Theory (3144202) 2022 Page | 30
New L J Institute of Engineering and Technology Semester: IV (2022)

Solution

Let G = (V, E) be an undirected graph.

Let 𝑉1 be the set of vertices of even degree and

Let 𝑉2 be the set of vertices of odd degree

We know that 2 | E | =∑𝑣∈𝑉 deg (𝑣) = ∑𝑣∈𝑉1 deg (𝑣) + ∑𝑣∈𝑉2 deg (𝑣)

Since deg (v) is even for 𝑣 ∈ 𝑉1

So, ∑𝑣∈𝑉1 deg (𝑣) is even for 𝑣 ∈ 𝑉1

Also the sum of the two term on RHS is even = 2 | E |

So, the second term on RHS i.e. ∑𝑣∈𝑉2 deg (𝑣) must be even.

But Since all the terms in this sum are odd so there must be an even number of such terms.

Hence we conclude that there are an even number of vertices of odd degree.

25 Find the number of edges in a r – regular graph with n – vertices. (Oct–2020) [NLJIET] 3

Solution:

Consider a r-regular graph G.

Then deg (v) = r,  v V(G).

 2 |𝐸| =  deg (v) = ∑𝑛𝑟=1 𝑟 = r × n


𝑟×𝑛
 |𝐸| =
2

26 Define self-loop, adjacent vertices and a pendant vertex. (Feb-2021) [NLJIET] 3

Solution:

Adjacent Vertices(Nodes):

If two nodes u and v are joined by an edge e then u and v are said to be adjacent nodes.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 31


New L J Institute of Engineering and Technology Semester: IV (2022)

Self-Loop(Sling):

An edge e of a graph G that joins a node u to itself is called a loop. A loop is an edge e =
(u, v).
SELF LOOP

Pendent Vertex:
A vertex of a graph with degree one is called a pendent vertex( or end vertex)

27 Find the number of edges in G if it has 5 vertices each of degree 2. 3


(Feb–2021)[NLJIET]

Solution:

Given that |𝑉|= 5

We know that ∑𝑛𝑖=1 𝑑( 𝑉𝑖 ) = 2 |𝐸|

⇒ 2 + 2 + 2 + 2 + 2 = 2 |𝐸|

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 32


New L J Institute of Engineering and Technology Semester: IV (2022)

⇒ 2 |𝐸| = 2 × 5

⇒ |𝐸| = 5

Number of edges in G = 5

28 Define complement of a sub graph by drawing the graphs. (Feb–2021) [NLJIET] 4


Solution:

Complement of a sub graph :

Let G be a graph and H be a sub graph of G. The complement H in G is the graph obtained
by deleting the edges of H from those of G

(Complement of H in G is denoted by H )

Graph G Sub graph H Complement of sub graph H = H

29 Define path and circuit of a graph by drawing the graphs (Feb-2021) [NLJIET] 4

Solution:

Path:A path is a walk through a sequence of vertices V1 → V2 → V3 → ... → Vn −1 → Vn

Without any repetition of vertices such a path is known as simple path.

Path:

𝑣1 − 𝑣2 − 𝑣3 − 𝑣4 − 𝑣5 is a path.

𝑣1 − 𝑣3 − 𝑣4 − 𝑣5 is a path.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 33


New L J Institute of Engineering and Technology Semester: IV (2022)

Note:

(1) No. of edges in a path called the length of path.

(2) A loop can be included in a walk but not in path

Circuit: (Cycle)

A closed path begin and ends at same vertex is called a circuit or elementary circuit

V0 , e1 , V1 , e 2 ,..., Vn −1 , e n , Vn . is circuit then V0 = Vn

Simple Circuit:

A circuit is said to be simple circuit if it does not include same edge twice

Elementary Circuit:

A circuit is said to be Elementary circuit if it does not include same vertex twice except the
end vertex.

Circuit:

𝑣6 − 𝑣4 − 𝑣5 − 𝑣6

𝑣1 − 𝑣2 − 𝑣3 − 𝑣4 − 𝑣1

Note:

(1) Length of shortest circuit (if any) in G is called Girth of G, denoted by g(G).

(2) Length of longest circuit is called circumference of G, denoted by C(G)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 34


New L J Institute of Engineering and Technology Semester: IV (2022)

30 Define adjacency matrix and find the same for (Feb–2021) [NLJIET] 4

Solution:

(1)Adjacency matrix of Non- Directed Graph

Let G be a graph with n vertices & no parallel edges. The adjacency matrix A = [𝑎𝑖𝑗 ] of
order n × n defined by

𝑎𝑖𝑗 = 1 If vertex 𝑉𝑖 is adjacent to 𝑉𝑗

= 0 otherwise

(2)Adjacency Matrix of directed Graph:

The adjacency matrix A = [𝑎𝑖𝑗 ]for a directed graph G with n vertices is an n × n matrix defined by

𝑎𝑖𝑗 = 1 If edge beginning at vertex 𝑉𝑖 end at 𝑉𝑗

= 0 otherwise

(2)The adjacency matrix of simple graph G

0 1 1 1 0
1 0 1 0 0

A = 1 1 0 1 0
 
1 0 1 0 1
0 0 0 1 0

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 35


New L J Institute of Engineering and Technology Semester: IV (2022)

31 Define in degree and out degree of a graph with example (Feb – 2021) [NLJIET] 3
Solution:

In degree & Out degree of a vertex:

In a directed graph G the no. of edge ending at a vertex V is called in degree of V &

The no. of edges beginning from vertex V is called out degree of V.

• In degree is denoted by 𝑑+ (𝑉𝑖 ) or ⃗⃗⃗⃗⃗⃗⃗⃗⃗


𝑑(𝑉𝑖 ) or in degree (𝑉𝑖 )
• Out degree is denoted by 𝑑 − (𝑉 ) ⃖⃗⃗⃗⃗⃗⃗⃗⃗⃗
𝑖 or 𝑑(𝑉𝑖 ) or out degree (𝑉𝑖 )
• A self loop contributes two degrees

( One out degree and One in degree)

• The sum of in degree and out degree is called the total degree of vertex

VERTEX IN DEGREE OUT DEGREE TOTAL DEGREE

a 0 3 3

b 2 1 3

c 2 1 3

d 1 1 2

e 1 2 3

f 2 0 2

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 36


New L J Institute of Engineering and Technology Semester: IV (2022)

32 Does a 3-regular graph with 5 vertices exist? (Feb–2021) [NLJIET] 3

Solution:
𝒓×𝒏
The number of edges in a r – regular graph with n – vertices = |𝑬| = 𝟐

The number of edges for a 3-regular graph with 5 vertices are


𝑟×𝑛 3×5
 |𝐸| = = = 15/2 which is not possible.
2 2

Hence, such type of graph does not exist

33 How many nodes are necessary to construct a graph with exactly 8 edges in which each 3
node is of degree 2 (Sep–2021) [NLJIET]

Solution:
Given that |𝐸|= 8

We know that

∑𝑛𝑖=1 𝑑( 𝑉𝑖 ) = 2 |𝐸|

2+2+2+…n times = 2 × 8

2 𝑛 = 2 × 8

𝑛 =8

Number of vertices in G = 8

34 Define Cyclic graph, Null graph and Strongly connected graph. (Sep–2021) [NLJIET] 3

Solution:

(1)Cyclic graph: A graph containing at least one cycle in it is called as a cyclic graph.

Examples-1

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 37


New L J Institute of Engineering and Technology Semester: IV (2022)

Example-2

Here,

• This graph contains two cycles in it.


• Therefore, it is a cyclic graph.

(2)Null Graph(Empty Graph):


A graph containing only isolated nodes is called a null graph..

• a null graph does not contain any edges in it.

Example

(3)Strongly Connected Graph:

A directed graph is said to be strongly connected if for every two vertices a and b in G there is a
path from a to b and b to a.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 38


New L J Institute of Engineering and Technology Semester: IV (2022)

35 Draw a graph which is regular but not bipartite. (Sep–2021) [NLJIET] 4

Solution:
Complete graph K4 is regular as degree of each vertex is 3

V1 V2

V3 V4
3 Regular graph with 4 vertices is not bipartite as
V1 is joined with V3 and V2 is joined with V4

36 Explain the following terms with proper illustrations. a) Directed graphs b) Simple and 7
elementary path c) Reachability of a vertex d) Connected graph (Dec-2021) [NLJIET]
Solution:

(a)Directed Graph / Digraph:

A graph in which every edge is directed is called a directed graph (Digraph)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 39


New L J Institute of Engineering and Technology Semester: IV (2022)

(b) Simple and elementary path

Path:

A path is a walk through a sequence of vertices V1 → V2 → V3 → ... → Vn −1 → Vn

• No. of edges in a path called the length of path.


• A loop can be included in a walk but not in path

A Simple Path: The path is called simple one if no edge is repeated in the path,

An Elementary Path: The path is called elementary one if no vertex is repeated in the
path,

Naturally, every elementary path of a diagraph is also simple.

For example, let’s consider the graph:

Simple Path:

1−2−3

1−4−3

1−2−4−3

Elementary Path:

1 − 2 − 3 ⇒ Length of path = 2

1 − 4 − 3 ⇒ Length of path = 2

1 − 2 − 4 − 3 ⇒ Length of path = 3

𝟏 − 𝟐 − 𝟒 − 𝟏 − 𝟒 − 𝟑 is simple but not elementary path

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 40


New L J Institute of Engineering and Technology Semester: IV (2022)

(c)Reachability of a vertex:

A vertex V of a simple digraph is said to be reachable from the vertex u of the same
digraph, if there exists a path from u to v.

Every node is reachable from itself

Example:

𝑃1 = (〈1,2〉, 〈2,1〉)

𝑃1 = (〈3,4〉, 〈4,3〉)

(d)Connected Graph:

A graph G is connected if every pair of vertices are joined by a path otherwise the graph is
disconnected.

Connected graph

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 41


New L J Institute of Engineering and Technology Semester: IV (2022)

37 Show that sum of in-degrees of all the nodes of simple digraph is equal to the sum of out- 7
degrees of all the nodes and this sum equal to the number of edges in it.
(Dec-2021) [NLJIET]

Solution:

We have to show that

If G = (V,E) is a directed graph with n nodes 𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 , …and ‘e’ number of edges,


then

∑ 𝒅𝒆𝒈− (𝒗) = ∑ 𝒅𝒆𝒈+ (𝒗) = 𝒆


𝒗∈𝑽 𝒗∈𝑽

• Let G = (V,E) be a directed graph with n nodes 𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 , …and ‘e’ number


of edges
• Any directed edge in G contributes ‘ 1 ‘out degree and ‘ 1 ‘in degree.
• Also, a self-loop contributes two degrees (1 out degree and 1 in degree)
• Once an edge is count for in degree it will not count for out degree.
• When we are adding the in degree of nodes , each edge is counted exactly once.
• Hence, total of in degrees of all nodes is same as the number of edges.

𝒊. 𝒆. ∑ 𝒅𝒆𝒈− (𝒗) = 𝒆
𝒗∈𝑽

Similarly, we can prove that

∑ 𝒅𝒆𝒈+ (𝒗) = 𝒆
𝒗∈𝑽

Hence, the theorem is proved.

40 How many edges does a graph have if it has vertices of degree 4, 3, 3, 2, 2? Draw such a 7
graph. [NLJIET]

Solution:

V=V(G)= {𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 , 𝑣5 }

𝑑(𝑉1 ) = 4

𝑑(𝑉2 ) = 3

𝑑(𝑉3 ) = 3 and |𝐸| = 7

𝑑(𝑉4 ) = 2

𝑑(𝑉5 ) = 2

|𝐸| =?

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 42


New L J Institute of Engineering and Technology Semester: IV (2022)

∑ 𝑑(𝑉𝑖 ) = 2|𝐸|

∑ 𝑑( 𝑉𝑖 ) = 4+3+3+2+2 = 14 = 2|𝐸|

⇒ 2(7) = 2|𝐸|

⇒ |𝐸| = 7

TOPIC:2 REACHABILITY
DESCRIPTIVE QUESTIONS
1 Define Reachable set of a node v. Find the reachable sets of (1) node v1 and (2) node v8 for 3
the digraph given in following Figure.[NLJIET]

Solution:

Reachable set:

A vertex V of a simple digraph is said to be reachable from the vertex u of the same
digraph, if there exists a path from u to v.

The set of vertices which are reachable from a given vertex v is said to be the reachable set
of V.

It is denoted by R(v).

𝑅(𝑣1 ) = 𝑅(𝑣2 ) = 𝑅(𝑣3 ) = 𝑅(𝑣4 ) = 𝑅(𝑣5 ) = {𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 , 𝑣5 , 𝑣6 }

𝑅(𝑣8 ) = {𝑣8 , 𝑣7 , 𝑣6 }

2 Define node base of a simple digraph. Find reachability set of all nodes for the following 7
diagraph. [NLJIET]

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 43


New L J Institute of Engineering and Technology Semester: IV (2022)

Solution:

Node Base:

In a digraph G = < V, E > a subset X  V is called a node base if reachable set of X is V


and no proper subset of X has this property

Reachability set of all nodes

𝑅(𝑣1 ) = 𝑅(𝑣2 ) = 𝑅(𝑣3 ) = 𝑅(𝑣4 ) = 𝑅(𝑣5 ) = {𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 , 𝑣5 , 𝑣6 }

𝑅(𝑣6 ) = {𝑣6 }

𝑅(𝑣7 ) = {𝑣7 , 𝑣6 }

𝑅(𝑣8 ) = {𝑣8 , 𝑣7 , 𝑣6 }

𝑅(𝑣9 ) = {𝑣9 }

𝑅(𝑣10 ) = {𝑣10 }

Node base:

𝑅(𝑣5 , 𝑣8 , 𝑣9 , 𝑣10 ) = 𝑉 = 𝑅(𝑣1 , 𝑣8 , 𝑣9 , 𝑣10 )

3 Explain geodesic with an example. [NLJIET] 5

Solution:

Geodesic:

If vertex V is reachable from the vertex u, then a path of minimum length from u to v is
called geodesic.

• The most familiar examples are the straight lines in Euclidean geometry.
• On a sphere, the images of geodesics are the great circles.
• The shortest path from point A to point B on a sphere is given by the shorter arc of
the great circle passing through A and B.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 44


New L J Institute of Engineering and Technology Semester: IV (2022)

PROCEDURE OF WARSHAL’S ALGORITHM TO FIND PATH MATRIX

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 45


New L J Institute of Engineering and Technology Semester: IV (2022)

4 Use Warshall’s algorithm to obtain path matrix from the adjacency matrix of 4

(Oct–2020) [NLJIET]
Solution:
The adjacency matrix of digraph G

0 0 0 1 0
1 0 0 0 0
𝐴=𝑃= 0 1 0 0 0
0 1 1 0 0
[0 0 1 0 0]

0 0 0 1 0
1 0 0 1 0
𝑃(𝑣1 ) = 0 1 0 0 0
0 1 1 0 0
[0 0 1 0 0]
0 0 0 1 0
1 0 0 1 0
𝑃(𝑣2 ) = 1 1 0 1 0
1 1 1 1 0
[0 0 1 0 0]

0 0 0 1 0
1 0 0 1 0
𝑃(𝑣3 ) = 1 1 0 1 0
1 1 1 1 0
[1 1 1 1 0]

1 1 1 1 0
1 1 1 1 0
𝑃(𝑣4 ) = 1 1 1 1 0
1 1 1 1 0
[1 1 1 1 0]

1 1 1 1 0
1 1 1 1 0
𝑃(𝑣5 ) = 1 1 1 1 0
1 1 1 1 0
[1 1 1 1 0]

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 46


New L J Institute of Engineering and Technology Semester: IV (2022)

5 Find the shortest path between each pair of vertices for a simple digraph using Warshall’s 4

Algorithm. (Sep–2021) [NLJIET]

Solution:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 47


New L J Institute of Engineering and Technology Semester: IV (2022)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 48


New L J Institute of Engineering and Technology Semester: IV (2022)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 49


New L J Institute of Engineering and Technology Semester: IV (2022)

6 Find the shortest path matrix between each pair of vertices for a digraph using Warshall’s
Algorithm. [NLJIET]

Do yourself
TOPIC:3 Connectedness
DESCRIPTIVE QUESTIONS
1 Define a unilateral component and strong component. Write unilateral and strong and weak 7
components of the Graph given in following figure. [NLJIET]

Solution:

For a simple digraph,

• A maximal weakly connected sub graph is called a weak component

• A maximal unilaterally connected sub graph is called a unilateral component

• A maximal strongly connected sub graph is called a strong component..

For the diagraph,

{1,2,3}, {4}, {5}, {6} are strong components.

{1,2,3,4,5}, {6} are the unilateral components.

{1,2,3,4,5,6} is the weak component because the graph is weakly connected.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 50


New L J Institute of Engineering and Technology Semester: IV (2022)

2 Find all the in degrees and out degrees of the nodes of the graph given in 7
following figure. Give all the elementary cycles of this graph. List all the nodes which are
reachable from another node of the diagraph [NLJIET]

Solution:
In Graph

Vertex In degree Out degree

𝒗𝟏 𝑑𝑒𝑔+ (𝒗𝟏 ) = 𝟏 𝑑𝑒𝑔− (𝒗𝟏 ) = 𝟏

𝒗𝟐 𝑑𝑒𝑔+ (𝒗𝟐 ) = 𝟏 𝑑𝑒𝑔− (𝒗𝟐 ) = 𝟐

𝒗𝟑 𝑑𝑒𝑔+ (𝒗𝟑 ) = 𝟏 𝑑𝑒𝑔− (𝒗𝟑 ) = 𝟐

𝒗𝟒 𝑑𝑒𝑔+ (𝒗𝟒 ) = 𝟏 𝑑𝑒𝑔− (𝒗𝟒 ) = 𝟐

𝒗𝟓 𝑑𝑒𝑔+ (𝒗𝟓 ) = 𝟐 𝑑𝑒𝑔− (𝒗𝟓 ) = 𝟎

Elementary Cycle:

𝒗𝟏 − 𝒗𝟐 − 𝒗𝟒 − 𝒗𝟏
𝒗𝟏 − 𝒗𝟐 − 𝒗𝟑 − 𝒗𝟒 − 𝒗𝟏

List of all the nodes which are reachable from another node of the diagraph

𝑅(𝑣1 ) = 𝑅(𝑣2 ) = 𝑅(𝑣3 ) = 𝑅(𝑣4 ) = 𝑅(𝑣5 ) = {𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 , 𝑣5 , 𝑣6 }

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 51


New L J Institute of Engineering and Technology Semester: IV (2022)

3 Define weakly connected, unilaterally connected and strongly connected graphs [NLJIET] 3

Solution:

Strongly connected A directed graph is said to be strongly connected it every two vertices
and b in G there is a path from a to b and b to a.

Weekly connected: A directed graph is weekly connected if it is not strongly connected.

Disconnected graph: A directed graph which is neither strongly connected nor weekly
connected is known as disconnected graph.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 52


New L J Institute of Engineering and Technology Semester: IV (2022)

Unilaterally connected graph: A directed graph is said to be Unilaterally connected graph


if for any pair of vertices of the graph at least one of the vertex of pair is reachable from
other vertex

4 Explain the application of graphs in resource allocation and deadlock detection in 7


Operating Systems with an example [NLJIET]

Solution:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 53


New L J Institute of Engineering and Technology Semester: IV (2022)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 54


New L J Institute of Engineering and Technology Semester: IV (2022)

TOPIC:4 Shortest Path Problems


1 Using Dijkstra’s algorithm, find the shortest path between vertices 𝑎 and 𝑧 [NLJIET] 7

Solution:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 55


New L J Institute of Engineering and Technology Semester: IV (2022)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 56


New L J Institute of Engineering and Technology Semester: IV (2022)

2 Using Dijkstra’s algorithm, find the shortest path between vertices 𝑎 and 𝑧 [NLJIET] 7

Solution:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 57


New L J Institute of Engineering and Technology Semester: IV (2022)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 58


New L J Institute of Engineering and Technology Semester: IV (2022)

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 59


New L J Institute of Engineering and Technology Semester: IV (2022)

3 Give an example of a graph which is 5


i) Eulerian as well as Hamiltonian
ii) Eulerian but not Hamiltonian
iii) Hamiltonian but not Eulerian
iv) Neither Hamiltonian nor Eulerian [NLJIET]

Solution:

A cycle that travels exactly once over each edge in a graph is called “Eulerian”.

” A cycle that travels exactly once over each vertex in a graph is called “Hamiltonian.”

4 Define a Eulerian graph and draw a graph which contains an Eulerian path but does not 3
contain an Eulerian circuit. [NLJIET]

Solution:
Definition:
A cycle that travels exactly once over each edge in a graph is called “Eulerian”.

” A cycle that travels exactly once over each vertex in a graph is called “Hamiltonian.”

An Euler path is a path that uses every edge of a graph exactly once.

A graph which contains an Eulerian path but does not contain an Eulerian circuit.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 60


New L J Institute of Engineering and Technology Semester: IV (2022)

The graph is connected and there are exactly two vertices b and f of odd degree.

Hence the graph contains an Eulerian path but does not contain an Eulerian circuit.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 61


New L J Institute of Engineering and Technology Semester: IV (2022)

5 State and prove the Euler’s theorem. [NLJIET] 5

Solution:

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 62


New L J Institute of Engineering and Technology Semester: IV (2022)

6 Which of the following graphs have Euler’s path or circuit? [NLJIET] 3

Solution:

We know that,

Theorem: 1 An undirected graph possess an Eulerian path if and only if it is connected


and has either 0 or 2 vertices of odd degree.

Theorem:2 An undirected graph possess an Eulerian circuit if and only if it is connected


and its vertices are all of even degree

In a graph I, each vertex is of even degree. Hence, it possess an Euler’s circuit.

Graph II is connected graph and it has exactly 2 vertices of odd degree. Hence, this
graph possess an Euler’s path.

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 63


New L J Institute of Engineering and Technology Semester: IV (2022)

7 Show any one Hamiltonian circuit. [NLJIET] 3

Solution:

A circuit in a connected graph G is a Hamiltonian circuit if it contains every vertex of G


exactly once except the first and the last vertex.

Hamiltonian circuit is :

2, 3, 10, 11, 12, 4, 5, 1, 6, 7, 17, 16, 15, 14, 13, 20, 19, 18, 9, 8, 2

Discrete Mathematics and Graph Theory (3144202) 2022 Page | 64

You might also like