SlideShare a Scribd company logo
1 of 14
Download to read offline
DFS AND BFS
DFS AND BFS
GRAPH TRAVERSAL
OVERVIEW
GRAPH TRAVERSAL
OVERVIEW
In this presentation, we will
explore the concepts of Depth-
First Search (DFS) and Breadth-
First Search (BFS) in graph
traversal. We will demystify their
algorithms and discuss their
applications in various fields.
In this presentation, we will
explore the concepts of Depth-
First Search (DFS) and Breadth-
First Search (BFS) in graph
traversal. We will demystify their
algorithms and discuss their
applications in various fields.
Understanding Graphs
Understanding Graphs
Before delving into traversal
algorithms, let's define a graph
as a collection of nodes
connected by edges. Graphs can
be directed or undirected, and
can have weighted edges.
Before delving into traversal
algorithms, let's define a graph
as a collection of nodes
connected by edges. Graphs can
be directed or undirected, and
can have weighted edges.
DFS is a recursive algorithm
that explores as far as possible
along each branch before
backtracking. It is commonly
implemented using a stack
data structure.
DFS is a recursive algorithm
that explores as far as possible
along each branch before
backtracking. It is commonly
implemented using a stack
data structure.
DEPTH-FIRST SEARCH
(DFS)
DEPTH-FIRST SEARCH
(DFS)
BREADTH-FIRST SEARCH
(BFS)
BREADTH-FIRST SEARCH
(BFS)
Unlike DFS, BFS explores the
neighbor nodes before moving
on to the next level. It is
commonly implemented using a
queue data structure.
Unlike DFS, BFS explores the
neighbor nodes before moving
on to the next level. It is
commonly implemented using a
queue data structure.
BFS IMPLEMENTATION
BFS IMPLEMENTATION
BFS can be implemented
using a queue to maintain the
order of nodes to be visited. It
also requires a visited set to
prevent revisiting nodes.
BFS can be implemented
using a queue to maintain the
order of nodes to be visited. It
also requires a visited set to
prevent revisiting nodes.
COMPARING DFS AND BFS
COMPARING DFS AND BFS
DFS is suitable for topological
sorting and solving mazes,
while BFS is ideal for finding the
shortest path and web
crawling. Both algorithms have
distinct use cases.
DFS is suitable for topological
sorting and solving mazes,
while BFS is ideal for finding the
shortest path and web
crawling. Both algorithms have
distinct use cases.
Applications in Computer
Science
Applications in Computer
Science
Both DFS and BFS are
fundamental in various
computer science applications,
including network routing,
garbage collection, and puzzle
solving algorithms.
Both DFS and BFS are
fundamental in various
computer science applications,
including network routing,
garbage collection, and puzzle
solving algorithms.
REAL-WORLD APPLICATIONS
REAL-WORLD APPLICATIONS
Beyond computer science,
DFS and BFS have practical
applications in social network
analysis, recommendation
systems, and route planning
in transportation.
Beyond computer science,
DFS and BFS have practical
applications in social network
analysis, recommendation
systems, and route planning
in transportation.
Despite their versatility, DFS
and BFS can face challenges
with infinite graphs, memory
constraints, and optimization
for specific use cases.
Despite their versatility, DFS
and BFS can face challenges
with infinite graphs, memory
constraints, and optimization
for specific use cases.
CHALLENGES AND
LIMITATIONS
CHALLENGES AND
LIMITATIONS
BEST PRACTICES AND
OPTIMIZATION
BEST PRACTICES AND
OPTIMIZATION
To optimize traversal, techniques
such as memoization, parallel
processing, and heuristic
search can be applied.
Understanding the graph
structure is key to efficient
traversal.
To optimize traversal, techniques
such as memoization, parallel
processing, and heuristic
search can be applied.
Understanding the graph
structure is key to efficient
traversal.
In conclusion, DFS and BFS are powerful tools for
exploring and analyzing graphs. Understanding their
differences and applications can lead to efficient
solutions in various domains.
In conclusion, DFS and BFS are powerful tools for
exploring and analyzing graphs. Understanding their
differences and applications can lead to efficient
solutions in various domains.
CONCLUSION
CONCLUSION
Thanks!

More Related Content

Similar to this the the ppt regarding breadth first search and depth first search

Similarity on DBpedia
Similarity on DBpediaSimilarity on DBpedia
Similarity on DBpediaSamantha Lam
 
Fishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data LakeFishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data LakeArangoDB Database
 
Unit 2 Uninformed Search Strategies.pptx
Unit  2 Uninformed Search Strategies.pptxUnit  2 Uninformed Search Strategies.pptx
Unit 2 Uninformed Search Strategies.pptxDrYogeshDeshmukh1
 
