# alu0100696691/algoritmosgrafos architecture

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

- Interactive diagram: https://gitdiagram.com/alu0100696691/algoritmosgrafos
- Repository: https://github.com/alu0100696691/algoritmosgrafos

## Overview

##### Main Components
- Input/Parser Module: A component responsible for reading graph files (the G0.grf, G1.grf, etc.) and extracting node coordinates and the adjacency matrix.
- Graph Data Structure & Manager: A class (likely implemented in practica6.cpp/practica6.h) that encapsulates the graph’s properties (node lists, coordinate data, and adjacency list).
- Algorithm Modules: Components that implement:
- Depth-first search (DFS)
- Breadth-first search (BFS)
- Shortest path calculation (Dijkstra with heap-based priority queue)
- Minimum spanning tree calculation (Kruskal’s algorithm)
- Main Execution & UI: The main.cpp (along with main.exe) acts as the entry point, presenting a menu for selecting the algorithm based on user input and coordinating the flow between reading the file, constructing the graph, and running the chosen algorithm.

##### Relationships and Interactions
- Flow of Data: Start from Input -> Parser which feeds data into the Graph Data Structure. From here, the Graph module exports methods or data needed by each Algorithm Module.
- The Main Execution module coordinates these steps based on user choices from the menu.

##### Architectural Patterns and Design Principles
- Encapsulation of Graph Data: The project uses classes to hold graph data, promoting modularity and encapsulation.
- Separation of Concerns: Different files/modules are dedicated to different responsibilities — file reading, graph storage, and algorithm execution.
- Procedural Flow Controlled by a Menu: The main driver (main.cpp) directs control flow based on user input.

##### Technologies and Frameworks
- C++ as the primary language along with appropriate STL components (such as containers and potential heap implementations for Dijkstra).
- Custom file I/O logic for reading graph data in a specific format.

##### Specific Elements
- Clear Labels: Each module should be clearly labeled (e.g., "File Parser", "Graph Class", "DFS Module", "BFS Module", "Dijkstra Module", "Kruskal Module", "Main UI/Controller").

## Diagram (Mermaid)

```mermaid
flowchart TD
    GF["Graph Files (G0.grf, G1.grf, etc.)"]:::input
    FP["File Parser Module"]:::parser
    GD["Graph Data Structure & Manager"]:::data
    Main["Main Execution & UI"]:::control
    DFS["DFS Module"]:::algo
    BFS["BFS Module"]:::algo
    Dijk["Dijkstra Module"]:::algo
    Kruskal["Kruskal Module"]:::algo

    GF -->|"reads"| FP
    FP -->|"parses_data"| GD
    Main -->|"initiates_parsing"| FP
    GD -->|"provides_data"| DFS
    GD -->|"provides_data"| BFS
    GD -->|"provides_data"| Dijk
    GD -->|"provides_data"| Kruskal
    Main -->|"selects_DFS"| DFS
    Main -->|"selects_BFS"| BFS
    Main -->|"selects_Dijkstra"| Dijk
    Main -->|"selects_Kruskal"| Kruskal
    DFS -->|"returns_result"| Main
    BFS -->|"returns_result"| Main
    Dijk -->|"returns_result"| Main
    Kruskal -->|"returns_result"| Main

    click FP "https://github.com/alu0100696691/algoritmosgrafos/blob/master/practica6.cpp"
    click GD "https://github.com/alu0100696691/algoritmosgrafos/blob/master/practica6.h"
    click DFS "https://github.com/alu0100696691/algoritmosgrafos/blob/master/practica6.cpp"
    click BFS "https://github.com/alu0100696691/algoritmosgrafos/blob/master/practica6.cpp"
    click Dijk "https://github.com/alu0100696691/algoritmosgrafos/blob/master/practica6.cpp"
    click Kruskal "https://github.com/alu0100696691/algoritmosgrafos/blob/master/practica6.cpp"
    click Main "https://github.com/alu0100696691/algoritmosgrafos/blob/master/main.cpp"

    classDef input fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef parser fill:#98FB98,stroke:#333,stroke-width:2px;
    classDef data fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef algo fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef control fill:#DDA0DD,stroke:#333,stroke-width:2px;
```
