Changeset 761:f1398882a928 in lemon-1.1 for lemon/adaptors.h
- Timestamp:
- 08/08/11 12:36:16 (13 years ago)
- Branch:
- 1.1
- Phase:
- public
- Tags:
- r1.1.4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/adaptors.h
r654 r761 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2011 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 419 419 Parent::initialize(digraph); 420 420 _node_filter = &node_filter; 421 _arc_filter = &arc_filter; 421 _arc_filter = &arc_filter; 422 422 } 423 423 … … 506 506 507 507 template <typename V> 508 class NodeMap 509 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 510 508 class NodeMap 509 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 510 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 511 511 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 512 512 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 513 513 514 514 public: … … 533 533 534 534 template <typename V> 535 class ArcMap 535 class ArcMap 536 536 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 537 537 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 538 538 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 539 539 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; … … 580 580 Parent::initialize(digraph); 581 581 _node_filter = &node_filter; 582 _arc_filter = &arc_filter; 582 _arc_filter = &arc_filter; 583 583 } 584 584 … … 649 649 650 650 template <typename V> 651 class NodeMap 651 class NodeMap 652 652 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 653 653 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 654 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 654 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 655 655 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 656 656 … … 676 676 677 677 template <typename V> 678 class ArcMap 678 class ArcMap 679 679 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 680 680 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { … … 1017 1017 1018 1018 template <typename V> 1019 class NodeMap 1019 class NodeMap 1020 1020 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1021 1021 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1022 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1022 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1023 1023 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1024 1024 … … 1044 1044 1045 1045 template <typename V> 1046 class ArcMap 1046 class ArcMap 1047 1047 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1048 1048 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1049 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1049 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1050 1050 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1051 1051 … … 1071 1071 1072 1072 template <typename V> 1073 class EdgeMap 1073 class EdgeMap 1074 1074 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1075 1075 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1076 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1076 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1077 1077 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1078 1078 … … 1113 1113 NF* _node_filter; 1114 1114 EF* _edge_filter; 1115 SubGraphBase() 1116 1115 SubGraphBase() 1116 : Parent(), _node_filter(0), _edge_filter(0) { } 1117 1117 1118 1118 void initialize(GR& graph, NF& node_filter, EF& edge_filter) { … … 1215 1215 1216 1216 template <typename V> 1217 class NodeMap 1217 class NodeMap 1218 1218 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1219 1219 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1220 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1220 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1221 1221 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1222 1222 … … 1242 1242 1243 1243 template <typename V> 1244 class ArcMap 1244 class ArcMap 1245 1245 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1246 1246 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1247 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1247 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1248 1248 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1249 1249 … … 1269 1269 1270 1270 template <typename V> 1271 class EdgeMap 1271 class EdgeMap 1272 1272 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1273 1273 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1274 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1275 1274 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1275 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1276 1276 1277 1277 public: … … 1496 1496 #endif 1497 1497 typedef DigraphAdaptorExtender< 1498 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1498 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1499 1499 true> > Parent; 1500 1500 … … 1517 1517 /// Creates a subgraph for the given digraph or graph with the 1518 1518 /// given node filter map. 1519 FilterNodes(GR& graph, NF& node_filter) 1519 FilterNodes(GR& graph, NF& node_filter) 1520 1520 : Parent(), const_true_map() 1521 1521 { … … 1555 1555 typename enable_if<UndirectedTagIndicator<GR> >::type> : 1556 1556 public GraphAdaptorExtender< 1557 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1557 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1558 1558 true> > { 1559 1559 1560 1560 typedef GraphAdaptorExtender< 1561 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1561 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1562 1562 true> > Parent; 1563 1563 … … 1643 1643 #endif 1644 1644 typedef DigraphAdaptorExtender< 1645 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1645 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1646 1646 AF, false> > Parent; 1647 1647 … … 1749 1749 class FilterEdges : 1750 1750 public GraphAdaptorExtender< 1751 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1751 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1752 1752 EF, false> > { 1753 1753 #endif 1754 1754 typedef GraphAdaptorExtender< 1755 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1755 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1756 1756 EF, false> > Parent; 1757 1757 … … 1778 1778 /// Creates a subgraph for the given graph with the given edge 1779 1779 /// filter map. 1780 FilterEdges(GR& graph, EF& edge_filter) 1780 FilterEdges(GR& graph, EF& edge_filter) 1781 1781 : Parent(), const_true_map() { 1782 1782 Parent::initialize(graph, const_true_map, edge_filter); … … 1846 1846 bool _forward; 1847 1847 1848 Arc(const Edge& edge, bool forward) 1848 Arc(const Edge& edge, bool forward) 1849 1849 : _edge(edge), _forward(forward) {} 1850 1850 … … 2086 2086 2087 2087 ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value) 2088 : _forward(*adaptor._digraph, value), 2088 : _forward(*adaptor._digraph, value), 2089 2089 _backward(*adaptor._digraph, value) {} 2090 2090 … … 2204 2204 typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier; 2205 2205 EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); } 2206 2206 2207 2207 typedef EdgeNotifier ArcNotifier; 2208 2208 ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); } … … 2708 2708 typename FM = CM, 2709 2709 typename TL = Tolerance<typename CM::Value> > 2710 class ResidualDigraph 2710 class ResidualDigraph 2711 2711 : public SubDigraph< 2712 2712 Undirector<const DGR>, … … 2765 2765 ResidualDigraph(const DGR& digraph, const CM& capacity, 2766 2766 FM& flow, const TL& tolerance = Tolerance()) 2767 : Parent(), _capacity(&capacity), _flow(&flow), 2767 : Parent(), _capacity(&capacity), _flow(&flow), 2768 2768 _graph(digraph), _node_filter(), 2769 2769 _forward_filter(capacity, flow, tolerance), … … 2847 2847 2848 2848 /// Constructor 2849 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2849 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2850 2850 : _adaptor(&adaptor) {} 2851 2851 … … 3424 3424 /// to get a node map of the split digraph. 3425 3425 /// Its value type is inherited from the first node map type (\c IN). 3426 /// \tparam IN The type of the node map for the in-nodes. 3426 /// \tparam IN The type of the node map for the in-nodes. 3427 3427 /// \tparam OUT The type of the node map for the out-nodes. 3428 3428 template <typename IN, typename OUT>
Note: See TracChangeset
for help on using the changeset viewer.