A Hybrid Technique for Shape Matching Based on chain code and DFS Tree
A Hybrid Technique for Shape Matching Based on chain code and DFS TreeA Hybrid Technique for Shape Matching Based on chain code and DFS Tree
A Hybrid Technique for Shape Matching Based on chain code and DFS TreeIOSR Journals
 
How to empower community by using GIS lecture 1
How to empower community by using GIS lecture 1How to empower community by using GIS lecture 1
How to empower community by using GIS lecture 1wang yaohui
 
Introduction To Geocoding: Linda Achieng
Introduction To Geocoding: Linda AchiengIntroduction To Geocoding: Linda Achieng
Introduction To Geocoding: Linda AchiengRedis Labs
 
Parallel algorithms for multi-source graph traversal and its applications
Parallel algorithms for multi-source graph traversal and its applicationsParallel algorithms for multi-source graph traversal and its applications
Parallel algorithms for multi-source graph traversal and its applicationsSubhajit Sahu
 
Building a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQLBuilding a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQLKudos S.A.S
 
Towards a Distributional Semantic Web Stack
Towards a Distributional Semantic Web StackTowards a Distributional Semantic Web Stack
Towards a Distributional Semantic Web StackAndre Freitas
 
Towards an architecture and adoption process for Linked Data technologies in ...
Towards an architecture and adoption process for Linked Data technologies in ...Towards an architecture and adoption process for Linked Data technologies in ...
Towards an architecture and adoption process for Linked Data technologies in ...Jose Emilio Labra Gayo
 
Do it on your own - From 3 to 5 Star Linked Open Data with RMLio
Do it on your own - From 3 to 5 Star Linked Open Data with RMLioDo it on your own - From 3 to 5 Star Linked Open Data with RMLio
Do it on your own - From 3 to 5 Star Linked Open Data with RMLioOpen Knowledge Belgium
 
Whitepaper sones GraphDB (eng)
Whitepaper sones GraphDB (eng)Whitepaper sones GraphDB (eng)
Whitepaper sones GraphDB (eng)sones GmbH
 
How Graph Databases used in Police Department?
How Graph Databases used in Police Department?How Graph Databases used in Police Department?
How Graph Databases used in Police Department?Samet KILICTAS
 
Scalable keyword search on large rdf data
Scalable keyword search on large rdf dataScalable keyword search on large rdf data
Scalable keyword search on large rdf dataLeMeniz Infotech
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph DatabasesPaolo Pareti
 

Similar to this the the ppt regarding breadth first search and depth first search (18)

Similarity on DBpedia
Similarity on DBpediaSimilarity on DBpedia
Similarity on DBpedia
 
Fishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data LakeFishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data Lake
 
Unit 2 Uninformed Search Strategies.pptx
Unit  2 Uninformed Search Strategies.pptxUnit  2 Uninformed Search Strategies.pptx
Unit 2 Uninformed Search Strategies.pptx
 
BFS and DFS
BFS and DFSBFS and DFS
BFS and DFS
 
A Hybrid Technique for Shape Matching Based on chain code and DFS Tree
A Hybrid Technique for Shape Matching Based on chain code and DFS TreeA Hybrid Technique for Shape Matching Based on chain code and DFS Tree
A Hybrid Technique for Shape Matching Based on chain code and DFS Tree
 
How to empower community by using GIS lecture 1
How to empower community by using GIS lecture 1How to empower community by using GIS lecture 1
How to empower community by using GIS lecture 1
 
Introduction To Geocoding: Linda Achieng
Introduction To Geocoding: Linda AchiengIntroduction To Geocoding: Linda Achieng
Introduction To Geocoding: Linda Achieng
 
Parallel algorithms for multi-source graph traversal and its applications
Parallel algorithms for multi-source graph traversal and its applicationsParallel algorithms for multi-source graph traversal and its applications
Parallel algorithms for multi-source graph traversal and its applications
 
Building a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQLBuilding a Spatial Database in PostgreSQL
Building a Spatial Database in PostgreSQL
 
Ch1revised
Ch1revisedCh1revised
Ch1revised
 
Towards a Distributional Semantic Web Stack
Towards a Distributional Semantic Web StackTowards a Distributional Semantic Web Stack
Towards a Distributional Semantic Web Stack
 
Towards an architecture and adoption process for Linked Data technologies in ...
Towards an architecture and adoption process for Linked Data technologies in ...Towards an architecture and adoption process for Linked Data technologies in ...
Towards an architecture and adoption process for Linked Data technologies in ...
 
