SlideShare a Scribd company logo
1 of 15
BY
SAKTHIPRIYA
Many graph algorithm of a graph G
Require one to systematically examine
the nodes and edges of a graph G.
 There are two standard ways of graph
traversal::-
Breadth first search
Depth first search
During execution of our algorithm each
node N of G will be one of three
states,called status of N.
Status=1(ready state)the initial of node
n.
Status=2(waiting state)the node n is on
the queue or stack wait to be processed.
Status=3(processed state)the node n has
been processed.
 Breadth first search is an algorithm for
traversing or searching tree or graph data
structure.
It uses the opposite strategy depth first
traversal.
The bft another name is called “breadth
first search “
BFS instead explores the highest depth
node first before being forced to
backtrack and expand shallower nodes.
It is an important graph search algorithm
is used to solve many problems including
finding the shortest plan in a graph.
BFS always used in “queue”
 Breadth-first search (BFS) is an algorithm for
traversing or searching tree or graph data
structures.
 It uses the opposite strategy as depth-
first search, which instead explores the
highest-depth nodes first before being forced
to backtrack and expand shallower nodes.
Gain access to
visit the nodes.
Two operation
 Level by level each elements exits at a
certain level (or depth) in the tree.
LEVEL 1
LEVEL 2
A
B C
D E F
LEVEL 0
 Depth-first search (DFS)is a general
technique for traversing a graph
 DFS always used in “stack”
 we have inserting elements and deleting the
elements .It is used to the operation in push
and pop.
A DFS traversal of a graph G
Visits all the vertices and edges of G
Determines whether G is connected
Computes the connected components of G
Computes a spanning forest of G
 A subgraph S of a graph G is a graph such
that
 The vertices of S are a subset
of the vertices of G
 The edges of S are a subset
of the edges of G
 A spanning subgraph of G is a subgraph that
contains all the vertices of G
 A spanning tree of a connected graph is a
spanning subgraph that is a tree
 A spanning tree is not unique unless the
graph is a tree
 Spanning trees have applications to the
design of communication networks
 A spanning forest of a graph is a spanning
subgraph that is a forest
 A graph is connected if there is a path
between every pair of vertices
 A connected component of a graph G is a
maximal connected subgraph of G
Property 1
DFS(G, v) visits all the vertices and
edges in the connected component of v
Property 2
The discovery edges labeled by DFS(G, v)
form a spanning tree of the connected
component of v

More Related Content

What's hot

2018 icml part 2 segwangkim
2018 icml part 2 segwangkim2018 icml part 2 segwangkim
2018 icml part 2 segwangkimsegwangkim
 
Application of linear algebra in cse
Application of linear algebra in cseApplication of linear algebra in cse
Application of linear algebra in cseArnob Khan
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language CHANDAN KUMAR
 
Cluster Analysis - Keyword Clustering
Cluster Analysis -  Keyword ClusteringCluster Analysis -  Keyword Clustering
Cluster Analysis - Keyword ClusteringJustine Jes Thomas
 
AP Calculus Slides October 24, 2007
AP Calculus Slides October 24, 2007AP Calculus Slides October 24, 2007
AP Calculus Slides October 24, 2007Darren Kuropatwa
 
Applications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer SciencesApplications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer SciencesAmir Sharif Chishti
 
1-7 Presenting Data
1-7 Presenting Data1-7 Presenting Data
1-7 Presenting Datarkelch
 
An Educational PPT on Handling data
An Educational PPT on Handling dataAn Educational PPT on Handling data
An Educational PPT on Handling dataBhartendu Jain
 
TO FIND AREA UNDER THE CURVE USING INTEGRATION
TO FIND AREA UNDER THE CURVE USING INTEGRATIONTO FIND AREA UNDER THE CURVE USING INTEGRATION
TO FIND AREA UNDER THE CURVE USING INTEGRATIONAbdurrahmaan Kazi
 
Applications of linear algebra in computer science
Applications of linear algebra in computer scienceApplications of linear algebra in computer science
Applications of linear algebra in computer scienceArnob Khan
 
Optimization of graph storage using GoFFish
Optimization of graph storage using GoFFishOptimization of graph storage using GoFFish
Optimization of graph storage using GoFFishAnushree Prasanna Kumar
 

What's hot (20)

2018 icml part 2 segwangkim
2018 icml part 2 segwangkim2018 icml part 2 segwangkim
2018 icml part 2 segwangkim
 
Unit 1. day 9
Unit 1. day 9Unit 1. day 9
Unit 1. day 9
 
Application of linear algebra in cse
Application of linear algebra in cseApplication of linear algebra in cse
Application of linear algebra in cse
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language
 
R nonlinear least square
R   nonlinear least squareR   nonlinear least square
R nonlinear least square
 
Applications of linear algebra in field of it
Applications of linear algebra in field of itApplications of linear algebra in field of it
Applications of linear algebra in field of it
 
