graph LR A("main.cpp") --- H("hadlock.hpp\n(571 lines)") B("tests.cpp") --- H C("utils.cpp") --- H D("algos.cpp") --- H H --- E("Compiler\nRepeats Work") style A fill:#e3f2fd,stroke:#1565c0 style B fill:#e3f2fd,stroke:#1565c0 style C fill:#e3f2fd,stroke:#1565c0 style D fill:#e3f2fd,stroke:#1565c0 style H fill:#ffcdd2,stroke:#c62828,stroke-width:3px style E fill:#f44336,stroke:#b71c1c,stroke-width:3px
graph LR subgraph Before["Before: Header-Only"] HPP["include/*.hpp\n(all code in headers)"] end subgraph After["After: Static Library"] HPP2["include/*.hpp\n(declarations only)"] CPP["source/*.cpp\n(implementations)"] LIB["libXNetwork.a\n(compiled once)"] end Before -- "Phase 1: >60 lines" --> After After -- "Phase 2: >40 lines" --> After After -- "Phase 3: >20 lines" --> After style Before fill:#e3f2fd style After fill:#e8f5e9 style HPP fill:#ffcdd2,stroke:#c62828 style HPP2 fill:#bbdefb,stroke:#1565c0 style CPP fill:#bbdefb,stroke:#1565c0 style LIB fill:#4caf50,stroke:#2e7d32
graph TD LIB["libXNetwork.a"] --> P2C["Py2Cpp"] LIB --> FMT["fmt"] TEST["test_xnetwork.exe"] --> LIB TEST --> DOCTEST["doctest"] style LIB fill:#4caf50,stroke:#2e7d32 style TEST fill:#2196f3,stroke:#1565c0 style P2C fill:#ff9800 style FMT fill:#ff9800 style DOCTEST fill:#ff9800
graph TD subgraph Moved["Moved to .cpp (13 functions)"] BC["biconnected_components"] CC["_construct_cycle"] BFS["_generic_bfs_cycle"] EM["exact_mwpm"] MIS["min_maximal_independant_set"] RCT["rand_vertex_cover_trial"] MVC["min_vertex_cover"] MOCC["min_odd_cycle_cover"] MVCF["min_vertex_cover_fast"] RCM["rand_vertex_cover_mt"] DJ["dijkstra"] GM["greedy_mwpm"] H["hierholzer"] end subgraph Stay["Stay in Header (7 functions)"] PD["pd_cover"] SHC["solve_hadlock_component"] SHM["solve_hadlock_max_cut"] VMC["validate_max_cut"] PM["prim_mst"] GMW["greedy_min_weight_matching"] CT["christofides_tsp"] end style Moved fill:#e8f5e9,stroke:#2e7d32 style Stay fill:#fff9c4,stroke:#f9a825 style PD fill:#fff9c4 style SHC fill:#fff9c4 style SHM fill:#fff9c4 style VMC fill:#fff9c4 style PM fill:#fff9c4 style GMW fill:#fff9c4 style CT fill:#fff9c4
graph LR subgraph Before["Before (Header-Only)"] H1["include/*.hpp\n57 KB, ~3500 lines"] end subgraph After["After (Static Library)"] H2["include/*.hpp\n(declarations only)"] C1["source/*.cpp\n~600 lines of implementations"] L1["libXNetwork.a\n(compiled once)"] end Before -- "13 functions\nmoved to .cpp" --> After style Before fill:#ffcdd2,stroke:#c62828 style After fill:#c8e6c9,stroke:#2e7d32 style H1 fill:#ffcdd2 style H2 fill:#bbdefb style C1 fill:#bbdefb style L1 fill:#4caf50
graph TD A("1. Add source/*.cpp to build") --> B("2. Create dummy.cpp") B --> C("3. Move functions >60 lines") C --> D("4. Move functions >40 lines") D --> E("5. Move functions >20 lines") E --> F("6. Add explicit instantiations") F --> G("7. Remove dummy.cpp") G --> H("8. Build + Test on both systems") style A fill:#e3f2fd style B fill:#bbdefb style C fill:#fff9c4 style D fill:#fff9c4 style E fill:#fff9c4 style F fill:#e8f5e9 style G fill:#fce4ec style H fill:#4caf50,stroke:#2e7d32,stroke-width:3px