0% found this document useful (0 votes)
155 views53 pages

Dm-Unit - 4

The document outlines the key topics to be covered in a graph theory unit, including graph terminology, special types of graphs, graph representations, connectivity, paths in graphs, graph coloring, and more. It provides definitions and examples of basic graph concepts such as vertices, edges, degrees, adjacency, and representations like adjacency matrices. It also introduces several important graph types including complete graphs, bipartite graphs, and regular graphs.

Uploaded by

kanchisudhanwa7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views53 pages

Dm-Unit - 4

The document outlines the key topics to be covered in a graph theory unit, including graph terminology, special types of graphs, graph representations, connectivity, paths in graphs, graph coloring, and more. It provides definitions and examples of basic graph concepts such as vertices, edges, degrees, adjacency, and representations like adjacency matrices. It also introduces several important graph types including complete graphs, bipartite graphs, and regular graphs.

Uploaded by

kanchisudhanwa7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 53

UNIT – 4

GRAPH THEORY

Prepared By
Mrs. Shivani Agrawal
Assistant Professor
Vishwaniketan’s iMEET
Syllabus

• Graph Terminology and Special Types of Graphs,


• Representing Graphs and Graph Isomorphism,
• Connectivity,
• Euler and Hamilton Paths,
• the handshaking lemma,
• Single source shortest path-Dijkstra's Algorithm,
• Planar Graphs,
• Graph Coloring.

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR, Pune 2


Basic terminology of the graph
• Graph:
– Collection of
• points called vertices
• lines called edges
– Each edge joins pair of vertices or single vertex by itself loop
v1 e1 v2
– G is ordered pair(V, E)
• V- set of vertices(nodes or points) e5
e4 e2
• E- set of edges(lines or arc )
• Eg. V={v1,v2,v3,v4}
v4 e3 v3
E={e1,e2,e3,e4,e5}
– Self loop and parallel edges: e6 e1 v2
v1
e5 e2
e5 e4
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
3
Pune v4 e3 v3
• Simple graph and multiple graph:
– Simple graph is graph with no parallel edges and self loop
– Otherwise multiple graph
e6 e1
v1 e1 v2 v2
v1
e5 e5 e2
e4 e2 e5 e4

v4 v3 v4 e3 v3
e3

• Weighted graph:
– Each edge, or each vertex, or both associated with positive
real number 2 v1 v2

8 4
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
4
Pune v4 6 v3
• Finite or infinite graph:
– Finite graph-Finite number of edges and vertices
– Otherwise infinite graph
• Labeled graph:
– Edges are labeled with some name or data
v1 e1 v2

e5 e2
e4

v4 e3 v3

– Eg. e1 to e5
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
5
Pune
• Adjacency and incidence:
– Two vertices joined by at least one edge then their vertices called
v1
adjacent vertices
– Incident e1
v2
e4 e2
v4 e3 v3

• v1 and v2, v2 and v3, v3 and v4, v2 and v4 are adjacent vertices
• v1 and v4, v1 and v3 are not adjacent vertices
• e1 is incident on v1 and v2
e2 is incident on v2 and v3
e3 is incident on v3 and v4
e4 is incident on v2 and v4
• e1 and e2, e2 and e2, e3 and e4, e1 and e4 are adjacent edges
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
6
Pune
• Degree of vertex:
– No. of edges incident on vertex
– Vertex with self loop count degree
e1 twice

– Denoted by d(vi) e2
v1 v3

.
v2
• d(v1)=3
v6 e3
• d(v2)=3 e7 e4
• d(v3)=1
v4
e6 v5 e5
• d(v4)=3
• d(v5)=4
• d(v6)=0
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
7
Pune
• Isolated vertex:
– Vertex with degree 0
• Pendant vertex:
– Vertex with degree 1
• Handshaking lemma:

– Number of vertices of odd degree in a graph is always


even
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
8
Pune
Matrix representation of graphs
• Adjacency matrix:
– No parallel edges:
– Eg. 1 v1 v2

v3

v5 v4

G1

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


9
Pune
– Eg. 2
v1
v2

v5 v4 v3

G1

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


10
Pune
– Eg. 3 v1
v2

v4 v3
v5
G1

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


11
Pune
• Incidence matrix:
v1 e1 v2

e4
e5 e2 e3

v4 v3
e6

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


12
Pune
• Adjacency matrix of a diagraph:
v1 v2
v3

v5 v4

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


13
Pune
• Incidence matrix of a diagraph:
v1 e1 v2 e8

e6 e7 e2

e3
v5 e5 v3

e4
v4

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


14
Pune
Some important and useful graphs
• Directed graph or digraph: v1 e1 v3
– Directed edges e2
– Simple directed graph: e5 e4 e3
• Without loop and multiple arcs
– Incidence: v2 e6 v4
• e1 is incident into v3
e7
• e1 is incident out v1
– Indegree and outdegree:
• Indegree:

• Outdegree:

– Underlining graph of diagraph:


– .
– . By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
15
Pune
• Null graph:
– Denoted by Nn

N3 N4

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


16
Pune
• Complete graph:
– Degree of each vertex is (n-1)
– Denoted by kn

k2 k3 k4 k5

– No. of edges n(n-1)/2

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


17
Pune
• Regular graph:
– Degree of each vertex is same

Regular graph of degree 2

Regular graph of
degree 3
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
18
Pune
• Bipartite graph:
– v1 union v2=v
– v1 intersection v2= null

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


19
Pune
• Complete bipartite graph:
– Denoted by Km,n
– Number of edges m*n

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


