SlideShare a Scribd company logo
1 of 78
Graph Theory
Introduction to Graph Theory
• What is Graph Theory?
• Study of graphs which are mathematical structures
• Graph consists of vertices and edges which connects the vertices
• Where we are using Graph Theory?
Introduction to Graph Theory
• Where in computer science, we are using Graph Theory?
Introduction to Graph Theory
• Graphs can be used to
• Determine whether it is possible to walk down all the streets in a city without going
down a street twice, and we can find the number of colors needed to color the regions
of a map.
• Design a circuit
• Determine a shortest route to travel
Graph Theory
• What is Graph?
• A graph is G=(V,E) consists of V, a non empty set of vertices (or nodes) and E, a set of
edges.
• Each edge is either one or two vertices associated with it, called as endpoints.
• An edge is said to be connected to the endpoints.
• A graph with infinite vertex set is called as an infinite graph
• A graph with a finite vertex set is called as a finite graph.
• Note that
• Each edge of the graph representing this computer network connects
two different vertices. That is, no edge connects a vertex to itself.
• No two different edges connect the same pair of vertices.
Types of Graphs
• Simple Graph
• A graph in which each edge connects two different vertices and where no two edges
connect the same pair of vertices.
• Each edge is associated to an unordered pair of vertices, and no other edge is
associated to this same edge.
• Edge connecting to vertex a and vertex b (i.e. {a,b}) no other edge is associated to edge
{a,b}
• Multigraph
• A graph in which multiple edges connects to the same pair of vertices.
• When there are m different edges associated to the same unordered pair of
vertices {a,b}, we say that {a,b} is an edge of multiplicity m.
• This set of edges connecting to a and b are m different copies of an edge {a,b}
• Pseudograph
• Loops: the edges that connect a vertex itself
• A graph containing loops and multiple edges connecting the same pair of
vertices are sometimes called as pseudograph.
a
b
c
a
b
c
Simple graph
Multigraph
Pseudograph
Types of Graphs
• Undirected Graphs
• A graph containing undirected edges.
• Directed Graphs(Diagraph)
• A graph (V,E) consists of a non-empty set of vertices V and a set of directed
edges (or arcs) E.
• Each directed edge is associated with an ordered pair of vertices.
• The directed edge associated with the ordered pair (a,b) is said to start at a
and end at b.
• An arrow pointing from a to b indicate the direction of an edge that starts at
a and ends at b.
• Can have loops and may also contain multiple directed edges starting and
ending at same vertices.
• May contain directed edges that connect vertices a and b in both directions
Types of Graphs
• Directed Graphs(Diagraph)
• A directed graph with no loops and has no multiple directed edges from a
and b is called as simple directed graph.
• Has at most one edge associated to each ordered pair of vertices
• Directed graphs that may have multiple directed edges from a vertex to a
second (possibly the same) vertex is called as directed multigraphs.
• When there are m directed edges, each associated to an ordered pair of vertices
(a, b), we say that (a, b) is an edge of multiplicity m.
• Mixed Graph
• A graph with both directed and undirected edges is called a mixed graph.
• Used to model a computer network containing links that operate in both
directions and other links that operate only in one direction.
a b
c
Types of Graphs
Type Edges Multiple edges allowed? Loops allowed?
Simple graph Undirected No No
Multigraph Undirected Yes No
Pseudograph Undirected Yes Yes
Simple directed graph Directed No No
Directed multigraph Directed Yes Yes
Mixed graph Directed or undirected Yes Yes
Table: Graph Terminology
Types of Graphs
A B
C
D
2
1
5
3 4
a
c
d
b
e
f
Simple directed graph
Directed multigraph
Multigraph
Graph Terminologies of Undirected Graph
• Two vertices u and v in an undirected graph G are called adjacent (or neighbours) in G if u
and v are endpoints of an edge of G.
• If edge e is associated with {u,v}, the edge e is called incident with the vertices u and v.
• The edge e is said to connect u and v
• The vertices u and v are called as endpoints of an edge associated with {u,v }.
• The degree of vertex in an undirected graph is the number of edges incident with it, except
that a loop at a vertex contributes twice to the degree of that vertex.
• The degree of vertex is denoted by deg(v).
a
c
d
b
e
f
What is the degree of vertex
1. a
2. b
3. c
4. d
5. e
6. f
What is the degree of vertex
1. a  4
2. b  4
3. c  2
4. d  2
5. e  3
6. f  2
Graph Terminologies of Undirected Graph
• A vertex of degree zero is called isolated.
• Such isolated vertex is not adjacent to any vertex.
• A vertex is a pendant if and only if it has degree one.
• A pendant vertex is adjacent to one and only one other vertex.
Graph Terminologies of Undirected Graph
• The Handshaking Theorem
Let G = (V, E) be an undirected graph with e edges. Then
2𝑒 =
𝑣∈𝑉
deg(𝑣)
This applies even if multiple edges and loops are present in the graph.
Q. How many edges are there in a graph with 12 vertices each of degree six?
• An undirected graph has an even number of edges
Graph Terminologies of Undirected Graph
• An undirected graph has an even number of vertices has odd degree.
Proof
Let 𝑉1 and 𝑉2 be the set of vertices of even degree and set of vertices of odd degree
respectively, in an undirected graph. Then
2𝑒 =
𝑣∈𝑉
deg(𝑣) =
𝑣∈𝑉1
deg(𝑣) +
𝑣∈𝑉2
deg(𝑣)
C E
D
B
G
A
F
H
Graph Terminologies of Directed Graph
• When (u,v) is an edge of the graph G with directed edges,
• u is said to be adjacent to v and v is said to be adjacent from u.
• The vertex u is called as initial vertex of (u,v), and v is called as terminal
or end vertex of (u,v).
• The initial vertex and terminal vertex of a loop are the same.
• In a graph with directed edges
• The in-degree of a vertex v, denoted by deg 𝑣 is the number of edges
with v as their terminal vertex.
• The out-degree of a vertex v, denoted by deg+(v) is the number of edges
with v as their initial vertex.
• A loop at a vertex contributes 1 to both the in-degree and the out-degree
of this vertex.
2
1
5
3 4
Graph Terminologies of Directed Graph
Let G=(V,E) be a graph with directed edges. Then
𝑣∈𝑉
𝑑𝑒𝑔 (𝑣) =
𝑣∈𝑉
𝑑𝑒𝑔
+
𝑣 = 𝐸
Special Graph Terminologies
• Complete Graph
• The complete graph on n vertices, denoted by Kn, is the simple graph that contains
exactly one edge between each pair of distinct vertices.
• Cycles
• The cycle Cn, 𝑛 ≥ 3, consists of n vertices 𝑣1, 𝑣2, . . . , 𝑣𝑛 and edges {𝑣1, 𝑣2}, {𝑣2, 𝑣3},- ..
,{𝑣𝑛−1, 𝑣𝑛}, and {𝑣𝑛, 𝑣1}.
Special Graph Terminologies
• Wheels
• We obtain wheel Wn when we add an additional vertex to the cycle Cn, for 𝑛 ≥ 3, and then
we connect this new vertex to each of 𝑛 vertices in Cn by new edges.
Special Graph Terminologies
• n-Cube
• The n-dimensional hypercube, or n-cube, denoted by Qn, is the graph that has vertices
representing the 2n bit strings of length n.
• Two vertices are adjacent if and only if the bit strings that they represent differ in exactly
one bit position.
Graph Representations
• A graph G can be represented in two ways
• Adjacency matrix/list
• Useful when information about the vertices is more desirable than information of edges.
• Incidence matrix
• Useful when information about edges is more desirable than information of vertices
• Adjacency list/matrix is more commonly used representation.
Graph Representations
• Adjacency List
• It is way to represent a graph without multiple edges
• It specifies the vertices that are adjacent to each vertex of the graph.
Vertex Adjacent vertices
a b, c, e
b a
c a, e, d
d c, e
e a, c, d
Adjacency List of Undirected graph G
Graph Representations
• Adjacency List
Initial Vertex Terminal vertices
a b, c, d, e
b b, d
c a, c, e
d
e b, c, d
Adjacency List of Directed graph G
Graph Representations
• Determine the Adjacency List for following graphs
a b c
e
d
a b
b a
c b
d a
e c
d 
c d 
e 
b e 
d
Graph Representations
• Determine the Adjacency List for following graphs
1
2
3
4
5
6

1 2
2 1 
3
1
3 2 
5

