# githubansh/metro__ architecture

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

- Interactive diagram: https://gitdiagram.com/githubansh/metro__
- Repository: https://github.com/githubansh/metro__

## Overview

##### Project type and purpose
- This is a standalone C++ command-line application for “Metro__ Route Planner.”
- It models the Delhi Metro network as a graph and uses Dijkstra’s algorithm to compute shortest routes.

##### File structure
- Everything lives at the top level—no separate “src” or “lib” folders.
- Data files: DATA.csv, matrix.txt, nodes.txt, stationnames.txt hold the raw graph representation.
- main.cpp contains CLI input parsing, graph construction, algorithm invocation, and result output.
- colorcodes.txt and _config.yml likely hold presentation settings or styling info for visualization.
- main.exe is the compiled binary (not part of the design but shows the build target).

##### README for additional insights
- Confirms use of adjacency lists, priority queues, and Dijkstra’s algorithm.
- Emphasizes performance optimization and real-time route planning.
- Mentions CLI as the user interface and that the graph is visualized (presumably by external tool or post-processing).

##### Elements
- Clear labels (e.g., “Data Loader,” “Graph Model,” “Dijkstra Engine”).
- From User → CLI Parser
- CLI Parser → Data Loader & Configuration Module
- Data Loader → Graph Model
- CLI Parser → Dijkstra Engine → Graph Model
- Dijkstra Engine → Output Renderer → User

##### Detail
- That the Graph Model holds nodes and adjacency lists in memory.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User (CLI)"]:::external

    %% Controller
    Parser["CLI Parser/Controller"]:::controller

    %% Configuration Module
    ConfigModule["Configuration/Styling Module"]:::config

    %% I/O Modules
    DataLoader["Data Loader"]:::io
    OutputRenderer["Output Renderer"]:::io

    %% Core Logic
    GraphModel["Graph Model"]:::core
    DijkstraEngine["Dijkstra Engine"]:::core

    %% External Data Files
    subgraph "Data Files"
        DATAcsv["DATA.csv"]:::external
        matrixTxt["matrix.txt"]:::external
        nodesTxt["nodes.txt"]:::external
        stationNames["stationnames.txt"]:::external
    end

    %% Flow
    User -->|"invokes"| Parser
    Parser -->|"loads config"| ConfigModule
    Parser -->|"calls loadData()"| DataLoader
    DataLoader -->|"reads CSV/TXT"| DATAcsv
    DataLoader -->|"reads CSV/TXT"| matrixTxt
    DataLoader -->|"reads CSV/TXT"| nodesTxt
    DataLoader -->|"reads CSV/TXT"| stationNames
    DataLoader -->|"builds adjacency lists"| GraphModel
    Parser -->|"requests shortest path"| DijkstraEngine
    DijkstraEngine -->|"queries graph"| GraphModel
    DijkstraEngine -->|"returns path"| OutputRenderer
    OutputRenderer -->|"displays result"| User
    ConfigModule -.->|"styling info"| DijkstraEngine

    %% Click Events
    click Parser "https://github.com/githubansh/metro__/blob/main/main.cpp"
    click DataLoader "https://github.com/githubansh/metro__/blob/main/main.cpp"
    click GraphModel "https://github.com/githubansh/metro__/blob/main/main.cpp"
    click DijkstraEngine "https://github.com/githubansh/metro__/blob/main/main.cpp"
    click OutputRenderer "https://github.com/githubansh/metro__/blob/main/main.cpp"
    click ConfigModule "https://github.com/githubansh/metro__/blob/main/_config.yml"
    click ConfigModule "https://github.com/githubansh/metro__/blob/main/colorcodes.txt"
    click DATAcsv "https://github.com/githubansh/metro__/blob/main/DATA.csv"
    click matrixTxt "https://github.com/githubansh/metro__/blob/main/matrix.txt"
    click nodesTxt "https://github.com/githubansh/metro__/blob/main/nodes.txt"
    click stationNames "https://github.com/githubansh/metro__/blob/main/stationnames.txt"

    %% Styles
    classDef io fill:#D6EAF8,stroke:#2980B9
    classDef core fill:#FADBD8,stroke:#C0392B
    classDef config fill:#D5F5E3,stroke:#27AE60
    classDef controller fill:#FCF3CF,stroke:#B7950B
    classDef external fill:#EAECEE,stroke:#ABB2B9
```
