Changeset 1159:7fdaa05a69a1 in lemon for lemon/adaptors.h
- Timestamp:
- 09/13/12 11:56:19 (12 years ago)
- Branch:
- default
- Children:
- 1160:00f8d9f9920d, 1401:cd72eae05bdf
- Parents:
- 1153:4bb9e72e1a41 (diff), 1157:761fe0846f49 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/adaptors.h
r956 r1159 1372 1372 /// and edge filter maps. 1373 1373 SubGraph(GR& graph, NF& node_filter, EF& edge_filter) { 1374 initialize(graph, node_filter, edge_filter);1374 this->initialize(graph, node_filter, edge_filter); 1375 1375 } 1376 1376 … … 2278 2278 /// Creates an undirected graph from the given digraph. 2279 2279 Undirector(DGR& digraph) { 2280 initialize(digraph);2280 this->initialize(digraph); 2281 2281 } 2282 2282 -
lemon/adaptors.h
r1157 r1159 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-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 361 361 /// parameter is set to be \c const. 362 362 /// 363 /// This class provides item counting in the same time as the adapted 364 /// digraph structure. 365 /// 363 366 /// \tparam DGR The type of the adapted digraph. 364 367 /// It must conform to the \ref concepts::Digraph "Digraph" concept. … … 419 422 Parent::initialize(digraph); 420 423 _node_filter = &node_filter; 421 _arc_filter = &arc_filter; 424 _arc_filter = &arc_filter; 422 425 } 423 426 … … 506 509 507 510 template <typename V> 508 class NodeMap 509 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 510 511 class NodeMap 512 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 513 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 511 514 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 512 515 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 513 516 514 517 public: … … 533 536 534 537 template <typename V> 535 class ArcMap 538 class ArcMap 536 539 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 537 540 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 538 541 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 539 542 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; … … 580 583 Parent::initialize(digraph); 581 584 _node_filter = &node_filter; 582 _arc_filter = &arc_filter; 585 _arc_filter = &arc_filter; 583 586 } 584 587 … … 649 652 650 653 template <typename V> 651 class NodeMap 654 class NodeMap 652 655 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 653 656 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 654 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 657 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 655 658 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 656 659 … … 676 679 677 680 template <typename V> 678 class ArcMap 681 class ArcMap 679 682 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 680 683 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { … … 719 722 /// by adding or removing nodes or arcs, unless the \c GR template 720 723 /// parameter is set to be \c const. 724 /// 725 /// This class provides only linear time counting for nodes and arcs. 721 726 /// 722 727 /// \tparam DGR The type of the adapted digraph. … … 1017 1022 1018 1023 template <typename V> 1019 class NodeMap 1024 class NodeMap 1020 1025 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1021 1026 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1022 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1027 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1023 1028 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1024 1029 … … 1044 1049 1045 1050 template <typename V> 1046 class ArcMap 1051 class ArcMap 1047 1052 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1048 1053 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1049 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1054 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1050 1055 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1051 1056 … … 1071 1076 1072 1077 template <typename V> 1073 class EdgeMap 1078 class EdgeMap 1074 1079 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1075 1080 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1076 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1081 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1077 1082 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1078 1083 … … 1113 1118 NF* _node_filter; 1114 1119 EF* _edge_filter; 1115 SubGraphBase() 1116 1120 SubGraphBase() 1121 : Parent(), _node_filter(0), _edge_filter(0) { } 1117 1122 1118 1123 void initialize(GR& graph, NF& node_filter, EF& edge_filter) { … … 1215 1220 1216 1221 template <typename V> 1217 class NodeMap 1222 class NodeMap 1218 1223 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1219 1224 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1220 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1225 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1221 1226 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1222 1227 … … 1242 1247 1243 1248 template <typename V> 1244 class ArcMap 1249 class ArcMap 1245 1250 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1246 1251 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1247 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1252 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1248 1253 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1249 1254 … … 1269 1274 1270 1275 template <typename V> 1271 class EdgeMap 1276 class EdgeMap 1272 1277 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1273 1278 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1274 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1275 1279 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1280 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1276 1281 1277 1282 public: … … 1314 1319 /// by adding or removing nodes or edges, unless the \c GR template 1315 1320 /// parameter is set to be \c const. 1321 /// 1322 /// This class provides only linear time counting for nodes, edges and arcs. 1316 1323 /// 1317 1324 /// \tparam GR The type of the adapted graph. … … 1471 1478 /// by adding or removing nodes or arcs/edges, unless the \c GR template 1472 1479 /// parameter is set to be \c const. 1480 /// 1481 /// This class provides only linear time item counting. 1473 1482 /// 1474 1483 /// \tparam GR The type of the adapted digraph or graph. … … 1496 1505 #endif 1497 1506 typedef DigraphAdaptorExtender< 1498 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1507 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1499 1508 true> > Parent; 1500 1509 … … 1517 1526 /// Creates a subgraph for the given digraph or graph with the 1518 1527 /// given node filter map. 1519 FilterNodes(GR& graph, NF& node_filter) 1528 FilterNodes(GR& graph, NF& node_filter) 1520 1529 : Parent(), const_true_map() 1521 1530 { … … 1555 1564 typename enable_if<UndirectedTagIndicator<GR> >::type> : 1556 1565 public GraphAdaptorExtender< 1557 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1566 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1558 1567 true> > { 1559 1568 1560 1569 typedef GraphAdaptorExtender< 1561 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1570 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1562 1571 true> > Parent; 1563 1572 … … 1619 1628 /// by adding or removing nodes or arcs, unless the \c GR template 1620 1629 /// parameter is set to be \c const. 1630 /// 1631 /// This class provides only linear time counting for nodes and arcs. 1621 1632 /// 1622 1633 /// \tparam DGR The type of the adapted digraph. … … 1643 1654 #endif 1644 1655 typedef DigraphAdaptorExtender< 1645 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1656 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1646 1657 AF, false> > Parent; 1647 1658 … … 1729 1740 /// by adding or removing nodes or edges, unless the \c GR template 1730 1741 /// parameter is set to be \c const. 1742 /// 1743 /// This class provides only linear time counting for nodes, edges and arcs. 1731 1744 /// 1732 1745 /// \tparam GR The type of the adapted graph. … … 1749 1762 class FilterEdges : 1750 1763 public GraphAdaptorExtender< 1751 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1764 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 1752 1765 EF, false> > { 1753 1766 #endif 1754 1767 typedef GraphAdaptorExtender< 1755 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1768 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1756 1769 EF, false> > Parent; 1757 1770 … … 1778 1791 /// Creates a subgraph for the given graph with the given edge 1779 1792 /// filter map. 1780 FilterEdges(GR& graph, EF& edge_filter) 1793 FilterEdges(GR& graph, EF& edge_filter) 1781 1794 : Parent(), const_true_map() { 1782 1795 Parent::initialize(graph, const_true_map, edge_filter); … … 1846 1859 bool _forward; 1847 1860 1848 Arc(const Edge& edge, bool forward) 1861 Arc(const Edge& edge, bool forward) 1849 1862 : _edge(edge), _forward(forward) {} 1850 1863 … … 2086 2099 2087 2100 ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value) 2088 : _forward(*adaptor._digraph, value), 2101 : _forward(*adaptor._digraph, value), 2089 2102 _backward(*adaptor._digraph, value) {} 2090 2103 … … 2204 2217 typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier; 2205 2218 EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); } 2206 2219 2207 2220 typedef EdgeNotifier ArcNotifier; 2208 2221 ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); } … … 2232 2245 /// by adding or removing nodes or edges, unless the \c GR template 2233 2246 /// parameter is set to be \c const. 2247 /// 2248 /// This class provides item counting in the same time as the adapted 2249 /// digraph structure. 2234 2250 /// 2235 2251 /// \tparam DGR The type of the adapted digraph. … … 2535 2551 /// by adding or removing nodes or arcs, unless the \c GR template 2536 2552 /// parameter is set to be \c const. 2553 /// 2554 /// This class provides item counting in the same time as the adapted 2555 /// graph structure. 2537 2556 /// 2538 2557 /// \tparam GR The type of the adapted graph. … … 2679 2698 /// This class conforms to the \ref concepts::Digraph "Digraph" concept. 2680 2699 /// 2700 /// This class provides only linear time counting for nodes and arcs. 2701 /// 2681 2702 /// \tparam DGR The type of the adapted digraph. 2682 2703 /// It must conform to the \ref concepts::Digraph "Digraph" concept. … … 2708 2729 typename FM = CM, 2709 2730 typename TL = Tolerance<typename CM::Value> > 2710 class ResidualDigraph 2731 class ResidualDigraph 2711 2732 : public SubDigraph< 2712 2733 Undirector<const DGR>, … … 2765 2786 ResidualDigraph(const DGR& digraph, const CM& capacity, 2766 2787 FM& flow, const TL& tolerance = Tolerance()) 2767 : Parent(), _capacity(&capacity), _flow(&flow), 2788 : Parent(), _capacity(&capacity), _flow(&flow), 2768 2789 _graph(digraph), _node_filter(), 2769 2790 _forward_filter(capacity, flow, tolerance), … … 2847 2868 2848 2869 /// Constructor 2849 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2870 ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 2850 2871 : _adaptor(&adaptor) {} 2851 2872 … … 3326 3347 /// in the adaptor. 3327 3348 /// 3349 /// This class provides item counting in the same time as the adapted 3350 /// digraph structure. 3351 /// 3328 3352 /// \tparam DGR The type of the adapted digraph. 3329 3353 /// It must conform to the \ref concepts::Digraph "Digraph" concept. … … 3424 3448 /// to get a node map of the split digraph. 3425 3449 /// 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. 3450 /// \tparam IN The type of the node map for the in-nodes. 3427 3451 /// \tparam OUT The type of the node map for the out-nodes. 3428 3452 template <typename IN, typename OUT>
Note: See TracChangeset
for help on using the changeset viewer.