# HG changeset patch # User Balazs Dezso # Date 1326318230 -3600 # Node ID 8b2b9e61d8ce0c7d36703ed5ee1df45acc8a9a17 # Parent 699c7eac2c6dea417e75c9d4432f5944938f97d8 Remove asRedBludeNode() function (#69) diff -r 699c7eac2c6d -r 8b2b9e61d8ce lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Wed Jan 11 22:21:07 2012 +0100 +++ b/lemon/bits/graph_extender.h Wed Jan 11 22:43:50 2012 +0100 @@ -840,16 +840,6 @@ } } - std::pair asRedBlueNode(const Node& node) const { - if (node == INVALID) { - return std::make_pair(RedNode(INVALID), BlueNode(INVALID)); - } else if (Parent::red(node)) { - return std::make_pair(Parent::asRedNodeUnsafe(node), BlueNode(INVALID)); - } else { - return std::make_pair(RedNode(INVALID), Parent::asBlueNodeUnsafe(node)); - } - } - // Alterable extension typedef AlterationNotifier NodeNotifier; diff -r 699c7eac2c6d -r 8b2b9e61d8ce lemon/concepts/bpgraph.h --- a/lemon/concepts/bpgraph.h Wed Jan 11 22:21:07 2012 +0100 +++ b/lemon/concepts/bpgraph.h Wed Jan 11 22:43:50 2012 +0100 @@ -800,17 +800,6 @@ /// returns INVALID. BlueNode asBlueNode(const Node&) const { return BlueNode(); } - /// \brief Convert the node to either red or blue node. - /// - /// If the node is from the red partition then it is returned in - /// first and second is INVALID. If the node is from the blue - /// partition then it is returned in second and first is - /// INVALID. If the node INVALID then both first and second are - /// INVALID in the return value. - std::pair asRedBlueNode(const Node&) const { - return std::make_pair(RedNode(), BlueNode()); - } - /// \brief Gives back the red end node of the edge. /// /// Gives back the red end node of the edge. diff -r 699c7eac2c6d -r 8b2b9e61d8ce lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h Wed Jan 11 22:21:07 2012 +0100 +++ b/lemon/concepts/graph_components.h Wed Jan 11 22:43:50 2012 +0100 @@ -428,17 +428,6 @@ /// returns INVALID. BlueNode asBlueNode(const Node&) const { return BlueNode(); } - /// \brief Convert the node to either red or blue node. - /// - /// If the node is from the red partition then it is returned in - /// first and second is INVALID. If the node is from the blue - /// partition then it is returned in second and first is - /// INVALID. If the node INVALID then both first and second are - /// INVALID in the return value. - std::pair asRedBlueNode(const Node&) const { - return std::make_pair(RedNode(), BlueNode()); - } - template struct Constraints { typedef typename _BpGraph::Node Node; @@ -467,8 +456,7 @@ bn = bpgraph.asBlueNodeUnsafe(bnan); rn = bpgraph.asRedNode(rnan); bn = bpgraph.asBlueNode(bnan); - std::pair p = bpgraph.asRedBlueNode(rnan); - ignore_unused_variable_warning(b,p); + ignore_unused_variable_warning(b); } } diff -r 699c7eac2c6d -r 8b2b9e61d8ce lemon/core.h --- a/lemon/core.h Wed Jan 11 22:21:07 2012 +0100 +++ b/lemon/core.h Wed Jan 11 22:43:50 2012 +0100 @@ -1209,11 +1209,10 @@ typedef typename To::Node Value; Value operator[](const Key& key) const { - std::pair red_blue_pair = _from.asRedBlueNode(key); - if (red_blue_pair.first != INVALID) { - return _red_node_ref[red_blue_pair.first]; + if (_from.red(key)) { + return _red_node_ref[_from.asRedNodeUnsafe(key)]; } else { - return _blue_node_ref[red_blue_pair.second]; + return _blue_node_ref[_from.asBlueNodeUnsafe(key)]; } } diff -r 699c7eac2c6d -r 8b2b9e61d8ce test/graph_test.h --- a/test/graph_test.h Wed Jan 11 22:21:07 2012 +0100 +++ b/test/graph_test.h Wed Jan 11 22:43:50 2012 +0100 @@ -52,10 +52,6 @@ check(G.asRedNodeUnsafe(nn) == n,"Wrong node conversion."); check(G.asRedNode(nn) == n,"Wrong node conversion."); check(G.asBlueNode(nn) == INVALID,"Wrong node conversion."); - std::pair rbn = - G.asRedBlueNode(nn); - check(rbn.first == n,"Wrong node conversion."); - check(rbn.second == INVALID,"Wrong node conversion."); ++n; } check(n==INVALID,"Wrong red Node list linking."); @@ -74,10 +70,6 @@ check(G.asBlueNodeUnsafe(nn) == n,"Wrong node conversion."); check(G.asBlueNode(nn) == n,"Wrong node conversion."); check(G.asRedNode(nn) == INVALID,"Wrong node conversion."); - std::pair rbn = - G.asRedBlueNode(nn); - check(rbn.first == INVALID,"Wrong node conversion."); - check(rbn.second == n,"Wrong node conversion."); ++n; } check(n==INVALID,"Wrong blue Node list linking.");