際際滷

際際滷Share a Scribd company logo
Search Algorithms
Uninformed Search Strategies
 An uninformed search algorithm is one where
there is no clue about how close a state is to
the goal(s).
 Egs: Breadth First Search, Depth First Search,
Uniform Cost Search
Breadth First Search
 Breadth-first search (BFS) is a technique for
traversing a finite graph or a tree to search a
node that meets a set of criteria.
 When all actions have the same cost, then the
appropriate strategy is breadth-first search
 The root node is expanded first, then all the
successors of the root node are expanded next,
then their successors, and so on.
Steps to implement BFS Traversal
Step 1: Define a Queue of size total number of vertices in the
graph.
Step 2: Select any vertex as starting point for traversal. Visit
that vertex and insert it into the Queue.
Step 3: Visit all the adjacent vertices of the vertex which is at
front of the Queue which is not visited and insert them into
the Queue.
Step 4: When there is no new vertex to be visited from the
vertex at front of the Queue then delete that vertex from
the Queue.
Step 5: Repeat step 3 and 4 until queue becomes empty.
Step 6: When queue becomes Empty, then produce final
spanning tree by removing unused edges from the graph
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS EXAMPLE : GRAPH
BFS  Binary Tree
BFS Advantages
 Breadth first search will always find the
shortest path first
 Breadth-first search always finds a solution with
a minimal number of actions, because
 when it is generating nodes at depth d, it has
already generated all the nodes at depth d -1
 so if one of them were a solution, it would have
been found
 The solution which is found is always the
optimal solution.
 It can be very memory intensive since it needs
to keep track of all the nodes in the search
graph/tree.
 It can be slow since it expands all the nodes at
each level before moving on to the next level.
 BFS works better when a user searches for the
vertices(goal state) that stay closer to any
given source(initial state)
BFS Disadvantages
Depth First Search
 Depth-first search (DFS) is an algorithm for
traversing or searching tree or graph data structures
 The algorithm starts at the root node and explores
as far as possible along each branch before
backtracking.
 Depth-first search always expands the deepest
node of any particular path before exploring its
breadth
 DFS traversal of a graph, produces a spanning tree
as final result.
Steps to implement DFS Traversal
Step 1: Define a Stack of size total number of vertices in the graph.
Step 2: Select any vertex as starting point for traversal. Visit that
vertex and push it on to the Stack.
Step 3: Visit any one of the adjacent vertex of the vertex which is
at top of the stack which is not visited and push it on to the
stack.
Step 4: Repeat step 3 until there are no new vertex to be visited
from the vertex on top of the stack.
Step 5: When there is no new vertex to be visited then use back
tracking and pop one vertex from the stack.
Step 6: Repeat steps 3, 4 and 5 until stack becomes Empty.
Step 7: When stack becomes Empty, then produce final spanning
tree by removing unused edges from the graph
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS EXAMPLE - GRAPH
DFS  Binary Tree
DFS Advantages
 Requires less memory since it only stores stack
of nodes on the path from root node to current
node.
 It can find solution without examining much
search space and stop once found.
 Takes less time to reach goal node than BFS
algorithm.
DFS Disadvantages
 The disadvantage of Depth-First Search is that
there is a possibility that it may go down the
left-most path forever(indefinitely in a cycle)
 Depth-First Search is not guaranteed to find
the solution.
 And there is no guarantee to find a minimal
solution, if more than one solution.
Comparison
 Breadth first search will always find the solution in
the shortest path
 BFS does not require backtracking
 Consumes more resources
 DFS requires less memory since only the nodes on
the current path are stored.
 By chance, DFS may find a solution without
examining much of the search space at all.
 Since DFS moves blindly down one path, looping
(cycles) is a SERIOUS problem
Uniform Cost Search
 Uniform-cost search is a searching algorithm used for
