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,stroke-width:3px style B fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style C fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style D fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style H fill:#ffcdd2,stroke:#c62828,stroke-width:3px style E fill:#ffcdd2,stroke:#c62828,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,stroke:#1565c0,stroke-width:3px style After fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px style HPP fill:#ffcdd2,stroke:#c62828,stroke-width:3px style HPP2 fill:#bbdefb,stroke:#01579b,stroke-width:3px style CPP fill:#bbdefb,stroke:#01579b,stroke-width:3px style LIB fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
graph TD LIB["libXNetwork.a"] --> P2C["Py2Cpp"] LIB --> FMT["fmt"] TEST["test_xnetwork.exe"] --> LIB TEST --> DOCTEST["doctest"] style LIB fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style TEST fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style P2C fill:#fff3e0,stroke:#e65100,stroke-width:3px style FMT fill:#fff3e0,stroke:#e65100,stroke-width:3px style DOCTEST fill:#fff3e0,stroke:#e65100,stroke-width:3px
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,stroke-width:3px style Stay fill:#fff9c4,stroke:#f57f17,stroke-width:3px style PD fill:#fff9c4,stroke:#f57f17,stroke-width:3px style SHC fill:#fff9c4,stroke:#f57f17,stroke-width:3px style SHM fill:#fff9c4,stroke:#f57f17,stroke-width:3px style VMC fill:#fff9c4,stroke:#f57f17,stroke-width:3px style PM fill:#fff9c4,stroke:#f57f17,stroke-width:3px style GMW fill:#fff9c4,stroke:#f57f17,stroke-width:3px style CT fill:#fff9c4,stroke:#f57f17,stroke-width:3px
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,stroke-width:3px style After fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style H1 fill:#ffcdd2,stroke:#c62828,stroke-width:3px style H2 fill:#bbdefb,stroke:#01579b,stroke-width:3px style C1 fill:#bbdefb,stroke:#01579b,stroke-width:3px style L1 fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
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,stroke:#1565c0,stroke-width:3px style B fill:#bbdefb,stroke:#01579b,stroke-width:3px style C fill:#fff9c4,stroke:#f57f17,stroke-width:3px style D fill:#fff9c4,stroke:#f57f17,stroke-width:3px style E fill:#fff9c4,stroke:#f57f17,stroke-width:3px style F fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px style G fill:#fce4ec,stroke:#ad1457,stroke-width:3px style H fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px