[Lemon-commits] Balazs Dezso: Remove asRedBludeNode() function (...

Lemon HG hg at lemon.cs.elte.hu
Fri Mar 1 17:49:47 CET 2013


details:   http://lemon.cs.elte.hu/hg/lemon/rev/8b2b9e61d8ce
changeset: 1195:8b2b9e61d8ce
user:      Balazs Dezso <deba [at] inf.elte.hu>
date:      Wed Jan 11 22:43:50 2012 +0100
description:
	Remove asRedBludeNode() function (#69)

diffstat:

 lemon/bits/graph_extender.h       |  10 ----------
 lemon/concepts/bpgraph.h          |  11 -----------
 lemon/concepts/graph_components.h |  14 +-------------
 lemon/core.h                      |   7 +++----
 test/graph_test.h                 |   8 --------
 5 files changed, 4 insertions(+), 46 deletions(-)

diffs (115 lines):

diff --git a/lemon/bits/graph_extender.h b/lemon/bits/graph_extender.h
--- a/lemon/bits/graph_extender.h
+++ b/lemon/bits/graph_extender.h
@@ -840,16 +840,6 @@
       }
     }
 
-    std::pair<RedNode, BlueNode> 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<BpGraphExtender, Node> NodeNotifier;
diff --git a/lemon/concepts/bpgraph.h b/lemon/concepts/bpgraph.h
--- a/lemon/concepts/bpgraph.h
+++ b/lemon/concepts/bpgraph.h
@@ -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<RedNode, BlueNode> 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 --git a/lemon/concepts/graph_components.h b/lemon/concepts/graph_components.h
--- a/lemon/concepts/graph_components.h
+++ b/lemon/concepts/graph_components.h
@@ -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<RedNode, BlueNode> asRedBlueNode(const Node&) const {
-        return std::make_pair(RedNode(), BlueNode());
-      }
-
       template <typename _BpGraph>
       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<RedNode, BlueNode> p = bpgraph.asRedBlueNode(rnan);
-            ignore_unused_variable_warning(b,p);
+            ignore_unused_variable_warning(b);
           }
         }
 
diff --git a/lemon/core.h b/lemon/core.h
--- a/lemon/core.h
+++ b/lemon/core.h
@@ -1209,11 +1209,10 @@
       typedef typename To::Node Value;
 
       Value operator[](const Key& key) const {
-        std::pair<RedNode, BlueNode> 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 --git a/test/graph_test.h b/test/graph_test.h
--- a/test/graph_test.h
+++ b/test/graph_test.h
@@ -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<typename Graph::RedNode, typename Graph::BlueNode> 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<typename Graph::RedNode, typename Graph::BlueNode> 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.");



More information about the Lemon-commits mailing list