traversing a weighted tree or graph (Dijkstra's algorithm)
 This algorithm comes into play when a different cost is
available for each edge
 The primary goal is to find a path to the goal node which has
the lowest cumulative cost
 Uniform-cost search expands nodes according to their path
costs from the root node
 g(n) = cost from root to n
 It gives maximum priority to the lowest cumulative cost
 Strategy: expand lowest g(n)
 A uniform-cost search algorithm is implemented by the
priority queue
Uniform Cost Search
Algorithm Characteristics
 Advantages:
 Uniform cost search is optimal because at every
state the path with the least cost is chosen
 Disadvantages:
 It does not care about the number of steps
involved in searching and only concerned about
path cost
 Due to which this algorithm may be stuck in an
infinite loop
Uniform Cost Search
Uniform Cost Search
Uniform Cost Search
Uniform Cost Search
Uniform Cost Search
Uniform Cost Search
Uniform Cost Search
Uniform Cost Search
Uniform Cost Search
Bidirectional search
 The bidirectional search simultaneously searches
forward from the initial state and backwards from the
goal state(s), hoping that the two searches will meet
 Bidirectional search replaces one single search graph
with two small sub graphs(one starts the search from an initial vertex
and other starts from goal vertex)
 Bidirectional search can use search techniques such as
BFS, DFS
 We can consider bidirectional approach when
 Both initial and goal states are unique and completely defined
 The branching factor is exactly the same in both directions
Bidirectional search
 To find if there exists a path from
vertex 0 to vertex 14
 We can execute two searches,
one from vertex 0 and other from
vertex 14.
 When both forward and
backward search meet at vertex
7, we know that we have found a
path from node 0 to 14
 The search can be terminated
now without further exploration

More Related Content

Similar to Problem Solving through Search - Uninformed Search (20)

AI(Module1).pptx
AI(Module1).pptxAI(Module1).pptx
AI(Module1).pptx
AnkitaVerma776806
uninformed search part 2.pptx
uninformed search part 2.pptxuninformed search part 2.pptx
uninformed search part 2.pptx
MUZAMILALI48
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptxPPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
RaviKiranVarma4
Search in Algorithm in artificial intelligence
Search in Algorithm in artificial intelligenceSearch in Algorithm in artificial intelligence
Search in Algorithm in artificial intelligence
karimibaryal1996
2.uninformed search
2.uninformed search2.uninformed search
2.uninformed search
KONGU ENGINEERING COLLEGE
Chap11 slides
Chap11 slidesChap11 slides
Chap11 slides
BaliThorat1
UNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITY
UNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITYUNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITY
UNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITY
PriyankaSeelaboyina
Unit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sUnit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution's
Harsha Patel
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptx
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptxAdhit_presentation_Searching_Algorithm(BFS,DFS).pptx
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptx
SuryaBasnet3
Searching is the universal technique of problem solving in Artificial Intelli...
Searching is the universal technique of problem solving in Artificial Intelli...Searching is the universal technique of problem solving in Artificial Intelli...
Searching is the universal technique of problem solving in Artificial Intelli...
KarpagaPriya10
abhishek ppt.pptx
abhishek ppt.pptxabhishek ppt.pptx
abhishek ppt.pptx
mohammadahmad827856
Uninformed Search technique
Uninformed Search techniqueUninformed Search technique
Uninformed Search technique
Kapil Dahal
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
GOKULKANNANMMECLECTC
Unit-2 for AIML including type of searches
Unit-2 for AIML including type of searchesUnit-2 for AIML including type of searches
Unit-2 for AIML including type of searches
SaranshGupta923104
Unit-2.2 Uninformed - Informed Searching.pptx
Unit-2.2 Uninformed - Informed Searching.pptxUnit-2.2 Uninformed - Informed Searching.pptx
Unit-2.2 Uninformed - Informed Searching.pptx
jagjeetsingh2022
BFS,DFS,Depth bound,Beam search,Iterative.pptx
BFS,DFS,Depth bound,Beam search,Iterative.pptxBFS,DFS,Depth bound,Beam search,Iterative.pptx
BFS,DFS,Depth bound,Beam search,Iterative.pptx
PriyadharshiniG41
Search strategies BFS, DFS
Search strategies BFS, DFSSearch strategies BFS, DFS
Search strategies BFS, DFS
Kuppusamy P
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
Anandhasilambarasan D
graphtraversals.pdf
graphtraversals.pdfgraphtraversals.pdf
graphtraversals.pdf
SeethaDinesh
Search strategies
Search strategiesSearch strategies
Search strategies
Shiwani Gupta
uninformed search part 2.pptx
uninformed search part 2.pptxuninformed search part 2.pptx
uninformed search part 2.pptx
MUZAMILALI48
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptxPPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
PPT ON INTRODUCTION TO AI- UNIT-1-PART-2.pptx
RaviKiranVarma4
Search in Algorithm in artificial intelligence
Search in Algorithm in artificial intelligenceSearch in Algorithm in artificial intelligence
Search in Algorithm in artificial intelligence
karimibaryal1996
Chap11 slides
Chap11 slidesChap11 slides
Chap11 slides
BaliThorat1
UNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITY
UNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITYUNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITY
UNIT II ARTIFICIQL INTELLIGENCE SEARCH STRATEGIES OSMANIA UNIVERSITY
PriyankaSeelaboyina
Unit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sUnit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution's
Harsha Patel
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptx
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptxAdhit_presentation_Searching_Algorithm(BFS,DFS).pptx
Adhit_presentation_Searching_Algorithm(BFS,DFS).pptx
SuryaBasnet3
Searching is the universal technique of problem solving in Artificial Intelli...
Searching is the universal technique of problem solving in Artificial Intelli...Searching is the universal technique of problem solving in Artificial Intelli...
Searching is the universal technique of problem solving in Artificial Intelli...
KarpagaPriya10
Uninformed Search technique
Uninformed Search techniqueUninformed Search technique
Uninformed Search technique
Kapil Dahal
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
GOKULKANNANMMECLECTC
Unit-2 for AIML including type of searches
Unit-2 for AIML including type of searchesUnit-2 for AIML including type of searches
Unit-2 for AIML including type of searches
SaranshGupta923104
Unit-2.2 Uninformed - Informed Searching.pptx
Unit-2.2 Uninformed - Informed Searching.pptxUnit-2.2 Uninformed - Informed Searching.pptx
Unit-2.2 Uninformed - Informed Searching.pptx
jagjeetsingh2022
BFS,DFS,Depth bound,Beam search,Iterative.pptx
BFS,DFS,Depth bound,Beam search,Iterative.pptxBFS,DFS,Depth bound,Beam search,Iterative.pptx
BFS,DFS,Depth bound,Beam search,Iterative.pptx
PriyadharshiniG41
Search strategies BFS, DFS
Search strategies BFS, DFSSearch strategies BFS, DFS
Search strategies BFS, DFS
Kuppusamy P
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
Anandhasilambarasan D
graphtraversals.pdf
graphtraversals.pdfgraphtraversals.pdf
graphtraversals.pdf
SeethaDinesh
Search strategies
Search strategiesSearch strategies
Search strategies
Shiwani Gupta

Recently uploaded (20)

UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptxUHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
arivazhaganrajangam
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
arivazhaganrajangam
Chapter 1- Introduction-chemical bonding.pptx
Chapter 1- Introduction-chemical bonding.pptxChapter 1- Introduction-chemical bonding.pptx
Chapter 1- Introduction-chemical bonding.pptx
venomalvi2
Mix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptxMix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptx
narayan311979
BSS_1_E1.2_ElectromobilityElectromobility.pdf
BSS_1_E1.2_ElectromobilityElectromobility.pdfBSS_1_E1.2_ElectromobilityElectromobility.pdf
BSS_1_E1.2_ElectromobilityElectromobility.pdf
jungdan064
Petrochemical-Processes-Handbook and PE.pdf
Petrochemical-Processes-Handbook and PE.pdfPetrochemical-Processes-Handbook and PE.pdf
Petrochemical-Processes-Handbook and PE.pdf
MustafaAhsan7
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo
Transformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptxTransformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptx
GetahunShankoKefeni
BCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdfBCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdf
VENKATESHBHAT25
CS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdfCS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdf
Naiyan Noor
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptxMODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
Alvas Institute of Engineering and technology, Moodabidri
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
adityaprakashme26
Kamal 2, new features and practical examples
Kamal 2, new features and practical examplesKamal 2, new features and practical examples
Kamal 2, new features and practical examples
Igor Aleksandrov
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Long Vo
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
Guru Nanak Technical Institutions
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Ba誰na
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
Guru Nanak Technical Institutions
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-8-2025 FINAL ver4...
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-8-2025 FINAL ver4...YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-8-2025 FINAL ver4...
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-8-2025 FINAL ver4...
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
Smart wearable device for for health monitering
Smart wearable device for for health moniteringSmart wearable device for for health monitering
Smart wearable device for for health monitering
Venky1435
Mastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdfMastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdf
Brion Mario
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptxUHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
UHV UNIT-3 HARMONY IN THE FAMILY AND SOCIETY.pptx
arivazhaganrajangam
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...UHV UNIT-5  IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
UHV UNIT-5 IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON P...
arivazhaganrajangam
Chapter 1- Introduction-chemical bonding.pptx
Chapter 1- Introduction-chemical bonding.pptxChapter 1- Introduction-chemical bonding.pptx
Chapter 1- Introduction-chemical bonding.pptx
venomalvi2
Mix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptxMix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptx
narayan311979
BSS_1_E1.2_ElectromobilityElectromobility.pdf
BSS_1_E1.2_ElectromobilityElectromobility.pdfBSS_1_E1.2_ElectromobilityElectromobility.pdf
BSS_1_E1.2_ElectromobilityElectromobility.pdf
jungdan064
Petrochemical-Processes-Handbook and PE.pdf
Petrochemical-Processes-Handbook and PE.pdfPetrochemical-Processes-Handbook and PE.pdf
Petrochemical-Processes-Handbook and PE.pdf
MustafaAhsan7
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo
Transformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptxTransformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptx
GetahunShankoKefeni
BCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdfBCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdf
VENKATESHBHAT25
CS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdfCS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdf
Naiyan Noor
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
adityaprakashme26
Kamal 2, new features and practical examples
Kamal 2, new features and practical examplesKamal 2, new features and practical examples
Kamal 2, new features and practical examples
Igor Aleksandrov
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Artificial Neural Network to Identify Verical Fractured Wells Flow Period (Lo...
Long Vo
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Baina NISS 2025 invited speach about Ethical Considerations for Respons...
Karim Ba誰na
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
Guru Nanak Technical Institutions
Smart wearable device for for health monitering
Smart wearable device for for health moniteringSmart wearable device for for health monitering
Smart wearable device for for health monitering
Venky1435
Mastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdfMastering Secure Login Mechanisms for React Apps.pdf
Mastering Secure Login Mechanisms for React Apps.pdf
Brion Mario

Problem Solving through Search - Uninformed Search

  • 2. Uninformed Search Strategies An uninformed search algorithm is one where there is no clue about how close a state is to the goal(s). Egs: Breadth First Search, Depth First Search, Uniform Cost Search
  • 3. Breadth First Search Breadth-first search (BFS) is a technique for traversing a finite graph or a tree to search a node that meets a set of criteria. When all actions have the same cost, then the appropriate strategy is breadth-first search The root node is expanded first, then all the successors of the root node are expanded next, then their successors, and so on.
  • 4. Steps to implement BFS Traversal Step 1: Define a Queue of size total number of vertices in the graph. Step 2: Select any vertex as starting point for traversal. Visit that vertex and insert it into the Queue. Step 3: Visit all the adjacent vertices of the vertex which is at front of the Queue which is not visited and insert them into the Queue. Step 4: When there is no new vertex to be visited from the vertex at front of the Queue then delete that vertex from the Queue. Step 5: Repeat step 3 and 4 until queue becomes empty. Step 6: When queue becomes Empty, then produce final spanning tree by removing unused edges from the graph
  • 10. BFS EXAMPLE : GRAPH
  • 11. BFS EXAMPLE : GRAPH
  • 12. BFS EXAMPLE : GRAPH
  • 13. BFS EXAMPLE : GRAPH
  • 14. BFS EXAMPLE : GRAPH
  • 15. BFS Binary Tree
  • 16. BFS Advantages Breadth first search will always find the shortest path first Breadth-first search always finds a solution with a minimal number of actions, because when it is generating nodes at depth d, it has already generated all the nodes at depth d -1 so if one of them were a solution, it would have been found The solution which is found is always the optimal solution.
  • 17. It can be very memory intensive since it needs to keep track of all the nodes in the search graph/tree. It can be slow since it expands all the nodes at each level before moving on to the next level. BFS works better when a user searches for the vertices(goal state) that stay closer to any given source(initial state) BFS Disadvantages
  • 18. Depth First Search Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures The algorithm starts at the root node and explores as far as possible along each branch before backtracking. Depth-first search always expands the deepest node of any particular path before exploring its breadth DFS traversal of a graph, produces a spanning tree as final result.
  • 19. Steps to implement DFS Traversal Step 1: Define a Stack of size total number of vertices in the graph. Step 2: Select any vertex as starting point for traversal. Visit that vertex and push it on to the Stack. Step 3: Visit any one of the adjacent vertex of the vertex which is at top of the stack which is not visited and push it on to the stack. Step 4: Repeat step 3 until there are no new vertex to be visited from the vertex on top of the stack. Step 5: When there is no new vertex to be visited then use back tracking and pop one vertex from the stack. Step 6: Repeat steps 3, 4 and 5 until stack becomes Empty. Step 7: When stack becomes Empty, then produce final spanning tree by removing unused edges from the graph
  • 20. DFS EXAMPLE - GRAPH
  • 21. DFS EXAMPLE - GRAPH
  • 22. DFS EXAMPLE - GRAPH
  • 23. DFS EXAMPLE - GRAPH
  • 24. DFS EXAMPLE - GRAPH
  • 25. DFS EXAMPLE - GRAPH
  • 26. DFS EXAMPLE - GRAPH
  • 27. DFS EXAMPLE - GRAPH
  • 28. DFS EXAMPLE - GRAPH
  • 29. DFS EXAMPLE - GRAPH
  • 30. DFS EXAMPLE - GRAPH
  • 31. DFS EXAMPLE - GRAPH
  • 32. DFS Binary Tree
  • 33. DFS Advantages Requires less memory since it only stores stack of nodes on the path from root node to current node. It can find solution without examining much search space and stop once found. Takes less time to reach goal node than BFS algorithm.
  • 34. DFS Disadvantages The disadvantage of Depth-First Search is that there is a possibility that it may go down the left-most path forever(indefinitely in a cycle) Depth-First Search is not guaranteed to find the solution. And there is no guarantee to find a minimal solution, if more than one solution.
  • 35. Comparison Breadth first search will always find the solution in the shortest path BFS does not require backtracking Consumes more resources DFS requires less memory since only the nodes on the current path are stored. By chance, DFS may find a solution without examining much of the search space at all. Since DFS moves blindly down one path, looping (cycles) is a SERIOUS problem
  • 36. Uniform Cost Search Uniform-cost search is a searching algorithm used for traversing a weighted tree or graph (Dijkstra's algorithm) This algorithm comes into play when a different cost is available for each edge The primary goal is to find a path to the goal node which has the lowest cumulative cost Uniform-cost search expands nodes according to their path costs from the root node g(n) = cost from root to n It gives maximum priority to the lowest cumulative cost Strategy: expand lowest g(n) A uniform-cost search algorithm is implemented by the priority queue
  • 37. Uniform Cost Search Algorithm Characteristics Advantages: Uniform cost search is optimal because at every state the path with the least cost is chosen Disadvantages: It does not care about the number of steps involved in searching and only concerned about path cost Due to which this algorithm may be stuck in an infinite loop
  • 47. Bidirectional search The bidirectional search simultaneously searches forward from the initial state and backwards from the goal state(s), hoping that the two searches will meet Bidirectional search replaces one single search graph with two small sub graphs(one starts the search from an initial vertex and other starts from goal vertex) Bidirectional search can use search techniques such as BFS, DFS We can consider bidirectional approach when Both initial and goal states are unique and completely defined The branching factor is exactly the same in both directions
  • 48. Bidirectional search To find if there exists a path from vertex 0 to vertex 14 We can execute two searches, one from vertex 0 and other from vertex 14. When both forward and backward search meet at vertex 7, we know that we have found a path from node 0 to 14 The search can be terminated now without further exploration