Cluster Analysis - Keyword Clustering
Cluster Analysis -  Keyword ClusteringCluster Analysis -  Keyword Clustering
Cluster Analysis - Keyword Clustering
 
MATCHING GRAPH THEORY
MATCHING GRAPH THEORYMATCHING GRAPH THEORY
MATCHING GRAPH THEORY
 
AP Calculus Slides October 24, 2007
AP Calculus Slides October 24, 2007AP Calculus Slides October 24, 2007
AP Calculus Slides October 24, 2007
 
Applications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer SciencesApplications of Linear Algebra in Computer Sciences
Applications of Linear Algebra in Computer Sciences
 
Bfs new
Bfs newBfs new
Bfs new
 
1-7 Presenting Data
1-7 Presenting Data1-7 Presenting Data
1-7 Presenting Data
 
3D Analyst - Lab
3D Analyst - Lab3D Analyst - Lab
3D Analyst - Lab
 
An Educational PPT on Handling data
An Educational PPT on Handling dataAn Educational PPT on Handling data
An Educational PPT on Handling data
 
TO FIND AREA UNDER THE CURVE USING INTEGRATION
TO FIND AREA UNDER THE CURVE USING INTEGRATIONTO FIND AREA UNDER THE CURVE USING INTEGRATION
TO FIND AREA UNDER THE CURVE USING INTEGRATION
 
Histogram
HistogramHistogram
Histogram
 
Data handling
Data handlingData handling
Data handling
 
Applications of linear algebra in computer science
Applications of linear algebra in computer scienceApplications of linear algebra in computer science
Applications of linear algebra in computer science
 
Histogram
HistogramHistogram
Histogram
 
Optimization of graph storage using GoFFish
Optimization of graph storage using GoFFishOptimization of graph storage using GoFFish
Optimization of graph storage using GoFFish
 

Similar to breadth first search

5.5 graph mining
5.5 graph mining5.5 graph mining
5.5 graph miningKrish_ver2
 
Riya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptx
Riya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptxRiya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptx
Riya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptxRIYABEPARI
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxking779879
 
NON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptxNON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptxRajitha Reddy Alugati
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx pptDhruvilSTATUS
 
Analysis & design of algorithm
Analysis & design of algorithmAnalysis & design of algorithm
Analysis & design of algorithmrahela bham
 
data structures and algorithms Unit 2
data structures and algorithms Unit 2data structures and algorithms Unit 2
data structures and algorithms Unit 2infanciaj
 
Basic Traversal and Search Techniques
Basic Traversal and Search TechniquesBasic Traversal and Search Techniques
Basic Traversal and Search TechniquesSVijaylakshmi
 
Basic Traversal and Search Techniques
Basic Traversal and Search TechniquesBasic Traversal and Search Techniques
Basic Traversal and Search TechniquesSVijaylakshmi
 
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxgraphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxwhittemorelucilla
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data StructureKeno benti
 
graph representation.pdf
graph representation.pdfgraph representation.pdf
graph representation.pdfamitbhachne
 
VANU no sql ppt.pptx
VANU no sql ppt.pptxVANU no sql ppt.pptx
VANU no sql ppt.pptxMJeyavarthini
 

Similar to breadth first search (20)

5.5 graph mining
5.5 graph mining5.5 graph mining
5.5 graph mining
 
Riya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptx
Riya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptxRiya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptx
Riya Bepari_34700122020_Artificial Intelligence_PEC-IT501B.pptx
 
Graph Representation
Graph RepresentationGraph Representation
Graph Representation
 
Graphs
GraphsGraphs
Graphs
 
Graph in data structures
Graph in data structuresGraph in data structures
Graph in data structures
 
Lecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptxLecture 2.3.1 Graph.pptx
Lecture 2.3.1 Graph.pptx
 
NON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptxNON-LINEAR DATA STRUCTURE-Graphs.pptx
NON-LINEAR DATA STRUCTURE-Graphs.pptx
 
Unit-6 Graph.ppsx ppt
Unit-6 Graph.ppsx                                       pptUnit-6 Graph.ppsx                                       ppt
Unit-6 Graph.ppsx ppt
 
Analysis & design of algorithm
Analysis & design of algorithmAnalysis & design of algorithm
Analysis & design of algorithm
 
data structures and algorithms Unit 2
data structures and algorithms Unit 2data structures and algorithms Unit 2
data structures and algorithms Unit 2
 
Data structure note
Data structure noteData structure note
Data structure note
 
Basic Traversal and Search Techniques
Basic Traversal and Search TechniquesBasic Traversal and Search Techniques
Basic Traversal and Search Techniques
 
Bfs dfs mst
Bfs dfs mstBfs dfs mst
Bfs dfs mst
 
Basic Traversal and Search Techniques
Basic Traversal and Search TechniquesBasic Traversal and Search Techniques
Basic Traversal and Search Techniques
 
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docxgraphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
 
