From b5ccbdeda492493c923e71c99e6baf276b318d8e Mon Sep 17 00:00:00 2001 From: Joris van Rantwijk Date: Thu, 21 Nov 2024 21:46:39 +0100 Subject: [PATCH] Remove expand_unlabeled_blossom() --- cpp/mwmatching.h | 49 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 42 deletions(-) diff --git a/cpp/mwmatching.h b/cpp/mwmatching.h index ccacd0f..3d777f8 100644 --- a/cpp/mwmatching.h +++ b/cpp/mwmatching.h @@ -1383,17 +1383,14 @@ public: blossom->tree_root = subblossoms.front()->tree_root; } - /** Erase the specified non-trivial blossom. */ - void erase_nontrivial_blossom(NonTrivialBlossomT* blossom) - { - nontrivial_blossom.erase(blossom->this_blossom_iterator); - } - - /** Expand the specified unlabeled blossom but do not yet delete it. */ - void expand_unlabeled_blossom_core(NonTrivialBlossomT* blossom) + /** Expand and delete the specified T-blossom. */ + void expand_t_blossom(NonTrivialBlossomT* blossom) { assert(blossom->parent == nullptr); - assert(blossom->label == LABEL_NONE); + assert(blossom->label == LABEL_T); + + // Remove label from blossom. + remove_blossom_label_t(blossom); // Remove blossom from the delta2 queue. delta2_disable_blossom(blossom); @@ -1420,26 +1417,6 @@ public: // Add unlabeled blossom to the delta2 queue. delta2_enable_blossom(sub_blossom); } - } - - /** Expand and delete the specified unlabeled blossom. */ - void expand_unlabeled_blossom(NonTrivialBlossomT* blossom) - { - expand_unlabeled_blossom_core(blossom); - erase_nontrivial_blossom(blossom); - } - - /** Expand and delete the specified T-blossom. */ - void expand_t_blossom(NonTrivialBlossomT* blossom) - { - assert(blossom->parent == nullptr); - assert(blossom->label == LABEL_T); - - // Remove label from blossom. - remove_blossom_label_t(blossom); - - // Expand the unlabeled blossom. - expand_unlabeled_blossom_core(blossom); // The expanded blossom was part of an alternating tree. // We must now reconstruct the part of the alternating tree @@ -1506,7 +1483,7 @@ public: } // Delete the expanded blossom. - erase_nontrivial_blossom(blossom); + nontrivial_blossom.erase(blossom->this_blossom_iterator); } /* ********** Augmenting: ********** */ @@ -1714,8 +1691,6 @@ public: * a matched edge to the base of the newly labeled T-blossom. * That newly labeled S-blossom is also added to the alternating tree. * - * Note that this function may expand blossoms that contain vertex "y". - * * @pre "x" is an S-vertex. * @pre "y" is an unlabeled, matched vertex. * @pre The top-level blossom that contains "y" has a matched base vertex. @@ -1727,16 +1702,6 @@ public: BlossomT* by = top_level_blossom(y); assert(bx->label == LABEL_S); - // If "y" is part of a zero-dual blossom, expand it. - // This would otherwise likely happen through a zero-delta4 step, - // so we can just do it now and avoid a substage. - NonTrivialBlossomT* ntb = by->nontrivial(); - while (ntb != nullptr && ntb->dual_var == 0) { - expand_unlabeled_blossom(ntb); - by = top_level_blossom(y); - ntb = by->nontrivial(); - } - // Assign label T to the top-level blossom that contains vertex "y". assign_blossom_label_t(by); by->tree_edge = std::make_pair(x, y);