Changeset 1027:8b2b9e61d8ce in lemon-main
- Timestamp:
- 01/11/12 22:43:50 (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/graph_extender.h
r1026 r1027 841 841 } 842 842 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 853 843 // Alterable extension 854 844 -
lemon/concepts/bpgraph.h
r1026 r1027 801 801 BlueNode asBlueNode(const Node&) const { return BlueNode(); } 802 802 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 in806 /// first and second is INVALID. If the node is from the blue807 /// partition then it is returned in second and first is808 /// INVALID. If the node INVALID then both first and second are809 /// INVALID in the return value.810 std::pair<RedNode, BlueNode> asRedBlueNode(const Node&) const {811 return std::make_pair(RedNode(), BlueNode());812 }813 814 803 /// \brief Gives back the red end node of the edge. 815 804 /// -
lemon/concepts/graph_components.h
r1026 r1027 428 428 /// returns INVALID. 429 429 BlueNode asBlueNode(const Node&) const { return BlueNode(); } 430 431 /// \brief Convert the node to either red or blue node.432 ///433 /// If the node is from the red partition then it is returned in434 /// first and second is INVALID. If the node is from the blue435 /// partition then it is returned in second and first is436 /// INVALID. If the node INVALID then both first and second are437 /// INVALID in the return value.438 std::pair<RedNode, BlueNode> asRedBlueNode(const Node&) const {439 return std::make_pair(RedNode(), BlueNode());440 }441 430 442 431 template <typename _BpGraph> … … 468 457 rn = bpgraph.asRedNode(rnan); 469 458 bn = bpgraph.asBlueNode(bnan); 470 std::pair<RedNode, BlueNode> p = bpgraph.asRedBlueNode(rnan); 471 ignore_unused_variable_warning(b,p); 459 ignore_unused_variable_warning(b); 472 460 } 473 461 } -
lemon/core.h
r1026 r1027 1210 1210 1211 1211 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)]; 1215 1214 } else { 1216 return _blue_node_ref[ red_blue_pair.second];1215 return _blue_node_ref[_from.asBlueNodeUnsafe(key)]; 1217 1216 } 1218 1217 } -
test/graph_test.h
r1026 r1027 53 53 check(G.asRedNode(nn) == n,"Wrong node conversion."); 54 54 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.");59 55 ++n; 60 56 } … … 75 71 check(G.asBlueNode(nn) == n,"Wrong node conversion."); 76 72 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.");81 73 ++n; 82 74 }
Note: See TracChangeset
for help on using the changeset viewer.