How alu0100696691/algoritmosgrafos works
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").