Skip to content

A collection of search algorithm implementations, including DFS, BFS, UCS, and Best First Search, all written in Python. Perfect for engineers and computer science students looking to deepen their understanding of graph traversal techniques.

Notifications You must be signed in to change notification settings

hanisa1/SearchAlgorithmsInPython

Repository files navigation

Search Algorithms in Python 🌟

Search Algorithms

Welcome to the Search Algorithms in Python repository! This project contains various implementations of fundamental search algorithms, including Depth-First Search (DFS), Breadth-First Search (BFS), Uniform Cost Search (UCS), and Best First Search, all written in clean, simple Python without any external libraries.

This is useful to all those taking Introduction To Artificial Intelligence at UTS.

LinkedIn Article: LinkedIn Article Explaining Each Search Algorithm In Theory

Table of Contents

Introduction

Search algorithms are a fundamental aspect of computer science, playing a critical role in problem-solving across various domains. This repository offers a hands-on exploration of these algorithms, providing both theoretical insights and practical Python implementations.

Algorithms

Depth-First Search (DFS)

DFS is a search algorithm that explores a graph by starting at the root node and exploring as far as possible along each branch before backtracking.

  • Use Cases: Solving mazes, puzzle games, topological sorting.
  • Time Complexity: O(V + E)
  • Space Complexity: O(V)

Breadth-First Search (BFS)

BFS is a search algorithm that explores all the nodes at the present depth level before moving on to the nodes at the next depth level.

  • Use Cases: Finding the shortest path in unweighted graphs, web crawlers, social networking searches.
  • Time Complexity: O(V + E)
  • Space Complexity: O(V)

Uniform Cost Search (UCS)

UCS is an extension of BFS that considers the cost of the path, making it suitable for finding the lowest-cost path.

  • Use Cases: Route planning, AI decision-making, robotics navigation.
  • Time Complexity: O(V + E)
  • Space Complexity: O(V)

Best First Search

Best First Search uses a heuristic to determine the most promising path, balancing exploration and exploitation.

  • Use Cases: AI pathfinding (e.g., A*), puzzle solving, game AI.
  • Time Complexity: O(V + E)
  • Space Complexity: O(V)

Contributing

Contributions are welcome! Whether you're fixing bugs, improving documentation, or adding new features, feel free to submit a pull request.

License

This project is licensed under the MIT License

About

A collection of search algorithm implementations, including DFS, BFS, UCS, and Best First Search, all written in Python. Perfect for engineers and computer science students looking to deepen their understanding of graph traversal techniques.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages