lemon/bipartite_matching.h
changeset 2386 81b47fc5c444
parent 2352 5e273e0bd5e2
child 2391 14a343be7a5a
     1.1 --- a/lemon/bipartite_matching.h	Fri Mar 02 17:56:22 2007 +0000
     1.2 +++ b/lemon/bipartite_matching.h	Fri Mar 02 18:04:28 2007 +0000
     1.3 @@ -115,7 +115,7 @@
     1.4      ///
     1.5      /// It initalizes the data structures with an initial matching.
     1.6      template <typename MatchingMap>
     1.7 -    void matchingInit(const MatchingMap& matching) {
     1.8 +    void matchingInit(const MatchingMap& mm) {
     1.9        for (ANodeIt it(*graph); it != INVALID; ++it) {
    1.10          anode_matching[it] = INVALID;
    1.11        }
    1.12 @@ -124,7 +124,7 @@
    1.13        }
    1.14        matching_size = 0;
    1.15        for (UEdgeIt it(*graph); it != INVALID; ++it) {
    1.16 -        if (matching[it]) {
    1.17 +        if (mm[it]) {
    1.18            ++matching_size;
    1.19            anode_matching[graph->aNode(it)] = it;
    1.20            bnode_matching[graph->bNode(it)] = it;
    1.21 @@ -137,7 +137,7 @@
    1.22      /// It initalizes the data structures with an initial matching.
    1.23      /// \return %True when the given map contains really a matching.
    1.24      template <typename MatchingMap>
    1.25 -    void checkedMatchingInit(const MatchingMap& matching) {
    1.26 +    void checkedMatchingInit(const MatchingMap& mm) {
    1.27        for (ANodeIt it(*graph); it != INVALID; ++it) {
    1.28          anode_matching[it] = INVALID;
    1.29        }
    1.30 @@ -146,7 +146,7 @@
    1.31        }
    1.32        matching_size = 0;
    1.33        for (UEdgeIt it(*graph); it != INVALID; ++it) {
    1.34 -        if (matching[it]) {
    1.35 +        if (mm[it]) {
    1.36            ++matching_size;
    1.37            if (anode_matching[graph->aNode(it)] != INVALID) {
    1.38              return false;
    1.39 @@ -187,7 +187,7 @@
    1.40  
    1.41        while (!success && !queue.empty()) {
    1.42          std::vector<Node> newqueue;
    1.43 -        for (int i = 0; i < (int)queue.size(); ++i) {
    1.44 +        for (int i = 0; i < int(queue.size()); ++i) {
    1.45            Node anode = queue[i];
    1.46            for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
    1.47              Node bnode = graph->bNode(jt);
    1.48 @@ -213,7 +213,7 @@
    1.49  
    1.50          typename Graph::template ANodeMap<bool> aused(*graph, false);
    1.51          
    1.52 -        for (int i = 0; i < (int)bqueue.size(); ++i) {
    1.53 +        for (int i = 0; i < int(bqueue.size()); ++i) {
    1.54            Node bnode = bqueue[i];
    1.55  
    1.56            bool used = false;
    1.57 @@ -279,7 +279,7 @@
    1.58  
    1.59        while (!queue.empty()) {
    1.60          std::vector<Node> newqueue;
    1.61 -        for (int i = 0; i < (int)queue.size(); ++i) {
    1.62 +        for (int i = 0; i < int(queue.size()); ++i) {
    1.63            Node anode = queue[i];
    1.64            for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
    1.65              Node bnode = graph->bNode(jt);
    1.66 @@ -363,7 +363,7 @@
    1.67  
    1.68        while (!queue.empty()) {
    1.69          std::vector<Node> newqueue;
    1.70 -        for (int i = 0; i < (int)queue.size(); ++i) {
    1.71 +        for (int i = 0; i < int(queue.size()); ++i) {
    1.72            Node anode = queue[i];
    1.73            for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
    1.74              Node bnode = graph->bNode(jt);
    1.75 @@ -403,10 +403,10 @@
    1.76      /// value mapped to the other uedges.
    1.77      /// \return The number of the matching edges.
    1.78      template <typename MatchingMap>
    1.79 -    int quickMatching(MatchingMap& matching) const {
    1.80 +    int quickMatching(MatchingMap& mm) const {
    1.81        for (ANodeIt it(*graph); it != INVALID; ++it) {
    1.82          if (anode_matching[it] != INVALID) {
    1.83 -          matching[anode_matching[it]] = true;
    1.84 +          mm[anode_matching[it]] = true;
    1.85          }
    1.86        }
    1.87        return matching_size;
    1.88 @@ -417,9 +417,9 @@
    1.89      /// Set true all matching uedge in the map and the others to false.
    1.90      /// \return The number of the matching edges.
    1.91      template <typename MatchingMap>
    1.92 -    int matching(MatchingMap& matching) const {
    1.93 +    int matching(MatchingMap& mm) const {
    1.94        for (UEdgeIt it(*graph); it != INVALID; ++it) {
    1.95 -        matching[it] = it == anode_matching[graph->aNode(it)];
    1.96 +        mm[it] = it == anode_matching[graph->aNode(it)];
    1.97        }
    1.98        return matching_size;
    1.99      }
   1.100 @@ -683,17 +683,17 @@
   1.101      /// it will allocate one. The destuctor deallocates this
   1.102      /// automatically allocated map, of course.
   1.103      /// \return \c (*this)
   1.104 -    MaxWeightedBipartiteMatching& heap(Heap& heap, HeapCrossRef &crossRef) {
   1.105 +    MaxWeightedBipartiteMatching& heap(Heap& hp, HeapCrossRef &cr) {
   1.106        if(local_heap_cross_ref) {
   1.107  	delete _heap_cross_ref;
   1.108  	local_heap_cross_ref = false;
   1.109        }
   1.110 -      _heap_cross_ref = &crossRef;
   1.111 +      _heap_cross_ref = &cr;
   1.112        if(local_heap) {
   1.113  	delete _heap;
   1.114  	local_heap = false;
   1.115        }
   1.116 -      _heap = &heap;
   1.117 +      _heap = &hp;
   1.118        return *this;
   1.119      }
   1.120  
   1.121 @@ -889,12 +889,12 @@
   1.122      /// for each matching edges and \f$ \pi(a) + \pi(b) - w(ab) \ge 0 \f$
   1.123      /// for each edges. 
   1.124      template <typename PotentialMap>
   1.125 -    void potential(PotentialMap& potential) const {
   1.126 +    void potential(PotentialMap& pt) const {
   1.127        for (ANodeIt it(*graph); it != INVALID; ++it) {
   1.128 -        potential[it] = anode_potential[it];
   1.129 +        pt[it] = anode_potential[it];
   1.130        }
   1.131        for (BNodeIt it(*graph); it != INVALID; ++it) {
   1.132 -        potential[it] = bnode_potential[it];
   1.133 +        pt[it] = bnode_potential[it];
   1.134        }
   1.135      }
   1.136  
   1.137 @@ -904,10 +904,10 @@
   1.138      /// value mapped to the other uedges.
   1.139      /// \return The number of the matching edges.
   1.140      template <typename MatchingMap>
   1.141 -    int quickMatching(MatchingMap& matching) const {
   1.142 +    int quickMatching(MatchingMap& mm) const {
   1.143        for (ANodeIt it(*graph); it != INVALID; ++it) {
   1.144          if (anode_matching[it] != INVALID) {
   1.145 -          matching[anode_matching[it]] = true;
   1.146 +          mm[anode_matching[it]] = true;
   1.147          }
   1.148        }
   1.149        return matching_size;
   1.150 @@ -918,9 +918,9 @@
   1.151      /// Set true all matching uedge in the map and the others to false.
   1.152      /// \return The number of the matching edges.
   1.153      template <typename MatchingMap>
   1.154 -    int matching(MatchingMap& matching) const {
   1.155 +    int matching(MatchingMap& mm) const {
   1.156        for (UEdgeIt it(*graph); it != INVALID; ++it) {
   1.157 -        matching[it] = it == anode_matching[graph->aNode(it)];
   1.158 +        mm[it] = it == anode_matching[graph->aNode(it)];
   1.159        }
   1.160        return matching_size;
   1.161      }
   1.162 @@ -1254,17 +1254,17 @@
   1.163      /// it will allocate one. The destuctor deallocates this
   1.164      /// automatically allocated map, of course.
   1.165      /// \return \c (*this)
   1.166 -    MinCostMaxBipartiteMatching& heap(Heap& heap, HeapCrossRef &crossRef) {
   1.167 +    MinCostMaxBipartiteMatching& heap(Heap& hp, HeapCrossRef &cr) {
   1.168        if(local_heap_cross_ref) {
   1.169  	delete _heap_cross_ref;
   1.170  	local_heap_cross_ref = false;
   1.171        }
   1.172 -      _heap_cross_ref = &crossRef;
   1.173 +      _heap_cross_ref = &cr;
   1.174        if(local_heap) {
   1.175  	delete _heap;
   1.176  	local_heap = false;
   1.177        }
   1.178 -      _heap = &heap;
   1.179 +      _heap = &hp;
   1.180        return *this;
   1.181      }
   1.182  
   1.183 @@ -1442,12 +1442,12 @@
   1.184      /// each matching edges and \f$ \pi(a) - \pi(b) + w(ab) \ge 0 \f$
   1.185      /// for each edges.
   1.186      template <typename PotentialMap>
   1.187 -    void potential(PotentialMap& potential) const {
   1.188 +    void potential(PotentialMap& pt) const {
   1.189        for (ANodeIt it(*graph); it != INVALID; ++it) {
   1.190 -        potential[it] = anode_potential[it];
   1.191 +        pt[it] = anode_potential[it];
   1.192        }
   1.193        for (BNodeIt it(*graph); it != INVALID; ++it) {
   1.194 -        potential[it] = bnode_potential[it];
   1.195 +        pt[it] = bnode_potential[it];
   1.196        }
   1.197      }
   1.198  
   1.199 @@ -1457,10 +1457,10 @@
   1.200      /// value mapped to the other uedges.
   1.201      /// \return The number of the matching edges.
   1.202      template <typename MatchingMap>
   1.203 -    int quickMatching(MatchingMap& matching) const {
   1.204 +    int quickMatching(MatchingMap& mm) const {
   1.205        for (ANodeIt it(*graph); it != INVALID; ++it) {
   1.206          if (anode_matching[it] != INVALID) {
   1.207 -          matching[anode_matching[it]] = true;
   1.208 +          mm[anode_matching[it]] = true;
   1.209          }
   1.210        }
   1.211        return matching_size;
   1.212 @@ -1471,9 +1471,9 @@
   1.213      /// Set true all matching uedge in the map and the others to false.
   1.214      /// \return The number of the matching edges.
   1.215      template <typename MatchingMap>
   1.216 -    int matching(MatchingMap& matching) const {
   1.217 +    int matching(MatchingMap& mm) const {
   1.218        for (UEdgeIt it(*graph); it != INVALID; ++it) {
   1.219 -        matching[it] = it == anode_matching[graph->aNode(it)];
   1.220 +        mm[it] = it == anode_matching[graph->aNode(it)];
   1.221        }
   1.222        return matching_size;
   1.223      }