How habiba-imran/vertex-voyage-sfml-based-dsa-project works
Project Type and Purpose
• This is a standalone C++ desktop application (“VertexVoyage”) that visualizes the shortest path between Pakistani cities on a map using Dijkstra’s algorithm.
• Built on top of SFML for graphics, it provides a simple GUI for city selection, supports multiple stops, and renders the resulting path in real time.
File-Structure Analysis
• Top-level source files:
• main.cpp (GUI entry point, orchestrates input, graph calls, and rendering)
• inputbox.cpp/h (encapsulates user-input widgets and text matching)
• graph.cpp/h (implements graph data structures and Dijkstra’s algorithm)
• source.cpp (likely contains helper routines or additional UI logic)
• Data files:
• Secret.txt (stores weighted adjacency list – distances between cities)
• .jpg / Output-Image.jpg (background map for rendering)
• Docs:
• README.md (setup & usage)
• DSA PROJECT REPORT.docx (academic report)
Key Components
a. User Interface Layer
• InputBox Component: captures source, destination, and intermediate stops
• Event Handler (in main.cpp): dispatches UI events
• SFML Renderer: draws map background and path overlays
b. Algorithm Layer
• Graph Module:
• Graph Loader (reads Secret.txt into adjacency list/matrix)
• Dijkstra Engine (computes shortest path(s))
c. Data Layer
• Secret.txt (adjacency data)
• .jpg (visual asset)
d. External Dependencies
• SFML Libraries (Graphics, Window, System DLLs)
Interactions & Data Flow
1. Application Launch → main.cpp initializes SFML window
2. Graph Loader reads Secret.txt into Graph data structure
3. User enters cities via InputBox → Event Handler captures inputs
4. Event Handler invokes Dijkstra Engine with selected nodes
5. Dijkstra returns ordered list of coordinates (path)
6. SFML Renderer draws map.jpg, overlays path polyline, and updates screen
7. Loop back to step 3 for additional inputs or exit
Architectural Patterns & Principles
• Separation of Concerns:
• UI / InputBox
• Core Algorithm (Graph + Dijkstra)
• Rendering
• Data I/O
• Single Responsibility: each .cpp/.h pair has a distinct role
• Data-Driven: adjacency is loaded at runtime from external text file
Essential Elements
• Component names (InputBox, GraphLoader, Dijkstra Engine, SFML Renderer)
• Data files with clear labels (Secret.txt, map.jpg)