Remove asRedBludeNode() function (#69)
authorBalazs Dezso <deba@inf.elte.hu>
Wed, 11 Jan 2012 22:43:50 +0100
changeset 10278b2b9e61d8ce
parent 1026 699c7eac2c6d
child 1028 4441b066368c
Remove asRedBludeNode() function (#69)
lemon/bits/graph_extender.h
lemon/concepts/bpgraph.h
lemon/concepts/graph_components.h
lemon/core.h
test/graph_test.h
     1.1 --- a/lemon/bits/graph_extender.h	Wed Jan 11 22:21:07 2012 +0100
     1.2 +++ b/lemon/bits/graph_extender.h	Wed Jan 11 22:43:50 2012 +0100
     1.3 @@ -840,16 +840,6 @@
     1.4        }
     1.5      }
     1.6  
     1.7 -    std::pair<RedNode, BlueNode> asRedBlueNode(const Node& node) const {
     1.8 -      if (node == INVALID) {
     1.9 -        return std::make_pair(RedNode(INVALID), BlueNode(INVALID));
    1.10 -      } else if (Parent::red(node)) {
    1.11 -        return std::make_pair(Parent::asRedNodeUnsafe(node), BlueNode(INVALID));
    1.12 -      } else {
    1.13 -        return std::make_pair(RedNode(INVALID), Parent::asBlueNodeUnsafe(node));
    1.14 -      }
    1.15 -    }
    1.16 -
    1.17      // Alterable extension
    1.18  
    1.19      typedef AlterationNotifier<BpGraphExtender, Node> NodeNotifier;
     2.1 --- a/lemon/concepts/bpgraph.h	Wed Jan 11 22:21:07 2012 +0100
     2.2 +++ b/lemon/concepts/bpgraph.h	Wed Jan 11 22:43:50 2012 +0100
     2.3 @@ -800,17 +800,6 @@
     2.4        /// returns INVALID.
     2.5        BlueNode asBlueNode(const Node&) const { return BlueNode(); }
     2.6  
     2.7 -      /// \brief Convert the node to either red or blue node.
     2.8 -      ///
     2.9 -      /// If the node is from the red partition then it is returned in
    2.10 -      /// first and second is INVALID. If the node is from the blue
    2.11 -      /// partition then it is returned in second and first is
    2.12 -      /// INVALID. If the node INVALID then both first and second are
    2.13 -      /// INVALID in the return value.
    2.14 -      std::pair<RedNode, BlueNode> asRedBlueNode(const Node&) const {
    2.15 -        return std::make_pair(RedNode(), BlueNode());
    2.16 -      }
    2.17 -
    2.18        /// \brief Gives back the red end node of the edge.
    2.19        /// 
    2.20        /// Gives back the red end node of the edge.
     3.1 --- a/lemon/concepts/graph_components.h	Wed Jan 11 22:21:07 2012 +0100
     3.2 +++ b/lemon/concepts/graph_components.h	Wed Jan 11 22:43:50 2012 +0100
     3.3 @@ -428,17 +428,6 @@
     3.4        /// returns INVALID.
     3.5        BlueNode asBlueNode(const Node&) const { return BlueNode(); }
     3.6  
     3.7 -      /// \brief Convert the node to either red or blue node.
     3.8 -      ///
     3.9 -      /// If the node is from the red partition then it is returned in
    3.10 -      /// first and second is INVALID. If the node is from the blue
    3.11 -      /// partition then it is returned in second and first is
    3.12 -      /// INVALID. If the node INVALID then both first and second are
    3.13 -      /// INVALID in the return value.
    3.14 -      std::pair<RedNode, BlueNode> asRedBlueNode(const Node&) const {
    3.15 -        return std::make_pair(RedNode(), BlueNode());
    3.16 -      }
    3.17 -
    3.18        template <typename _BpGraph>
    3.19        struct Constraints {
    3.20          typedef typename _BpGraph::Node Node;
    3.21 @@ -467,8 +456,7 @@
    3.22              bn = bpgraph.asBlueNodeUnsafe(bnan);
    3.23              rn = bpgraph.asRedNode(rnan);
    3.24              bn = bpgraph.asBlueNode(bnan);
    3.25 -            std::pair<RedNode, BlueNode> p = bpgraph.asRedBlueNode(rnan);
    3.26 -            ignore_unused_variable_warning(b,p);
    3.27 +            ignore_unused_variable_warning(b);
    3.28            }
    3.29          }
    3.30  
     4.1 --- a/lemon/core.h	Wed Jan 11 22:21:07 2012 +0100
     4.2 +++ b/lemon/core.h	Wed Jan 11 22:43:50 2012 +0100
     4.3 @@ -1209,11 +1209,10 @@
     4.4        typedef typename To::Node Value;
     4.5  
     4.6        Value operator[](const Key& key) const {
     4.7 -        std::pair<RedNode, BlueNode> red_blue_pair = _from.asRedBlueNode(key);
     4.8 -        if (red_blue_pair.first != INVALID) {
     4.9 -          return _red_node_ref[red_blue_pair.first];
    4.10 +        if (_from.red(key)) {
    4.11 +          return _red_node_ref[_from.asRedNodeUnsafe(key)];
    4.12          } else {
    4.13 -          return _blue_node_ref[red_blue_pair.second];
    4.14 +          return _blue_node_ref[_from.asBlueNodeUnsafe(key)];
    4.15          }
    4.16        }
    4.17  
     5.1 --- a/test/graph_test.h	Wed Jan 11 22:21:07 2012 +0100
     5.2 +++ b/test/graph_test.h	Wed Jan 11 22:43:50 2012 +0100
     5.3 @@ -52,10 +52,6 @@
     5.4        check(G.asRedNodeUnsafe(nn) == n,"Wrong node conversion.");
     5.5        check(G.asRedNode(nn) == n,"Wrong node conversion.");
     5.6        check(G.asBlueNode(nn) == INVALID,"Wrong node conversion.");
     5.7 -      std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
     5.8 -        G.asRedBlueNode(nn);
     5.9 -      check(rbn.first == n,"Wrong node conversion.");
    5.10 -      check(rbn.second == INVALID,"Wrong node conversion.");
    5.11        ++n;
    5.12      }
    5.13      check(n==INVALID,"Wrong red Node list linking.");
    5.14 @@ -74,10 +70,6 @@
    5.15        check(G.asBlueNodeUnsafe(nn) == n,"Wrong node conversion.");
    5.16        check(G.asBlueNode(nn) == n,"Wrong node conversion.");
    5.17        check(G.asRedNode(nn) == INVALID,"Wrong node conversion.");
    5.18 -      std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
    5.19 -        G.asRedBlueNode(nn);
    5.20 -      check(rbn.first == INVALID,"Wrong node conversion.");
    5.21 -      check(rbn.second == n,"Wrong node conversion.");
    5.22        ++n;
    5.23      }
    5.24      check(n==INVALID,"Wrong blue Node list linking.");