SlideShare a Scribd company logo
PRESENTATION
DISCRETE
STRUCTURE
MAHESH SINGH MADAI
PREPARED BY
TOPICS
Hamiltonian Path and Circuit
Matching Theory
Shortest Path Problem ( Dijkstra’s Algorithm)
#1. HAMILTONIAN PATH & CIRCUIT
• Let the graph be G = (V,E); where |V|>=3 (vertices/nodes) and E denote the Edges(connector
of endpoints)
• A simple path in such graph G that passes through every vertex exactly once is called
Hamiltonian path. Every edge mayn't be used here.
• A circuit is that path where starting and endpoints are same.
• For example:
A B A B
D C
D C
Path -> A –B –C –D
Circuit -> A-B-C-D-A
More Examples:
A B
C A B C D
D E E F G H
Hamilton Path Exists Hamilton Path Does not Exists
a b
c d
#THEOROM:
Let G be a graph of n>=3 vertices, then G has a Hamiltonian path if for only two
non adjacent vertices u and v of G satisfy the following condition
deg (u) + deg (v) >= n
For example:
a b
c d
Here, total vertices (n) = 4
Take vertex a and d
deg(a) = 1 & deg(d) = 2
1+ 2 < 4  So, Hamiltonian circuit does not exists.
#2. MATCHING THEORY
• A matching graph is a subgraph of a graph where there are no edges adjacent
to each other.
• Simply, there should not be any common vertex between any two edges
• A vertex is said to be a matched if it is incident to an edge otherwise
unmatched.
• The vertices should have a degree of 1 or 0
• Notation  M(G)
• In a matching, deg(V) = 1, then (V) is said to be matched
deg(V) = 0, then (V) is said to be unmatched
MAXIMAL MATCHING
• A maximal matching is a matching M of a graph G with the property that if any
edge not in M is added to M, it is no longer a matching
• A matching M of a graph G is maximal if every edge in G has a non-empty
intersection with at least one edge in M.
• It is also known as maximum cardinality matching.
• It is a matching that contains the largest possible number of edges.
• The number of edges in the maximum matching of ‘G’ is called its matching
number.
MAXIMUM MATCHING
PERFECT MATCHING
• A matching (M) of graph (G) is said to be a perfect match, if every vertex of graph
g (G) is incident to exactly one edge of the matching
(M), i.e., deg(V) = 1 ∀V
• Every perfect matching of graph is also a maximum matching of graph, because
there is no chance of adding one more edge in a perfect matching graph.
Hamilton Path & Dijkstra's Algorithm
#3. SHORTEST PATH PROBLEM
Weighted Graph(Labelled Graph):
A weighted graph is a graph G, in which each edge e, is assigned a non-
negative real number. The number is the weight of the e.
The length of a path in a weighted graph is the sum of the weights of the
edges of this path
The shortest path is the minimum length of the path.
Hamilton Path & Dijkstra's Algorithm
#3.DIJKSTRA’S ALGORITHM (/DEIK-STRAS/)
• Formulated by Edsgar W. Dijkstra
• Dijkstra’s algorithm can be used to determine the shortest path from
one node in a graph to every other node within the same graph data
structure, provided that the nodes are reachable from the starting node.
• This algorithm will continue to run until all of the reachable vertices in a
graph have been visited.
• Application: Google Maps, Satellite Navigation, Finding Shortest Path
etc.
#3.DIJKSTRA’S ALGORITHM (/DEIK-STRAS/)
Steps:
a) Assign every node a tentative distance
b) Set initial node as current and mark all nodes as
unvisited.
c) For current node, consider all unvisited nodes and
calculate distance
d) Compare current and calculated distance and assign
the smaller value.
e) When all neighbors are considered, mark them
f) If the destination node is marked, Stop
Hamilton Path & Dijkstra's Algorithm
Qn: Find the shortest path between a and z
THANK YOU!!!

More Related Content

PPTX
POLYCYSTIC OVARY SYNDROME
PPTX
Real-Life Problems that can be Solved by Statistics.pptx
PPTX
12_Graph.pptx
PPT
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
PPT
mathematics of network science: basic definitions
PDF
14 chapter9 graph_algorithmstopologicalsort_shortestpath
PPT
Inroduction_To_Algorithms_Lect14
POLYCYSTIC OVARY SYNDROME
Real-Life Problems that can be Solved by Statistics.pptx
12_Graph.pptx
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
mathematics of network science: basic definitions
14 chapter9 graph_algorithmstopologicalsort_shortestpath
Inroduction_To_Algorithms_Lect14

Similar to Hamilton Path & Dijkstra's Algorithm (20)