20
Pune
Isomorphism
• Denoted by
• Isomorphic

• Not isomorphic

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


21
Pune
• Solve:

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


22
Pune
New graphs from old ones
• Subgraph:
– V’ is subset of V and E’ is subset of E
– Eg. H1, H2 and H4 are subgraphs of G not H3

• Edge disjoint subgraphs:


– No edge common between two graphs
– Eg. H1 and H2
• Vertex disjoint subgraphs:
– No vertex common between
By Mrs. two
Pallavi Yevale, AI&DS, graphs
DYPIEMR,
23
Pune

• Spanning subgraph:
– V’=V

• Null subgraph:

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


24
Pune
• Factors of a graph:
– K- factor graph
– Eg. 1- factor graph
2- factor graph

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


25
Pune
• Complement of a graph:

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


26
Pune
Operations on graph
• Union:
• Intersection:

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


27
Pune
• Ring sum:

• Removal of edge and vertex:

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


28
Pune
Paths and circuits
• Path:
– P1 =( v1 e2 v2 e4 v4 )
– P2 = (v4 e4 v2 e2 v1 e1 v2 e3 v3)
– P3 = (v3 e3 v2 e2 v1 e1 v2 e3 v3)
• Simple path:
– No repetition of edges
– Eg. P1 and P2 but not P3
• Elementary path:
– No repetition of vertices
– Eg. P1 but not P2 and P3
• Circuit:
– End vertices are same
– C1 = (v1 e1 v2 e2 v1)
– C2 = (v3 e4 v1 e1 v2 e3 v3)
• Simple circuit:
– No repetition of edges
– Eg. C1 and C2
• Elementary circuit:
– No repetition of vertices except first and last
– Eg. C1 and C2

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


29
Pune
Connected and disconnected graphs
• Connected graphs: there exists path between
every pair of vertices

• Disconnected graph: otherwise

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


30
Pune
• Connected digraph: if its is strongly or weakly
connected
– Strongly connected:
• Path from both a to b and b to a
– Weakly connected:
• Not strongly connected and its underlying graph is
connected
– Disconnected digraph: if it is neither strongly
connected or weakly

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


31
Pune
Edge and vertex connectivity
• Edge connectivity:
– In a connected graph a cut set is minimal set of edges
whose removal disconnects the graph
– Denoted by λ(G)

λ(G)=3
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
32
Pune
– If cutset is single edge called bridge
– λ(G)=1

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


33
Pune
• Vertex connectivity:
– Smallest number of vertices whose removal
disconnects the graph
– Denoted by K(G)

K(G)=2
– Graph is said to be separable graph if its vertex
connectivity is one
K(G)=1
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
34
Pune
• Relation between edge and vertex
connectivity:

– ᵟ is minimum degree of vertex

– e is number of edges
– n is number of vertices

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


35
Pune
Shortest path algorithm
• Step 1: let P= ø , T={ all vertices of G}
set L(a)= 0, L (x)= ∞ , for all x ϵ T and x ≠ a
• Step 2: P=PU{v} and T= T-{v}
if v=z then L(z) is shortest path, stop
• Step 3:if v ≠ z then
L(x)=min[old L(x), L(v)+ w(v, x)]
• Step 4: repeat step 2 and 3 until z gets
permanent label
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
36
Pune
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
37
Pune
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
38
Pune
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
39
Pune
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
40
Pune
Eulerian path and circuit
• Eulerian path:
– Path with every edge of graph appears exactly once
• Eulerian circuit:
– Circuit with every edge of graph appears exactly once
• Eulerian graph:
– Graph with Eulerian circuit

.
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
41
Pune
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
42
Pune
Hamiltonian path and circuit
• Hamiltonian path:
– Path with every vertex of graph appears exactly once
– P1= 1 2 3 4
– P2= b c a
• Hamiltonian circuit:
– Circuit with every vertex of graph appears exactly once
except first and last
– C1= 1 2 3 4 1
• Hamiltonian graph:
– Graph with Hamiltonian circuit
By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,
43
Pune
• Theorem 1:
– Let G be a simple connected graph on n vertices. If the
sum of the degree for each pair of vertices in G is (n-
1) or large, then there exist Hamiltonian path in G.
– If above condition is not satisfied then may be or may
not be the Hamiltonian path exists.
– By theorem Path is present in first graph but in second
graph theorem can not prove about path existence

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


44
Pune
• Theorem 2:
– Let G be a simple connected graph on n vertices. If the
degree of each vertex is greater than or equal to n/2 , then
there exist Hamiltonian circuit in G.
– If above condition is not satisfied then may be or may not be
the Hamiltonian circuit exists.
– By theorem circuit is present in first graph but in second
graph theorem can not prove about circuit existence

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


45
Pune
Travelling salesman problem
• Nearest neighbor method:
– Starting at vertex a
– Starting at vertex d

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


46
Pune
Planar graph
• Planar graph:
– Graph with no intersecting edges

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


47
Pune
• Regions:
– Set of edges forming its boundary

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


48
Pune
• Euler’s formula:
• r=2–v+e
• v–e+r=v–(v–1)+1
• v – (e - 1) + (r - 1) = 2
• e <= 3v-6

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


49
Pune
Graph coloring

• Chromatic number: denoted by

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


50
Pune
• Coloring of a planar graph:

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


51
Pune
Applications of graph
• Web graph: WWW
• Google map:

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


52
Pune
Thank You

By Mrs. Pallavi Yevale, AI&DS, DYPIEMR,


53
Pune

You might also like