lemon/matching.h
changeset 955 7f6e2bd76654
parent 954 07ec2b52e53d
child 956 141f9c0db4a3
     1.1 --- a/lemon/matching.h	Wed Mar 17 10:29:57 2010 +0100
     1.2 +++ b/lemon/matching.h	Wed Mar 17 12:35:52 2010 +0100
     1.3 @@ -1675,6 +1675,9 @@
     1.4      /// matching. This initialization is also called jumpstart heuristic.
     1.5      void fractionalInit() {
     1.6        createStructures();
     1.7 +
     1.8 +      _blossom_node_list.clear();
     1.9 +      _blossom_potential.clear();
    1.10        
    1.11        if (_fractional == 0) {
    1.12          _fractional = new FractionalMatching(_graph, _weight, false);
    1.13 @@ -1697,11 +1700,20 @@
    1.14  
    1.15        _unmatched = 0;
    1.16  
    1.17 +      _delta1->clear();
    1.18 +      _delta2->clear();
    1.19 +      _delta3->clear();
    1.20 +      _delta4->clear();
    1.21 +      _blossom_set->clear();
    1.22 +      _tree_set->clear();
    1.23 +
    1.24        int index = 0;
    1.25        for (NodeIt n(_graph); n != INVALID; ++n) {
    1.26          Value pot = _fractional->nodeValue(n);
    1.27          (*_node_index)[n] = index;
    1.28          (*_node_data)[index].pot = pot;
    1.29 +        (*_node_data)[index].heap_index.clear();
    1.30 +        (*_node_data)[index].heap.clear();
    1.31          int blossom =
    1.32            _blossom_set->insert(n, std::numeric_limits<Value>::max());
    1.33  
    1.34 @@ -3080,6 +3092,9 @@
    1.35      /// matching. This initialization is also called jumpstart heuristic.
    1.36      void fractionalInit() {
    1.37        createStructures();
    1.38 +
    1.39 +      _blossom_node_list.clear();
    1.40 +      _blossom_potential.clear();
    1.41        
    1.42        if (_fractional == 0) {
    1.43          _fractional = new FractionalMatching(_graph, _weight, false);
    1.44 @@ -3102,11 +3117,19 @@
    1.45  
    1.46        _unmatched = 0;
    1.47  
    1.48 +      _delta2->clear();
    1.49 +      _delta3->clear();
    1.50 +      _delta4->clear();
    1.51 +      _blossom_set->clear();
    1.52 +      _tree_set->clear();
    1.53 +
    1.54        int index = 0;
    1.55        for (NodeIt n(_graph); n != INVALID; ++n) {
    1.56          Value pot = _fractional->nodeValue(n);
    1.57          (*_node_index)[n] = index;
    1.58          (*_node_data)[index].pot = pot;
    1.59 +        (*_node_data)[index].heap_index.clear();
    1.60 +        (*_node_data)[index].heap.clear();
    1.61          int blossom =
    1.62            _blossom_set->insert(n, std::numeric_limits<Value>::max());
    1.63