Do it on your own - From 3 to 5 Star Linked Open Data with RMLio
Do it on your own - From 3 to 5 Star Linked Open Data with RMLioDo it on your own - From 3 to 5 Star Linked Open Data with RMLio
Do it on your own - From 3 to 5 Star Linked Open Data with RMLio
 
Whitepaper sones GraphDB (eng)
Whitepaper sones GraphDB (eng)Whitepaper sones GraphDB (eng)
Whitepaper sones GraphDB (eng)
 
How Graph Databases used in Police Department?
How Graph Databases used in Police Department?How Graph Databases used in Police Department?
How Graph Databases used in Police Department?
 
Scalable keyword search on large rdf data
Scalable keyword search on large rdf dataScalable keyword search on large rdf data
Scalable keyword search on large rdf data
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 

Recently uploaded

Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf203318pmpc
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 

Recently uploaded (20)

Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 

this the the ppt regarding breadth first search and depth first search

  • 1. DFS AND BFS DFS AND BFS
  • 2. GRAPH TRAVERSAL OVERVIEW GRAPH TRAVERSAL OVERVIEW In this presentation, we will explore the concepts of Depth- First Search (DFS) and Breadth- First Search (BFS) in graph traversal. We will demystify their algorithms and discuss their applications in various fields. In this presentation, we will explore the concepts of Depth- First Search (DFS) and Breadth- First Search (BFS) in graph traversal. We will demystify their algorithms and discuss their applications in various fields.
  • 3. Understanding Graphs Understanding Graphs Before delving into traversal algorithms, let's define a graph as a collection of nodes connected by edges. Graphs can be directed or undirected, and can have weighted edges. Before delving into traversal algorithms, let's define a graph as a collection of nodes connected by edges. Graphs can be directed or undirected, and can have weighted edges.
  • 4. DFS is a recursive algorithm that explores as far as possible along each branch before backtracking. It is commonly implemented using a stack data structure. DFS is a recursive algorithm that explores as far as possible along each branch before backtracking. It is commonly implemented using a stack data structure. DEPTH-FIRST SEARCH (DFS) DEPTH-FIRST SEARCH (DFS)
  • 5.
  • 6. BREADTH-FIRST SEARCH (BFS) BREADTH-FIRST SEARCH (BFS) Unlike DFS, BFS explores the neighbor nodes before moving on to the next level. It is commonly implemented using a queue data structure. Unlike DFS, BFS explores the neighbor nodes before moving on to the next level. It is commonly implemented using a queue data structure.
  • 7. BFS IMPLEMENTATION BFS IMPLEMENTATION BFS can be implemented using a queue to maintain the order of nodes to be visited. It also requires a visited set to prevent revisiting nodes. BFS can be implemented using a queue to maintain the order of nodes to be visited. It also requires a visited set to prevent revisiting nodes.
  • 8. COMPARING DFS AND BFS COMPARING DFS AND BFS DFS is suitable for topological sorting and solving mazes, while BFS is ideal for finding the shortest path and web crawling. Both algorithms have distinct use cases. DFS is suitable for topological sorting and solving mazes, while BFS is ideal for finding the shortest path and web crawling. Both algorithms have distinct use cases.
  • 9. Applications in Computer Science Applications in Computer Science Both DFS and BFS are fundamental in various computer science applications, including network routing, garbage collection, and puzzle solving algorithms. Both DFS and BFS are fundamental in various computer science applications, including network routing, garbage collection, and puzzle solving algorithms.
  • 10. REAL-WORLD APPLICATIONS REAL-WORLD APPLICATIONS Beyond computer science, DFS and BFS have practical applications in social network analysis, recommendation systems, and route planning in transportation. Beyond computer science, DFS and BFS have practical applications in social network analysis, recommendation systems, and route planning in transportation.
  • 11. Despite their versatility, DFS and BFS can face challenges with infinite graphs, memory constraints, and optimization for specific use cases. Despite their versatility, DFS and BFS can face challenges with infinite graphs, memory constraints, and optimization for specific use cases. CHALLENGES AND LIMITATIONS CHALLENGES AND LIMITATIONS
  • 12. BEST PRACTICES AND OPTIMIZATION BEST PRACTICES AND OPTIMIZATION To optimize traversal, techniques such as memoization, parallel processing, and heuristic search can be applied. Understanding the graph structure is key to efficient traversal. To optimize traversal, techniques such as memoization, parallel processing, and heuristic search can be applied. Understanding the graph structure is key to efficient traversal.
  • 13. In conclusion, DFS and BFS are powerful tools for exploring and analyzing graphs. Understanding their differences and applications can lead to efficient solutions in various domains. In conclusion, DFS and BFS are powerful tools for exploring and analyzing graphs. Understanding their differences and applications can lead to efficient solutions in various domains. CONCLUSION CONCLUSION