6
4
2
5 4 
6
6 
a b c
e
d
a b
b a
c b
d a
e c
d 
c d 
e 
b e 
d
Graph Representations
• Adjacency Matrix
• Suppose a graph G=(V,E) is a simple graph, where |V|=n
• Vertices are listed as v1, v2, . . ., vn
• Adjacency matrix A or (AG) og G, with respect to this listing of the vertices,is the 𝒏 × 𝒏
zero-one matrix with 1 as its (i,j)th entry when vi and vj are adjacent and 0 as its (i,j)th
entry when vi and vj are not adjacent.
• Or we can say adjacency matrix A =[aij], then
𝑎𝑖,𝑗 =
1
0
𝑖𝑓 𝑣𝑖, 𝑣𝑗 𝑖𝑠 𝑎𝑛 𝑒𝑑𝑔𝑒 𝑜𝑓𝑔
𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 0 1
1 0
1 0
0 1
1 0
0 1
0 1
1 0
a b c d
a
b
c
d
All undirected graphs, including multi graphs and pseudographs, have symmetric adjacency matrices.
𝑛 × 𝑛
Graph Representations
• Adjacency Matrix
• Adjacency matrix A or (AG) of directed graph G, with respect to this listing of the vertices,is
the 𝒏 × 𝒏 zero-one matrix with 1 in its (i,j)th entry if there is an edge from vi and vj ,
• we can say adjacency matrix A =[aij] of directed graph w.r.t to the listing of the vertices,
then
𝑎𝑖,𝑗 =
1
0
𝑖𝑓 𝑣𝑖, 𝑣𝑗 𝑖𝑠 𝑎𝑛 𝑒𝑑𝑔𝑒 𝑜𝑓𝑔
𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
The adjacency matrix for a directed graph does not have to be symmetric, because there
may not be an edge from aj to ai when there is an edge from ai to aj.
Graph Representations
• Determine the adjacency matrices for the following graphs
a b c
e
d
1
2
3
4
5
6
0 1
1 0
0 1 0
1 1 0
0 1
1 1
0 0
0 0 1
0 0 1
1 1 0
0 1 0
1 0 0
1 1 0
0 0 0
1 0 0
0 1 0
0 0 0
0 1 0
0 0 0
0 0 1
1 0 1
0 0 0
a b c d e
a
b
c
d
e
1 2 3 4 5 6
1
2
3
4
5
6
0 3
3 0
0 2
1 1
0 1
2 1
1 2
2 0
a b c d
a
b
c
d
Graph Representations
• Incidence Matrix
• Let G=(V,E) is an undirected graph,
• Suppose 𝑣1, 𝑣2, . . . , 𝑣𝑛 are the vertices and 𝑒1, 𝑒2, . . . , 𝑒𝑚 are the edges of G.
• The incidence matrix w.r.t. this ordering of V and E is the 𝒏 × 𝒎 matrix 𝑀 = 𝑚𝑖𝑗 ,
where
𝑚𝑖𝑗 =
1
0
𝑤ℎ𝑒𝑛 𝑒𝑑𝑔𝑒 𝑒𝑗 𝑖𝑠 𝑖𝑛𝑐𝑖𝑑𝑒𝑛𝑡 𝑤𝑖𝑡ℎ 𝑣𝑖
𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
v1 v2 v3
v4 v5
e1
e2
e3
e4 e5
e6
1 1 0
0 0 1
0 0 0
1 0 1
0 1 0
0 0 0
1 0 1
0 1 1
0 0 0
1 1 0
e1 e2 e3 e4 e5 e6
v1
v2
v3
v4
v5
𝑛 × 𝑚
Graph Representations
• Represent the following pseudograph using Incidence Matrix
1 1 1
0 1 1
0 0 0
0 0 0
1 0 1
1 1 0
0 0 0
0 1 0
1 0 0
0 0 0 0 0 0 1 1 1
0 0 0 0 1 1 0 0 0
v1 v2 v3
v4
v5
e2
e1
e4
e3
e5
e6
e7
e8
e9
e1 e2 e3 e4 e5 e6 e7 e8 e9
v1
v2
v3
v4
v5
Graph Representations
• Represent the following graph using Adjacency Matrix
Sub Graph
• Sometime we need only part of graph to solve a problem.
• When edges and vertices are removed from a graph, without removing
endpoints of any remaining edges, a smaller graph is obtained. Such a
graph is called a subgraph of the original graph.
• A subgraph of a graph 𝐺 = (𝑉, 𝐸) is a graph 𝐻 = (𝑊, 𝐹), where 𝑊 ⊆ 𝑉
and 𝐹 ⊆ 𝐸.
• A subgraph H of G is a proper subgraph of G if 𝐻 ≠ 𝐺
a b c
e
d
a b
d
Operations on Graphs
• Various operations can be performed on graphs
• Union (𝐴 ∪ 𝐵)
𝐴 = 2, 4, 6, 8, 10
𝐵 = 4, 8,12, 16
𝑨 ∪ 𝑩 = {𝟐, 𝟒, 𝟔, 𝟖, 𝟏𝟎, 𝟏𝟐, 𝟏𝟔}
• Intersection (𝐴 ∩ 𝐵)
𝐴 = 2, 4, 6, 8, 10
𝐵 = 4, 8,12, 16
𝑨 ∩ 𝑩 = {𝟒, 𝟖}
• Sum (𝐴 + 𝐵)
• Ring sum (𝐴⨁𝐵)
• Product (𝐴 × 𝐵)
Union of Graphs
• Two or more graphs can be combined in various ways. The new graph that contains all the
vertices and edges of these graphs is called the union of the graphs.
• The union of two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2) is the simple graph
with vertex set 𝑽𝟏 ∪ 𝑽𝟐 and edge set 𝑬𝟏 ∪ 𝑬𝟐 . The union of 𝐺1 and 𝐺2 is denoted by
𝐺1 ∪ 𝐺2.
𝑉1 = 𝑎, 𝑏, 𝑐, 𝑑 , 𝑉2 = 𝑎, 𝑏, 𝑐, 𝑑, 𝑒
𝑽𝟏 ∪ 𝑽𝟐 = {𝒂, 𝒃, 𝒄, 𝒅, 𝒆}
𝐸1 = 𝑎, 𝑏 , 𝑎, 𝑑 , 𝑏, 𝑐 , 𝐸2 = 𝑎, 𝑑 , 𝑎, 𝑒 , 𝑏, 𝑑 , 𝑏, 𝑒 , 𝑐, 𝑒
𝑬𝟏 ∪ 𝑬𝟐 = { 𝒂, 𝒃 , 𝒂, 𝒅 , 𝒂, 𝒆 , 𝒃, 𝒄 , 𝒃, 𝒅 , 𝒃, 𝒆 , 𝒄, 𝒆 }
a b c
d
a b c
e
d
G1 G2
Intersection of Graphs
• The intersection of two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2) is the simple
graph with vertex set 𝑽𝟏 ∩ 𝑽𝟐 and edge set 𝑬𝟏 ∩ 𝑬𝟐 . The intersection of 𝐺1 and 𝐺2 is
denoted by 𝐺1 ∩ 𝐺2. Contains common vertices and common edges of these graphs.
𝑉1 = 1,2,3,4,5,6 , 𝑉2 = 1,2,3,4,5,6
𝑽𝟏 ∩ 𝑽𝟐 = {𝟏, 𝟐, 𝟑, 𝟒, 𝟓, 𝟔}
𝐸1 = 1,2 , 1,5 , 1,6 , 2,3 , 2,6 , 3,4 , 3,6 , 4,5 , 4,6 , 5,1 , {5,6}
𝐸2 = 1,6 , 2,6 , 3,6 , 4,6 , 5,6
𝑬𝟏 ∩ 𝑬𝟐 = { 1,6 , 2,6 , 3,6 , 4,6 , 5,6 }
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
∩
G1
G2
G1 ∩ G2
Sum of Graphs
• If two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2), such that 𝑉1 ∩ 𝑉2 = ∅,
then the sum of 𝐺1 and 𝐺2 is denoted by 𝑮𝟏 + 𝑮𝟐 consists of those edges, which
are in G1 and in G2 and the edges obtained, by joining each vertex of G1 to each
vertex of G2.
𝑉1 = 𝑎, 𝑏 , 𝑉2 = 𝑥, 𝑦, 𝑧
𝑽𝟏 + 𝑽𝟐 = {𝒂, 𝒃, 𝒙, 𝒚, 𝒛}
𝐸1 = 𝑎, 𝑏 , 𝐸2 = { 𝑥, 𝑦 , 𝑦, 𝑧 }
𝑬𝟏 + 𝑬𝟐 = { 𝒂, 𝒃 , 𝒂, 𝒙 , 𝒂, 𝒚 , 𝒂, 𝒛 , 𝒃, 𝒙 , 𝒃, 𝒚 , 𝒃, 𝒛 , 𝒙, 𝒚 , {𝒚, 𝒛}}
a
b
x
y
z
a
b
y
z
x
+
G1 G2
G1 + G2
Ring sum of Graphs
• The ring sum of two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2) is the
simple graph with vertex set 𝑽𝟏 ∪ 𝑽𝟐 and the edges that are either in 𝐺1 or in
𝐺2 but not in both i.e. (𝑬𝟏 ∪ 𝑬𝟐) − (𝑬𝟏 ∩ 𝑬𝟐) . The ring sum of 𝐺1 and 𝐺2 is
denoted by 𝐺1⨁𝐺2.
𝑉1 = 𝑎, 𝑏, 𝑐, 𝑑, 𝑒 , 𝑉2 = 𝑏, 𝑐, 𝑑, 𝑒
𝑽𝟏 ∪ 𝑽𝟐 = {𝒂, 𝒃, 𝒄, 𝒅, 𝒆}
𝐸1 = 𝑎, 𝑏 , 𝑎, 𝑐 , 𝑎, 𝑑 , 𝑎, 𝑒 , 𝑏, 𝑐 , 𝑏, 𝑑 , 𝑏, 𝑒 , 𝑐, 𝑑 , {𝑑, 𝑒}
𝐸2 = { 𝑏, 𝑐 , 𝑏, 𝑒 , 𝑐, 𝑑 , 𝑐, 𝑒 , {𝑑, 𝑒}}
(𝑬𝟏 ∪ 𝑬𝟐) − (𝑬𝟏 ∩ 𝑬𝟐) = { 𝒂, 𝒃 , 𝒂, 𝒄 , 𝒂, 𝒅 , 𝒂, 𝒆 , 𝒃, 𝒅 , {𝒄, 𝒆}}
a
b
c d
e b
c d
e
a
b e
c d
a
b e
⨁
G1 G2 G1 ⨁ G2
Product of Graphs
• Product of sets A and B
𝐴 = 1, 2, 3, 4, 5 , 𝐵 = {9, 8, 7}
𝐴 × 𝐵 = { 1,9 , 1,8 , 1, 7 , 2,9 , 2, 8 , 2, 7 , . . . , 5, 9 , 5,8 , 5,7 }
• Product of graphs G and H
• Vertex set of G is 𝑉 𝐺 = {𝑣1, 𝑣2, . . . , 𝑣𝑛}
• Vertex set of H is 𝑉 𝐻 = {𝑢1, 𝑢2, . . . , 𝑢𝑚}
• Product of G and H i.e. V 𝐺 × 𝐻 = { 𝑣𝑖, 𝑢𝑗 𝑣𝑖 ∈ 𝑉 𝐺 𝑎𝑛𝑑 𝑢𝑗 ∈ 𝑉(𝐻)}
𝑉 𝐺 × 𝐻 = { 𝑣1, 𝑢1 , 𝑣1, 𝑢2 , . . . , 𝑣1, 𝑢𝑚 , 𝑣2, 𝑢1 , 𝑣2, 𝑢2 , . . . , 𝑣2, 𝑢𝑚 , . . . , 𝑣𝑛, 𝑢1 , 𝑣𝑛, 𝑢2 , . . . , 𝑣𝑛, 𝑢𝑚 }
• Two vertices 𝑣𝑖, 𝑢𝑗 𝑎𝑛𝑑 𝑣𝑘, 𝑢𝑙 are adjacent in 𝐺 × 𝐻 if and only if either
𝑣𝑖 = 𝑣𝑘 𝑎𝑛𝑑 𝑢𝑗 is adjacent to 𝑢𝑙in H OR
𝑢𝑗 = 𝑢𝑙 𝑎𝑛𝑑 𝑣𝑖 is adjacent to 𝑣𝑘in G
Product of Graphs
×
G H G X H
𝑣𝑖, 𝑢𝑗
𝑣𝑘, 𝑢𝑙
𝑣𝑖, 𝑢𝑗
𝑣𝑘, 𝑢𝑙
𝑣𝑖 = 𝑣𝑘 𝑎𝑛𝑑 𝑢𝑗 is adjacent to 𝑢𝑙in H
OR
𝑢𝑗 = 𝑢𝑙 𝑎𝑛𝑑 𝑣𝑖 is adjacent to 𝑣𝑘in G
Product of Graphs
• Example
a
b c
1
2
3
4
(a,1)
(b,1) (c,1)
(a,2)
(b,2) (c,2)
(a,3)
(b,3) (c,3)
(a,4)
(b,4) (c,4)
Walk
• For a graph G=(V,E), a walk is defined as a sequence of alternating vertices an edges such as
𝑣0, 𝑒1, 𝑣1, 𝑒2, 𝑣2, 𝑒3, . . . 𝑣𝑛−1, 𝑒𝑛, 𝑣𝑛 where each edge 𝑒𝑖 = {𝑣𝑖−1, 𝑣𝑖}.
• The length of this walk is 𝑛.
• Walks can have repeated edges.
• A walk is considered to be Closed if the starting vertex is the same as the ending vertex, that
is 𝑣0 = 𝑣𝑛. A walk is considered Open otherwise.
Walk is denoted as abcdb.
Length of this walk is 4.
Another possible walk is abcdbce
and its length will be ?
Walk is denoted as ecfge. Length of this walk is 4.
Trail
• A trail is defined as a walk with no repeated edges.
• The length of this trail is 𝑛.
The walk can be defined as abc.
There are no repeated edges so
this walk is also a trail.
This walk must repeat at least one edge.
So this walk cannot be a trail.
Path
• A path is a sequence of edges that begins at a vertex of a graph and travels from vertex to
vertex along edges of the graph.
• For a graph G=(V,E), a path of length 𝑛 from u to v in G is a sequence of n edges 𝑒1, 𝑒2, … , 𝑒𝑛 of
G such that 𝑒1 is associated with {𝑣0, 𝑣1}, 𝑒2 is associated with {𝑣1, 𝑣2}. and so on, with 𝑒𝑛
associated with {𝑣𝑛−1, 𝑣𝑛}, where 𝑣0 = u and 𝑣𝑛 = v.
• We denote the path by its vertex sequence 𝑣0, 𝑣1, . . . , 𝑣𝑛 because listing these vertices
uniquely determines the path.
• The path is a circuit if it begins and ends at the same vertex i.e., if u = v, and has length greater
than zero.
• The path or circuit is said to pass through the vertices 𝑣0, 𝑣1, . . . , 𝑣𝑛−1 or traverse the edges
𝑒1, 𝑒2, … , 𝑒𝑛.
• A path or circuit is simple if it does not contain the same edge more than once.
Path
a,b,c,f,e,d is a simple path with length 5.
a,b,c,f,e,d,a is a circuit with length 6.
b,f,e,c,d is not a path.
a,e,f,e,b,c is not a simple path with length 4
because it contains {e,f} twice.
Graph Connectivity
• Connectivity defines whether a graph is connected or disconnected.
• An undirected graph is called connected if there is a path between every pair of
distinct vertices of the graph.
• From every vertex to any other vertex, there should be some path to traverse that is called
the connectivity of a graph.
• A graph with multiple disconnected vertices and edges is said to be
disconnected.
G1 G2 G3
Graph Connectivity
• A connected component of a graph G is a connected subgraph of G that is not a
proper subgraph of another connected subgraph of G.
Graph Connectivity
• Cut Vertex
• The removal of a vertex and all edges incident with it produces a sub graph with more
connected components than in the original graph. Such vertices are called cut vertices (or
articulation points).
• An edge whose removal produces a graph with more connected components than in the
original graph is called a cut edge or bridge.
• The removal of a cut vertex from a connected graph produces a subgraph that is not connected.
Graph Connectivity
• Cut Vertex
G
What are the cut vertices of G?
After removing vertex b After removing vertex c After removing vertex e
What are the cut edges of G? Cut edges of G are {a,b} and {c,e}.
Graph Connectivity
• A directed graph is strongly connected if there is a path from a to b and from b to
a whenever a and b are vertices in the graph.
• A directed graph is weakly connected if there is a path between every two
vertices in the underlying undirected graph.
• i.e. A directed graph is weakly connected if and only if there is always a path between two
vertices when the directions of the edges are disregarded.
G is strongly connected. H is weakly connected.
Isomorphism of Graphs
• Can we draw two graphs in the same way?
• The simple graphs G1=(V1,E1)and G2=(V2,E2) are isomorphic if there is one to one and
onto function f from V1 to V2 with the property that a and b are adjacent in G1 if and
only if f(a) and f(b) are adjacent in G2, for all a and b in V1. Such a function f is called an
isomorphism.
• When two simple graphs are isomorphic, there is a one-to-one correspondence between
vertices of the two graphs that preserves the adjacency relationship.
• Isomorphic simple graphs also must have the same number of edges.
Isomorphism of Graphs
• The degrees of the vertices in isomorphic simple graphs must be the same.
Isomorphism of Graphs
G G’ v5 V5’
Isomorphism of Graphs
• The number of vertices, the number of edges, and the number of vertices of each
degree are all invariants under isomorphism.
• If any of these quantities differ in two simple graphs, these graphs cannot be
isomorphic.
• However, when these invariants are the same, it does not necessarily mean
that the two graphs are isomorphic.
Q. Determine whether the graphs G and H shown below are isomorphic.
G H
G
H
Isomorphism of Graphs
• Use of adjacency matrices to show isomorphism
• Define a function f and then determine whether it is an isomorphism
f(u1)=?
deg(u1)=2 and u1 is not adjacent to any other vertex of degree 2, f(u1) must be either v6
or v4.
Assume f(u1) = v6
As u2 is adjacent to u1 , so possible f(u2) must be either v3 or v5 . Assume f(u2) = v3 .
Similarly
We get f(u3)= v4 , f(u4)= v5 , f(u5)= v1 , f(u6)= v2 .
Now we have a one-to-one correspondence between the vertex set of G and the vertex
set of H.
f(u1) = v6 , f(u2) = v3 , f(u3)= v4 , f(u4)= v5 , f(u5)= v1 , f(u6)= v2
G
H
Isomorphism of Graphs
• Use of adjacency matrices to show isomorphism
Now we have a one-to-one correspondence between the vertex set of G and the vertex
set of H.
f(u1) = v6 , f(u2) = v3 , f(u3)= v4 , f(u4)= v5 , f(u5)= v1 , f(u6)= v2
We examine the adjacency matrix of G and the adjacency matrix H with the rows and
columns labeled by the images of the corresponding vertices in G
𝐴𝐻 =
v6
v3
v4
v5
v1
v2
0 1 0
1 0 1
0 1 0
1 0 0
0 0 1
1 0 0
1 0 1
0 0 0
0 1 0
0 1 0
1 0 1
0 1 0
𝑣6 𝑣3 𝑣4 𝑣5 𝑣1 𝑣2
𝐴𝐺 =
u1
u2
u3
u4
u5
u6
0 1 0
1 0 1
0 1 0
1 0 0
0 0 1
1 0 0
1 0 1
0 0 0
0 1 0
0 1 0
1 0 1
0 1 0
𝑢1 𝑢2 𝑢3 𝑢4 𝑢5 𝑢6
Because AG = AH , it follows that f preserves edges.
We conclude that f is an isomorphism, so G and H are isomorphic.
Isomorphism of Graphs
• Points to remember for checking isomorphism
Match the
• Number of vertices
• number of edges
• Number of vertices of each degree
• Degree of selected vertex and degree of its adjacent vertices.
Homomorphism of Graphs
• Two graphs G1 and G2 are said to be homomorphic, if each of these graphs can be obtained
from the same graph 'G' by dividing some edges of G with more vertices.
Homomorphism of Graphs
• Two homomorphic graphs G1 and G2 can be obtained from the same graph 'G' by
• Inserting vertices OR
• Removing vertices with degree 2
Euler and Hamiltonian Graphs
• Can we travel along the edges of a graph starting at a vertex and returning to it by traversing
each edge of the graph exactly once?
Euler Circuit
• Can we travel along the edges of a graph starting at a vertex and returning to it while visiting
each vertex of the graph exactly once?
Hamiltonian Circuit
Euler and Hamiltonian Graphs
• Euler Path and Circuit
• The town of Konigsberg, Prussia, was divided into four sections by the branches of the
Pregel River
• The townspeople wondered whether it was possible to start at some location in the town,
travel across all the bridges without crossing any bridge twice, and return to the starting
point.
• Swiss mathematician Leonhard Euler solved this problem using Graph theory
Euler and Hamiltonian Graphs
• Euler Circuit and Path
• An Euler circuit in a graph G is a simple circuit containing every edge of G.
• An Euler path in G is a simple path containing every edge of G.
G1has Euler circuit
a, e, c, d, b, a
G2 has neither
Euler circuit nor
Euler path
G3 doesn’t have Euler circuit
but it has Euler path
a, c, d, e, b, d, a, b
Euler and Hamiltonian Graphs
Which of the following directed graphs have an Euler circuit? Of those that do not, which have an Euler path?
Euler and Hamiltonian Graphs
• Necessary And Sufficient Conditions For Euler Circuits And Paths
• A connected multigraph with at least two vertices has an Euler circuit if and only if each
of its vertices has even degree
• A connected multigraph has an Euler path but not an Euler circuit if and only if it has
exactly two vertices of odd degree.
c d
b e
a
Euler Circuit: a, c, e, a, b, d, a
deg(a)=4, deg(c)=2, deg(e)=2,
deg(b)=2, deg(d)=2
Euler path: b, a, g, f, e, d, c, g, b, c, f, d
deg(a)=2, deg(b)=3, deg(c)=4,
deg(d)=3, deg(e)=2, deg(f)=4, deg(g)=4
Euler and Hamiltonian Graphs
• Hamilton Path and Circuit
• A simple path in a graph G that passes through every vertex exactly once is called a
Hamilton path.
• A simple circuit in a graph G that passes through every vertex exactly once is called a
Hamilton circuit.
Hamilton path:
a, b, d, c
a, b, c, d
Hamilton Circuit:
a, b, c, d, e, a
Neither Hamilton circuit nor
Hamilton path
Euler and Hamiltonian Graphs
• Hamilton Path and Circuit
• A graph with a vertex of degree one cannot have a Hamilton circuit,
• Because in a Hamilton circuit, each vertex is incident with two edges in the circuit.
• When a Hamilton circuit is being constructed and this circuit has already passed through
a vertex, then all remaining edges incident with this vertex, other than the two used
in the circuit, can be removed from consideration.
• A Hamilton circuit cannot contain a smaller circuit within it.
Euler and Hamiltonian Graphs
• Hamilton Path and Circuit
• 𝐾𝑛 has a Hamilton circuit whenever 𝑛 ≥ 3.
• If 𝐺 is a simple graph with 𝑛 vertices with 𝑛 ≥ 3 such that the degree of every vertex in
G is at least 𝒏
𝟐, then G has a Hamilton circuit.
• If is G a simple graph with n vertices with 𝑛 ≥ 3 such that 𝒅𝒆𝒈 𝒖 + 𝒅𝒆𝒈(𝒗) ≥ 𝒏 for
every pair of non-adjacent vertices u and v in G, then G has a Hamilton circuit.
Planar Graphs
• Can we join these houses and utilities so that none of the connections cross?
• When is it possible to find at least one way to represent this graph in a plane without any
edges crossing?
Planar Graphs
• A graph is called planar if it can be drawn in the plane without any edges crossing
• Where a crossing of edges is the intersection of the lines or arcs representing them at a point
other than their common endpoint.
• Such a drawing is called a planar representation of the graph.
• A graph may be planar even if it is usually drawn with crossings, because it may
be possible to draw it in a different way without crossings.
a b
c
d
a b
c
d
a b
d c
e f
g
h
a b
c
d
e f
g
h
a b
c
e f
g
h
d
Planar Graphs
• Can we join these houses and utilities so that none of the connections cross?
Planar Graphs
v6
• Can we join these houses and utilities so that none of the connections cross?
• As last vertex v6 is not possible to connect without crossing some edge, So given graph is not a
planar graph.
• The three houses and three utilities cannot be connected in the plane without a crossing.
Planar Graphs
• Euler’s Formula
• A planar representation of a graph splits the plane into regions, including an unbounded
region.
• Euler showed that all planar representations of a graph split the plane into the same
number of regions.
• Let G be a connected planar simple graph with e edges and v vertices. Let r be the
number of regions in a planar representation of G. Then
𝒓 = 𝒆 − 𝒗 + 𝟐
• Proof of theorem can be given by constructing a sequence of subgraphs G1, G2, ... , Ge = G,
1
2
R1
1
2
R1
3
1
2
R1
3
R2
1
2
R1
3
R2
4
5
R3
1
2
R1
3
R2
4
5
R3
R4
G1 G2 G3 G4 G5
Planar Graphs
Suppose that a connected planar simple graph has 24 vertices, each of degree 3. Into how
many regions does a representation of this planar graph split the plane?
Planar Graphs
• Corollary1
• If G is a connected planar simple graph with e edges and v vertices, where 𝑣 ≥ 3, then
𝑒 ≤ 3𝑣 − 6
• Corollary2
• If G is a connected planar simple graph, then G has a vertex of degree not exceeding five.
If G has at least three vertices,
we know that 𝑒 ≤ 3𝑣 − 6 (from Corollary 1),
so 2𝑒 ≤ 6𝑣 − 12
If the degree of every vertex were at least six,
then because 2𝑒 = 𝑣∈𝑉 deg(𝑣), we will have
2𝑒 ≥ 6𝑣
But this contradicts the inequality 2𝑒 ≤ 6𝑣 − 12
It follows that there must be a vertex with degree no greater than five.
Planar Graphs
• Degree of a region
• The number of edges on the boundary of this region.
• When an edge occurs twice on the boundary, it contributes two to the degree.
Planar Graphs
• Corollary1
• If G is a connected planar simple graph with e edges and v vertices,
where 𝑣 ≥ 3, then
𝑒 ≤ 3𝑣 − 6
• Proof
• A connected planar simple graph drawn in the plane divides the plane
into r regions
• The degree of each region is at least three
• Sum of the degrees of the regions is exactly twice the number of
edges in the graph.
• Because each region has degree greater than or equal to three, it
follows that
2𝑒 =
𝑎𝑙𝑙 𝑟𝑒𝑔𝑖𝑜𝑛𝑠 𝑅
deg(𝑅) ≥ 3𝑟
• Hence
2
3 𝑒 ≥ 𝑟
Planar Graphs
• Proof to Corollary1
𝑒 − 𝑣 + 2 ≤ 2
3 𝑒
It follows that
𝑒
3 ≤ 𝑣 − 2
This shows that
𝑒 ≤ 3𝑣 − 6
𝑏𝑦 𝑢𝑠𝑖𝑛𝑔 𝐸𝑢𝑙𝑒𝑟′
𝑠 𝐹𝑜𝑟𝑚𝑢𝑙𝑎 𝑟 = 𝑒 − 𝑣 + 2
Planar Graphs
• Corollary1
• If G is a connected planar simple graph with e edges and v vertices, where 𝑣 ≥ 3, then
𝑒 ≤ 3𝑣 − 6
• Corollary2
• If G is a connected planar simple graph, then G has a vertex of degree not exceeding five.
Revise Graph Connectivity
• Cut Vertex
• The removal of a vertex and all edges incident with it produces a sub graph with more
connected components than in the original graph. Such vertices are called cut vertices (or
articulation points).
• An edge whose removal produces a graph with more connected components than in the
original graph is called a cut edge or bridge.
• The removal of a cut vertex from a connected graph produces a subgraph that is not connected.
Graph Connectivity
• Cut set
• A cut set of a graph is a set of edges such that the removal of these edges produces a
subgraph with more connected components than in the original graph, but no proper subset
of this set of edges has this property.
Cut set E1 = {e1, e8, e5, e3} Cut set E2 = {e3, e6, e2}

