graph LR A["Initial Partition"] --> B["Compute Gains"] B --> C{"Select Best Move"} C --> D["Update Partition"] D --> E{"Stopping Rule?"} E -->|No| B E -->|Yes| F["Restore Best Snapshot"] F --> G["Output Partition"] style A fill:#4caf50,color:#fff style G fill:#4caf50,color:#fff style C fill:#ff9800,color:#fff style E fill:#f44336,color:#fff
graph LR subgraph Level_n["Level n\n(2 ones)"] A["11000"] --- B["10100"] --- C["10010"] B --- D["01100"] --- E["01010"] end subgraph Level_np1["Level n+1\n(3 ones)"] F["11100"] --- G["11010"] --- H["11001"] G --- I["10110"] --- J["01110"] end A --- F B --- G C --- H D --- I E --- J style A fill:#2196f3,color:#fff style J fill:#2196f3,color:#fff
flowchart TD A["Start: Vertex x"] --> B["Initialization\n(to first vertex)"] B --> C["Build Tree Structure"] C --> D{"Main Loop"} D -->|"H_n β 0"| E["Apply Ο or Οβ»ΒΉ"] E --> F["Rotate Tree"] F --> G["Compute Flip Seq Ο"] G --> H["Apply Flip Sequence"] H --> I["Flip Last Bit"] I -->|"\n rev(H_n) β 1"| J["Compute Flip Seq Ο'"] J --> K["Apply Flip Sequence"] K --> L["Flip Last Bit"] L --> D H -->|"Terminate?"| M["Done!"] style A fill:#4caf50,color:#fff style M fill:#f44336,color:#fff style D fill:#ff9800,color:#fff
classDiagram class MidVertex { -vector<int> bits_ +compute_flip_seq_0() +compute_flip_seq_1() +to_first_vertex() +to_last_vertex() } class MidTree { -int root_ -vector<list<int>> children_ +flip_tree() +rotate() +root_canonically() } class MidHamCycle { -MidVertex x_, y_ -MidVisitFunc visit_f_ +MidHamCycle(x, limit, visit) } class MidLvlPartMgr { -const Gnl& hyprgraph +int total_cost +optimize(part) +compute_total_cost(part) } class MLMidLvlPartMgr { -double bal_tol -size_t limitsize +run_Partition(hyprgraph, part) } MidHamCycle --> MidVertex : uses MidHamCycle --> MidTree : uses MidLvlPartMgr --> MidHamCycle : enumerates via MLMidLvlPartMgr --> MidLvlPartMgr : leaf optimization
flowchart TD A["Input: 833-module netlist"] --> B{"modules β₯ limitsize?"} B -->|"Yes (833 β₯ 50)"| C["Contract graph\n(matching-based)"] C --> D["~416 modules"] D --> E["Recurse"] E --> F{"modules β€ 10?"} F -->|"Yes"| G["MidLvlPartMgr\n(exhaustive)"] F -->|"No"| H["FM optimize"] H --> D G --> I["Project up"] I --> J["FM optimize at this level"] J --> K["Output: cost=58"] B -->|"No"| F style A fill:#2196f3,color:#fff style G fill:#4caf50,color:#fff style K fill:#f44336,color:#fff