Graph Data Structure
Graph Data StructureGraph Data Structure
Graph Data Structure
 
graph representation.pdf
graph representation.pdfgraph representation.pdf
graph representation.pdf
 
Vanmathy no sql
Vanmathy no sql Vanmathy no sql
Vanmathy no sql
 
VANU no sql ppt.pptx
VANU no sql ppt.pptxVANU no sql ppt.pptx
VANU no sql ppt.pptx
 
Spanningtreesppt
SpanningtreespptSpanningtreesppt
Spanningtreesppt
 

More from DeepikaT13

Mobile computing
Mobile computingMobile computing
Mobile computingDeepikaT13
 
Image processing
Image processingImage processing
Image processingDeepikaT13
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filteringDeepikaT13
 
Hive architecture
Hive  architectureHive  architecture
Hive architectureDeepikaT13
 
Sotware engineering
Sotware engineeringSotware engineering
Sotware engineeringDeepikaT13
 
Computer network
Computer networkComputer network
Computer networkDeepikaT13
 
Storage management in operating system
Storage management in operating systemStorage management in operating system
Storage management in operating systemDeepikaT13
 
Neural network
Neural networkNeural network
Neural networkDeepikaT13
 
memory reference instruction
memory reference instructionmemory reference instruction
memory reference instructionDeepikaT13
 
Computer registers
Computer registersComputer registers
Computer registersDeepikaT13
 

More from DeepikaT13 (20)

Mobile computing
Mobile computingMobile computing
Mobile computing
 
Image processing
Image processingImage processing
Image processing
 
aloha
alohaaloha
aloha
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 
Exceptions
ExceptionsExceptions
Exceptions
 
Hive architecture
Hive  architectureHive  architecture
Hive architecture
 
Rdbms
RdbmsRdbms
Rdbms
 
Sotware engineering
Sotware engineeringSotware engineering
Sotware engineering
 
Data mining
Data miningData mining
Data mining
 
Computer network
Computer networkComputer network
Computer network
 
Storage management in operating system
Storage management in operating systemStorage management in operating system
Storage management in operating system
 
Jdbc
JdbcJdbc
Jdbc
 
Data mining
Data miningData mining
Data mining
 
Neural network
Neural networkNeural network
Neural network
 
memory reference instruction
memory reference instructionmemory reference instruction
memory reference instruction
 
constructors
constructorsconstructors
constructors
 
Disjoint set
Disjoint setDisjoint set
Disjoint set
 
Destructors
DestructorsDestructors
Destructors
 
Crisp set
Crisp setCrisp set
Crisp set
 
Computer registers
Computer registersComputer registers
Computer registers
 

Recently uploaded

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 

Recently uploaded (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 

breadth first search

  • 2. Many graph algorithm of a graph G Require one to systematically examine the nodes and edges of a graph G.  There are two standard ways of graph traversal::- Breadth first search Depth first search
  • 3. During execution of our algorithm each node N of G will be one of three states,called status of N. Status=1(ready state)the initial of node n. Status=2(waiting state)the node n is on the queue or stack wait to be processed. Status=3(processed state)the node n has been processed.
  • 4.  Breadth first search is an algorithm for traversing or searching tree or graph data structure. It uses the opposite strategy depth first traversal. The bft another name is called “breadth first search “
  • 5. BFS instead explores the highest depth node first before being forced to backtrack and expand shallower nodes. It is an important graph search algorithm is used to solve many problems including finding the shortest plan in a graph. BFS always used in “queue”
  • 6.  Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures.  It uses the opposite strategy as depth- first search, which instead explores the highest-depth nodes first before being forced to backtrack and expand shallower nodes.
  • 7. Gain access to visit the nodes. Two operation
  • 8.
  • 9.  Level by level each elements exits at a certain level (or depth) in the tree. LEVEL 1 LEVEL 2 A B C D E F LEVEL 0
  • 10.  Depth-first search (DFS)is a general technique for traversing a graph  DFS always used in “stack”  we have inserting elements and deleting the elements .It is used to the operation in push and pop. A DFS traversal of a graph G Visits all the vertices and edges of G Determines whether G is connected Computes the connected components of G Computes a spanning forest of G
  • 11.  A subgraph S of a graph G is a graph such that  The vertices of S are a subset of the vertices of G  The edges of S are a subset of the edges of G  A spanning subgraph of G is a subgraph that contains all the vertices of G
  • 12.  A spanning tree of a connected graph is a spanning subgraph that is a tree  A spanning tree is not unique unless the graph is a tree  Spanning trees have applications to the design of communication networks  A spanning forest of a graph is a spanning subgraph that is a forest
  • 13.  A graph is connected if there is a path between every pair of vertices  A connected component of a graph G is a maximal connected subgraph of G
  • 14.
  • 15. Property 1 DFS(G, v) visits all the vertices and edges in the connected component of v Property 2 The discovery edges labeled by DFS(G, v) form a spanning tree of the connected component of v