More Related Content

What's hot

Graph isomorphism
Graph isomorphismGraph isomorphism
Graph isomorphismCore Condor
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Darwish Ahmad
 
Koningsberg bridge problem
Koningsberg  bridge  problemKoningsberg  bridge  problem
Koningsberg bridge problemSudiksha Joshi
 
Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...appasami
 
Graph coloring and_applications
Graph coloring and_applicationsGraph coloring and_applications
Graph coloring and_applicationsmohammad alkhalil
 
Cs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersCs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersappasami
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applicationsManikanta satyala
 
Features image processing and Extaction
Features image processing and ExtactionFeatures image processing and Extaction
Features image processing and ExtactionAli A Jalil
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theoryArvindBorge
 
Graph theory in network system
Graph theory in network systemGraph theory in network system
Graph theory in network systemManikanta satyala
 

What's hot (20)

Connectivity of graph
Connectivity of graphConnectivity of graph
Connectivity of graph
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Planar graph
Planar graphPlanar graph
Planar graph
 
Graph isomorphism
Graph isomorphismGraph isomorphism
Graph isomorphism
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring
 
Graphs - Discrete Math
Graphs - Discrete MathGraphs - Discrete Math
Graphs - Discrete Math
 
Koningsberg bridge problem
Koningsberg  bridge  problemKoningsberg  bridge  problem
Koningsberg bridge problem
 
Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 graph theory and applications Anna University question paper apr may 2...
 
