Learning paths / Artificial Intelligence / Uninformed Search: BFS, DFS, and Uniform-Cost Search

AI course contents

AI Foundations

  1. Artificial Intelligence: A Practical Learning Roadmap
  2. What Is Artificial Intelligence?
  3. A Short History of Artificial Intelligence
  4. Narrow AI, Artificial General Intelligence, and Superintelligence
  5. Reactive, Limited-Memory, and Other AI Categories
  6. Major Branches of Artificial Intelligence
  7. Applications of Artificial Intelligence
  8. Capabilities and Characteristics of AI Systems
  9. Benefits, Limitations, and Trade-Offs of AI
  10. AI Risks, Challenges, and Responsible Use
  11. Prerequisites for Learning AI

Agents, Search, and Knowledge

  1. Intelligent Agents and Environments
  2. Formulating AI Problems and State Spaces
  3. Uninformed Search: BFS, DFS, and Uniform-Cost Search
  4. Informed Search and Heuristic Functions
  5. Local Search and Optimization
  6. Game Trees, Minimax, and Alpha-Beta Pruning
  7. Knowledge Representation: Logic, Rules, and Ontologies
  8. Reasoning Under Uncertainty and Bayesian Inference
  9. Expert Systems and Rule-Based Inference

Machine Learning Foundations

  1. Machine Learning: A Core Branch of AI
  2. Supervised, Unsupervised, Semi-Supervised, and Self-Supervised Learning
  3. The Machine-Learning Workflow
  4. Data Quality, Features, and Preprocessing
  5. Training, Validation, and Test Sets
  6. Regression and Classification
  7. Confusion Matrices, Precision, Recall, F1, and ROC/PR Curves
  8. Overfitting, Underfitting, and Generalization
  9. Classical Machine-Learning Algorithms
  10. Clustering and Dimensionality Reduction

Deep Learning and Perception

  1. Artificial Neural Networks and Perceptrons
  2. Gradient Descent, Loss Functions, and Backpropagation
  3. Deep Learning: CNNs, RNNs, and Sequence Models
  4. Computer Vision: Classification, Detection, and Segmentation
  5. Natural Language Processing (NLP)
  6. Speech Recognition, Synthesis, and Audio AI
  7. AI in Robotics and Autonomous Systems

Generative AI and Language Models

  1. Generative AI and Foundation Models
  2. Transformers, Attention, and Embeddings
  3. Large Language Models (LLMs) and Token Prediction
  4. Prompt Design and Structured Outputs
  5. Retrieval-Augmented Generation (RAG)
  6. Fine-Tuning, Adapters, and Model Customization

Responsible AI and Practice

  1. Evaluating AI Products and Generative Models
  2. AI Security, Privacy, and Prompt-Injection Defense
  3. Fairness, Explainability, Documentation, and AI Governance
  4. Deploying and Monitoring AI Systems
  5. AI Tools, Cloud Services, GPUs, and Compute Choices
  6. AI in Healthcare, Finance, Education, and Industry
  7. Capstone: Design a Responsible AI Knowledge Assistant

Artificial intelligence • Original RRTutors lesson

Uninformed Search: BFS, DFS, and Uniform-Cost Search

Compare search strategies that use no estimate of distance to the goal.

Concept and explanation

Breadth-first search explores by depth and finds a fewest-step solution when all actions have equal cost. Depth-first search uses less frontier memory in some cases but can follow a long or infinite branch. Uniform-cost search expands the least-cost path so far and is suitable for non-negative variable action costs.

How to apply it

Choose the frontier structure from the objective: queue for BFS, stack for DFS, and priority queue for uniform cost.

Worked example

In a weighted road network, a route with fewer edges may cost more than a longer route, so BFS is not enough.

Illustrative Python example

from collections import deque

frontier = deque([start])
visited = {start}
while frontier:
    state = frontier.popleft()
    for neighbor in successors(state):
        if neighbor not in visited:
            visited.add(neighbor)
            frontier.append(neighbor)

Expected result

The queue explores nodes in nondecreasing depth when every edge has equal cost.

Limitations and cautions

Search completeness and optimality depend on branching, cycles, costs, and termination assumptions.

Practice exercise

Compare BFS and uniform-cost search on a graph with one expensive direct edge and a cheaper multi-edge path.

Key takeaway: Search guarantees come from the frontier policy and assumptions about the problem.