graph LR subgraph S["Set S"] A(("A")) B(("B")) end subgraph V_S["Set V \ S"] C(("C")) D(("D")) end A ===|"5 β"| C A -..-|"3 β"| D B ===|"7 β"| C B -..-|"2 β"| D linkStyle 0 stroke:#4caf50,stroke-width:3px linkStyle 1 stroke:#4caf50,stroke-width:3px linkStyle 2 stroke:#4caf50,stroke-width:3px linkStyle 3 stroke:#4caf50,stroke-width:3px style A fill:#e3f2fd,stroke:#1565c0 style B fill:#e3f2fd,stroke:#1565c0 style C fill:#fce4ec,stroke:#c62828 style D fill:#fce4ec,stroke:#c62828 style S fill:#e3f2fd,color:#1565c0 style V_S fill:#fce4ec,color:#c62828
graph LR subgraph Planar["β Planar"] K4(("Kβ")) end K4 --- 2(( )) K4 --- 3(( )) K4 --- 4(( )) 2 --- 3 2 --- 4 3 --- 4 style Planar fill:#e8f5e9,color:#2e7d32 style K4 fill:#c8e6c9,stroke:#2e7d32 style 2 fill:#c8e6c9,stroke:#2e7d32 style 3 fill:#c8e6c9,stroke:#2e7d32 style 4 fill:#c8e6c9,stroke:#2e7d32
graph LR subgraph NonPlanar["π« Non-Planar"] K5(("Kβ ")) end K5 --- B(( )) K5 --- C(( )) K5 --- D(( )) K5 --- E(( )) B --- C B --- D B --- E C --- D C --- E D --- E style NonPlanar fill:#fce4ec,color:#c62828 style K5 fill:#ffcdd2,stroke:#c62828 style B fill:#ffcdd2,stroke:#c62828 style C fill:#ffcdd2,stroke:#c62828 style D fill:#ffcdd2,stroke:#c62828 style E fill:#ffcdd2,stroke:#c62828
graph LR 0((0)) ---|"a"| 1((1)) 1 ---|"b"| 2((2)) 2 ---|"c"| 0 2 ---|"d"| 3((3)) 3 ---|"e"| 4((4)) 4 ---|"f"| 2 style 0 fill:#bbdefb,stroke:#1565c0 style 1 fill:#bbdefb,stroke:#1565c0 style 2 fill:#bbdefb,stroke:#1565c0 style 3 fill:#bbdefb,stroke:#1565c0 style 4 fill:#bbdefb,stroke:#1565c0 linkStyle 0 stroke:#1565c0,stroke-width:2px linkStyle 1 stroke:#1565c0,stroke-width:2px linkStyle 2 stroke:#1565c0,stroke-width:2px linkStyle 3 stroke:#1565c0,stroke-width:2px linkStyle 4 stroke:#1565c0,stroke-width:2px linkStyle 5 stroke:#1565c0,stroke-width:2px
flowchart LR A["1. Find Planar\nEmbedding"] --> B["2. Build Dual\nGraph"] B --> C["3. Identify\nOdd Faces"] C --> D["4. All-Pairs Shortest\nPaths in Dual"] style A fill:#e3f2fd,stroke:#1565c0 style B fill:#bbdefb,stroke:#1565c0 style C fill:#fff9c4,stroke:#f9a825 style D fill:#e8f5e9,stroke:#2e7d32
flowchart LR E["5. Complete Graph of\nOdd Faces + MWPM"] --> F["6. Excluded Edges\n from Matching Paths"] F --> G["7. Max Cut = All Edges\n setminus Excluded"] style E fill:#fce4ec,stroke:#c62828 style F fill:#f3e5f5,stroke:#7b1fa2 style G fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px
graph TD subgraph Primal["Primal Graph"] 1((1)) --- 2((2)) 2 --- 3((3)) 3 --- 4((4)) 4 --- 1 1 --- 3 end subgraph Dual["Dual Graph"] Fa(((Fβ))) Fb(((F_b))) Fc(((F_c))) Fa === Fb Fb === Fc Fa === Fc end style Primal fill:#e3f2fd style Dual fill:#fce4ec style Fa fill:#ffcdd2,stroke:#c62828 style Fb fill:#ffcdd2,stroke:#c62828 style Fc fill:#ffcdd2,stroke:#c62828 style 1 fill:#bbdefb,stroke:#1565c0 style 2 fill:#bbdefb,stroke:#1565c0 style 3 fill:#bbdefb,stroke:#1565c0 style 4 fill:#bbdefb,stroke:#1565c0 linkStyle 0 stroke:#1565c0,stroke-width:2px linkStyle 1 stroke:#1565c0,stroke-width:2px linkStyle 2 stroke:#1565c0,stroke-width:2px linkStyle 3 stroke:#1565c0,stroke-width:2px linkStyle 4 stroke:#1565c0,stroke-width:2px
graph TD subgraph Faces["Triangle Faces (Both Odd)"] T1[("Fβ: (0,1,2)\n3 edges")] T2[("Fβ: (0,2,1)\n3 edges")] end T1 -.- T2 style Faces fill:#fff9c4 style T1 fill:#fff9c4,stroke:#f9a825,stroke-width:3px style T2 fill:#fff9c4,stroke:#f9a825,stroke-width:3px
graph TD subgraph Dual2["Dual Graph"] Fa(((Fβ))) -- "w=2" --- Fb(((F_b))) Fb -- "w=3" --- Fc(((F_c))) Fa -- "w=5" --- Fc end style Fa fill:#ffcdd2,stroke:#c62828,stroke-width:3px style Fb fill:#ffcdd2,stroke:#c62828,stroke-width:3px style Fc fill:#ffcdd2,stroke:#c62828,stroke-width:3px style Dual2 fill:#fce4ec
graph LR Fa(((Fβ))) -- "d=5" --- Fb(((F_b))) Fa -- "d=3" --- Fc(((F_c))) Fb -- "d=4" --- Fc style Fa fill:#ffcdd2,stroke:#c62828,stroke-width:3px style Fb fill:#ffcdd2,stroke:#c62828,stroke-width:3px style Fc fill:#ffcdd2,stroke:#c62828,stroke-width:3px linkStyle 0 stroke:#bdbdbd,stroke-width:2px linkStyle 1 stroke:#4caf50,stroke-width:4px linkStyle 2 stroke:#bdbdbd,stroke-width:2px
graph TD subgraph DualPath["Dual Path: Fa β Fb β Fc"] Fa(((Fβ))) -- "primal: (1,3)" --> Fb(((F_b))) Fb -- "primal: (3,4)" --> Fc(((F_c))) end style Fa fill:#ffcdd2,stroke:#c62828 style Fb fill:#ffcdd2,stroke:#c62828 style Fc fill:#ffcdd2,stroke:#c62828 style DualPath fill:#f3e5f5
graph LR 1((1)) -- "β" --- 2((2)) 2 -- "β" --- 3((3)) 3 -- "β" --- 4((4)) 4 -- "β" --- 1 1 -- "β" --- 3 style 1 fill:#e3f2fd,stroke:#1565c0 style 2 fill:#fce4ec,stroke:#c62828 style 3 fill:#fce4ec,stroke:#c62828 style 4 fill:#e3f2fd,stroke:#1565c0 linkStyle 0 stroke:#4caf50,stroke-width:3px linkStyle 1 stroke:#4caf50,stroke-width:3px linkStyle 2 stroke:#f44336,stroke-width:3px linkStyle 3 stroke:#4caf50,stroke-width:3px linkStyle 4 stroke:#f44336,stroke-width:3px
graph LR 0((0)) -- "5" --- 1((1)) 1 -- "10" --- 2((2)) 2 -- "3" --- 0 style 0 fill:#bbdefb,stroke:#1565c0 style 1 fill:#bbdefb,stroke:#1565c0 style 2 fill:#bbdefb,stroke:#1565c0 linkStyle 0 stroke:#1565c0,stroke-width:2px linkStyle 1 stroke:#1565c0,stroke-width:2px linkStyle 2 stroke:#1565c0,stroke-width:2px
graph LR 1((1)) -- "5" --- 2((2)) 2 -- "10" --- 3((3)) 3 -- "5" --- 4((4)) 4 -- "10" --- 1 1 -- "2" --- 3 style 1 fill:#bbdefb,stroke:#1565c0 style 2 fill:#fce4ec,stroke:#c62828 style 3 fill:#e3f2fd,stroke:#1565c0 style 4 fill:#fce4ec,stroke:#c62828 linkStyle 0 stroke:#1565c0,stroke-width:2px linkStyle 1 stroke:#1565c0,stroke-width:2px linkStyle 2 stroke:#1565c0,stroke-width:2px linkStyle 3 stroke:#1565c0,stroke-width:2px linkStyle 4 stroke:#ff9800,stroke-width:3px
graph TD subgraph Full["Full Graph"] 0((0)) --- 1((1)) 1 --- 2((2)) 2 --- 0 2 --- 3((3)) 3 --- 4((4)) 4 --- 2 end subgraph BC2["BC Component 2"] D((2)) --- E((3)) E --- F((4)) F --- D end subgraph BC1["BC Component 1"] A((0)) --- B((1)) B --- C((2)) C --- A end style Full fill:#e3f2fd style BC1 fill:#e8f5e9 style BC2 fill:#fce4ec style 0 fill:#bbdefb,stroke:#1565c0 style 1 fill:#bbdefb,stroke:#1565c0 style 2 fill:#ffcc80,stroke:#e65100,stroke-width:3px style 3 fill:#bbdefb,stroke:#1565c0 style 4 fill:#bbdefb,stroke:#1565c0 style A fill:#bbdefb,stroke:#1565c0 style B fill:#bbdefb,stroke:#1565c0 style C fill:#ffcc80,stroke:#e65100,stroke-width:3px style D fill:#ffcc80,stroke:#e65100,stroke-width:3px style E fill:#bbdefb,stroke:#1565c0 style F fill:#bbdefb,stroke:#1565c0
graph TD BC["BC Components"] --> Pool subgraph Pool["Thread Pool (hardware_concurrency workers)"] W1["Worker 1"] W2["Worker 2"] W3["Worker β―"] end W1 -. "Comp 0" .-> R["Union of Cuts"] W2 -. "Comp 1" .-> R W3 -. "Comp N" .-> R R --> MC["MAX-CUT π"] style BC fill:#e3f2fd style Pool fill:#fce4ec,stroke:#c62828 style W1 fill:#ffcdd2,stroke:#c62828 style W2 fill:#ffcdd2,stroke:#c62828 style W3 fill:#ffcdd2,stroke:#c62828 style R fill:#f3e5f5,stroke:#7b1fa2 style MC fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px
graph LR A("Input Graph") --> B{"Planar?"} B -->|"Yes"| D{"Many BC\nComponents?"} D -->|"No"| E("Solve Directly") D -->|"Yes"| F("BC Decompose + \nSolve per Block") B -->|"No"| C("Raise Error") style A fill:#e3f2fd style B fill:#fff9c4 style C fill:#fce4ec style D fill:#fff9c4 style E fill:#e8f5e9 style F fill:#e8f5e9
graph LR A("Planar\nGraph") --> B("Biconnected\nComponents") B --> C("Per-Component\nHadlock") C --> D("Union of\nCuts") D --> E("MAX-CUT π") style A fill:#e3f2fd style B fill:#fff9c4 style C fill:#e8f5e9 style D fill:#f3e5f5 style E fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px