COIN-OR::LEMON - Graph Library

Ticket #69: 37d179a45077.patch

File 37d179a45077.patch, 4.9 KB (added by Balazs Dezso, 13 years ago)

Remove asRedBlueNode()

  • lemon/bits/graph_extender.h

    # HG changeset patch
    # User Balazs Dezso <deba@inf.elte.hu>
    # Date 1326318230 -3600
    # Node ID 37d179a450778255e09c55e8758b09668a10ffef
    # Parent  d248eca9ca25b2dc0a185c45ea9a3934dedca484
    Remove asRedBludeNode() function
    
    diff -r d248eca9ca25 -r 37d179a45077 lemon/bits/graph_extender.h
    a b  
    840840      }
    841841    }
    842842
    843     std::pair<RedNode, BlueNode> asRedBlueNode(const Node& node) const {
    844       if (node == INVALID) {
    845         return std::make_pair(RedNode(INVALID), BlueNode(INVALID));
    846       } else if (Parent::red(node)) {
    847         return std::make_pair(Parent::asRedNodeUnsafe(node), BlueNode(INVALID));
    848       } else {
    849         return std::make_pair(RedNode(INVALID), Parent::asBlueNodeUnsafe(node));
    850       }
    851     }
    852 
    853843    // Alterable extension
    854844
    855845    typedef AlterationNotifier<BpGraphExtender, Node> NodeNotifier;
  • lemon/concepts/bpgraph.h

    diff -r d248eca9ca25 -r 37d179a45077 lemon/concepts/bpgraph.h
    a b  
    800800      /// returns INVALID.
    801801      BlueNode asBlueNode(const Node&) const { return BlueNode(); }
    802802
    803       /// \brief Convert the node to either red or blue node.
    804       ///
    805       /// If the node is from the red partition then it is returned in
    806       /// first and second is INVALID. If the node is from the blue
    807       /// partition then it is returned in second and first is
    808       /// INVALID. If the node INVALID then both first and second are
    809       /// INVALID in the return value.
    810       std::pair<RedNode, BlueNode> asRedBlueNode(const Node&) const {
    811         return std::make_pair(RedNode(), BlueNode());
    812       }
    813 
    814803      /// \brief Gives back the red end node of the edge.
    815804      ///
    816805      /// Gives back the red end node of the edge.
  • lemon/concepts/graph_components.h

    diff -r d248eca9ca25 -r 37d179a45077 lemon/concepts/graph_components.h
    a b  
    423423      /// returns INVALID.
    424424      BlueNode asBlueNode(const Node&) const { return BlueNode(); }
    425425
    426       /// \brief Convert the node to either red or blue node.
    427       ///
    428       /// If the node is from the red partition then it is returned in
    429       /// first and second is INVALID. If the node is from the blue
    430       /// partition then it is returned in second and first is
    431       /// INVALID. If the node INVALID then both first and second are
    432       /// INVALID in the return value.
    433       std::pair<RedNode, BlueNode> asRedBlueNode(const Node&) const {
    434         return std::make_pair(RedNode(), BlueNode());
    435       }
    436 
    437426      template <typename _BpGraph>
    438427      struct Constraints {
    439428        typedef typename _BpGraph::Node Node;
     
    463452            bn = bpgraph.asBlueNodeUnsafe(bnan);
    464453            rn = bpgraph.asRedNode(rnan);
    465454            bn = bpgraph.asBlueNode(bnan);
    466             std::pair<RedNode, BlueNode> p = bpgraph.asRedBlueNode(rnan);
    467455          }
    468456        }
    469457
  • lemon/core.h

    diff -r d248eca9ca25 -r 37d179a45077 lemon/core.h
    a b  
    12091209      typedef typename To::Node Value;
    12101210
    12111211      Value operator[](const Key& key) const {
    1212         std::pair<RedNode, BlueNode> red_blue_pair = _from.asRedBlueNode(key);
    1213         if (red_blue_pair.first != INVALID) {
    1214           return _red_node_ref[red_blue_pair.first];
     1212        if (_from.red(key)) {
     1213          return _red_node_ref[_from.asRedNodeUnsafe(key)];
    12151214        } else {
    1216           return _blue_node_ref[red_blue_pair.second];
     1215          return _blue_node_ref[_from.asBlueNodeUnsafe(key)];
    12171216        }
    12181217      }
    12191218
  • test/graph_test.h

    diff -r d248eca9ca25 -r 37d179a45077 test/graph_test.h
    a b  
    5252      check(G.asRedNodeUnsafe(nn) == n,"Wrong node conversion.");
    5353      check(G.asRedNode(nn) == n,"Wrong node conversion.");
    5454      check(G.asBlueNode(nn) == INVALID,"Wrong node conversion.");
    55       std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
    56         G.asRedBlueNode(nn);
    57       check(rbn.first == n,"Wrong node conversion.");
    58       check(rbn.second == INVALID,"Wrong node conversion.");
    5955      ++n;
    6056    }
    6157    check(n==INVALID,"Wrong red Node list linking.");
     
    7470      check(G.asBlueNodeUnsafe(nn) == n,"Wrong node conversion.");
    7571      check(G.asBlueNode(nn) == n,"Wrong node conversion.");
    7672      check(G.asRedNode(nn) == INVALID,"Wrong node conversion.");
    77       std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
    78         G.asRedBlueNode(nn);
    79       check(rbn.first == INVALID,"Wrong node conversion.");
    80       check(rbn.second == n,"Wrong node conversion.");
    8173      ++n;
    8274    }
    8375    check(n==INVALID,"Wrong blue Node list linking.");