Graph coloring and_applications
Graph coloring and_applicationsGraph coloring and_applications
Graph coloring and_applications
 
Graph
GraphGraph
Graph
 
Cs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersCs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answers
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applications
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
Features image processing and Extaction
Features image processing and ExtactionFeatures image processing and Extaction
Features image processing and Extaction
 
Graph theory
Graph theoryGraph theory
Graph theory
 
MATCHING GRAPH THEORY
MATCHING GRAPH THEORYMATCHING GRAPH THEORY
MATCHING GRAPH THEORY
 
Ppt of graph theory
Ppt of graph theoryPpt of graph theory
Ppt of graph theory
 
Graph theory in network system
Graph theory in network systemGraph theory in network system
Graph theory in network system
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 

Similar to Graph Theory

Similar to Graph Theory (20)

Graph 1
Graph 1Graph 1
Graph 1
 
Unit 2: All
Unit 2: AllUnit 2: All
Unit 2: All
 
Graphs (Models & Terminology)
Graphs (Models & Terminology)Graphs (Models & Terminology)
Graphs (Models & Terminology)
 
Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructures
 
Basics of graph
Basics of graphBasics of graph
Basics of graph
 
ppt 1.pptx
ppt 1.pptxppt 1.pptx
ppt 1.pptx
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
CS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on GraphsCS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on Graphs
 
