# infonetlijian/fidelity-guaranteed-entanglement-routing architecture

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

- Interactive diagram: https://gitdiagram.com/infonetlijian/fidelity-guaranteed-entanglement-routing
- Repository: https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing

## Overview

##### Project Type & Purpose
- This project is a simulation framework designed for evaluating and comparing quantum network routing algorithms – specifically Q-PATH and Q-LEAP – as described in the referenced IEEE publication.
- The simulations cover multiple scenarios (single versus multiple source-destination pairs; fidelity thresholds versus channel capacity) and are implemented in Python, focused purely on algorithmic simulations of quantum networking.

##### Analyzing the File Structure
- Top-level Files: You have several data output files (e.g., “4SDpairs_record.txt”, “Multiple_SDPairs_vs_Fidelity_Threshold.txt”) used for storing simulation results, a LICENSE file, and the README.
- The src Directory: This contains the entirety of the simulation’s codebase. Within src, you see:
- Entry/Simulation Control: “simulation.py” acts as the simulation driver.
- Algorithm Implementations: Files like “qpath.py”, “qleap.py”, “dijkstra alg.py”, “hopspf.py”, “spfa.py”, etc. These implement the core routing algorithms, cost computations, and path-finding techniques.
- Topology and Network Management: Modules such as “network.py”, “vlink.py”, “vtopology.py”, and “updatetopo.py” indicate that the project encapsulates network topology generation and updating routines.
- Auxiliary Tools: Scripts like “paint.py”, “creattable.py”, and “patharrange.py” suggest utilities for visualizing or processing simulation data.
- Experiment/Test Scripts: A series of “t1.py” to “t6.py” and “test.py” which might be used for specific algorithm tests or experimental setups.

a. Main Components:
- Simulation Engine: Centered around the simulation.py script which orchestrates the entire experiment.
- Routing Algorithm Modules: Separate components or modules for each algorithm such as Q-PATH (qpath.py, and possibly support modules like dijkstra alg.py) and Q-LEAP (qleap.py), along with alternative algorithms (e.g., hopspf, spfa, mqleap, mqpath).
- Network Topology Manager: Components including network.py, vlink.py, and vtopology.py, which manage network construction/updating and node/edge definitions.
- Data Processing & Utility Modules: Tools like creattable.py, paint.py, patharrange.py that handle simulation visualization, result tabulation, and intermediate data formatting.
- Experiment/Scenario Handlers: Scripts (t1.py to t6.py) that likely encapsulate different experiment scenarios (simulations varying parameters like capacity, fidelity, number of S-D pairs).

b. Relationships & Interactions:
- The Simulation Engine is the entry point; it calls routines in both the Routing Algorithm Modules and the Network Topology Manager to set up and execute experiments.
- Data flows from simulation input (possibly reading configuration, network topology data, etc.), through the routing algorithm computations, to the output-result modules (which write data files).
- Auxiliary components such as visualization or table generation utilities are triggered either during or after simulation runs.

c. Architectural Patterns/Design Principles:
- Modular design: Components are clearly separated by function (simulation control, algorithm processing, network handling, utilities).
- Reusability and separation of concerns: Different scripts handle different simulation scenarios and routing strategies, allowing for straightforward extension or modification.

d. Relevant Technologies & Frameworks:
- Python is the primary language.
- Core algorithms (such as variations of Dijkstra, SPFA, etc.) indicate reliance on classical computational geometry/graph theory techniques.
- The experiment components and data output reflect simulation-based research common in network science.

