graph TD subgraph "Input Graph" A[s] --> B B --> C[t] D[s] --> E E --> F[t] end subgraph "Steiner Forest" A1[Source] --> S[* Steiner] S --> T1[Target] end style A fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style B fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style C fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style D fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style E fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style F fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style S fill:#f3e5f5,stroke:#7b1fa2,color:#2e3440,stroke-width:3px
graph TB subgraph "Steiner Tree (Single Tree)" direction TB S1["sโ"] === T1["tโ"] S2["sโ"] === T2["tโ"] S3["sโ"] === T3["tโ"] end subgraph "Steiner Forest (Multiple Trees)" direction TB S1a["sโ"] --- T1a["tโ"] S2a["sโ"] --- T2a["tโ"] S3a["sโ"] --- T3a["tโ"] end style S1 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style S2 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style S3 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style T1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style T2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style T3 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style S1a fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style S2a fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style S3a fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style T1a fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style T2a fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style T3a fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph TD subgraph "Initial State (5 components)" A0(0) --> A0 B0(1) --> B0 C0(2) --> C0 D0(3) --> D0 E0(4) --> E0 end subgraph "After union(0,1), union(2,3)" A1(0) --> B1(1) C1(2) --> D1(3) end subgraph "After union(1,2) - Path Compression" A2(0) --> B2(1) --> C2(2) --> D2(3) end style A0 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style B0 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style C0 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style D0 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style E0 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style A1 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style B1 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style C1 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style D1 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style A2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style C2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style D2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
flowchart LR A["1. Init: y=0, F={}"] --> B{"2. While โ unconnected pairs"} B -->|"Yes"| C["Identify Active Components"] C --> D["Increase y_C uniformly"] D --> E{"Edge becomes tight?"} E -->|"Yes"| F["Add e to F"] F --> G["Update Components"] G --> B B -->|"No"| H["3. Reverse Delete"] H --> I["Return Forest F'"] style A fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style B fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style C fill:#f3e5f5,stroke:#7b1fa2,color:#2e3440,stroke-width:3px style D fill:#f3e5f5,stroke:#7b1fa2,color:#2e3440,stroke-width:3px style E fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style F fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style G fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style H fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style I fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph TD subgraph "Grid Graph (hรw)" N00(0,0) --- N01(0,1) --- N02(0,2) N00 --- N10(1,0) --- N11(1,1) N01 --- N11 --- N12(1,2) N10 --- N11 --- N20(2,0) end style N00 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style N01 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style N02 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style N10 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style N11 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style N12 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style N20 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph TD subgraph "Forest Property" C1(Cโ) --- C2(Cโ) C2 --- C3(Cโ) end style C1 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style C2 fill:#e3f2fd,stroke:#1565c0,color:#2e3440,stroke-width:3px style C3 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px