CS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on GraphsCS-102 Data Structure lectures on Graphs
CS-102 Data Structure lectures on Graphs
 
Graphs.pptx
Graphs.pptxGraphs.pptx
Graphs.pptx
 
Graph data structure
Graph data structureGraph data structure
Graph data structure
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
 
Graph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxGraph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptx
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Graphs in data structures
Graphs in data structuresGraphs in data structures
Graphs in data structures
 
Graph
GraphGraph
Graph
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
 
Unit ix graph
Unit   ix    graph Unit   ix    graph
Unit ix graph
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptx
 

More from Rashmi Bhat

Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Process Scheduling in OS
Process Scheduling in OSProcess Scheduling in OS
Process Scheduling in OSRashmi Bhat
 
Introduction to Operating System
Introduction to Operating SystemIntroduction to Operating System
Introduction to Operating SystemRashmi Bhat
 
The Geometry of Virtual Worlds.pdf
The Geometry of Virtual Worlds.pdfThe Geometry of Virtual Worlds.pdf
The Geometry of Virtual Worlds.pdfRashmi Bhat
 
Spatial Data Mining
Spatial Data MiningSpatial Data Mining
Spatial Data MiningRashmi Bhat
 
Mining Frequent Patterns And Association Rules
Mining Frequent Patterns And Association RulesMining Frequent Patterns And Association Rules
Mining Frequent Patterns And Association RulesRashmi Bhat
 
Classification in Data Mining
Classification in Data MiningClassification in Data Mining
Classification in Data MiningRashmi Bhat
 
Data Warehouse Fundamentals
Data Warehouse FundamentalsData Warehouse Fundamentals
Data Warehouse FundamentalsRashmi Bhat
 
Virtual Reality
Virtual Reality Virtual Reality
Virtual Reality Rashmi Bhat
 
Introduction To Virtual Reality
Introduction To Virtual RealityIntroduction To Virtual Reality
Introduction To Virtual RealityRashmi Bhat
 

More from Rashmi Bhat (17)

Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Process Scheduling in OS
Process Scheduling in OSProcess Scheduling in OS
Process Scheduling in OS
 
Introduction to Operating System
Introduction to Operating SystemIntroduction to Operating System
Introduction to Operating System
 
The Geometry of Virtual Worlds.pdf
The Geometry of Virtual Worlds.pdfThe Geometry of Virtual Worlds.pdf
The Geometry of Virtual Worlds.pdf
 
Module 1 VR.pdf
Module 1 VR.pdfModule 1 VR.pdf
Module 1 VR.pdf
 
OLAP
OLAPOLAP
OLAP
 
Spatial Data Mining
Spatial Data MiningSpatial Data Mining
Spatial Data Mining
 
Web mining
Web miningWeb mining
Web mining
 
Mining Frequent Patterns And Association Rules
Mining Frequent Patterns And Association RulesMining Frequent Patterns And Association Rules
Mining Frequent Patterns And Association Rules
 
Clustering
ClusteringClustering
Clustering
 
Classification in Data Mining
Classification in Data MiningClassification in Data Mining
Classification in Data Mining
 
ETL Process
ETL ProcessETL Process
ETL Process
 
Data Warehouse Fundamentals
Data Warehouse FundamentalsData Warehouse Fundamentals
Data Warehouse Fundamentals
 
Virtual Reality
Virtual Reality Virtual Reality
Virtual Reality
 
Introduction To Virtual Reality
Introduction To Virtual RealityIntroduction To Virtual Reality
Introduction To Virtual Reality
 

Recently uploaded

Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 

Recently uploaded (20)

POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 

