# arminzolfaghari/searching-algorithms-ids-bbfs-astar architecture

> Architecture diagram of the GitHub repository arminzolfaghari/searching-algorithms-ids-bbfs-astar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar
- Repository: https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar

## Overview

##### Project type and purpose
- This is a standalone Python AI project (not a web or microservice application) that implements and compares three search algorithms—Iterative Deepening Search (IDS), Bidirectional Breadth-First Search (BBFS), and A*—to solve a simple path-finding puzzle. It provides both a command-line interface (CLI) and a graphical interface (GUI).

##### File structure
- Top-level scripts:
- main.py           – entry point, parses user choice (CLI vs. GUI) and algorithm selection
- GraphicalInterface.py – GUI layer (renders grid, handles user events)
- AStar.py, BidirectionalBreadthFirstSearch.py, IterativeDeepeningSearch.py – the three core search algorithms
- AdditionalFunctions.py – shared utilities (e.g., parsing input, heuristics)
- Node.py           – state representation for search nodes
- Data directories:
- input/            – test maps
- Assets/           – image/sprite assets for GUI
- result/           – output logs and result files
- Configuration/build: no external build system, pure Python modules.

##### README for insights
- Confirms purpose (push butter to plate optimally), describes invocation (main.py → choose algorithm), shows GUI screenshots, references PDF descriptions.

##### Main components & relationships
a. Components:
- User Interface Layer
– CLI handler (in main.py)
– GraphicalInterface (in GraphicalInterface.py)
- Core Logic Layer
– Search engines: IDS, BBFS, A* modules
– Shared utilities: AdditionalFunctions.py
– State model: Node.py
- Data Layer
– Input loader: reads map text files from input/
– Output writer: writes to result/
– Asset manager: loads images from Assets/
b. Interactions:
1. User → main.py (selects CLI or GUI + algorithm)
2. main.py → Data loader reads the selected input file
3. main.py (or GUI) initializes Node for start state
4. main.py (or GUI) invokes chosen search module, passing Node(s) and utility functions
5. Search module → AdditionalFunctions & Node for expansions, heuristics
6. Algorithm returns a path (sequence of moves)
7. main.py (or GUI) → directs result to console, result/*.txt, and/or GUI canvas
8. GUI layer visualizes moves using Assets
c. Architectural patterns & principles:
- Layered architecture separating UI, business logic (search algorithms), and data I/O
- Single-responsibility per module: each algorithm in its own file, Node encapsulates state, utilities separated
- Plug-and-play: adding a new search algorithm only requires dropping a new .py and hooking it in main.py
d. Key technologies/libraries:
- Python 3.x standard library (no external dependencies specified)
- Possibly Tkinter or Pygame (in GraphicalInterface.py)
- File I/O, text parsing for input maps

## Diagram (Mermaid)

```mermaid
graph TB
    %% External entity
    User[(User)]:::external

    %% UI Layer
    subgraph "UI Layer"
        CLI["CLI Handler\n(main.py)"]:::ui
        GUI["Graphical Interface\n(GraphicalInterface.py)"]:::ui
    end

    %% Core Logic Layer
    subgraph "Core Logic Layer"
        AStar["A* Module\n(AStar.py)"]:::core
        BBFS["Bidirectional BFS Module\n(BidirectionalBreadthFirstSearch.py)"]:::core
        IDS["Iterative Deepening Search Module\n(IterativeDeepeningSearch.py)"]:::core
        Utils["Shared Utilities\n(AdditionalFunctions.py)"]:::core
        Node["State Model\n(Node.py)"]:::core
    end

    %% Data Layer
    subgraph "Data Layer"
        In["Input Loader\n(input/)"]:::data
        Out["Output Writer\n(result/)"]:::data
        Assets["Asset Manager\n(Assets/)"]:::data
    end

    %% Connections
    User --> CLI
    User --> GUI

    CLI --> In
    GUI --> In

    CLI --> AStar
    CLI --> BBFS
    CLI --> IDS

    GUI --> AStar
    GUI --> BBFS
    GUI --> IDS

    AStar --> Utils
    AStar --> Node
    BBFS --> Utils
    BBFS --> Node
    IDS --> Utils
    IDS --> Node

    AStar --> Out
    BBFS --> Out
    IDS --> Out

    GUI --> Assets

    %% Click Events
    click CLI "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/blob/main/main.py"
    click GUI "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/blob/main/GraphicalInterface.py"
    click AStar "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/blob/main/AStar.py"
    click BBFS "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/blob/main/BidirectionalBreadthFirstSearch.py"
    click IDS "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/blob/main/IterativeDeepeningSearch.py"
    click Utils "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/blob/main/AdditionalFunctions.py"
    click Node "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/blob/main/Node.py"
    click In "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/tree/main/input/"
    click Out "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/tree/main/result/"
    click Assets "https://github.com/arminzolfaghari/searching-algorithms-ids-bbfs-astar/tree/main/Assets/"

    %% Styles
    classDef ui fill:#88bde6,stroke:#333,stroke-width:1px
    classDef core fill:#a2d39c,stroke:#333,stroke-width:1px
    classDef data fill:#f7c46b,stroke:#333,stroke-width:1px
    classDef external fill:#cccccc,stroke:#333,stroke-width:1px
```
