# holosion/ai_search architecture

> Architecture diagram of the GitHub repository holosion/ai_search, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/holosion/ai_search
- Repository: https://github.com/holosion/ai_search
- Video tour (about a minute): https://gitdiagram.com/holosion/ai_search/video

## Overview

This repository is a collection of standalone AI search and constraint-satisfaction examples, not a unified application. The common user workflow is to provide a maze or graph (or an optimization/CSP setup), run an algorithm, and inspect a path, solution, or search result. The graph keeps those independent examples separate; sampled files support the BFS, DFS, A*, greedy, uniform-cost, hill-climbing, and backtracking details. Other listed algorithms are represented at their tree-supported paths, without inferring their internal wiring.

Main entry points: [`CSP/backtracking.py`](https://github.com/holosion/ai_search/blob/main/CSP/backtracking.py) (Backtracking CSP), [`Breadth_First_Search/breadth_first.py`](https://github.com/holosion/ai_search/blob/main/Breadth_First_Search/breadth_first.py) (Breadth-first search), [`Depth_First_Search/depth.py`](https://github.com/holosion/ai_search/blob/main/Depth_First_Search/depth.py) (Depth-first search), [`General_Search/search2.py`](https://github.com/holosion/ai_search/blob/main/General_Search/search2.py) (General maze DFS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_maze["Maze Search"]
  node_bfs["Breadth-first search<br/>[breadth_first.py]"]
  node_dfs["Depth-first search<br/>[depth.py]"]
  node_general_dfs["General maze DFS<br/>[search2.py]"]
  node_dls["Depth-limited search<br/>[depth_limit.py]"]
end

subgraph group_graph["Graph Search"]
  node_astar["A* search<br/>[A.py]"]
  node_astar_alt["A* variant<br/>[A_search.py]"]
  node_greedy["Greedy best-first<br/>[greedy.py]"]
  node_ucs["Uniform-cost search<br/>[uniform.py]"]
end

subgraph group_optimization["Optimization"]
  node_hill["Hill climbing<br/>[hillclimbing.py]"]
end

subgraph group_csp["Constraint Satisfaction"]
  node_backtracking["Backtracking CSP<br/>[backtracking.py]"]
  node_forward["Forward-checking CSP"]
end

node_user(("Algorithm user"))
node_constraint_lib["Constraint package"]
node_path_result["Path result"]
node_optimization_result["Best state"]
node_csp_result["Assignments"]

node_user -->|"runs maze search"| node_bfs
node_bfs -->|"returns shortest path"| node_path_result
node_user -->|"runs maze search"| node_dfs
node_dfs -->|"returns path"| node_path_result
node_user -->|"runs maze search"| node_general_dfs
node_general_dfs -->|"returns path"| node_path_result
node_user -->|"sets graph and limit"| node_dls
node_dls -->|"returns path"| node_path_result
node_user -->|"supplies graph and heuristic"| node_astar
node_astar -->|"returns path"| node_path_result
node_user -->|"supplies graph and heuristic"| node_astar_alt
node_astar_alt -->|"returns path"| node_path_result
node_user -->|"supplies graph and heuristic"| node_greedy
node_greedy -->|"returns path"| node_path_result
node_user -->|"supplies weighted graph"| node_ucs
node_ucs -->|"returns cost"| node_path_result
node_user -->|"sets objective and start"| node_hill
node_hill -->|"returns state and value"| node_optimization_result
node_user -->|"defines variables and constraints"| node_backtracking
node_backtracking -->|"calls solver"| node_constraint_lib
node_backtracking -->|"prints solutions"| node_csp_result
node_user -->|"runs CSP example"| node_forward

click node_bfs "https://github.com/holosion/ai_search/blob/main/Breadth_First_Search/breadth_first.py"
click node_dfs "https://github.com/holosion/ai_search/blob/main/Depth_First_Search/depth.py"
click node_general_dfs "https://github.com/holosion/ai_search/blob/main/General_Search/search2.py"
click node_dls "https://github.com/holosion/ai_search/blob/main/Depth_First_Search/depth_limit.py"
click node_astar "https://github.com/holosion/ai_search/blob/main/A%20star%20search/A.py"
click node_astar_alt "https://github.com/holosion/ai_search/blob/main/Other_Search_Algorithms/A_search.py"
click node_greedy "https://github.com/holosion/ai_search/blob/main/gready_best_search/greedy.py"
click node_ucs "https://github.com/holosion/ai_search/blob/main/uniformcostsearch/uniform.py"
click node_hill "https://github.com/holosion/ai_search/blob/main/hillclimbing.py"
click node_backtracking "https://github.com/holosion/ai_search/blob/main/CSP/backtracking.py"
click node_forward "https://github.com/holosion/ai_search/blob/main/CSP/forward_checking.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bfs,node_dfs,node_general_dfs,node_dls,node_user toneBlue
class node_astar,node_astar_alt,node_greedy,node_ucs toneAmber
class node_hill toneMint
class node_backtracking,node_forward toneRose
class node_constraint_lib,node_path_result,node_optimization_result,node_csp_result toneIndigo
```

## Components

### Maze Search

- [Breadth-first search](https://github.com/holosion/ai_search/blob/main/Breadth_First_Search/breadth_first.py): `Breadth_First_Search/breadth_first.py`
- [Depth-first search](https://github.com/holosion/ai_search/blob/main/Depth_First_Search/depth.py): `Depth_First_Search/depth.py`
- [General maze DFS](https://github.com/holosion/ai_search/blob/main/General_Search/search2.py): `General_Search/search2.py`
- [Depth-limited search](https://github.com/holosion/ai_search/blob/main/Depth_First_Search/depth_limit.py): `Depth_First_Search/depth_limit.py`

### Graph Search

- [A* search](https://github.com/holosion/ai_search/blob/main/A%20star%20search/A.py): `A star search/A.py`
- [A* variant](https://github.com/holosion/ai_search/blob/main/Other_Search_Algorithms/A_search.py): `Other_Search_Algorithms/A_search.py`
- [Greedy best-first](https://github.com/holosion/ai_search/blob/main/gready_best_search/greedy.py): `gready_best_search/greedy.py`
- [Uniform-cost search](https://github.com/holosion/ai_search/blob/main/uniformcostsearch/uniform.py): `uniformcostsearch/uniform.py`

### Optimization

- [Hill climbing](https://github.com/holosion/ai_search/blob/main/hillclimbing.py): `hillclimbing.py`

### Constraint Satisfaction

- [Backtracking CSP](https://github.com/holosion/ai_search/blob/main/CSP/backtracking.py): `CSP/backtracking.py`
- [Forward-checking CSP](https://github.com/holosion/ai_search/blob/main/CSP/forward_checking.py): `CSP/forward_checking.py`

### Other components

- **Algorithm user**
- **Constraint package**
- **Path result**
- **Best state**
- **Assignments**

## Connections

- Algorithm user → Breadth-first search: runs maze search
- Breadth-first search → Path result: returns shortest path
- Algorithm user → Depth-first search: runs maze search
- Depth-first search → Path result: returns path
- Algorithm user → General maze DFS: runs maze search
- General maze DFS → Path result: returns path
- Algorithm user → Depth-limited search: sets graph and limit
- Depth-limited search → Path result: returns path
- Algorithm user → A* search: supplies graph and heuristic
- A* search → Path result: returns path
- Algorithm user → A* variant: supplies graph and heuristic
- A* variant → Path result: returns path
- Algorithm user → Greedy best-first: supplies graph and heuristic
- Greedy best-first → Path result: returns path
- Algorithm user → Uniform-cost search: supplies weighted graph
- Uniform-cost search → Path result: returns cost
- Algorithm user → Hill climbing: sets objective and start
- Hill climbing → Best state: returns state and value
- Algorithm user → Backtracking CSP: defines variables and constraints
- Backtracking CSP → Constraint package: calls solver
- Backtracking CSP → Assignments: prints solutions
- Algorithm user → Forward-checking CSP: runs CSP example
