Unit 4 - Directed Graph
Unit 4 - Directed Graph
DIRECTED GRAPH
Directed Graphs – Types of Directed Graphs –Digraphs and Binary
Relations – Directed Paths and Connectedness – Euler Graphs –
Adjacency Matrix of a Digraph.
vi to vj.
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE 3
DIRECTED GRAPHS (DIGRAPH)
A directed graph (or a digraph for short) G consists of a set of vertices V
= {v1 , v2 , . . .}, a set of edges E = {e1 , e2 , . . .}, and a mapping Ψ that
maps every edge onto some ordered pair of vertices (vi , vj ).
PENDANT VERTEX
• A vertex v in a digraph is called a pendant if it is of degree 1, i.e,
d+(v) + d-(v) = 1
v1 v2
v4 v3
d+(x1) = 2
d+(x2) = 2
d+(x3) = 0
d+(x4) = 2
d-(x1) = 1
d-(x2) = 1
d-(x3) = 3
d-(x4) = 1
Sum of degrees of (+) and (-) for all vertices is same.
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE 16
COMPLETE SYMMETRIC DIGRAPH
• It is a simple digraph in which there exists exactly one edge directed
from every vertex to every other vertex.
𝑣1
𝑣3 𝑣2
A complete asymmetric digraph of n vertices contains n(n – l)/2 edges,
but a complete symmetric digraph of n vertices contains n(n – 1) edges.
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE 18
BALANCED DIGRAPHS
• A digraph is said to be balanced if for every vertex vi, the indegree
equals out-degree ,i.e , d+(vi) = d-(vi)
• A balanced digraph is also referred to as a pseudo symmetric digraph,
or an isograph
𝑣1
d+(v1) = 1
d+(v2) = 2
d+(v3) = 1
𝑣3 𝑣2
d-(v1) = 1
d-(v2) = 2
d-(v3) = 1
𝑣1
𝑣2 𝑣3
• d+(vi) = d-(vi) = 2
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE 20
REGULAR BALANCED DIGRAPHS
• d+(vi) = d-(vi) = 1
𝑣2
𝑣1 𝑣3
G1 G2
A D V4 v3
• Soln :
Isomorphic undirected graphs :
G1 G2
Vertices 4 4
Edges 6 6 23
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE
SOLUTION
Degree :
G1 G2
d(D)=2 d(v1)=2
d(C)=2 d(v2)=4
d(B)=4 d(v3)=4
d(A)=4 d(v4)=2
One-to-one correspondence :
𝐴→𝐵→𝐶→𝐷
𝑣1 → 𝑣4 → 𝑣3 → 𝑣2
No/of vertices and edges are same. Only the difference is in in-degree
and out-degree.
Vertex G1 Vertex G2
I.D O.D I.D O.D
A d-(A)=1 d+(A)=1 v1 d-(v1)=1 d+(v1)=1
B d-(B)=1 d+(B)=1 v2 d-(v2)=2 d+(v2)=2
C d-(C)=2 d+(C)=2 v3 d-(v3)=2 d+(v3)=2
D d-(D)=2 d+(D)=2 v4 d-(v4)=1 d+(v4)=1
One-to-one correspondence :
𝐴→𝐵→𝐶→𝐷
𝑣1 → 𝑣4 → 𝑣3 → 𝑣2
ii)
• Soln :
Isomorphic undirected graphs :
G1 G2
Vertices 4 4
Edges 6 6 27
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE
SOLUTION
Degree :
G1 G2
d(D)=3 d(v1)=3
d(C)=3 d(v2)=3
d(B)=3 d(v3)=3
d(A)=3 d(v4)=3
One-to-one correspondence :
𝐴→𝐵→𝐶→𝐷
𝑣1 → 𝑣2 → 𝑣3 → 𝑣4
Vertex G1 Vertex G2
I.D O.D I.D O.D
A d-(A)=1 d+(A)=2 v1 d-(v1)=2 d+(v1)=1
B d-(B)=2 d+(B)=1 v2 d-(v2)=2 d+(v2)=1
C d-(C)=2 d+(C)=1 v3 d-(v3)=2 d+(v3)=1
D d-(D)=1 d+(D)=2 v4 d-(v4)=0 d+(v4)=3
30
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE
BINARY RELATIONS
Reflexive di-graphs :
• The digraph of a reflexive relation will have self loop at every vertex.
• A digraph in which no vertex has a self-loop is called an irreflexive
digraph.
2) Symmetric relation :
Eg :
i. “Is equal to” is both symmetric and reflexive.
ii. “Is spouse of” is symmetric.
Symmetric digraphs :
• The digraph of a symmetric relation is a symmetric digraph because
for every directed edge from vertex xi to xj, there is directed edge from
xj to xi
V1 V2
• Eg :
i) “is greater than” - 7 R 5 & (5 R 3) ⇒ (7 R 3) V4 V3
• Eg:
i. Is equal to
ii. Is congruent to
iii. Is isomorphic to
• In general, an equivalence relation on a set partitions the elements of the
set into classes (called equivalence classes) such that two elements are in
the same class if and only if they are related.
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE 38
TYPES OF RELATION
4) Equivalence relation :
• X = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
• In the figure, e4 e6 e2
Path = v1e1v2e2v3
v4 e3 v3
and edges, beginning with vi and ending with vj such that each edge is
but a vertex may appear more than once in the case of undirected graphs.
Eg :
vie4v4e3v3 – semi-walk
v1e4v4e3v3e2v2e1v1 – closed semi-walk
A B
𝐴 → 𝐵 , B → A (B →C → A)
A →C(A →B →C) , C →A
A →D , D →A(D →B →C →A)
B →C , C →B(C →A →B)
D C
B →D(B →C →D) , D →B
C →D , D →C(D →B →C)
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE 45
WEAKLY CONNECTED
• A digraph is said to be weakly connected if there is a path between
every 2 vertices in the underlying undirected graph.
A B A B
D C D C
A→ C , C → A
(No path exists). Path exists.
DR.M.SUJITHRA , ASSISTANT PROFESSOR, DEPT OF COMPUTING- DATA SCIENCE 46
UNILATERALLY CONNECTED
• A digraph is said to be unilaterally connected if for any pair of vertices
of the graph at least one of the pair of vertices is reachable from the
other vertices.
A B
𝐴 → 𝐵 ,B → A
A →C , C →A (C → D → A)
A →D , D →A
B →C , C →B
B →D , D →B (D → A → B)
D C
C →D , D →C
𝐴 → 𝐵 𝐴 → 𝐷 → 𝐵 ,B → A
D
A →C , C →A (C →B →A)
A →D , D →A(D →B →A)
B →C (B →A →C) , C →B
B →D(B → A →D) , D →B C B
C →D (C →B →A →D) , D →C(D →C)
iv)
𝐴 → 𝐵 𝐴 → C → 𝐵 ,B → A D
A →C , C →A (C →B →A)
A →D , D →A
B →C (B →A →C) , C →B C B
B →D , D →B
C →D , D →C
Therefore, it is unilaterally connected.
Euler line :
a →b →c →d →e →f