SlideShare a Scribd company logo
Graphs
Discrete Maths
Definitions - Graph
A generalization of the simple concept of a
set of dots, links, edges or arcs.
Representation: Graph G =(V, E) consists set of vertices
denoted by V, or by V(G) and set of edges E, or E(G)
Definitions – Edge Type
Directed: Ordered pair of vertices. Represented as (u, v)
directed from vertex u to v.
Undirected: Unordered pair of vertices. Represented as {u,
v}. Disregards any sense of direction and treats both end
vertices interchangeably.
u v
u v
Definitions – Edge Type
 Loop: A loop is an edge whose endpoints are
equal i.e., an edge joining a vertex to it self is
called a loop. Represented as {u, u} = {u}
 Multiple Edges: Two or more edges joining the
same pair of vertices.
u
Definitions – Graph Type
Simple (Undirected) Graph: consists of V, a nonempty set
of vertices, and E, a set of unordered pairs of distinct
elements of V called edges (undirected)
Representation Example: G(V, E), V = {u, v, w}, E = {{u, v}, {v,
w}, {u, w}}
u v
w
Definitions – Graph Type
Multigraph: G(V,E), consists of set of vertices V, set of
Edges E and a function f from E to {{u, v}| u, v V, u ≠ v}.
The edges e1 and e2 are called multiple or parallel edges
if f (e1) = f (e2).
Representation Example: V = {u, v, w}, E = {e1, e2, e3}
u
v
w
e1
e2
e3
Definitions – Graph Type
Pseudograph: G(V,E), consists of set of vertices V, set of Edges
E and a function F from E to {{u, v}| u, v Î V}. Loops allowed in
such a graph.
Representation Example: V = {u, v, w}, E = {e1, e2, e3, e4}
u
v
w
e1
e3
e2
e4
Definitions – Graph Type
Directed Graph: G(V, E), set of vertices V, and set of Edges E,
that are ordered pair of elements of V (directed edges)
Representation Example: G(V, E), V = {u, v, w}, E = {(u, v), (v,
w), (w, u)}
u
w
v
Definitions – Graph Type
Directed Multigraph: G(V,E), consists of set of vertices V,
set of Edges E and a function f from E to {{u, v}| u, v V}. The
edges e1 and e2 are multiple edges if f(e1) = f(e2)
Representation Example: V = {u, v, w}, E = {e1, e2, e3, e4}
u
u
u
e1
e2
e3
e4
Definitions – Graph Type
Type Edges Multiple
Edges
Allowed ?
Loops
Allowed ?
Simple Graph undirected No No
Multigraph undirected Yes No
Pseudograph undirected Yes Yes
Directed Graph directed No Yes
Directed
Multigraph
directed Yes Yes
Terminology – Undirected graphs
 u and v are adjacent if {u, v} is an edge, e is called incident with u and v. u and v are called endpoints of {u,
v}
 Degree of Vertex (deg (v)): the number of edges incident on a vertex. A loop contributes twice to the degree
(why?).
 Pendant Vertex: deg (v) =1
 Isolated Vertex: deg (v) = 0
Representation Example: For V = {u, v, w} , E = { {u, w}, {u, w}, (u, v) }, deg (u) = 2, deg (v) = 1, deg (w) = 1, deg (k)
= 0, w and v are pendant , k is isolated
u
k
w
v
Terminology – Directed graphs
 For the edge (u, v), u is adjacent to v OR v is adjacent from u, u – Initial vertex, v – Terminal vertex
 In-degree (deg-
(u)): number of edges for which u is terminal vertex
 Out-degree (deg+
(u)): number of edges for which u is initial vertex
Note: A loop contributes 1 to both in-degree and out-degree (why?)
Representation Example: For V = {u, v, w} , E = { (u, w), ( v, w), (u, v) }, deg-
(u) = 0, deg+
(u) = 2, deg-
(v) =
1,
deg+
(v) = 1, and deg-
(w) = 2, deg+
(u) = 0
u
w
v
Simple graphs – special
cases
 Complete graph: Kn, is the simple graph that contains
exactly one edge between each pair of distinct vertices.
Representation Example: K1, K2, K3, K4
K2
K1
K4
K3
Simple graphs – special
cases
 Cycle: Cn, n 3 consists of n vertices v
≥ 1, v2, v3 … vn and edges
{v1, v2}, {v2, v3}, {v3, v4} … {vn-1, vn}, {vn, v1}
Representation Example: C3, C4
C3 C4
Simple graphs – special
cases