Graph Theory

  • 2. Introduction to Graph Theory • What is Graph Theory? • Study of graphs which are mathematical structures • Graph consists of vertices and edges which connects the vertices • Where we are using Graph Theory?
  • 3. Introduction to Graph Theory • Where in computer science, we are using Graph Theory?
  • 4. Introduction to Graph Theory • Graphs can be used to • Determine whether it is possible to walk down all the streets in a city without going down a street twice, and we can find the number of colors needed to color the regions of a map. • Design a circuit • Determine a shortest route to travel
  • 5. Graph Theory • What is Graph? • A graph is G=(V,E) consists of V, a non empty set of vertices (or nodes) and E, a set of edges. • Each edge is either one or two vertices associated with it, called as endpoints. • An edge is said to be connected to the endpoints. • A graph with infinite vertex set is called as an infinite graph • A graph with a finite vertex set is called as a finite graph. • Note that • Each edge of the graph representing this computer network connects two different vertices. That is, no edge connects a vertex to itself. • No two different edges connect the same pair of vertices.
  • 6. Types of Graphs • Simple Graph • A graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices. • Each edge is associated to an unordered pair of vertices, and no other edge is associated to this same edge. • Edge connecting to vertex a and vertex b (i.e. {a,b}) no other edge is associated to edge {a,b} • Multigraph • A graph in which multiple edges connects to the same pair of vertices. • When there are m different edges associated to the same unordered pair of vertices {a,b}, we say that {a,b} is an edge of multiplicity m. • This set of edges connecting to a and b are m different copies of an edge {a,b} • Pseudograph • Loops: the edges that connect a vertex itself • A graph containing loops and multiple edges connecting the same pair of vertices are sometimes called as pseudograph. a b c a b c Simple graph Multigraph Pseudograph
  • 7. Types of Graphs • Undirected Graphs • A graph containing undirected edges. • Directed Graphs(Diagraph) • A graph (V,E) consists of a non-empty set of vertices V and a set of directed edges (or arcs) E. • Each directed edge is associated with an ordered pair of vertices. • The directed edge associated with the ordered pair (a,b) is said to start at a and end at b. • An arrow pointing from a to b indicate the direction of an edge that starts at a and ends at b. • Can have loops and may also contain multiple directed edges starting and ending at same vertices. • May contain directed edges that connect vertices a and b in both directions
  • 8. Types of Graphs • Directed Graphs(Diagraph) • A directed graph with no loops and has no multiple directed edges from a and b is called as simple directed graph. • Has at most one edge associated to each ordered pair of vertices • Directed graphs that may have multiple directed edges from a vertex to a second (possibly the same) vertex is called as directed multigraphs. • When there are m directed edges, each associated to an ordered pair of vertices (a, b), we say that (a, b) is an edge of multiplicity m. • Mixed Graph • A graph with both directed and undirected edges is called a mixed graph. • Used to model a computer network containing links that operate in both directions and other links that operate only in one direction. a b c
  • 9. Types of Graphs Type Edges Multiple edges allowed? Loops allowed? Simple graph Undirected No No Multigraph Undirected Yes No Pseudograph Undirected Yes Yes Simple directed graph Directed No No Directed multigraph Directed Yes Yes Mixed graph Directed or undirected Yes Yes Table: Graph Terminology
  • 10. Types of Graphs A B C D 2 1 5 3 4 a c d b e f Simple directed graph Directed multigraph Multigraph
  • 11. Graph Terminologies of Undirected Graph • Two vertices u and v in an undirected graph G are called adjacent (or neighbours) in G if u and v are endpoints of an edge of G. • If edge e is associated with {u,v}, the edge e is called incident with the vertices u and v. • The edge e is said to connect u and v • The vertices u and v are called as endpoints of an edge associated with {u,v }. • The degree of vertex in an undirected graph is the number of edges incident with it, except that a loop at a vertex contributes twice to the degree of that vertex. • The degree of vertex is denoted by deg(v). a c d b e f What is the degree of vertex 1. a 2. b 3. c 4. d 5. e 6. f What is the degree of vertex 1. a  4 2. b  4 3. c  2 4. d  2 5. e  3 6. f  2
  • 12. Graph Terminologies of Undirected Graph • A vertex of degree zero is called isolated. • Such isolated vertex is not adjacent to any vertex. • A vertex is a pendant if and only if it has degree one. • A pendant vertex is adjacent to one and only one other vertex.
  • 13. Graph Terminologies of Undirected Graph • The Handshaking Theorem Let G = (V, E) be an undirected graph with e edges. Then 2𝑒 = 𝑣∈𝑉 deg(𝑣) This applies even if multiple edges and loops are present in the graph. Q. How many edges are there in a graph with 12 vertices each of degree six? • An undirected graph has an even number of edges
  • 14. Graph Terminologies of Undirected Graph • An undirected graph has an even number of vertices has odd degree. Proof Let 𝑉1 and 𝑉2 be the set of vertices of even degree and set of vertices of odd degree respectively, in an undirected graph. Then 2𝑒 = 𝑣∈𝑉 deg(𝑣) = 𝑣∈𝑉1 deg(𝑣) + 𝑣∈𝑉2 deg(𝑣) C E D B G A F H
  • 15. Graph Terminologies of Directed Graph • When (u,v) is an edge of the graph G with directed edges, • u is said to be adjacent to v and v is said to be adjacent from u. • The vertex u is called as initial vertex of (u,v), and v is called as terminal or end vertex of (u,v). • The initial vertex and terminal vertex of a loop are the same. • In a graph with directed edges • The in-degree of a vertex v, denoted by deg 𝑣 is the number of edges with v as their terminal vertex. • The out-degree of a vertex v, denoted by deg+(v) is the number of edges with v as their initial vertex. • A loop at a vertex contributes 1 to both the in-degree and the out-degree of this vertex. 2 1 5 3 4
  • 16. Graph Terminologies of Directed Graph Let G=(V,E) be a graph with directed edges. Then 𝑣∈𝑉 𝑑𝑒𝑔 (𝑣) = 𝑣∈𝑉 𝑑𝑒𝑔 + 𝑣 = 𝐸
  • 17. Special Graph Terminologies • Complete Graph • The complete graph on n vertices, denoted by Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices. • Cycles • The cycle Cn, 𝑛 ≥ 3, consists of n vertices 𝑣1, 𝑣2, . . . , 𝑣𝑛 and edges {𝑣1, 𝑣2}, {𝑣2, 𝑣3},- .. ,{𝑣𝑛−1, 𝑣𝑛}, and {𝑣𝑛, 𝑣1}.
  • 18. Special Graph Terminologies • Wheels • We obtain wheel Wn when we add an additional vertex to the cycle Cn, for 𝑛 ≥ 3, and then we connect this new vertex to each of 𝑛 vertices in Cn by new edges.
  • 19. Special Graph Terminologies • n-Cube • The n-dimensional hypercube, or n-cube, denoted by Qn, is the graph that has vertices representing the 2n bit strings of length n. • Two vertices are adjacent if and only if the bit strings that they represent differ in exactly one bit position.
  • 20. Graph Representations • A graph G can be represented in two ways • Adjacency matrix/list • Useful when information about the vertices is more desirable than information of edges. • Incidence matrix • Useful when information about edges is more desirable than information of vertices • Adjacency list/matrix is more commonly used representation.
  • 21. Graph Representations • Adjacency List • It is way to represent a graph without multiple edges • It specifies the vertices that are adjacent to each vertex of the graph. Vertex Adjacent vertices a b, c, e b a c a, e, d d c, e e a, c, d Adjacency List of Undirected graph G
  • 22. Graph Representations • Adjacency List Initial Vertex Terminal vertices a b, c, d, e b b, d c a, c, e d e b, c, d Adjacency List of Directed graph G
  • 23. Graph Representations • Determine the Adjacency List for following graphs a b c e d a b b a c b d a e c d c d e b e d
  • 24. Graph Representations • Determine the Adjacency List for following graphs 1 2 3 4 5 6 1 2 2 1 3 1 3 2 5 6 4 2 5 4 6 6 a b c e d a b b a c b d a e c d c d e b e d
  • 25. Graph Representations • Adjacency Matrix • Suppose a graph G=(V,E) is a simple graph, where |V|=n • Vertices are listed as v1, v2, . . ., vn • Adjacency matrix A or (AG) og G, with respect to this listing of the vertices,is the 𝒏 × 𝒏 zero-one matrix with 1 as its (i,j)th entry when vi and vj are adjacent and 0 as its (i,j)th entry when vi and vj are not adjacent. • Or we can say adjacency matrix A =[aij], then 𝑎𝑖,𝑗 = 1 0 𝑖𝑓 𝑣𝑖, 𝑣𝑗 𝑖𝑠 𝑎𝑛 𝑒𝑑𝑔𝑒 𝑜𝑓𝑔 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 a b c d a b c d All undirected graphs, including multi graphs and pseudographs, have symmetric adjacency matrices. 𝑛 × 𝑛
  • 26. Graph Representations • Adjacency Matrix • Adjacency matrix A or (AG) of directed graph G, with respect to this listing of the vertices,is the 𝒏 × 𝒏 zero-one matrix with 1 in its (i,j)th entry if there is an edge from vi and vj , • we can say adjacency matrix A =[aij] of directed graph w.r.t to the listing of the vertices, then 𝑎𝑖,𝑗 = 1 0 𝑖𝑓 𝑣𝑖, 𝑣𝑗 𝑖𝑠 𝑎𝑛 𝑒𝑑𝑔𝑒 𝑜𝑓𝑔 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 The adjacency matrix for a directed graph does not have to be symmetric, because there may not be an edge from aj to ai when there is an edge from ai to aj.
  • 27. Graph Representations • Determine the adjacency matrices for the following graphs a b c e d 1 2 3 4 5 6 0 1 1 0 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 a b c d e a b c d e 1 2 3 4 5 6 1 2 3 4 5 6 0 3 3 0 0 2 1 1 0 1 2 1 1 2 2 0 a b c d a b c d
  • 28. Graph Representations • Incidence Matrix • Let G=(V,E) is an undirected graph, • Suppose 𝑣1, 𝑣2, . . . , 𝑣𝑛 are the vertices and 𝑒1, 𝑒2, . . . , 𝑒𝑚 are the edges of G. • The incidence matrix w.r.t. this ordering of V and E is the 𝒏 × 𝒎 matrix 𝑀 = 𝑚𝑖𝑗 , where 𝑚𝑖𝑗 = 1 0 𝑤ℎ𝑒𝑛 𝑒𝑑𝑔𝑒 𝑒𝑗 𝑖𝑠 𝑖𝑛𝑐𝑖𝑑𝑒𝑛𝑡 𝑤𝑖𝑡ℎ 𝑣𝑖 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 v1 v2 v3 v4 v5 e1 e2 e3 e4 e5 e6 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 0 e1 e2 e3 e4 e5 e6 v1 v2 v3 v4 v5 𝑛 × 𝑚
  • 29. Graph Representations • Represent the following pseudograph using Incidence Matrix 1 1 1 0 1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 v1 v2 v3 v4 v5 e2 e1 e4 e3 e5 e6 e7 e8 e9 e1 e2 e3 e4 e5 e6 e7 e8 e9 v1 v2 v3 v4 v5
  • 30. Graph Representations • Represent the following graph using Adjacency Matrix
  • 31. Sub Graph • Sometime we need only part of graph to solve a problem. • When edges and vertices are removed from a graph, without removing endpoints of any remaining edges, a smaller graph is obtained. Such a graph is called a subgraph of the original graph. • A subgraph of a graph 𝐺 = (𝑉, 𝐸) is a graph 𝐻 = (𝑊, 𝐹), where 𝑊 ⊆ 𝑉 and 𝐹 ⊆ 𝐸. • A subgraph H of G is a proper subgraph of G if 𝐻 ≠ 𝐺 a b c e d a b d
  • 32. Operations on Graphs • Various operations can be performed on graphs • Union (𝐴 ∪ 𝐵) 𝐴 = 2, 4, 6, 8, 10 𝐵 = 4, 8,12, 16 𝑨 ∪ 𝑩 = {𝟐, 𝟒, 𝟔, 𝟖, 𝟏𝟎, 𝟏𝟐, 𝟏𝟔} • Intersection (𝐴 ∩ 𝐵) 𝐴 = 2, 4, 6, 8, 10 𝐵 = 4, 8,12, 16 𝑨 ∩ 𝑩 = {𝟒, 𝟖} • Sum (𝐴 + 𝐵) • Ring sum (𝐴⨁𝐵) • Product (𝐴 × 𝐵)
  • 33. Union of Graphs • Two or more graphs can be combined in various ways. The new graph that contains all the vertices and edges of these graphs is called the union of the graphs. • The union of two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2) is the simple graph with vertex set 𝑽𝟏 ∪ 𝑽𝟐 and edge set 𝑬𝟏 ∪ 𝑬𝟐 . The union of 𝐺1 and 𝐺2 is denoted by 𝐺1 ∪ 𝐺2. 𝑉1 = 𝑎, 𝑏, 𝑐, 𝑑 , 𝑉2 = 𝑎, 𝑏, 𝑐, 𝑑, 𝑒 𝑽𝟏 ∪ 𝑽𝟐 = {𝒂, 𝒃, 𝒄, 𝒅, 𝒆} 𝐸1 = 𝑎, 𝑏 , 𝑎, 𝑑 , 𝑏, 𝑐 , 𝐸2 = 𝑎, 𝑑 , 𝑎, 𝑒 , 𝑏, 𝑑 , 𝑏, 𝑒 , 𝑐, 𝑒 𝑬𝟏 ∪ 𝑬𝟐 = { 𝒂, 𝒃 , 𝒂, 𝒅 , 𝒂, 𝒆 , 𝒃, 𝒄 , 𝒃, 𝒅 , 𝒃, 𝒆 , 𝒄, 𝒆 } a b c d a b c e d G1 G2
  • 34. Intersection of Graphs • The intersection of two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2) is the simple graph with vertex set 𝑽𝟏 ∩ 𝑽𝟐 and edge set 𝑬𝟏 ∩ 𝑬𝟐 . The intersection of 𝐺1 and 𝐺2 is denoted by 𝐺1 ∩ 𝐺2. Contains common vertices and common edges of these graphs. 𝑉1 = 1,2,3,4,5,6 , 𝑉2 = 1,2,3,4,5,6 𝑽𝟏 ∩ 𝑽𝟐 = {𝟏, 𝟐, 𝟑, 𝟒, 𝟓, 𝟔} 𝐸1 = 1,2 , 1,5 , 1,6 , 2,3 , 2,6 , 3,4 , 3,6 , 4,5 , 4,6 , 5,1 , {5,6} 𝐸2 = 1,6 , 2,6 , 3,6 , 4,6 , 5,6 𝑬𝟏 ∩ 𝑬𝟐 = { 1,6 , 2,6 , 3,6 , 4,6 , 5,6 } 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 ∩ G1 G2 G1 ∩ G2
  • 35. Sum of Graphs • If two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2), such that 𝑉1 ∩ 𝑉2 = ∅, then the sum of 𝐺1 and 𝐺2 is denoted by 𝑮𝟏 + 𝑮𝟐 consists of those edges, which are in G1 and in G2 and the edges obtained, by joining each vertex of G1 to each vertex of G2. 𝑉1 = 𝑎, 𝑏 , 𝑉2 = 𝑥, 𝑦, 𝑧 𝑽𝟏 + 𝑽𝟐 = {𝒂, 𝒃, 𝒙, 𝒚, 𝒛} 𝐸1 = 𝑎, 𝑏 , 𝐸2 = { 𝑥, 𝑦 , 𝑦, 𝑧 } 𝑬𝟏 + 𝑬𝟐 = { 𝒂, 𝒃 , 𝒂, 𝒙 , 𝒂, 𝒚 , 𝒂, 𝒛 , 𝒃, 𝒙 , 𝒃, 𝒚 , 𝒃, 𝒛 , 𝒙, 𝒚 , {𝒚, 𝒛}} a b x y z a b y z x + G1 G2 G1 + G2
  • 36. Ring sum of Graphs • The ring sum of two simple graphs 𝐺1 = (𝑉1, 𝐸1) and 𝐺2 = (𝑉2, 𝐸2) is the simple graph with vertex set 𝑽𝟏 ∪ 𝑽𝟐 and the edges that are either in 𝐺1 or in 𝐺2 but not in both i.e. (𝑬𝟏 ∪ 𝑬𝟐) − (𝑬𝟏 ∩ 𝑬𝟐) . The ring sum of 𝐺1 and 𝐺2 is denoted by 𝐺1⨁𝐺2. 𝑉1 = 𝑎, 𝑏, 𝑐, 𝑑, 𝑒 , 𝑉2 = 𝑏, 𝑐, 𝑑, 𝑒 𝑽𝟏 ∪ 𝑽𝟐 = {𝒂, 𝒃, 𝒄, 𝒅, 𝒆} 𝐸1 = 𝑎, 𝑏 , 𝑎, 𝑐 , 𝑎, 𝑑 , 𝑎, 𝑒 , 𝑏, 𝑐 , 𝑏, 𝑑 , 𝑏, 𝑒 , 𝑐, 𝑑 , {𝑑, 𝑒} 𝐸2 = { 𝑏, 𝑐 , 𝑏, 𝑒 , 𝑐, 𝑑 , 𝑐, 𝑒 , {𝑑, 𝑒}} (𝑬𝟏 ∪ 𝑬𝟐) − (𝑬𝟏 ∩ 𝑬𝟐) = { 𝒂, 𝒃 , 𝒂, 𝒄 , 𝒂, 𝒅 , 𝒂, 𝒆 , 𝒃, 𝒅 , {𝒄, 𝒆}} a b c d e b c d e a b e c d a b e ⨁ G1 G2 G1 ⨁ G2
  • 37. Product of Graphs • Product of sets A and B 𝐴 = 1, 2, 3, 4, 5 , 𝐵 = {9, 8, 7} 𝐴 × 𝐵 = { 1,9 , 1,8 , 1, 7 , 2,9 , 2, 8 , 2, 7 , . . . , 5, 9 , 5,8 , 5,7 } • Product of graphs G and H • Vertex set of G is 𝑉 𝐺 = {𝑣1, 𝑣2, . . . , 𝑣𝑛} • Vertex set of H is 𝑉 𝐻 = {𝑢1, 𝑢2, . . . , 𝑢𝑚} • Product of G and H i.e. V 𝐺 × 𝐻 = { 𝑣𝑖, 𝑢𝑗 𝑣𝑖 ∈ 𝑉 𝐺 𝑎𝑛𝑑 𝑢𝑗 ∈ 𝑉(𝐻)} 𝑉 𝐺 × 𝐻 = { 𝑣1, 𝑢1 , 𝑣1, 𝑢2 , . . . , 𝑣1, 𝑢𝑚 , 𝑣2, 𝑢1 , 𝑣2, 𝑢2 , . . . , 𝑣2, 𝑢𝑚 , . . . , 𝑣𝑛, 𝑢1 , 𝑣𝑛, 𝑢2 , . . . , 𝑣𝑛, 𝑢𝑚 } • Two vertices 𝑣𝑖, 𝑢𝑗 𝑎𝑛𝑑 𝑣𝑘, 𝑢𝑙 are adjacent in 𝐺 × 𝐻 if and only if either 𝑣𝑖 = 𝑣𝑘 𝑎𝑛𝑑 𝑢𝑗 is adjacent to 𝑢𝑙in H OR 𝑢𝑗 = 𝑢𝑙 𝑎𝑛𝑑 𝑣𝑖 is adjacent to 𝑣𝑘in G
  • 38. Product of Graphs × G H G X H 𝑣𝑖, 𝑢𝑗 𝑣𝑘, 𝑢𝑙 𝑣𝑖, 𝑢𝑗 𝑣𝑘, 𝑢𝑙 𝑣𝑖 = 𝑣𝑘 𝑎𝑛𝑑 𝑢𝑗 is adjacent to 𝑢𝑙in H OR 𝑢𝑗 = 𝑢𝑙 𝑎𝑛𝑑 𝑣𝑖 is adjacent to 𝑣𝑘in G
  • 39. Product of Graphs • Example a b c 1 2 3 4 (a,1) (b,1) (c,1) (a,2) (b,2) (c,2) (a,3) (b,3) (c,3) (a,4) (b,4) (c,4)
  • 40. Walk • For a graph G=(V,E), a walk is defined as a sequence of alternating vertices an edges such as 𝑣0, 𝑒1, 𝑣1, 𝑒2, 𝑣2, 𝑒3, . . . 𝑣𝑛−1, 𝑒𝑛, 𝑣𝑛 where each edge 𝑒𝑖 = {𝑣𝑖−1, 𝑣𝑖}. • The length of this walk is 𝑛. • Walks can have repeated edges. • A walk is considered to be Closed if the starting vertex is the same as the ending vertex, that is 𝑣0 = 𝑣𝑛. A walk is considered Open otherwise. Walk is denoted as abcdb. Length of this walk is 4. Another possible walk is abcdbce and its length will be ? Walk is denoted as ecfge. Length of this walk is 4.
  • 41. Trail • A trail is defined as a walk with no repeated edges. • The length of this trail is 𝑛. The walk can be defined as abc. There are no repeated edges so this walk is also a trail. This walk must repeat at least one edge. So this walk cannot be a trail.
  • 42. Path • A path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph. • For a graph G=(V,E), a path of length 𝑛 from u to v in G is a sequence of n edges 𝑒1, 𝑒2, … , 𝑒𝑛 of G such that 𝑒1 is associated with {𝑣0, 𝑣1}, 𝑒2 is associated with {𝑣1, 𝑣2}. and so on, with 𝑒𝑛 associated with {𝑣𝑛−1, 𝑣𝑛}, where 𝑣0 = u and 𝑣𝑛 = v. • We denote the path by its vertex sequence 𝑣0, 𝑣1, . . . , 𝑣𝑛 because listing these vertices uniquely determines the path. • The path is a circuit if it begins and ends at the same vertex i.e., if u = v, and has length greater than zero. • The path or circuit is said to pass through the vertices 𝑣0, 𝑣1, . . . , 𝑣𝑛−1 or traverse the edges 𝑒1, 𝑒2, … , 𝑒𝑛. • A path or circuit is simple if it does not contain the same edge more than once.
  • 43. Path a,b,c,f,e,d is a simple path with length 5. a,b,c,f,e,d,a is a circuit with length 6. b,f,e,c,d is not a path. a,e,f,e,b,c is not a simple path with length 4 because it contains {e,f} twice.
  • 44. Graph Connectivity • Connectivity defines whether a graph is connected or disconnected. • An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. • From every vertex to any other vertex, there should be some path to traverse that is called the connectivity of a graph. • A graph with multiple disconnected vertices and edges is said to be disconnected. G1 G2 G3
  • 45. Graph Connectivity • A connected component of a graph G is a connected subgraph of G that is not a proper subgraph of another connected subgraph of G.
  • 46. Graph Connectivity • Cut Vertex • The removal of a vertex and all edges incident with it produces a sub graph with more connected components than in the original graph. Such vertices are called cut vertices (or articulation points). • An edge whose removal produces a graph with more connected components than in the original graph is called a cut edge or bridge. • The removal of a cut vertex from a connected graph produces a subgraph that is not connected.
  • 47. Graph Connectivity • Cut Vertex G What are the cut vertices of G? After removing vertex b After removing vertex c After removing vertex e What are the cut edges of G? Cut edges of G are {a,b} and {c,e}.
  • 48. Graph Connectivity • A directed graph is strongly connected if there is a path from a to b and from b to a whenever a and b are vertices in the graph. • A directed graph is weakly connected if there is a path between every two vertices in the underlying undirected graph. • i.e. A directed graph is weakly connected if and only if there is always a path between two vertices when the directions of the edges are disregarded. G is strongly connected. H is weakly connected.
  • 49. Isomorphism of Graphs • Can we draw two graphs in the same way? • The simple graphs G1=(V1,E1)and G2=(V2,E2) are isomorphic if there is one to one and onto function f from V1 to V2 with the property that a and b are adjacent in G1 if and only if f(a) and f(b) are adjacent in G2, for all a and b in V1. Such a function f is called an isomorphism. • When two simple graphs are isomorphic, there is a one-to-one correspondence between vertices of the two graphs that preserves the adjacency relationship. • Isomorphic simple graphs also must have the same number of edges.
  • 50. Isomorphism of Graphs • The degrees of the vertices in isomorphic simple graphs must be the same.
  • 51. Isomorphism of Graphs G G’ v5 V5’
  • 52. Isomorphism of Graphs • The number of vertices, the number of edges, and the number of vertices of each degree are all invariants under isomorphism. • If any of these quantities differ in two simple graphs, these graphs cannot be isomorphic. • However, when these invariants are the same, it does not necessarily mean that the two graphs are isomorphic. Q. Determine whether the graphs G and H shown below are isomorphic. G H
  • 53. G H Isomorphism of Graphs • Use of adjacency matrices to show isomorphism • Define a function f and then determine whether it is an isomorphism f(u1)=? deg(u1)=2 and u1 is not adjacent to any other vertex of degree 2, f(u1) must be either v6 or v4. Assume f(u1) = v6 As u2 is adjacent to u1 , so possible f(u2) must be either v3 or v5 . Assume f(u2) = v3 . Similarly We get f(u3)= v4 , f(u4)= v5 , f(u5)= v1 , f(u6)= v2 . Now we have a one-to-one correspondence between the vertex set of G and the vertex set of H. f(u1) = v6 , f(u2) = v3 , f(u3)= v4 , f(u4)= v5 , f(u5)= v1 , f(u6)= v2
  • 54. G H Isomorphism of Graphs • Use of adjacency matrices to show isomorphism Now we have a one-to-one correspondence between the vertex set of G and the vertex set of H. f(u1) = v6 , f(u2) = v3 , f(u3)= v4 , f(u4)= v5 , f(u5)= v1 , f(u6)= v2 We examine the adjacency matrix of G and the adjacency matrix H with the rows and columns labeled by the images of the corresponding vertices in G 𝐴𝐻 = v6 v3 v4 v5 v1 v2 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 𝑣6 𝑣3 𝑣4 𝑣5 𝑣1 𝑣2 𝐴𝐺 = u1 u2 u3 u4 u5 u6 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 𝑢1 𝑢2 𝑢3 𝑢4 𝑢5 𝑢6 Because AG = AH , it follows that f preserves edges. We conclude that f is an isomorphism, so G and H are isomorphic.
  • 55. Isomorphism of Graphs • Points to remember for checking isomorphism Match the • Number of vertices • number of edges • Number of vertices of each degree • Degree of selected vertex and degree of its adjacent vertices.
  • 56. Homomorphism of Graphs • Two graphs G1 and G2 are said to be homomorphic, if each of these graphs can be obtained from the same graph 'G' by dividing some edges of G with more vertices.
  • 57. Homomorphism of Graphs • Two homomorphic graphs G1 and G2 can be obtained from the same graph 'G' by • Inserting vertices OR • Removing vertices with degree 2
  • 58. Euler and Hamiltonian Graphs • Can we travel along the edges of a graph starting at a vertex and returning to it by traversing each edge of the graph exactly once? Euler Circuit • Can we travel along the edges of a graph starting at a vertex and returning to it while visiting each vertex of the graph exactly once? Hamiltonian Circuit
  • 59. Euler and Hamiltonian Graphs • Euler Path and Circuit • The town of Konigsberg, Prussia, was divided into four sections by the branches of the Pregel River • The townspeople wondered whether it was possible to start at some location in the town, travel across all the bridges without crossing any bridge twice, and return to the starting point. • Swiss mathematician Leonhard Euler solved this problem using Graph theory
  • 60. Euler and Hamiltonian Graphs • Euler Circuit and Path • An Euler circuit in a graph G is a simple circuit containing every edge of G. • An Euler path in G is a simple path containing every edge of G. G1has Euler circuit a, e, c, d, b, a G2 has neither Euler circuit nor Euler path G3 doesn’t have Euler circuit but it has Euler path a, c, d, e, b, d, a, b
  • 61. Euler and Hamiltonian Graphs Which of the following directed graphs have an Euler circuit? Of those that do not, which have an Euler path?
  • 62. Euler and Hamiltonian Graphs • Necessary And Sufficient Conditions For Euler Circuits And Paths • A connected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has even degree • A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree. c d b e a Euler Circuit: a, c, e, a, b, d, a deg(a)=4, deg(c)=2, deg(e)=2, deg(b)=2, deg(d)=2 Euler path: b, a, g, f, e, d, c, g, b, c, f, d deg(a)=2, deg(b)=3, deg(c)=4, deg(d)=3, deg(e)=2, deg(f)=4, deg(g)=4
  • 63. Euler and Hamiltonian Graphs • Hamilton Path and Circuit • A simple path in a graph G that passes through every vertex exactly once is called a Hamilton path. • A simple circuit in a graph G that passes through every vertex exactly once is called a Hamilton circuit. Hamilton path: a, b, d, c a, b, c, d Hamilton Circuit: a, b, c, d, e, a Neither Hamilton circuit nor Hamilton path
  • 64. Euler and Hamiltonian Graphs • Hamilton Path and Circuit • A graph with a vertex of degree one cannot have a Hamilton circuit, • Because in a Hamilton circuit, each vertex is incident with two edges in the circuit. • When a Hamilton circuit is being constructed and this circuit has already passed through a vertex, then all remaining edges incident with this vertex, other than the two used in the circuit, can be removed from consideration. • A Hamilton circuit cannot contain a smaller circuit within it.
  • 65. Euler and Hamiltonian Graphs • Hamilton Path and Circuit • 𝐾𝑛 has a Hamilton circuit whenever 𝑛 ≥ 3. • If 𝐺 is a simple graph with 𝑛 vertices with 𝑛 ≥ 3 such that the degree of every vertex in G is at least 𝒏 𝟐, then G has a Hamilton circuit. • If is G a simple graph with n vertices with 𝑛 ≥ 3 such that 𝒅𝒆𝒈 𝒖 + 𝒅𝒆𝒈(𝒗) ≥ 𝒏 for every pair of non-adjacent vertices u and v in G, then G has a Hamilton circuit.
  • 66. Planar Graphs • Can we join these houses and utilities so that none of the connections cross? • When is it possible to find at least one way to represent this graph in a plane without any edges crossing?
  • 67. Planar Graphs • A graph is called planar if it can be drawn in the plane without any edges crossing • Where a crossing of edges is the intersection of the lines or arcs representing them at a point other than their common endpoint. • Such a drawing is called a planar representation of the graph. • A graph may be planar even if it is usually drawn with crossings, because it may be possible to draw it in a different way without crossings. a b c d a b c d a b d c e f g h a b c d e f g h a b c e f g h d
  • 68. Planar Graphs • Can we join these houses and utilities so that none of the connections cross?
  • 69. Planar Graphs v6 • Can we join these houses and utilities so that none of the connections cross? • As last vertex v6 is not possible to connect without crossing some edge, So given graph is not a planar graph. • The three houses and three utilities cannot be connected in the plane without a crossing.
  • 70. Planar Graphs • Euler’s Formula • A planar representation of a graph splits the plane into regions, including an unbounded region. • Euler showed that all planar representations of a graph split the plane into the same number of regions. • Let G be a connected planar simple graph with e edges and v vertices. Let r be the number of regions in a planar representation of G. Then 𝒓 = 𝒆 − 𝒗 + 𝟐 • Proof of theorem can be given by constructing a sequence of subgraphs G1, G2, ... , Ge = G, 1 2 R1 1 2 R1 3 1 2 R1 3 R2 1 2 R1 3 R2 4 5 R3 1 2 R1 3 R2 4 5 R3 R4 G1 G2 G3 G4 G5
  • 71. Planar Graphs Suppose that a connected planar simple graph has 24 vertices, each of degree 3. Into how many regions does a representation of this planar graph split the plane?
  • 72. Planar Graphs • Corollary1 • If G is a connected planar simple graph with e edges and v vertices, where 𝑣 ≥ 3, then 𝑒 ≤ 3𝑣 − 6 • Corollary2 • If G is a connected planar simple graph, then G has a vertex of degree not exceeding five. If G has at least three vertices, we know that 𝑒 ≤ 3𝑣 − 6 (from Corollary 1), so 2𝑒 ≤ 6𝑣 − 12 If the degree of every vertex were at least six, then because 2𝑒 = 𝑣∈𝑉 deg(𝑣), we will have 2𝑒 ≥ 6𝑣 But this contradicts the inequality 2𝑒 ≤ 6𝑣 − 12 It follows that there must be a vertex with degree no greater than five.
  • 73. Planar Graphs • Degree of a region • The number of edges on the boundary of this region. • When an edge occurs twice on the boundary, it contributes two to the degree.
  • 74. Planar Graphs • Corollary1 • If G is a connected planar simple graph with e edges and v vertices, where 𝑣 ≥ 3, then 𝑒 ≤ 3𝑣 − 6 • Proof • A connected planar simple graph drawn in the plane divides the plane into r regions • The degree of each region is at least three • Sum of the degrees of the regions is exactly twice the number of edges in the graph. • Because each region has degree greater than or equal to three, it follows that 2𝑒 = 𝑎𝑙𝑙 𝑟𝑒𝑔𝑖𝑜𝑛𝑠 𝑅 deg(𝑅) ≥ 3𝑟 • Hence 2 3 𝑒 ≥ 𝑟
  • 75. Planar Graphs • Proof to Corollary1 𝑒 − 𝑣 + 2 ≤ 2 3 𝑒 It follows that 𝑒 3 ≤ 𝑣 − 2 This shows that 𝑒 ≤ 3𝑣 − 6 𝑏𝑦 𝑢𝑠𝑖𝑛𝑔 𝐸𝑢𝑙𝑒𝑟′ 𝑠 𝐹𝑜𝑟𝑚𝑢𝑙𝑎 𝑟 = 𝑒 − 𝑣 + 2
  • 76. Planar Graphs • Corollary1 • If G is a connected planar simple graph with e edges and v vertices, where 𝑣 ≥ 3, then 𝑒 ≤ 3𝑣 − 6 • Corollary2 • If G is a connected planar simple graph, then G has a vertex of degree not exceeding five.
  • 77. Revise Graph Connectivity • Cut Vertex • The removal of a vertex and all edges incident with it produces a sub graph with more connected components than in the original graph. Such vertices are called cut vertices (or articulation points). • An edge whose removal produces a graph with more connected components than in the original graph is called a cut edge or bridge. • The removal of a cut vertex from a connected graph produces a subgraph that is not connected.
  • 78. Graph Connectivity • Cut set • A cut set of a graph is a set of edges such that the removal of these edges produces a subgraph with more connected components than in the original graph, but no proper subset of this set of edges has this property. Cut set E1 = {e1, e8, e5, e3} Cut set E2 = {e3, e6, e2}