PPTX
Randomized algorithms all pairs shortest path
PDF
APPLICATIONS OF GRAPH THEORY IN HUMAN LIFE
PPTX
TREE ADT, TREE TRAVERSALS, BINARY TREE ADT
PPT
Graphs
PDF
gsm nithya.pdf
PPTX
Graph in data structures
PDF
04 greedyalgorithmsii 2x2
PPTX
ENSA_Agadir_Hassane_Bouzahir_Last_Chapter_ENSA_Coloring_Dijkstra.pptx
PPTX
logic.pptx
PPTX
Graph Algorithms
PPTX
Ram minimum spanning tree
PPTX
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
PDF
Unit-10 Graphs .pdf
PPTX
Graph terminology and algorithm and tree.pptx
PPTX
Spanning Tree in data structure and .pptx
PDF
Maximum Matching in General Graphs
PPTX
Data Structures and Agorithm: DS 21 Graph Theory.pptx
PPTX
Chapter 1
PPTX
Data structure and algorithm
PDF
Problem Solving with Algorithms and Data Structure - Graphs
Randomized algorithms all pairs shortest path
APPLICATIONS OF GRAPH THEORY IN HUMAN LIFE
TREE ADT, TREE TRAVERSALS, BINARY TREE ADT
Graphs
gsm nithya.pdf
Graph in data structures
04 greedyalgorithmsii 2x2
ENSA_Agadir_Hassane_Bouzahir_Last_Chapter_ENSA_Coloring_Dijkstra.pptx
logic.pptx
Graph Algorithms
Ram minimum spanning tree
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
Unit-10 Graphs .pdf
Graph terminology and algorithm and tree.pptx
Spanning Tree in data structure and .pptx
Maximum Matching in General Graphs
Data Structures and Agorithm: DS 21 Graph Theory.pptx
Chapter 1
Data structure and algorithm
Problem Solving with Algorithms and Data Structure - Graphs
Ad

Recently uploaded (20)

PPTX
additive manufacturing of ss316l using mig welding
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Sustainable Sites - Green Building Construction
DOCX
573137875-Attendance-Management-System-original
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPT
Project quality management in manufacturing
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Welding lecture in detail for understanding
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
OOP with Java - Java Introduction (Basics)
additive manufacturing of ss316l using mig welding
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Mechanical Engineering MATERIALS Selection
CH1 Production IntroductoryConcepts.pptx
Sustainable Sites - Green Building Construction
573137875-Attendance-Management-System-original
Internet of Things (IOT) - A guide to understanding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Project quality management in manufacturing
bas. eng. economics group 4 presentation 1.pptx
Welding lecture in detail for understanding
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Foundation to blockchain - A guide to Blockchain Tech
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
OOP with Java - Java Introduction (Basics)
Ad

Hamilton Path & Dijkstra's Algorithm

  • 2. TOPICS Hamiltonian Path and Circuit Matching Theory Shortest Path Problem ( Dijkstra’s Algorithm)
  • 3. #1. HAMILTONIAN PATH & CIRCUIT • Let the graph be G = (V,E); where |V|>=3 (vertices/nodes) and E denote the Edges(connector of endpoints) • A simple path in such graph G that passes through every vertex exactly once is called Hamiltonian path. Every edge mayn't be used here. • A circuit is that path where starting and endpoints are same. • For example: A B A B D C D C Path -> A –B –C –D Circuit -> A-B-C-D-A
  • 4. More Examples: A B C A B C D D E E F G H Hamilton Path Exists Hamilton Path Does not Exists a b c d
  • 5. #THEOROM: Let G be a graph of n>=3 vertices, then G has a Hamiltonian path if for only two non adjacent vertices u and v of G satisfy the following condition deg (u) + deg (v) >= n For example: a b c d Here, total vertices (n) = 4 Take vertex a and d deg(a) = 1 & deg(d) = 2 1+ 2 < 4  So, Hamiltonian circuit does not exists.
  • 6. #2. MATCHING THEORY • A matching graph is a subgraph of a graph where there are no edges adjacent to each other. • Simply, there should not be any common vertex between any two edges • A vertex is said to be a matched if it is incident to an edge otherwise unmatched. • The vertices should have a degree of 1 or 0 • Notation  M(G) • In a matching, deg(V) = 1, then (V) is said to be matched deg(V) = 0, then (V) is said to be unmatched
  • 7. MAXIMAL MATCHING • A maximal matching is a matching M of a graph G with the property that if any edge not in M is added to M, it is no longer a matching • A matching M of a graph G is maximal if every edge in G has a non-empty intersection with at least one edge in M. • It is also known as maximum cardinality matching. • It is a matching that contains the largest possible number of edges. • The number of edges in the maximum matching of ‘G’ is called its matching number. MAXIMUM MATCHING
  • 8. PERFECT MATCHING • A matching (M) of graph (G) is said to be a perfect match, if every vertex of graph g (G) is incident to exactly one edge of the matching (M), i.e., deg(V) = 1 ∀V • Every perfect matching of graph is also a maximum matching of graph, because there is no chance of adding one more edge in a perfect matching graph.
  • 10. #3. SHORTEST PATH PROBLEM Weighted Graph(Labelled Graph): A weighted graph is a graph G, in which each edge e, is assigned a non- negative real number. The number is the weight of the e. The length of a path in a weighted graph is the sum of the weights of the edges of this path The shortest path is the minimum length of the path.
  • 12. #3.DIJKSTRA’S ALGORITHM (/DEIK-STRAS/) • Formulated by Edsgar W. Dijkstra • Dijkstra’s algorithm can be used to determine the shortest path from one node in a graph to every other node within the same graph data structure, provided that the nodes are reachable from the starting node. • This algorithm will continue to run until all of the reachable vertices in a graph have been visited. • Application: Google Maps, Satellite Navigation, Finding Shortest Path etc.
  • 13. #3.DIJKSTRA’S ALGORITHM (/DEIK-STRAS/) Steps: a) Assign every node a tentative distance b) Set initial node as current and mark all nodes as unvisited. c) For current node, consider all unvisited nodes and calculate distance d) Compare current and calculated distance and assign the smaller value. e) When all neighbors are considered, mark them f) If the destination node is marked, Stop
  • 15. Qn: Find the shortest path between a and z