##### Instructing the Principal Software Engineer
- Clear Labels: Name each module or component (e.g., “Simulation Engine (simulation.py)”, “Q-PATH Algorithm (qpath.py + support modules)”, “Network Topology Manager (network.py, vtopology.py)”).
- Detail Important Interfaces: Show how simulation.py interacts with both the algorithm modules and network managers. Highlight any utility paths or experiment-specific scripts that funnel into the main simulation engine.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Simulation Layer
    subgraph "Simulation Layer"
        simEngine["Simulation Engine (simulation.py)"]
    end

    %% Routing Algorithm Modules
    subgraph "Routing Algorithm Modules"
        subgraph "Q-PATH Module"
            qpathMain["Q-PATH Algorithm (qpath.py)"]
            dijkstra["Dijkstra Support (dijkstra alg.py)"]
            extendD["Extend Dijkstra (extenddijkstra.py)"]
            qpathMain -->|"uses"| dijkstra
            qpathMain -->|"uses"| extendD
        end
        subgraph "Q-LEAP Module"
            qleap["Q-LEAP Algorithm (qleap.py)"]
        end
        subgraph "Alternative Algorithms"
            subgraph "Hop-based SPF"
                hopspf["HopSPF (hopspf.py)"]
                mhopspf["Modified HopSPF (mhopspf.py)"]
                hopspf -->|"enhances"| mhopspf
            end
            subgraph "SPFA Variants"
                spfa["SPFA (spfa.py)"]
                spfmincost["SPF MinCost (spfmincost.py)"]
                spfsearch["SPF Search (spfsearch.py)"]
                spfa -->|"optimizes"| spfmincost
                spfa -->|"searches"| spfsearch
            end
            subgraph "MQLEAP & MQPATH"
                mqleap["MQLEAP (mqleap.py)"]
                mqpath["MQPATH (mqpath.py)"]
            end
        end
    end

    %% Network Topology Manager
    subgraph "Network Topology Manager"
        network["Core Network (network.py)"]
        virtual["Virtual Link & Topology (vlink.py, vtopology.py)"]
        updatet["Topology Update (updatetopo.py)"]
    end

    %% Data Processing & Utilities
    subgraph "Data Processing & Utilities"
        creattable["Table Creation (creattable.py)"]
        paint["Visualization/Plotting (paint.py)"]
        patharrange["Path Arrangement (patharrange.py)"]
    end

    %% Experiment Scenarios
    subgraph "Experiment Scenarios"
        t1["Test Scenario (t1.py)"]
        t2["Test Scenario (t2.py)"]
        t3["Test Scenario (t3.py)"]
        t4["Test Scenario (t4.py)"]
        t5["Test Scenario (t5.py)"]
        t6["Test Scenario (t6.py)"]
        test["General Test (test.py)"]
    end

    %% Data Output
    result(("Result Data (Simulation Output Files)"))

    %% Relationships from Simulation Engine to other modules
    simEngine -->|"SetsUp"| network
    simEngine -->|"SetsUp"| virtual
    simEngine -->|"Updates"| updatet
    simEngine -->|"Invokes"| qpathMain
    simEngine -->|"Invokes"| qleap
    simEngine -->|"Invokes"| hopspf
    simEngine -->|"Invokes"| spfa
    simEngine -->|"Invokes"| mqleap

    %% Additional dependency: Network provides topology for algorithms
    network -->|"ProvidesTopo"| qpathMain
    virtual -->|"DefinesLinks"| qleap

    %% Algorithm Modules output results
    qpathMain -->|"Outputs"| result
    qleap -->|"Outputs"| result
    hopspf -->|"Outputs"| result
    mhopspf -->|"Outputs"| result
    spfa -->|"Outputs"| result
    spfmincost -->|"Outputs"| result
    spfsearch -->|"Outputs"| result
    mqleap -->|"Outputs"| result
    mqpath -->|"Outputs"| result

    %% Simulation Engine triggers utilities
    simEngine -->|"Triggers"| creattable
    simEngine -->|"Triggers"| paint
    simEngine -->|"Triggers"| patharrange

    %% Experiment scenarios feed into Simulation Engine
    t1 -->|"Tests"| simEngine
    t2 -->|"Tests"| simEngine
    t3 -->|"Tests"| simEngine
    t4 -->|"Tests"| simEngine
    t5 -->|"Tests"| simEngine
    t6 -->|"Tests"| simEngine
    test -->|"Tests"| simEngine

    %% Topology Update interacts with Core Network
    updatet -->|"Modifies"| network

    %% Styles
    class simEngine simulation;
    class qpathMain,dijkstra,extendD,qleap,hopspf,mhopspf,spfa,spfmincost,spfsearch,mqleap,mqpath algorithm;
    class network,virtual,updatet topology;
    class creattable,paint,patharrange utility;
    class t1,t2,t3,t4,t5,t6,test experimental;
    class result data;

    classDef simulation fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef algorithm fill:#D5F5E3,stroke:#145A32,stroke-width:2px;
    classDef topology fill:#FCF3CF,stroke:#B7950B,stroke-width:2px;
    classDef utility fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef experimental fill:#FADBD8,stroke:#CB4335,stroke-width:2px;
    classDef data fill:#F5CBA7,stroke:#935116,stroke-width:2px;

    %% Click Events
    click simEngine "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/simulation.py"
    click qpathMain "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/qpath.py"
    click dijkstra "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/dijkstra alg.py"
    click extendD "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/extenddijkstra.py"
    click qleap "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/qleap.py"
    click hopspf "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/hopspf.py"
    click mhopspf "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/mhopspf.py"
    click spfa "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/spfa.py"
    click spfmincost "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/spfmincost.py"
    click spfsearch "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/spfsearch.py"
    click mqleap "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/mqleap.py"
    click mqpath "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/mqpath.py"
    click network "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/network.py"
    click virtual "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/vlink.py"
    click updatet "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/updatetopo.py"
    click creattable "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/creattable.py"
    click paint "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/paint.py"
    click patharrange "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/patharrange.py"
    click t1 "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/t1.py"
    click t2 "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/t2.py"
    click t3 "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/t3.py"
    click t4 "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/t4.py"
    click t5 "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/t5.py"
    click t6 "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/t6.py"
    click test "https://github.com/infonetlijian/fidelity-guaranteed-entanglement-routing/blob/main/src/test.py"
```
