Changeset 956:141f9c0db4a3 in lemon for lemon/adaptors.h
 Timestamp:
 03/06/10 15:35:12 (10 years ago)
 Branch:
 default
 Children:
 957:f802439d2b58, 959:38213abd2911, 1041:f112c18bc304
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/adaptors.h
r834 r956 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 200320 095 * Copyright (C) 20032010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 422 422 Parent::initialize(digraph); 423 423 _node_filter = &node_filter; 424 _arc_filter = &arc_filter; 424 _arc_filter = &arc_filter; 425 425 } 426 426 … … 509 509 510 510 template <typename V> 511 class NodeMap 512 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 513 511 class NodeMap 512 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 513 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 514 514 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 515 515 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 516 516 517 517 public: … … 536 536 537 537 template <typename V> 538 class ArcMap 538 class ArcMap 539 539 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 540 540 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 541 541 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 542 542 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; … … 583 583 Parent::initialize(digraph); 584 584 _node_filter = &node_filter; 585 _arc_filter = &arc_filter; 585 _arc_filter = &arc_filter; 586 586 } 587 587 … … 652 652 653 653 template <typename V> 654 class NodeMap 654 class NodeMap 655 655 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 656 656 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 657 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 657 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 658 658 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 659 659 … … 679 679 680 680 template <typename V> 681 class ArcMap 681 class ArcMap 682 682 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 683 683 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { … … 1022 1022 1023 1023 template <typename V> 1024 class NodeMap 1024 class NodeMap 1025 1025 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1026 1026 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1027 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1027 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1028 1028 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1029 1029 … … 1049 1049 1050 1050 template <typename V> 1051 class ArcMap 1051 class ArcMap 1052 1052 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1053 1053 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1054 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1054 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1055 1055 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1056 1056 … … 1076 1076 1077 1077 template <typename V> 1078 class EdgeMap 1078 class EdgeMap 1079 1079 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1080 1080 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1081 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1081 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1082 1082 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1083 1083 … … 1118 1118 NF* _node_filter; 1119 1119 EF* _edge_filter; 1120 SubGraphBase() 1121 1120 SubGraphBase() 1121 : Parent(), _node_filter(0), _edge_filter(0) { } 1122 1122 1123 1123 void initialize(GR& graph, NF& node_filter, EF& edge_filter) { … … 1220 1220 1221 1221 template <typename V> 1222 class NodeMap 1222 class NodeMap 1223 1223 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1224 1224 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1225 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1225 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1226 1226 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1227 1227 … … 1247 1247 1248 1248 template <typename V> 1249 class ArcMap 1249 class ArcMap 1250 1250 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1251 1251 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1252 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1252 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1253 1253 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1254 1254 … … 1274 1274 1275 1275 template <typename V> 1276 class EdgeMap 1276 class EdgeMap 1277 1277 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1278 1278 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1279 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1280 1279 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1280 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1281 1281 1282 1282 public: … … 1505 1505 #endif 1506 1506 typedef DigraphAdaptorExtender< 1507 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1507 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1508 1508 true> > Parent; 1509 1509 … … 1526 1526 /// Creates a subgraph for the given digraph or graph with the 1527 1527 /// given node filter map. 1528 FilterNodes(GR& graph, NF& node_filter) 1528 FilterNodes(GR& graph, NF& node_filter) 1529 1529 : Parent(), const_true_map() 1530 1530 { … … 1564 1564 typename enable_if<UndirectedTagIndicator<GR> >::type> : 1565 1565 public GraphAdaptorExtender< 1566 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1566 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1567 1567 true> > { 1568 1568 1569 1569 typedef GraphAdaptorExtender< 1570 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1570 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1571 1571 true> > Parent; 1572 1572 … … 1654 1654 #endif 1655 1655 typedef DigraphAdaptorExtender< 1656 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1656 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1657 1657 AF, false> > Parent; 1658 1658 … … 1762 1762 class FilterEdges : 1763 1763 public GraphAdaptorExtender< 1764 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1764 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1765 1765 EF, false> > { 1766 1766 #endif 1767 1767 typedef GraphAdaptorExtender< 1768 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1768 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1769 1769 EF, false> > Parent; 1770 1770 … … 1791 1791 /// Creates a subgraph for the given graph with the given edge 1792 1792 /// filter map. 1793 FilterEdges(GR& graph, EF& edge_filter) 1793 FilterEdges(GR& graph, EF& edge_filter) 1794 1794 : Parent(), const_true_map() { 1795 1795 Parent::initialize(graph, const_true_map, edge_filter); … … 1859 1859 bool _forward; 1860 1860 1861 Arc(const Edge& edge, bool forward) 1861 Arc(const Edge& edge, bool forward) 1862 1862 : _edge(edge), _forward(forward) {} 1863 1863 … … 2099 2099 2100 2100 ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value) 2101 : _forward(*adaptor._digraph, value), 2101 : _forward(*adaptor._digraph, value), 2102 2102 _backward(*adaptor._digraph, value) {} 2103 2103 … … 2217 2217 typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier; 2218 2218 EdgeNotifier& notifier(Edge) const { return _digraph>notifier(Edge()); } 2219 2219 2220 2220 typedef EdgeNotifier ArcNotifier; 2221 2221 ArcNotifier& notifier(Arc) const { return _digraph>notifier(Edge()); } … … 2729 2729 typename FM = CM, 2730 2730 typename TL = Tolerance<typename CM::Value> > 2731 class ResidualDigraph 2731 class ResidualDigraph 2732 2732 : public SubDigraph< 2733 2733 Undirector<const DGR>, … … 2786 2786 ResidualDigraph(const DGR& digraph, const CM& capacity, 2787 2787 FM& flow, const TL& tolerance = Tolerance()) 2788 : Parent(), _capacity(&capacity), _flow(&flow), 2788 : Parent(), _capacity(&capacity), _flow(&flow), 2789 2789 _graph(digraph), _node_filter(), 2790 2790 _forward_filter(capacity, flow, tolerance), … … 2868 2868 2869 2869 /// Constructor 2870 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2870 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2871 2871 : _adaptor(&adaptor) {} 2872 2872 … … 3448 3448 /// to get a node map of the split digraph. 3449 3449 /// Its value type is inherited from the first node map type (\c IN). 3450 /// \tparam IN The type of the node map for the innodes. 3450 /// \tparam IN The type of the node map for the innodes. 3451 3451 /// \tparam OUT The type of the node map for the outnodes. 3452 3452 template <typename IN, typename OUT>
Note: See TracChangeset
for help on using the changeset viewer.