Wheels: Wn, obtained by adding additional vertex to Cn and
connecting all vertices to this new vertex by new edges.
Representation Example: W3, W4
W3 W4
Simple graphs – special
cases
 N-cubes: Qn, vertices represented by 2n bit strings of length
n. Two vertices are adjacent if and only if the bit strings that
they represent differ by exactly one bit positions
Representation Example: Q1, Q2
0
10
1
00
11
Q1
01
Q2
Subgraphs
 A subgraph of a graph G = (V, E) is a graph H =(V’, E’) where V’ is a
subset of V and E’ is a subset of E
Application example: solving sub-problems within a graph
Representation example: V = {u, v, w}, E = ({u, v}, {v, w}, {w, u}}, H1 ,
H2
u
v w
u
u
w
v v
H1
H2
G
Subgraphs
 G = G1 U G2 wherein E = E1 U E2 and V = V1 U V2, G, G1 and G2 are
simple graphs of G
Representation example: V1 = {u, w}, E1 = {{u, w}}, V2 = {w, v},
E1 = {{w, v}}, V = {u, v ,w}, E = {{{u, w}, {{w, v}}
u
v
w w
v
w
u
G1 G2 G
Representation
 Incidence (Matrix): Most useful when information about
edges is more desirable than information about vertices.
 Adjacency (Matrix/List): Most useful when information
about the vertices is more desirable than information about
the edges. These two representations are also most popular
since information about the vertices is often more desirable
than edges in most applications
Representation- Incidence
Matrix
 Representation Example: G = (V, E)
v w
u
e1
e3
e2
e1 e2 e3
v 1 0 1
u 1 1 0
w 0 1 1
Representation- Adjacency
Matrix
 There is an N x N matrix, where |V| = N , the Adjacenct Matrix
(NxN) A = [aij]
For undirected graph

For directed graph
 This makes it easier to find subgraphs, and to reverse graphs if needed.




otherwise
0
G
of
edge
an
is
)
v
,
(v
if
1
a
j
i
ij




otherwise
0
G
of
edge
an
is
}
v
,
{v
if
1
a
j
i
ij
Representation- Adjacency
Matrix
 Adjacency is chosen on the ordering of vertices. Hence,
there as are as many as n! such matrices.
 The adjacency matrix of simple graphs are symmetric (aij =
aji) (why?)
 When there are relatively few edges in the graph the
adjacency matrix is a sparse matrix
 Directed Multigraphs can be represented by using aij =
number of edges from vi to vj
Representation- Adjacency
Matrix
 Example: Undirected Graph G (V, E)
v u w
v 0 1 1
u 1 0 1
w 1 1 0
u
v w
Representation- Adjacency
Matrix
 Example: directed Graph G (V, E)
v u w
v 0 1 0
u 0 0 1
w 1 0 0
u
v w

More Related Content

PPT
Chapter 5 Graphs (1).ppt
ishan743441
 
PPT
graph.ppt
RakeshPandey951330
 
PPT
graph.ppt
SumitSamanta16
 
PPT
GT L7 graph.ppt Graph Theory - Discrete Mathematics
ThinnerBreath
 
PPTX
LEC 1.pptx
ssuserc1e786
 
PPTX
Graph Theory
Rashmi Bhat
 
PDF
Graphs.pdf
pubggaming58982
 
PPT
graph.ppt
yogeshbairagi126
 
Chapter 5 Graphs (1).ppt
ishan743441
 
graph.ppt
SumitSamanta16
 
GT L7 graph.ppt Graph Theory - Discrete Mathematics
ThinnerBreath
 
LEC 1.pptx
ssuserc1e786
 
Graph Theory
Rashmi Bhat
 
Graphs.pdf
pubggaming58982
 
graph.ppt
yogeshbairagi126
 

Similar to Discrete Maths141 - Graph Theory and Lecture (20)

PPT
Graphs in Discrete mathematics for computing
shardaharyani
 
PPT
graph.ppt
AqeelAbbas94
 
PPT
Graph-theory.ppt
AlpaSinghRajput1
 
PPT
Graph.ppt
AlpaSinghRajput1
 
PPTX
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
nasalapurepallavi272
 
PPT
Tn 110 lecture 8
ITNet
 
PPT
graph ASS (1).ppt
ARVIND SARDAR
 
PPT
Graph-theory (1).ppt BBA 1st Semester Graph
swatiritvik
 
PPT
graphass1-23022111180722548-1ba6b00a.ppt
ssuser7b9bda1
 
PPTX
Graph ASS DBATU.pptx
ARVIND SARDAR
 
PPTX
Graph representation
DEEPIKA T
 
PPT
UNIT III discrete mathematice notes availiable
CHHAYANAYAK5
 
PDF
Discrete Mathematics – Graphs and Trees.pdf
ruhamadana111
 
PPTX
DATA STRUCTURES unit 4.pptx
ShivamKrPathak
 
PPTX
Introduction to Graph Theory
Premsankar Chakkingal
 
PDF
Graphs
Dwight Sabio
 
PDF
Graph representation
Amit Kumar Rathi
 
PPTX
Graphs.pptx
satvikkushwaha1
 
PPTX
Graph Theory in Theoretical computer science
Ahmad177077
 
Graphs in Discrete mathematics for computing
shardaharyani
 
graph.ppt
AqeelAbbas94
 
Graph-theory.ppt
AlpaSinghRajput1
 
Graph.ppt
AlpaSinghRajput1
 
Chapter 6-DS(Introduction to Graph and its terminologies).pptx
nasalapurepallavi272
 
Tn 110 lecture 8
ITNet
 
graph ASS (1).ppt
ARVIND SARDAR
 
Graph-theory (1).ppt BBA 1st Semester Graph
swatiritvik
 
graphass1-23022111180722548-1ba6b00a.ppt
ssuser7b9bda1
 
Graph ASS DBATU.pptx
ARVIND SARDAR
 
Graph representation
DEEPIKA T
 
UNIT III discrete mathematice notes availiable
CHHAYANAYAK5
 
Discrete Mathematics – Graphs and Trees.pdf
ruhamadana111
 
DATA STRUCTURES unit 4.pptx
ShivamKrPathak
 
Introduction to Graph Theory
Premsankar Chakkingal
 
Graphs
Dwight Sabio
 
Graph representation
Amit Kumar Rathi
 
Graphs.pptx
satvikkushwaha1
 
Graph Theory in Theoretical computer science
Ahmad177077
 
Ad

Recently uploaded (20)

PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
CDH. pptx
AneetaSharma15
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
Basics and rules of probability with real-life uses
ravatkaran694
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
Ad

Discrete Maths141 - Graph Theory and Lecture

  • 2. Definitions - Graph A generalization of the simple concept of a set of dots, links, edges or arcs. Representation: Graph G =(V, E) consists set of vertices denoted by V, or by V(G) and set of edges E, or E(G)
  • 3. Definitions – Edge Type Directed: Ordered pair of vertices. Represented as (u, v) directed from vertex u to v. Undirected: Unordered pair of vertices. Represented as {u, v}. Disregards any sense of direction and treats both end vertices interchangeably. u v u v
  • 4. Definitions – Edge Type  Loop: A loop is an edge whose endpoints are equal i.e., an edge joining a vertex to it self is called a loop. Represented as {u, u} = {u}  Multiple Edges: Two or more edges joining the same pair of vertices. u
  • 5. Definitions – Graph Type Simple (Undirected) Graph: consists of V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements of V called edges (undirected) Representation Example: G(V, E), V = {u, v, w}, E = {{u, v}, {v, w}, {u, w}} u v w
  • 6. Definitions – Graph Type Multigraph: G(V,E), consists of set of vertices V, set of Edges E and a function f from E to {{u, v}| u, v V, u ≠ v}. The edges e1 and e2 are called multiple or parallel edges if f (e1) = f (e2). Representation Example: V = {u, v, w}, E = {e1, e2, e3} u v w e1 e2 e3
  • 7. Definitions – Graph Type Pseudograph: G(V,E), consists of set of vertices V, set of Edges E and a function F from E to {{u, v}| u, v Î V}. Loops allowed in such a graph. Representation Example: V = {u, v, w}, E = {e1, e2, e3, e4} u v w e1 e3 e2 e4
  • 8. Definitions – Graph Type Directed Graph: G(V, E), set of vertices V, and set of Edges E, that are ordered pair of elements of V (directed edges) Representation Example: G(V, E), V = {u, v, w}, E = {(u, v), (v, w), (w, u)} u w v
  • 9. Definitions – Graph Type Directed Multigraph: G(V,E), consists of set of vertices V, set of Edges E and a function f from E to {{u, v}| u, v V}. The edges e1 and e2 are multiple edges if f(e1) = f(e2) Representation Example: V = {u, v, w}, E = {e1, e2, e3, e4} u u u e1 e2 e3 e4
  • 10. Definitions – Graph Type Type Edges Multiple Edges Allowed ? Loops Allowed ? Simple Graph undirected No No Multigraph undirected Yes No Pseudograph undirected Yes Yes Directed Graph directed No Yes Directed Multigraph directed Yes Yes
  • 11. Terminology – Undirected graphs  u and v are adjacent if {u, v} is an edge, e is called incident with u and v. u and v are called endpoints of {u, v}  Degree of Vertex (deg (v)): the number of edges incident on a vertex. A loop contributes twice to the degree (why?).  Pendant Vertex: deg (v) =1  Isolated Vertex: deg (v) = 0 Representation Example: For V = {u, v, w} , E = { {u, w}, {u, w}, (u, v) }, deg (u) = 2, deg (v) = 1, deg (w) = 1, deg (k) = 0, w and v are pendant , k is isolated u k w v
  • 12. Terminology – Directed graphs  For the edge (u, v), u is adjacent to v OR v is adjacent from u, u – Initial vertex, v – Terminal vertex  In-degree (deg- (u)): number of edges for which u is terminal vertex  Out-degree (deg+ (u)): number of edges for which u is initial vertex Note: A loop contributes 1 to both in-degree and out-degree (why?) Representation Example: For V = {u, v, w} , E = { (u, w), ( v, w), (u, v) }, deg- (u) = 0, deg+ (u) = 2, deg- (v) = 1, deg+ (v) = 1, and deg- (w) = 2, deg+ (u) = 0 u w v
  • 13. Simple graphs – special cases  Complete graph: Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices. Representation Example: K1, K2, K3, K4 K2 K1 K4 K3
  • 14. Simple graphs – special cases  Cycle: Cn, n 3 consists of n vertices v ≥ 1, v2, v3 … vn and edges {v1, v2}, {v2, v3}, {v3, v4} … {vn-1, vn}, {vn, v1} Representation Example: C3, C4 C3 C4
  • 15. Simple graphs – special cases  Wheels: Wn, obtained by adding additional vertex to Cn and connecting all vertices to this new vertex by new edges. Representation Example: W3, W4 W3 W4
  • 16. Simple graphs – special cases  N-cubes: Qn, vertices represented by 2n bit strings of length n. Two vertices are adjacent if and only if the bit strings that they represent differ by exactly one bit positions Representation Example: Q1, Q2 0 10 1 00 11 Q1 01 Q2
  • 17. Subgraphs  A subgraph of a graph G = (V, E) is a graph H =(V’, E’) where V’ is a subset of V and E’ is a subset of E Application example: solving sub-problems within a graph Representation example: V = {u, v, w}, E = ({u, v}, {v, w}, {w, u}}, H1 , H2 u v w u u w v v H1 H2 G
  • 18. Subgraphs  G = G1 U G2 wherein E = E1 U E2 and V = V1 U V2, G, G1 and G2 are simple graphs of G Representation example: V1 = {u, w}, E1 = {{u, w}}, V2 = {w, v}, E1 = {{w, v}}, V = {u, v ,w}, E = {{{u, w}, {{w, v}} u v w w v w u G1 G2 G
  • 19. Representation  Incidence (Matrix): Most useful when information about edges is more desirable than information about vertices.  Adjacency (Matrix/List): Most useful when information about the vertices is more desirable than information about the edges. These two representations are also most popular since information about the vertices is often more desirable than edges in most applications
  • 20. Representation- Incidence Matrix  Representation Example: G = (V, E) v w u e1 e3 e2 e1 e2 e3 v 1 0 1 u 1 1 0 w 0 1 1
  • 21. Representation- Adjacency Matrix  There is an N x N matrix, where |V| = N , the Adjacenct Matrix (NxN) A = [aij] For undirected graph  For directed graph  This makes it easier to find subgraphs, and to reverse graphs if needed.     otherwise 0 G of edge an is ) v , (v if 1 a j i ij     otherwise 0 G of edge an is } v , {v if 1 a j i ij
  • 22. Representation- Adjacency Matrix  Adjacency is chosen on the ordering of vertices. Hence, there as are as many as n! such matrices.  The adjacency matrix of simple graphs are symmetric (aij = aji) (why?)  When there are relatively few edges in the graph the adjacency matrix is a sparse matrix  Directed Multigraphs can be represented by using aij = number of edges from vi to vj
  • 23. Representation- Adjacency Matrix  Example: Undirected Graph G (V, E) v u w v 0 1 1 u 1 0 1 w 1 1 0 u v w
  • 24. Representation- Adjacency Matrix  Example: directed Graph G (V, E) v u w v 0 1 0 u 0 0 1 w 1 0 0 u v w