0
19
0
92
74
37
28
18
36
7
2
| ... | ... |
@@ -104,23 +104,21 @@ |
| 104 | 104 |
typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier; |
| 105 | 105 |
NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
|
| 106 | 106 |
|
| 107 | 107 |
typedef typename ItemSetTraits<DGR, Arc>::ItemNotifier ArcNotifier; |
| 108 | 108 |
ArcNotifier& notifier(Arc) const { return _digraph->notifier(Arc()); }
|
| 109 | 109 |
|
| 110 | 110 |
template <typename V> |
| 111 | 111 |
class NodeMap : public DGR::template NodeMap<V> {
|
| 112 |
typedef typename DGR::template NodeMap<V> Parent; |
|
| 113 |
|
|
| 112 | 114 |
public: |
| 113 |
|
|
| 114 |
typedef typename DGR::template NodeMap<V> Parent; |
|
| 115 |
|
|
| 116 | 115 |
explicit NodeMap(const Adaptor& adaptor) |
| 117 | 116 |
: Parent(*adaptor._digraph) {}
|
| 118 |
|
|
| 119 | 117 |
NodeMap(const Adaptor& adaptor, const V& value) |
| 120 | 118 |
: Parent(*adaptor._digraph, value) { }
|
| 121 | 119 |
|
| 122 | 120 |
private: |
| 123 | 121 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 124 | 122 |
return operator=<NodeMap>(cmap); |
| 125 | 123 |
} |
| 126 | 124 |
|
| ... | ... |
@@ -129,23 +127,21 @@ |
| 129 | 127 |
Parent::operator=(cmap); |
| 130 | 128 |
return *this; |
| 131 | 129 |
} |
| 132 | 130 |
|
| 133 | 131 |
}; |
| 134 | 132 |
|
| 135 | 133 |
template <typename V> |
| 136 | 134 |
class ArcMap : public DGR::template ArcMap<V> {
|
| 135 |
typedef typename DGR::template ArcMap<V> Parent; |
|
| 136 |
|
|
| 137 | 137 |
public: |
| 138 |
|
|
| 139 |
typedef typename DGR::template ArcMap<V> Parent; |
|
| 140 |
|
|
| 141 | 138 |
explicit ArcMap(const DigraphAdaptorBase<DGR>& adaptor) |
| 142 | 139 |
: Parent(*adaptor._digraph) {}
|
| 143 |
|
|
| 144 | 140 |
ArcMap(const DigraphAdaptorBase<DGR>& adaptor, const V& value) |
| 145 | 141 |
: Parent(*adaptor._digraph, value) {}
|
| 146 | 142 |
|
| 147 | 143 |
private: |
| 148 | 144 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 149 | 145 |
return operator=<ArcMap>(cmap); |
| 150 | 146 |
} |
| 151 | 147 |
|
| ... | ... |
@@ -250,18 +246,19 @@ |
| 250 | 246 |
typedef typename ItemSetTraits<GR, Arc>::ItemNotifier ArcNotifier; |
| 251 | 247 |
ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
|
| 252 | 248 |
|
| 253 | 249 |
typedef typename ItemSetTraits<GR, Edge>::ItemNotifier EdgeNotifier; |
| 254 | 250 |
EdgeNotifier& notifier(Edge) const { return _graph->notifier(Edge()); }
|
| 255 | 251 |
|
| 256 | 252 |
template <typename V> |
| 257 | 253 |
class NodeMap : public GR::template NodeMap<V> {
|
| 254 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 255 |
|
|
| 258 | 256 |
public: |
| 259 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 260 | 257 |
explicit NodeMap(const GraphAdaptorBase<GR>& adapter) |
| 261 | 258 |
: Parent(*adapter._graph) {}
|
| 262 | 259 |
NodeMap(const GraphAdaptorBase<GR>& adapter, const V& value) |
| 263 | 260 |
: Parent(*adapter._graph, value) {}
|
| 264 | 261 |
|
| 265 | 262 |
private: |
| 266 | 263 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 267 | 264 |
return operator=<NodeMap>(cmap); |
| ... | ... |
@@ -272,18 +269,19 @@ |
| 272 | 269 |
Parent::operator=(cmap); |
| 273 | 270 |
return *this; |
| 274 | 271 |
} |
| 275 | 272 |
|
| 276 | 273 |
}; |
| 277 | 274 |
|
| 278 | 275 |
template <typename V> |
| 279 | 276 |
class ArcMap : public GR::template ArcMap<V> {
|
| 277 |
typedef typename GR::template ArcMap<V> Parent; |
|
| 278 |
|
|
| 280 | 279 |
public: |
| 281 |
typedef typename GR::template ArcMap<V> Parent; |
|
| 282 | 280 |
explicit ArcMap(const GraphAdaptorBase<GR>& adapter) |
| 283 | 281 |
: Parent(*adapter._graph) {}
|
| 284 | 282 |
ArcMap(const GraphAdaptorBase<GR>& adapter, const V& value) |
| 285 | 283 |
: Parent(*adapter._graph, value) {}
|
| 286 | 284 |
|
| 287 | 285 |
private: |
| 288 | 286 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 289 | 287 |
return operator=<ArcMap>(cmap); |
| ... | ... |
@@ -293,18 +291,19 @@ |
| 293 | 291 |
ArcMap& operator=(const CMap& cmap) {
|
| 294 | 292 |
Parent::operator=(cmap); |
| 295 | 293 |
return *this; |
| 296 | 294 |
} |
| 297 | 295 |
}; |
| 298 | 296 |
|
| 299 | 297 |
template <typename V> |
| 300 | 298 |
class EdgeMap : public GR::template EdgeMap<V> {
|
| 299 |
typedef typename GR::template EdgeMap<V> Parent; |
|
| 300 |
|
|
| 301 | 301 |
public: |
| 302 |
typedef typename GR::template EdgeMap<V> Parent; |
|
| 303 | 302 |
explicit EdgeMap(const GraphAdaptorBase<GR>& adapter) |
| 304 | 303 |
: Parent(*adapter._graph) {}
|
| 305 | 304 |
EdgeMap(const GraphAdaptorBase<GR>& adapter, const V& value) |
| 306 | 305 |
: Parent(*adapter._graph, value) {}
|
| 307 | 306 |
|
| 308 | 307 |
private: |
| 309 | 308 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
| 310 | 309 |
return operator=<EdgeMap>(cmap); |
| ... | ... |
@@ -316,19 +315,19 @@ |
| 316 | 315 |
return *this; |
| 317 | 316 |
} |
| 318 | 317 |
}; |
| 319 | 318 |
|
| 320 | 319 |
}; |
| 321 | 320 |
|
| 322 | 321 |
template <typename DGR> |
| 323 | 322 |
class ReverseDigraphBase : public DigraphAdaptorBase<DGR> {
|
| 323 |
typedef DigraphAdaptorBase<DGR> Parent; |
|
| 324 | 324 |
public: |
| 325 | 325 |
typedef DGR Digraph; |
| 326 |
typedef DigraphAdaptorBase<DGR> Parent; |
|
| 327 | 326 |
protected: |
| 328 | 327 |
ReverseDigraphBase() : Parent() { }
|
| 329 | 328 |
public: |
| 330 | 329 |
typedef typename Parent::Node Node; |
| 331 | 330 |
typedef typename Parent::Arc Arc; |
| 332 | 331 |
|
| 333 | 332 |
void firstIn(Arc& a, const Node& n) const { Parent::firstOut(a, n); }
|
| 334 | 333 |
void firstOut(Arc& a, const Node& n ) const { Parent::firstIn(a, n); }
|
| ... | ... |
@@ -369,20 +368,20 @@ |
| 369 | 368 |
/// digraph are convertible to each other. |
| 370 | 369 |
template<typename DGR> |
| 371 | 370 |
#ifdef DOXYGEN |
| 372 | 371 |
class ReverseDigraph {
|
| 373 | 372 |
#else |
| 374 | 373 |
class ReverseDigraph : |
| 375 | 374 |
public DigraphAdaptorExtender<ReverseDigraphBase<DGR> > {
|
| 376 | 375 |
#endif |
| 376 |
typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent; |
|
| 377 | 377 |
public: |
| 378 | 378 |
/// The type of the adapted digraph. |
| 379 | 379 |
typedef DGR Digraph; |
| 380 |
typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent; |
|
| 381 | 380 |
protected: |
| 382 | 381 |
ReverseDigraph() { }
|
| 383 | 382 |
public: |
| 384 | 383 |
|
| 385 | 384 |
/// \brief Constructor |
| 386 | 385 |
/// |
| 387 | 386 |
/// Creates a reverse digraph adaptor for the given digraph. |
| 388 | 387 |
explicit ReverseDigraph(DGR& digraph) {
|
| ... | ... |
@@ -398,23 +397,23 @@ |
| 398 | 397 |
template<typename DGR> |
| 399 | 398 |
ReverseDigraph<const DGR> reverseDigraph(const DGR& digraph) {
|
| 400 | 399 |
return ReverseDigraph<const DGR>(digraph); |
| 401 | 400 |
} |
| 402 | 401 |
|
| 403 | 402 |
|
| 404 | 403 |
template <typename DGR, typename NF, typename AF, bool ch = true> |
| 405 | 404 |
class SubDigraphBase : public DigraphAdaptorBase<DGR> {
|
| 405 |
typedef DigraphAdaptorBase<DGR> Parent; |
|
| 406 | 406 |
public: |
| 407 | 407 |
typedef DGR Digraph; |
| 408 | 408 |
typedef NF NodeFilterMap; |
| 409 | 409 |
typedef AF ArcFilterMap; |
| 410 | 410 |
|
| 411 | 411 |
typedef SubDigraphBase Adaptor; |
| 412 |
typedef DigraphAdaptorBase<DGR> Parent; |
|
| 413 | 412 |
protected: |
| 414 | 413 |
NF* _node_filter; |
| 415 | 414 |
AF* _arc_filter; |
| 416 | 415 |
SubDigraphBase() |
| 417 | 416 |
: Parent(), _node_filter(0), _arc_filter(0) { }
|
| 418 | 417 |
|
| 419 | 418 |
void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
|
| 420 | 419 |
Parent::initialize(digraph); |
| ... | ... |
@@ -504,20 +503,21 @@ |
| 504 | 503 |
} |
| 505 | 504 |
|
| 506 | 505 |
public: |
| 507 | 506 |
|
| 508 | 507 |
template <typename V> |
| 509 | 508 |
class NodeMap |
| 510 | 509 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
| 511 | 510 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
|
| 511 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
|
| 512 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; |
|
| 513 |
|
|
| 512 | 514 |
public: |
| 513 | 515 |
typedef V Value; |
| 514 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
|
| 515 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; |
|
| 516 | 516 |
|
| 517 | 517 |
NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) |
| 518 | 518 |
: Parent(adaptor) {}
|
| 519 | 519 |
NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor, const V& value) |
| 520 | 520 |
: Parent(adaptor, value) {}
|
| 521 | 521 |
|
| 522 | 522 |
private: |
| 523 | 523 |
NodeMap& operator=(const NodeMap& cmap) {
|
| ... | ... |
@@ -530,20 +530,21 @@ |
| 530 | 530 |
return *this; |
| 531 | 531 |
} |
| 532 | 532 |
}; |
| 533 | 533 |
|
| 534 | 534 |
template <typename V> |
| 535 | 535 |
class ArcMap |
| 536 | 536 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
| 537 | 537 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
|
| 538 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
|
| 539 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; |
|
| 540 |
|
|
| 538 | 541 |
public: |
| 539 | 542 |
typedef V Value; |
| 540 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, |
|
| 541 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; |
|
| 542 | 543 |
|
| 543 | 544 |
ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) |
| 544 | 545 |
: Parent(adaptor) {}
|
| 545 | 546 |
ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor, const V& value) |
| 546 | 547 |
: Parent(adaptor, value) {}
|
| 547 | 548 |
|
| 548 | 549 |
private: |
| 549 | 550 |
ArcMap& operator=(const ArcMap& cmap) {
|
| ... | ... |
@@ -557,23 +558,23 @@ |
| 557 | 558 |
} |
| 558 | 559 |
}; |
| 559 | 560 |
|
| 560 | 561 |
}; |
| 561 | 562 |
|
| 562 | 563 |
template <typename DGR, typename NF, typename AF> |
| 563 | 564 |
class SubDigraphBase<DGR, NF, AF, false> |
| 564 | 565 |
: public DigraphAdaptorBase<DGR> {
|
| 566 |
typedef DigraphAdaptorBase<DGR> Parent; |
|
| 565 | 567 |
public: |
| 566 | 568 |
typedef DGR Digraph; |
| 567 | 569 |
typedef NF NodeFilterMap; |
| 568 | 570 |
typedef AF ArcFilterMap; |
| 569 | 571 |
|
| 570 | 572 |
typedef SubDigraphBase Adaptor; |
| 571 |
typedef DigraphAdaptorBase<Digraph> Parent; |
|
| 572 | 573 |
protected: |
| 573 | 574 |
NF* _node_filter; |
| 574 | 575 |
AF* _arc_filter; |
| 575 | 576 |
SubDigraphBase() |
| 576 | 577 |
: Parent(), _node_filter(0), _arc_filter(0) { }
|
| 577 | 578 |
|
| 578 | 579 |
void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
|
| 579 | 580 |
Parent::initialize(digraph); |
| ... | ... |
@@ -645,20 +646,21 @@ |
| 645 | 646 |
} |
| 646 | 647 |
return arc; |
| 647 | 648 |
} |
| 648 | 649 |
|
| 649 | 650 |
template <typename V> |
| 650 | 651 |
class NodeMap |
| 651 | 652 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
| 652 | 653 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
|
| 654 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
|
| 655 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; |
|
| 656 |
|
|
| 653 | 657 |
public: |
| 654 | 658 |
typedef V Value; |
| 655 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
|
| 656 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; |
|
| 657 | 659 |
|
| 658 | 660 |
NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) |
| 659 | 661 |
: Parent(adaptor) {}
|
| 660 | 662 |
NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor, const V& value) |
| 661 | 663 |
: Parent(adaptor, value) {}
|
| 662 | 664 |
|
| 663 | 665 |
private: |
| 664 | 666 |
NodeMap& operator=(const NodeMap& cmap) {
|
| ... | ... |
@@ -671,20 +673,21 @@ |
| 671 | 673 |
return *this; |
| 672 | 674 |
} |
| 673 | 675 |
}; |
| 674 | 676 |
|
| 675 | 677 |
template <typename V> |
| 676 | 678 |
class ArcMap |
| 677 | 679 |
: public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
| 678 | 680 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
|
| 681 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
|
| 682 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; |
|
| 683 |
|
|
| 679 | 684 |
public: |
| 680 | 685 |
typedef V Value; |
| 681 |
typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, |
|
| 682 |
LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; |
|
| 683 | 686 |
|
| 684 | 687 |
ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) |
| 685 | 688 |
: Parent(adaptor) {}
|
| 686 | 689 |
ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor, const V& value) |
| 687 | 690 |
: Parent(adaptor, value) {}
|
| 688 | 691 |
|
| 689 | 692 |
private: |
| 690 | 693 |
ArcMap& operator=(const ArcMap& cmap) {
|
| ... | ... |
@@ -858,23 +861,23 @@ |
| 858 | 861 |
const NF& node_filter, const AF& arc_filter) {
|
| 859 | 862 |
return SubDigraph<const DGR, const NF, const AF> |
| 860 | 863 |
(digraph, node_filter, arc_filter); |
| 861 | 864 |
} |
| 862 | 865 |
|
| 863 | 866 |
|
| 864 | 867 |
template <typename GR, typename NF, typename EF, bool ch = true> |
| 865 | 868 |
class SubGraphBase : public GraphAdaptorBase<GR> {
|
| 869 |
typedef GraphAdaptorBase<GR> Parent; |
|
| 866 | 870 |
public: |
| 867 | 871 |
typedef GR Graph; |
| 868 | 872 |
typedef NF NodeFilterMap; |
| 869 | 873 |
typedef EF EdgeFilterMap; |
| 870 | 874 |
|
| 871 | 875 |
typedef SubGraphBase Adaptor; |
| 872 |
typedef GraphAdaptorBase<GR> Parent; |
|
| 873 | 876 |
protected: |
| 874 | 877 |
|
| 875 | 878 |
NF* _node_filter; |
| 876 | 879 |
EF* _edge_filter; |
| 877 | 880 |
|
| 878 | 881 |
SubGraphBase() |
| 879 | 882 |
: Parent(), _node_filter(0), _edge_filter(0) { }
|
| 880 | 883 |
|
| ... | ... |
@@ -1011,20 +1014,21 @@ |
| 1011 | 1014 |
} |
| 1012 | 1015 |
return edge; |
| 1013 | 1016 |
} |
| 1014 | 1017 |
|
| 1015 | 1018 |
template <typename V> |
| 1016 | 1019 |
class NodeMap |
| 1017 | 1020 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
| 1018 | 1021 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
|
| 1022 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
| 1023 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; |
|
| 1024 |
|
|
| 1019 | 1025 |
public: |
| 1020 | 1026 |
typedef V Value; |
| 1021 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
| 1022 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; |
|
| 1023 | 1027 |
|
| 1024 | 1028 |
NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) |
| 1025 | 1029 |
: Parent(adaptor) {}
|
| 1026 | 1030 |
NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value) |
| 1027 | 1031 |
: Parent(adaptor, value) {}
|
| 1028 | 1032 |
|
| 1029 | 1033 |
private: |
| 1030 | 1034 |
NodeMap& operator=(const NodeMap& cmap) {
|
| ... | ... |
@@ -1037,20 +1041,21 @@ |
| 1037 | 1041 |
return *this; |
| 1038 | 1042 |
} |
| 1039 | 1043 |
}; |
| 1040 | 1044 |
|
| 1041 | 1045 |
template <typename V> |
| 1042 | 1046 |
class ArcMap |
| 1043 | 1047 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
| 1044 | 1048 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
|
| 1049 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
| 1050 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; |
|
| 1051 |
|
|
| 1045 | 1052 |
public: |
| 1046 | 1053 |
typedef V Value; |
| 1047 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
| 1048 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; |
|
| 1049 | 1054 |
|
| 1050 | 1055 |
ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) |
| 1051 | 1056 |
: Parent(adaptor) {}
|
| 1052 | 1057 |
ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value) |
| 1053 | 1058 |
: Parent(adaptor, value) {}
|
| 1054 | 1059 |
|
| 1055 | 1060 |
private: |
| 1056 | 1061 |
ArcMap& operator=(const ArcMap& cmap) {
|
| ... | ... |
@@ -1063,20 +1068,21 @@ |
| 1063 | 1068 |
return *this; |
| 1064 | 1069 |
} |
| 1065 | 1070 |
}; |
| 1066 | 1071 |
|
| 1067 | 1072 |
template <typename V> |
| 1068 | 1073 |
class EdgeMap |
| 1069 | 1074 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
| 1070 | 1075 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
|
| 1076 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
| 1077 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; |
|
| 1078 |
|
|
| 1071 | 1079 |
public: |
| 1072 | 1080 |
typedef V Value; |
| 1073 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, |
|
| 1074 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; |
|
| 1075 | 1081 |
|
| 1076 | 1082 |
EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) |
| 1077 | 1083 |
: Parent(adaptor) {}
|
| 1078 | 1084 |
|
| 1079 | 1085 |
EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor, const V& value) |
| 1080 | 1086 |
: Parent(adaptor, value) {}
|
| 1081 | 1087 |
|
| 1082 | 1088 |
private: |
| ... | ... |
@@ -1091,23 +1097,23 @@ |
| 1091 | 1097 |
} |
| 1092 | 1098 |
}; |
| 1093 | 1099 |
|
| 1094 | 1100 |
}; |
| 1095 | 1101 |
|
| 1096 | 1102 |
template <typename GR, typename NF, typename EF> |
| 1097 | 1103 |
class SubGraphBase<GR, NF, EF, false> |
| 1098 | 1104 |
: public GraphAdaptorBase<GR> {
|
| 1105 |
typedef GraphAdaptorBase<GR> Parent; |
|
| 1099 | 1106 |
public: |
| 1100 | 1107 |
typedef GR Graph; |
| 1101 | 1108 |
typedef NF NodeFilterMap; |
| 1102 | 1109 |
typedef EF EdgeFilterMap; |
| 1103 | 1110 |
|
| 1104 | 1111 |
typedef SubGraphBase Adaptor; |
| 1105 |
typedef GraphAdaptorBase<GR> Parent; |
|
| 1106 | 1112 |
protected: |
| 1107 | 1113 |
NF* _node_filter; |
| 1108 | 1114 |
EF* _edge_filter; |
| 1109 | 1115 |
SubGraphBase() |
| 1110 | 1116 |
: Parent(), _node_filter(0), _edge_filter(0) { }
|
| 1111 | 1117 |
|
| 1112 | 1118 |
void initialize(GR& graph, NF& node_filter, EF& edge_filter) {
|
| 1113 | 1119 |
Parent::initialize(graph); |
| ... | ... |
@@ -1206,20 +1212,21 @@ |
| 1206 | 1212 |
} |
| 1207 | 1213 |
return edge; |
| 1208 | 1214 |
} |
| 1209 | 1215 |
|
| 1210 | 1216 |
template <typename V> |
| 1211 | 1217 |
class NodeMap |
| 1212 | 1218 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
| 1213 | 1219 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
|
| 1220 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
| 1221 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; |
|
| 1222 |
|
|
| 1214 | 1223 |
public: |
| 1215 | 1224 |
typedef V Value; |
| 1216 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
| 1217 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; |
|
| 1218 | 1225 |
|
| 1219 | 1226 |
NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) |
| 1220 | 1227 |
: Parent(adaptor) {}
|
| 1221 | 1228 |
NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value) |
| 1222 | 1229 |
: Parent(adaptor, value) {}
|
| 1223 | 1230 |
|
| 1224 | 1231 |
private: |
| 1225 | 1232 |
NodeMap& operator=(const NodeMap& cmap) {
|
| ... | ... |
@@ -1232,20 +1239,21 @@ |
| 1232 | 1239 |
return *this; |
| 1233 | 1240 |
} |
| 1234 | 1241 |
}; |
| 1235 | 1242 |
|
| 1236 | 1243 |
template <typename V> |
| 1237 | 1244 |
class ArcMap |
| 1238 | 1245 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
| 1239 | 1246 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
|
| 1247 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
| 1248 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; |
|
| 1249 |
|
|
| 1240 | 1250 |
public: |
| 1241 | 1251 |
typedef V Value; |
| 1242 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
| 1243 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; |
|
| 1244 | 1252 |
|
| 1245 | 1253 |
ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor) |
| 1246 | 1254 |
: Parent(adaptor) {}
|
| 1247 | 1255 |
ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value) |
| 1248 | 1256 |
: Parent(adaptor, value) {}
|
| 1249 | 1257 |
|
| 1250 | 1258 |
private: |
| 1251 | 1259 |
ArcMap& operator=(const ArcMap& cmap) {
|
| ... | ... |
@@ -1258,20 +1266,21 @@ |
| 1258 | 1266 |
return *this; |
| 1259 | 1267 |
} |
| 1260 | 1268 |
}; |
| 1261 | 1269 |
|
| 1262 | 1270 |
template <typename V> |
| 1263 | 1271 |
class EdgeMap |
| 1264 | 1272 |
: public SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
| 1265 | 1273 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
|
| 1274 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
| 1275 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; |
|
| 1276 |
|
|
| 1266 | 1277 |
public: |
| 1267 | 1278 |
typedef V Value; |
| 1268 |
typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, |
|
| 1269 |
LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; |
|
| 1270 | 1279 |
|
| 1271 | 1280 |
EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) |
| 1272 | 1281 |
: Parent(adaptor) {}
|
| 1273 | 1282 |
|
| 1274 | 1283 |
EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor, const V& value) |
| 1275 | 1284 |
: Parent(adaptor, value) {}
|
| 1276 | 1285 |
|
| 1277 | 1286 |
private: |
| ... | ... |
@@ -1480,25 +1489,25 @@ |
| 1480 | 1489 |
template<typename GR, |
| 1481 | 1490 |
typename NF = typename GR::template NodeMap<bool>, |
| 1482 | 1491 |
typename Enable = void> |
| 1483 | 1492 |
class FilterNodes : |
| 1484 | 1493 |
public DigraphAdaptorExtender< |
| 1485 | 1494 |
SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, |
| 1486 | 1495 |
true> > {
|
| 1487 | 1496 |
#endif |
| 1488 |
public: |
|
| 1489 |
|
|
| 1490 |
typedef GR Digraph; |
|
| 1491 |
typedef NF NodeFilterMap; |
|
| 1492 |
|
|
| 1493 | 1497 |
typedef DigraphAdaptorExtender< |
| 1494 | 1498 |
SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, |
| 1495 | 1499 |
true> > Parent; |
| 1496 | 1500 |
|
| 1501 |
public: |
|
| 1502 |
|
|
| 1503 |
typedef GR Digraph; |
|
| 1504 |
typedef NF NodeFilterMap; |
|
| 1505 |
|
|
| 1497 | 1506 |
typedef typename Parent::Node Node; |
| 1498 | 1507 |
|
| 1499 | 1508 |
protected: |
| 1500 | 1509 |
ConstMap<typename Digraph::Arc, Const<bool, true> > const_true_map; |
| 1501 | 1510 |
|
| 1502 | 1511 |
FilterNodes() : const_true_map() {}
|
| 1503 | 1512 |
|
| 1504 | 1513 |
public: |
| ... | ... |
@@ -1543,24 +1552,27 @@ |
| 1543 | 1552 |
|
| 1544 | 1553 |
template<typename GR, typename NF> |
| 1545 | 1554 |
class FilterNodes<GR, NF, |
| 1546 | 1555 |
typename enable_if<UndirectedTagIndicator<GR> >::type> : |
| 1547 | 1556 |
public GraphAdaptorExtender< |
| 1548 | 1557 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, |
| 1549 | 1558 |
true> > {
|
| 1550 | 1559 |
|
| 1551 |
public: |
|
| 1552 |
typedef GR Graph; |
|
| 1553 |
typedef NF NodeFilterMap; |
|
| 1554 | 1560 |
typedef GraphAdaptorExtender< |
| 1555 | 1561 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, |
| 1556 | 1562 |
true> > Parent; |
| 1557 | 1563 |
|
| 1564 |
public: |
|
| 1565 |
|
|
| 1566 |
typedef GR Graph; |
|
| 1567 |
typedef NF NodeFilterMap; |
|
| 1568 |
|
|
| 1558 | 1569 |
typedef typename Parent::Node Node; |
| 1570 |
|
|
| 1559 | 1571 |
protected: |
| 1560 | 1572 |
ConstMap<typename GR::Edge, Const<bool, true> > const_true_map; |
| 1561 | 1573 |
|
| 1562 | 1574 |
FilterNodes() : const_true_map() {}
|
| 1563 | 1575 |
|
| 1564 | 1576 |
public: |
| 1565 | 1577 |
|
| 1566 | 1578 |
FilterNodes(GR& graph, NodeFilterMap& node_filter) : |
| ... | ... |
@@ -1624,26 +1636,27 @@ |
| 1624 | 1636 |
#else |
| 1625 | 1637 |
template<typename DGR, |
| 1626 | 1638 |
typename AF = typename DGR::template ArcMap<bool> > |
| 1627 | 1639 |
class FilterArcs : |
| 1628 | 1640 |
public DigraphAdaptorExtender< |
| 1629 | 1641 |
SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, |
| 1630 | 1642 |
AF, false> > {
|
| 1631 | 1643 |
#endif |
| 1644 |
typedef DigraphAdaptorExtender< |
|
| 1645 |
SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, |
|
| 1646 |
AF, false> > Parent; |
|
| 1647 |
|
|
| 1632 | 1648 |
public: |
| 1649 |
|
|
| 1633 | 1650 |
/// The type of the adapted digraph. |
| 1634 | 1651 |
typedef DGR Digraph; |
| 1635 | 1652 |
/// The type of the arc filter map. |
| 1636 | 1653 |
typedef AF ArcFilterMap; |
| 1637 | 1654 |
|
| 1638 |
typedef DigraphAdaptorExtender< |
|
| 1639 |
SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, |
|
| 1640 |
AF, false> > Parent; |
|
| 1641 |
|
|
| 1642 | 1655 |
typedef typename Parent::Arc Arc; |
| 1643 | 1656 |
|
| 1644 | 1657 |
protected: |
| 1645 | 1658 |
ConstMap<typename DGR::Node, Const<bool, true> > const_true_map; |
| 1646 | 1659 |
|
| 1647 | 1660 |
FilterArcs() : const_true_map() {}
|
| 1648 | 1661 |
|
| 1649 | 1662 |
public: |
| ... | ... |
@@ -1733,26 +1746,27 @@ |
| 1733 | 1746 |
#else |
| 1734 | 1747 |
template<typename GR, |
| 1735 | 1748 |
typename EF = typename GR::template EdgeMap<bool> > |
| 1736 | 1749 |
class FilterEdges : |
| 1737 | 1750 |
public GraphAdaptorExtender< |
| 1738 | 1751 |
SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, |
| 1739 | 1752 |
EF, false> > {
|
| 1740 | 1753 |
#endif |
| 1754 |
typedef GraphAdaptorExtender< |
|
| 1755 |
SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, |
|
| 1756 |
EF, false> > Parent; |
|
| 1757 |
|
|
| 1741 | 1758 |
public: |
| 1759 |
|
|
| 1742 | 1760 |
/// The type of the adapted graph. |
| 1743 | 1761 |
typedef GR Graph; |
| 1744 | 1762 |
/// The type of the edge filter map. |
| 1745 | 1763 |
typedef EF EdgeFilterMap; |
| 1746 | 1764 |
|
| 1747 |
typedef GraphAdaptorExtender< |
|
| 1748 |
SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, |
|
| 1749 |
EF, false> > Parent; |
|
| 1750 |
|
|
| 1751 | 1765 |
typedef typename Parent::Edge Edge; |
| 1752 | 1766 |
|
| 1753 | 1767 |
protected: |
| 1754 | 1768 |
ConstMap<typename GR::Node, Const<bool, true> > const_true_map; |
| 1755 | 1769 |
|
| 1756 | 1770 |
FilterEdges() : const_true_map(true) {
|
| 1757 | 1771 |
Parent::setNodeFilterMap(const_true_map); |
| 1758 | 1772 |
} |
| ... | ... |
@@ -2106,20 +2120,20 @@ |
| 2106 | 2120 |
MapImpl _forward, _backward; |
| 2107 | 2121 |
|
| 2108 | 2122 |
}; |
| 2109 | 2123 |
|
| 2110 | 2124 |
public: |
| 2111 | 2125 |
|
| 2112 | 2126 |
template <typename V> |
| 2113 | 2127 |
class NodeMap : public DGR::template NodeMap<V> {
|
| 2128 |
typedef typename DGR::template NodeMap<V> Parent; |
|
| 2129 |
|
|
| 2114 | 2130 |
public: |
| 2115 |
|
|
| 2116 | 2131 |
typedef V Value; |
| 2117 |
typedef typename DGR::template NodeMap<Value> Parent; |
|
| 2118 | 2132 |
|
| 2119 | 2133 |
explicit NodeMap(const UndirectorBase<DGR>& adaptor) |
| 2120 | 2134 |
: Parent(*adaptor._digraph) {}
|
| 2121 | 2135 |
|
| 2122 | 2136 |
NodeMap(const UndirectorBase<DGR>& adaptor, const V& value) |
| 2123 | 2137 |
: Parent(*adaptor._digraph, value) { }
|
| 2124 | 2138 |
|
| 2125 | 2139 |
private: |
| ... | ... |
@@ -2132,21 +2146,21 @@ |
| 2132 | 2146 |
Parent::operator=(cmap); |
| 2133 | 2147 |
return *this; |
| 2134 | 2148 |
} |
| 2135 | 2149 |
|
| 2136 | 2150 |
}; |
| 2137 | 2151 |
|
| 2138 | 2152 |
template <typename V> |
| 2139 | 2153 |
class ArcMap |
| 2140 |
: public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > |
|
| 2141 |
{
|
|
| 2154 |
: public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > {
|
|
| 2155 |
typedef SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > Parent; |
|
| 2156 |
|
|
| 2142 | 2157 |
public: |
| 2143 | 2158 |
typedef V Value; |
| 2144 |
typedef SubMapExtender<Adaptor, ArcMapBase<V> > Parent; |
|
| 2145 | 2159 |
|
| 2146 | 2160 |
explicit ArcMap(const UndirectorBase<DGR>& adaptor) |
| 2147 | 2161 |
: Parent(adaptor) {}
|
| 2148 | 2162 |
|
| 2149 | 2163 |
ArcMap(const UndirectorBase<DGR>& adaptor, const V& value) |
| 2150 | 2164 |
: Parent(adaptor, value) {}
|
| 2151 | 2165 |
|
| 2152 | 2166 |
private: |
| ... | ... |
@@ -2158,20 +2172,20 @@ |
| 2158 | 2172 |
ArcMap& operator=(const CMap& cmap) {
|
| 2159 | 2173 |
Parent::operator=(cmap); |
| 2160 | 2174 |
return *this; |
| 2161 | 2175 |
} |
| 2162 | 2176 |
}; |
| 2163 | 2177 |
|
| 2164 | 2178 |
template <typename V> |
| 2165 | 2179 |
class EdgeMap : public Digraph::template ArcMap<V> {
|
| 2180 |
typedef typename Digraph::template ArcMap<V> Parent; |
|
| 2181 |
|
|
| 2166 | 2182 |
public: |
| 2167 |
|
|
| 2168 | 2183 |
typedef V Value; |
| 2169 |
typedef typename Digraph::template ArcMap<V> Parent; |
|
| 2170 | 2184 |
|
| 2171 | 2185 |
explicit EdgeMap(const UndirectorBase<DGR>& adaptor) |
| 2172 | 2186 |
: Parent(*adaptor._digraph) {}
|
| 2173 | 2187 |
|
| 2174 | 2188 |
EdgeMap(const UndirectorBase<DGR>& adaptor, const V& value) |
| 2175 | 2189 |
: Parent(*adaptor._digraph, value) {}
|
| 2176 | 2190 |
|
| 2177 | 2191 |
private: |
| ... | ... |
@@ -2233,20 +2247,20 @@ |
| 2233 | 2247 |
/// of the adapted digraph.) |
| 2234 | 2248 |
template<typename DGR> |
| 2235 | 2249 |
#ifdef DOXYGEN |
| 2236 | 2250 |
class Undirector {
|
| 2237 | 2251 |
#else |
| 2238 | 2252 |
class Undirector : |
| 2239 | 2253 |
public GraphAdaptorExtender<UndirectorBase<DGR> > {
|
| 2240 | 2254 |
#endif |
| 2255 |
typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent; |
|
| 2241 | 2256 |
public: |
| 2242 | 2257 |
/// The type of the adapted digraph. |
| 2243 | 2258 |
typedef DGR Digraph; |
| 2244 |
typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent; |
|
| 2245 | 2259 |
protected: |
| 2246 | 2260 |
Undirector() { }
|
| 2247 | 2261 |
public: |
| 2248 | 2262 |
|
| 2249 | 2263 |
/// \brief Constructor |
| 2250 | 2264 |
/// |
| 2251 | 2265 |
/// Creates an undirected graph from the given digraph. |
| 2252 | 2266 |
Undirector(DGR& digraph) {
|
| ... | ... |
@@ -2444,20 +2458,20 @@ |
| 2444 | 2458 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 2445 | 2459 |
NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); }
|
| 2446 | 2460 |
|
| 2447 | 2461 |
typedef typename ItemSetTraits<GR, Arc>::ItemNotifier ArcNotifier; |
| 2448 | 2462 |
ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
|
| 2449 | 2463 |
|
| 2450 | 2464 |
template <typename V> |
| 2451 | 2465 |
class NodeMap : public GR::template NodeMap<V> {
|
| 2466 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 2467 |
|
|
| 2452 | 2468 |
public: |
| 2453 | 2469 |
|
| 2454 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 2455 |
|
|
| 2456 | 2470 |
explicit NodeMap(const OrienterBase<GR, DM>& adapter) |
| 2457 | 2471 |
: Parent(*adapter._graph) {}
|
| 2458 | 2472 |
|
| 2459 | 2473 |
NodeMap(const OrienterBase<GR, DM>& adapter, const V& value) |
| 2460 | 2474 |
: Parent(*adapter._graph, value) {}
|
| 2461 | 2475 |
|
| 2462 | 2476 |
private: |
| 2463 | 2477 |
NodeMap& operator=(const NodeMap& cmap) {
|
| ... | ... |
@@ -2469,20 +2483,20 @@ |
| 2469 | 2483 |
Parent::operator=(cmap); |
| 2470 | 2484 |
return *this; |
| 2471 | 2485 |
} |
| 2472 | 2486 |
|
| 2473 | 2487 |
}; |
| 2474 | 2488 |
|
| 2475 | 2489 |
template <typename V> |
| 2476 | 2490 |
class ArcMap : public GR::template EdgeMap<V> {
|
| 2491 |
typedef typename Graph::template EdgeMap<V> Parent; |
|
| 2492 |
|
|
| 2477 | 2493 |
public: |
| 2478 | 2494 |
|
| 2479 |
typedef typename Graph::template EdgeMap<V> Parent; |
|
| 2480 |
|
|
| 2481 | 2495 |
explicit ArcMap(const OrienterBase<GR, DM>& adapter) |
| 2482 | 2496 |
: Parent(*adapter._graph) { }
|
| 2483 | 2497 |
|
| 2484 | 2498 |
ArcMap(const OrienterBase<GR, DM>& adapter, const V& value) |
| 2485 | 2499 |
: Parent(*adapter._graph, value) { }
|
| 2486 | 2500 |
|
| 2487 | 2501 |
private: |
| 2488 | 2502 |
ArcMap& operator=(const ArcMap& cmap) {
|
| ... | ... |
@@ -2541,27 +2555,29 @@ |
| 2541 | 2555 |
typename DM> |
| 2542 | 2556 |
class Orienter {
|
| 2543 | 2557 |
#else |
| 2544 | 2558 |
template<typename GR, |
| 2545 | 2559 |
typename DM = typename GR::template EdgeMap<bool> > |
| 2546 | 2560 |
class Orienter : |
| 2547 | 2561 |
public DigraphAdaptorExtender<OrienterBase<GR, DM> > {
|
| 2548 | 2562 |
#endif |
| 2563 |
typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent; |
|
| 2549 | 2564 |
public: |
| 2550 | 2565 |
|
| 2551 | 2566 |
/// The type of the adapted graph. |
| 2552 | 2567 |
typedef GR Graph; |
| 2553 | 2568 |
/// The type of the direction edge map. |
| 2554 | 2569 |
typedef DM DirectionMap; |
| 2555 | 2570 |
|
| 2556 |
typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent; |
|
| 2557 | 2571 |
typedef typename Parent::Arc Arc; |
| 2572 |
|
|
| 2558 | 2573 |
protected: |
| 2559 | 2574 |
Orienter() { }
|
| 2575 |
|
|
| 2560 | 2576 |
public: |
| 2561 | 2577 |
|
| 2562 | 2578 |
/// \brief Constructor |
| 2563 | 2579 |
/// |
| 2564 | 2580 |
/// Constructor of the adaptor. |
| 2565 | 2581 |
Orienter(GR& graph, DM& direction) {
|
| 2566 | 2582 |
Parent::initialize(graph, direction); |
| 2567 | 2583 |
} |
| ... | ... |
@@ -2861,20 +2877,21 @@ |
| 2861 | 2877 |
ResidualDigraph<DGR, CM, FM> |
| 2862 | 2878 |
residualDigraph(const DGR& digraph, const CM& capacity_map, FM& flow_map) {
|
| 2863 | 2879 |
return ResidualDigraph<DGR, CM, FM> (digraph, capacity_map, flow_map); |
| 2864 | 2880 |
} |
| 2865 | 2881 |
|
| 2866 | 2882 |
|
| 2867 | 2883 |
template <typename DGR> |
| 2868 | 2884 |
class SplitNodesBase {
|
| 2885 |
typedef DigraphAdaptorBase<const DGR> Parent; |
|
| 2886 |
|
|
| 2869 | 2887 |
public: |
| 2870 | 2888 |
|
| 2871 | 2889 |
typedef DGR Digraph; |
| 2872 |
typedef DigraphAdaptorBase<const DGR> Parent; |
|
| 2873 | 2890 |
typedef SplitNodesBase Adaptor; |
| 2874 | 2891 |
|
| 2875 | 2892 |
typedef typename DGR::Node DigraphNode; |
| 2876 | 2893 |
typedef typename DGR::Arc DigraphArc; |
| 2877 | 2894 |
|
| 2878 | 2895 |
class Node; |
| 2879 | 2896 |
class Arc; |
| 2880 | 2897 |
|
| ... | ... |
@@ -3223,21 +3240,21 @@ |
| 3223 | 3240 |
ArcImpl _arc_map; |
| 3224 | 3241 |
NodeImpl _node_map; |
| 3225 | 3242 |
}; |
| 3226 | 3243 |
|
| 3227 | 3244 |
public: |
| 3228 | 3245 |
|
| 3229 | 3246 |
template <typename V> |
| 3230 | 3247 |
class NodeMap |
| 3231 |
: public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > |
|
| 3232 |
{
|
|
| 3248 |
: public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > {
|
|
| 3249 |
typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > Parent; |
|
| 3250 |
|
|
| 3233 | 3251 |
public: |
| 3234 | 3252 |
typedef V Value; |
| 3235 |
typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<Value> > Parent; |
|
| 3236 | 3253 |
|
| 3237 | 3254 |
NodeMap(const SplitNodesBase<DGR>& adaptor) |
| 3238 | 3255 |
: Parent(adaptor) {}
|
| 3239 | 3256 |
|
| 3240 | 3257 |
NodeMap(const SplitNodesBase<DGR>& adaptor, const V& value) |
| 3241 | 3258 |
: Parent(adaptor, value) {}
|
| 3242 | 3259 |
|
| 3243 | 3260 |
private: |
| ... | ... |
@@ -3249,21 +3266,21 @@ |
| 3249 | 3266 |
NodeMap& operator=(const CMap& cmap) {
|
| 3250 | 3267 |
Parent::operator=(cmap); |
| 3251 | 3268 |
return *this; |
| 3252 | 3269 |
} |
| 3253 | 3270 |
}; |
| 3254 | 3271 |
|
| 3255 | 3272 |
template <typename V> |
| 3256 | 3273 |
class ArcMap |
| 3257 |
: public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > |
|
| 3258 |
{
|
|
| 3274 |
: public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > {
|
|
| 3275 |
typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > Parent; |
|
| 3276 |
|
|
| 3259 | 3277 |
public: |
| 3260 | 3278 |
typedef V Value; |
| 3261 |
typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<Value> > Parent; |
|
| 3262 | 3279 |
|
| 3263 | 3280 |
ArcMap(const SplitNodesBase<DGR>& adaptor) |
| 3264 | 3281 |
: Parent(adaptor) {}
|
| 3265 | 3282 |
|
| 3266 | 3283 |
ArcMap(const SplitNodesBase<DGR>& adaptor, const V& value) |
| 3267 | 3284 |
: Parent(adaptor, value) {}
|
| 3268 | 3285 |
|
| 3269 | 3286 |
private: |
| ... | ... |
@@ -3319,19 +3336,20 @@ |
| 3319 | 3336 |
/// type of the adapted digraph. |
| 3320 | 3337 |
template <typename DGR> |
| 3321 | 3338 |
#ifdef DOXYGEN |
| 3322 | 3339 |
class SplitNodes {
|
| 3323 | 3340 |
#else |
| 3324 | 3341 |
class SplitNodes |
| 3325 | 3342 |
: public DigraphAdaptorExtender<SplitNodesBase<const DGR> > {
|
| 3326 | 3343 |
#endif |
| 3344 |
typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent; |
|
| 3345 |
|
|
| 3327 | 3346 |
public: |
| 3328 | 3347 |
typedef DGR Digraph; |
| 3329 |
typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent; |
|
| 3330 | 3348 |
|
| 3331 | 3349 |
typedef typename DGR::Node DigraphNode; |
| 3332 | 3350 |
typedef typename DGR::Arc DigraphArc; |
| 3333 | 3351 |
|
| 3334 | 3352 |
typedef typename Parent::Node Node; |
| 3335 | 3353 |
typedef typename Parent::Arc Arc; |
| 3336 | 3354 |
|
| 3337 | 3355 |
/// \brief Constructor |
| ... | ... |
@@ -42,61 +42,65 @@ |
| 42 | 42 |
// |
| 43 | 43 |
// The template parameters are the Graph, the current Item type and |
| 44 | 44 |
// the Value type of the map. |
| 45 | 45 |
template <typename _Graph, typename _Item, typename _Value> |
| 46 | 46 |
class ArrayMap |
| 47 | 47 |
: public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
|
| 48 | 48 |
public: |
| 49 | 49 |
// The graph type. |
| 50 |
typedef _Graph |
|
| 50 |
typedef _Graph GraphType; |
|
| 51 | 51 |
// The item type. |
| 52 | 52 |
typedef _Item Item; |
| 53 | 53 |
// The reference map tag. |
| 54 | 54 |
typedef True ReferenceMapTag; |
| 55 | 55 |
|
| 56 | 56 |
// The key type of the map. |
| 57 | 57 |
typedef _Item Key; |
| 58 | 58 |
// The value type of the map. |
| 59 | 59 |
typedef _Value Value; |
| 60 | 60 |
|
| 61 | 61 |
// The const reference type of the map. |
| 62 | 62 |
typedef const _Value& ConstReference; |
| 63 | 63 |
// The reference type of the map. |
| 64 | 64 |
typedef _Value& Reference; |
| 65 | 65 |
|
| 66 |
// The map type. |
|
| 67 |
typedef ArrayMap Map; |
|
| 68 |
|
|
| 66 | 69 |
// The notifier type. |
| 67 | 70 |
typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; |
| 68 | 71 |
|
| 72 |
private: |
|
| 73 |
|
|
| 69 | 74 |
// The MapBase of the Map which imlements the core regisitry function. |
| 70 | 75 |
typedef typename Notifier::ObserverBase Parent; |
| 71 | 76 |
|
| 72 |
private: |
|
| 73 | 77 |
typedef std::allocator<Value> Allocator; |
| 74 | 78 |
|
| 75 | 79 |
public: |
| 76 | 80 |
|
| 77 | 81 |
// \brief Graph initialized map constructor. |
| 78 | 82 |
// |
| 79 | 83 |
// Graph initialized map constructor. |
| 80 |
explicit ArrayMap(const |
|
| 84 |
explicit ArrayMap(const GraphType& graph) {
|
|
| 81 | 85 |
Parent::attach(graph.notifier(Item())); |
| 82 | 86 |
allocate_memory(); |
| 83 | 87 |
Notifier* nf = Parent::notifier(); |
| 84 | 88 |
Item it; |
| 85 | 89 |
for (nf->first(it); it != INVALID; nf->next(it)) {
|
| 86 | 90 |
int id = nf->id(it);; |
| 87 | 91 |
allocator.construct(&(values[id]), Value()); |
| 88 | 92 |
} |
| 89 | 93 |
} |
| 90 | 94 |
|
| 91 | 95 |
// \brief Constructor to use default value to initialize the map. |
| 92 | 96 |
// |
| 93 | 97 |
// It constructs a map and initialize all of the the map. |
| 94 |
ArrayMap(const |
|
| 98 |
ArrayMap(const GraphType& graph, const Value& value) {
|
|
| 95 | 99 |
Parent::attach(graph.notifier(Item())); |
| 96 | 100 |
allocate_memory(); |
| 97 | 101 |
Notifier* nf = Parent::notifier(); |
| 98 | 102 |
Item it; |
| 99 | 103 |
for (nf->first(it); it != INVALID; nf->next(it)) {
|
| 100 | 104 |
int id = nf->id(it);; |
| 101 | 105 |
allocator.construct(&(values[id]), value); |
| 102 | 106 |
} |
| ... | ... |
@@ -33,20 +33,20 @@ |
| 33 | 33 |
//\brief Extenders for the graph types |
| 34 | 34 |
namespace lemon {
|
| 35 | 35 |
|
| 36 | 36 |
// \ingroup digraphbits |
| 37 | 37 |
// |
| 38 | 38 |
// \brief BaseDigraph to BaseGraph extender |
| 39 | 39 |
template <typename Base> |
| 40 | 40 |
class UndirDigraphExtender : public Base {
|
| 41 |
typedef Base Parent; |
|
| 41 | 42 |
|
| 42 | 43 |
public: |
| 43 | 44 |
|
| 44 |
typedef Base Parent; |
|
| 45 | 45 |
typedef typename Parent::Arc Edge; |
| 46 | 46 |
typedef typename Parent::Node Node; |
| 47 | 47 |
|
| 48 | 48 |
typedef True UndirectedTag; |
| 49 | 49 |
|
| 50 | 50 |
class Arc : public Edge {
|
| 51 | 51 |
friend class UndirDigraphExtender; |
| 52 | 52 |
|
| ... | ... |
@@ -275,18 +275,19 @@ |
| 275 | 275 |
return Parent::findArc(s, t, p); |
| 276 | 276 |
} |
| 277 | 277 |
return INVALID; |
| 278 | 278 |
} |
| 279 | 279 |
}; |
| 280 | 280 |
|
| 281 | 281 |
template <typename Base> |
| 282 | 282 |
class BidirBpGraphExtender : public Base {
|
| 283 |
typedef Base Parent; |
|
| 284 |
|
|
| 283 | 285 |
public: |
| 284 |
typedef Base Parent; |
|
| 285 | 286 |
typedef BidirBpGraphExtender Digraph; |
| 286 | 287 |
|
| 287 | 288 |
typedef typename Parent::Node Node; |
| 288 | 289 |
typedef typename Parent::Edge Edge; |
| 289 | 290 |
|
| 290 | 291 |
|
| 291 | 292 |
using Parent::first; |
| 292 | 293 |
using Parent::next; |
| ... | ... |
@@ -148,25 +148,26 @@ |
| 148 | 148 |
// }; |
| 149 | 149 |
|
| 150 | 150 |
// #endif |
| 151 | 151 |
|
| 152 | 152 |
// DefaultMap class |
| 153 | 153 |
template <typename _Graph, typename _Item, typename _Value> |
| 154 | 154 |
class DefaultMap |
| 155 | 155 |
: public DefaultMapSelector<_Graph, _Item, _Value>::Map {
|
| 156 |
typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; |
|
| 157 |
|
|
| 156 | 158 |
public: |
| 157 |
typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; |
|
| 158 | 159 |
typedef DefaultMap<_Graph, _Item, _Value> Map; |
| 159 |
|
|
| 160 |
typedef typename Parent::Graph Graph; |
|
| 160 |
|
|
| 161 |
typedef typename Parent::GraphType GraphType; |
|
| 161 | 162 |
typedef typename Parent::Value Value; |
| 162 | 163 |
|
| 163 |
explicit DefaultMap(const Graph& graph) : Parent(graph) {}
|
|
| 164 |
DefaultMap(const Graph& graph, const Value& value) |
|
| 164 |
explicit DefaultMap(const GraphType& graph) : Parent(graph) {}
|
|
| 165 |
DefaultMap(const GraphType& graph, const Value& value) |
|
| 165 | 166 |
: Parent(graph, value) {}
|
| 166 | 167 |
|
| 167 | 168 |
DefaultMap& operator=(const DefaultMap& cmap) {
|
| 168 | 169 |
return operator=<DefaultMap>(cmap); |
| 169 | 170 |
} |
| 170 | 171 |
|
| 171 | 172 |
template <typename CMap> |
| 172 | 173 |
DefaultMap& operator=(const CMap& cmap) {
|
| ... | ... |
@@ -29,19 +29,20 @@ |
| 29 | 29 |
//\brief Extenders for the arc set types |
| 30 | 30 |
namespace lemon {
|
| 31 | 31 |
|
| 32 | 32 |
// \ingroup digraphbits |
| 33 | 33 |
// |
| 34 | 34 |
// \brief Extender for the ArcSets |
| 35 | 35 |
template <typename Base> |
| 36 | 36 |
class ArcSetExtender : public Base {
|
| 37 |
typedef Base Parent; |
|
| 38 |
|
|
| 37 | 39 |
public: |
| 38 | 40 |
|
| 39 |
typedef Base Parent; |
|
| 40 | 41 |
typedef ArcSetExtender Digraph; |
| 41 | 42 |
|
| 42 | 43 |
// Base extensions |
| 43 | 44 |
|
| 44 | 45 |
typedef typename Parent::Node Node; |
| 45 | 46 |
typedef typename Parent::Arc Arc; |
| 46 | 47 |
|
| 47 | 48 |
int maxId(Node) const {
|
| ... | ... |
@@ -213,20 +214,19 @@ |
| 213 | 214 |
|
| 214 | 215 |
using Parent::first; |
| 215 | 216 |
|
| 216 | 217 |
// Mappable extension |
| 217 | 218 |
|
| 218 | 219 |
template <typename _Value> |
| 219 | 220 |
class ArcMap |
| 220 | 221 |
: public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
|
| 221 |
public: |
|
| 222 |
typedef ArcSetExtender Digraph; |
|
| 223 | 222 |
typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; |
| 224 | 223 |
|
| 224 |
public: |
|
| 225 | 225 |
explicit ArcMap(const Digraph& _g) |
| 226 | 226 |
: Parent(_g) {}
|
| 227 | 227 |
ArcMap(const Digraph& _g, const _Value& _v) |
| 228 | 228 |
: Parent(_g, _v) {}
|
| 229 | 229 |
|
| 230 | 230 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 231 | 231 |
return operator=<ArcMap>(cmap); |
| 232 | 232 |
} |
| ... | ... |
@@ -269,27 +269,26 @@ |
| 269 | 269 |
}; |
| 270 | 270 |
|
| 271 | 271 |
|
| 272 | 272 |
// \ingroup digraphbits |
| 273 | 273 |
// |
| 274 | 274 |
// \brief Extender for the EdgeSets |
| 275 | 275 |
template <typename Base> |
| 276 | 276 |
class EdgeSetExtender : public Base {
|
| 277 |
typedef Base Parent; |
|
| 277 | 278 |
|
| 278 | 279 |
public: |
| 279 | 280 |
|
| 280 |
typedef Base Parent; |
|
| 281 |
typedef EdgeSetExtender Digraph; |
|
| 281 |
typedef EdgeSetExtender Graph; |
|
| 282 | 282 |
|
| 283 | 283 |
typedef typename Parent::Node Node; |
| 284 | 284 |
typedef typename Parent::Arc Arc; |
| 285 | 285 |
typedef typename Parent::Edge Edge; |
| 286 | 286 |
|
| 287 |
|
|
| 288 | 287 |
int maxId(Node) const {
|
| 289 | 288 |
return Parent::maxNodeId(); |
| 290 | 289 |
} |
| 291 | 290 |
|
| 292 | 291 |
int maxId(Arc) const {
|
| 293 | 292 |
return Parent::maxArcId(); |
| 294 | 293 |
} |
| 295 | 294 |
|
| ... | ... |
@@ -345,152 +344,152 @@ |
| 345 | 344 |
} |
| 346 | 345 |
|
| 347 | 346 |
EdgeNotifier& notifier(Edge) const {
|
| 348 | 347 |
return edge_notifier; |
| 349 | 348 |
} |
| 350 | 349 |
|
| 351 | 350 |
|
| 352 | 351 |
class NodeIt : public Node {
|
| 353 |
const |
|
| 352 |
const Graph* graph; |
|
| 354 | 353 |
public: |
| 355 | 354 |
|
| 356 | 355 |
NodeIt() {}
|
| 357 | 356 |
|
| 358 | 357 |
NodeIt(Invalid i) : Node(i) { }
|
| 359 | 358 |
|
| 360 |
explicit NodeIt(const |
|
| 359 |
explicit NodeIt(const Graph& _graph) : graph(&_graph) {
|
|
| 361 | 360 |
_graph.first(static_cast<Node&>(*this)); |
| 362 | 361 |
} |
| 363 | 362 |
|
| 364 |
NodeIt(const Digraph& _graph, const Node& node) |
|
| 365 |
: Node(node), digraph(&_graph) {}
|
|
| 363 |
NodeIt(const Graph& _graph, const Node& node) |
|
| 364 |
: Node(node), graph(&_graph) {}
|
|
| 366 | 365 |
|
| 367 | 366 |
NodeIt& operator++() {
|
| 368 |
|
|
| 367 |
graph->next(*this); |
|
| 369 | 368 |
return *this; |
| 370 | 369 |
} |
| 371 | 370 |
|
| 372 | 371 |
}; |
| 373 | 372 |
|
| 374 | 373 |
|
| 375 | 374 |
class ArcIt : public Arc {
|
| 376 |
const |
|
| 375 |
const Graph* graph; |
|
| 377 | 376 |
public: |
| 378 | 377 |
|
| 379 | 378 |
ArcIt() { }
|
| 380 | 379 |
|
| 381 | 380 |
ArcIt(Invalid i) : Arc(i) { }
|
| 382 | 381 |
|
| 383 |
explicit ArcIt(const |
|
| 382 |
explicit ArcIt(const Graph& _graph) : graph(&_graph) {
|
|
| 384 | 383 |
_graph.first(static_cast<Arc&>(*this)); |
| 385 | 384 |
} |
| 386 | 385 |
|
| 387 |
ArcIt(const Digraph& _graph, const Arc& e) : |
|
| 388 |
Arc(e), digraph(&_graph) { }
|
|
| 386 |
ArcIt(const Graph& _graph, const Arc& e) : |
|
| 387 |
Arc(e), graph(&_graph) { }
|
|
| 389 | 388 |
|
| 390 | 389 |
ArcIt& operator++() {
|
| 391 |
|
|
| 390 |
graph->next(*this); |
|
| 392 | 391 |
return *this; |
| 393 | 392 |
} |
| 394 | 393 |
|
| 395 | 394 |
}; |
| 396 | 395 |
|
| 397 | 396 |
|
| 398 | 397 |
class OutArcIt : public Arc {
|
| 399 |
const |
|
| 398 |
const Graph* graph; |
|
| 400 | 399 |
public: |
| 401 | 400 |
|
| 402 | 401 |
OutArcIt() { }
|
| 403 | 402 |
|
| 404 | 403 |
OutArcIt(Invalid i) : Arc(i) { }
|
| 405 | 404 |
|
| 406 |
OutArcIt(const Digraph& _graph, const Node& node) |
|
| 407 |
: digraph(&_graph) {
|
|
| 405 |
OutArcIt(const Graph& _graph, const Node& node) |
|
| 406 |
: graph(&_graph) {
|
|
| 408 | 407 |
_graph.firstOut(*this, node); |
| 409 | 408 |
} |
| 410 | 409 |
|
| 411 |
OutArcIt(const Digraph& _graph, const Arc& arc) |
|
| 412 |
: Arc(arc), digraph(&_graph) {}
|
|
| 410 |
OutArcIt(const Graph& _graph, const Arc& arc) |
|
| 411 |
: Arc(arc), graph(&_graph) {}
|
|
| 413 | 412 |
|
| 414 | 413 |
OutArcIt& operator++() {
|
| 415 |
|
|
| 414 |
graph->nextOut(*this); |
|
| 416 | 415 |
return *this; |
| 417 | 416 |
} |
| 418 | 417 |
|
| 419 | 418 |
}; |
| 420 | 419 |
|
| 421 | 420 |
|
| 422 | 421 |
class InArcIt : public Arc {
|
| 423 |
const |
|
| 422 |
const Graph* graph; |
|
| 424 | 423 |
public: |
| 425 | 424 |
|
| 426 | 425 |
InArcIt() { }
|
| 427 | 426 |
|
| 428 | 427 |
InArcIt(Invalid i) : Arc(i) { }
|
| 429 | 428 |
|
| 430 |
InArcIt(const Digraph& _graph, const Node& node) |
|
| 431 |
: digraph(&_graph) {
|
|
| 429 |
InArcIt(const Graph& _graph, const Node& node) |
|
| 430 |
: graph(&_graph) {
|
|
| 432 | 431 |
_graph.firstIn(*this, node); |
| 433 | 432 |
} |
| 434 | 433 |
|
| 435 |
InArcIt(const Digraph& _graph, const Arc& arc) : |
|
| 436 |
Arc(arc), digraph(&_graph) {}
|
|
| 434 |
InArcIt(const Graph& _graph, const Arc& arc) : |
|
| 435 |
Arc(arc), graph(&_graph) {}
|
|
| 437 | 436 |
|
| 438 | 437 |
InArcIt& operator++() {
|
| 439 |
|
|
| 438 |
graph->nextIn(*this); |
|
| 440 | 439 |
return *this; |
| 441 | 440 |
} |
| 442 | 441 |
|
| 443 | 442 |
}; |
| 444 | 443 |
|
| 445 | 444 |
|
| 446 | 445 |
class EdgeIt : public Parent::Edge {
|
| 447 |
const |
|
| 446 |
const Graph* graph; |
|
| 448 | 447 |
public: |
| 449 | 448 |
|
| 450 | 449 |
EdgeIt() { }
|
| 451 | 450 |
|
| 452 | 451 |
EdgeIt(Invalid i) : Edge(i) { }
|
| 453 | 452 |
|
| 454 |
explicit EdgeIt(const |
|
| 453 |
explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
|
|
| 455 | 454 |
_graph.first(static_cast<Edge&>(*this)); |
| 456 | 455 |
} |
| 457 | 456 |
|
| 458 |
EdgeIt(const Digraph& _graph, const Edge& e) : |
|
| 459 |
Edge(e), digraph(&_graph) { }
|
|
| 457 |
EdgeIt(const Graph& _graph, const Edge& e) : |
|
| 458 |
Edge(e), graph(&_graph) { }
|
|
| 460 | 459 |
|
| 461 | 460 |
EdgeIt& operator++() {
|
| 462 |
|
|
| 461 |
graph->next(*this); |
|
| 463 | 462 |
return *this; |
| 464 | 463 |
} |
| 465 | 464 |
|
| 466 | 465 |
}; |
| 467 | 466 |
|
| 468 | 467 |
class IncEdgeIt : public Parent::Edge {
|
| 469 | 468 |
friend class EdgeSetExtender; |
| 470 |
const |
|
| 469 |
const Graph* graph; |
|
| 471 | 470 |
bool direction; |
| 472 | 471 |
public: |
| 473 | 472 |
|
| 474 | 473 |
IncEdgeIt() { }
|
| 475 | 474 |
|
| 476 | 475 |
IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
|
| 477 | 476 |
|
| 478 |
IncEdgeIt(const |
|
| 477 |
IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
|
|
| 479 | 478 |
_graph.firstInc(*this, direction, n); |
| 480 | 479 |
} |
| 481 | 480 |
|
| 482 |
IncEdgeIt(const Digraph& _graph, const Edge &ue, const Node &n) |
|
| 483 |
: digraph(&_graph), Edge(ue) {
|
|
| 481 |
IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n) |
|
| 482 |
: graph(&_graph), Edge(ue) {
|
|
| 484 | 483 |
direction = (_graph.source(ue) == n); |
| 485 | 484 |
} |
| 486 | 485 |
|
| 487 | 486 |
IncEdgeIt& operator++() {
|
| 488 |
|
|
| 487 |
graph->nextInc(*this, direction); |
|
| 489 | 488 |
return *this; |
| 490 | 489 |
} |
| 491 | 490 |
}; |
| 492 | 491 |
|
| 493 | 492 |
// \brief Base node of the iterator |
| 494 | 493 |
// |
| 495 | 494 |
// Returns the base node (ie. the source in this case) of the iterator |
| 496 | 495 |
Node baseNode(const OutArcIt &e) const {
|
| ... | ... |
@@ -529,24 +528,23 @@ |
| 529 | 528 |
// Returns the running node of the iterator |
| 530 | 529 |
Node runningNode(const IncEdgeIt &e) const {
|
| 531 | 530 |
return e.direction ? v(e) : u(e); |
| 532 | 531 |
} |
| 533 | 532 |
|
| 534 | 533 |
|
| 535 | 534 |
template <typename _Value> |
| 536 | 535 |
class ArcMap |
| 537 |
: public MapExtender<DefaultMap< |
|
| 536 |
: public MapExtender<DefaultMap<Graph, Arc, _Value> > {
|
|
| 537 |
typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; |
|
| 538 |
|
|
| 538 | 539 |
public: |
| 539 |
typedef EdgeSetExtender Digraph; |
|
| 540 |
typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; |
|
| 541 |
|
|
| 542 |
ArcMap(const Digraph& _g) |
|
| 540 |
ArcMap(const Graph& _g) |
|
| 543 | 541 |
: Parent(_g) {}
|
| 544 |
ArcMap(const |
|
| 542 |
ArcMap(const Graph& _g, const _Value& _v) |
|
| 545 | 543 |
: Parent(_g, _v) {}
|
| 546 | 544 |
|
| 547 | 545 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 548 | 546 |
return operator=<ArcMap>(cmap); |
| 549 | 547 |
} |
| 550 | 548 |
|
| 551 | 549 |
template <typename CMap> |
| 552 | 550 |
ArcMap& operator=(const CMap& cmap) {
|
| ... | ... |
@@ -554,25 +552,24 @@ |
| 554 | 552 |
return *this; |
| 555 | 553 |
} |
| 556 | 554 |
|
| 557 | 555 |
}; |
| 558 | 556 |
|
| 559 | 557 |
|
| 560 | 558 |
template <typename _Value> |
| 561 | 559 |
class EdgeMap |
| 562 |
: public MapExtender<DefaultMap< |
|
| 560 |
: public MapExtender<DefaultMap<Graph, Edge, _Value> > {
|
|
| 561 |
typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; |
|
| 562 |
|
|
| 563 | 563 |
public: |
| 564 |
typedef EdgeSetExtender Digraph; |
|
| 565 |
typedef MapExtender<DefaultMap<Digraph, Edge, _Value> > Parent; |
|
| 566 |
|
|
| 567 |
EdgeMap(const Digraph& _g) |
|
| 564 |
EdgeMap(const Graph& _g) |
|
| 568 | 565 |
: Parent(_g) {}
|
| 569 | 566 |
|
| 570 |
EdgeMap(const |
|
| 567 |
EdgeMap(const Graph& _g, const _Value& _v) |
|
| 571 | 568 |
: Parent(_g, _v) {}
|
| 572 | 569 |
|
| 573 | 570 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
| 574 | 571 |
return operator=<EdgeMap>(cmap); |
| 575 | 572 |
} |
| 576 | 573 |
|
| 577 | 574 |
template <typename CMap> |
| 578 | 575 |
EdgeMap& operator=(const CMap& cmap) {
|
| ... | ... |
@@ -21,19 +21,20 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/error.h> |
| 24 | 24 |
|
| 25 | 25 |
namespace lemon {
|
| 26 | 26 |
|
| 27 | 27 |
template <typename _Digraph> |
| 28 | 28 |
class DigraphAdaptorExtender : public _Digraph {
|
| 29 |
typedef _Digraph Parent; |
|
| 30 |
|
|
| 29 | 31 |
public: |
| 30 | 32 |
|
| 31 |
typedef _Digraph Parent; |
|
| 32 | 33 |
typedef _Digraph Digraph; |
| 33 | 34 |
typedef DigraphAdaptorExtender Adaptor; |
| 34 | 35 |
|
| 35 | 36 |
// Base extensions |
| 36 | 37 |
|
| 37 | 38 |
typedef typename Parent::Node Node; |
| 38 | 39 |
typedef typename Parent::Arc Arc; |
| 39 | 40 |
|
| ... | ... |
@@ -168,19 +169,20 @@ |
| 168 | 169 |
Node runningNode(const InArcIt &e) const {
|
| 169 | 170 |
return Parent::source(e); |
| 170 | 171 |
} |
| 171 | 172 |
|
| 172 | 173 |
}; |
| 173 | 174 |
|
| 174 | 175 |
template <typename _Graph> |
| 175 | 176 |
class GraphAdaptorExtender : public _Graph {
|
| 177 |
typedef _Graph Parent; |
|
| 178 |
|
|
| 176 | 179 |
public: |
| 177 | 180 |
|
| 178 |
typedef _Graph Parent; |
|
| 179 | 181 |
typedef _Graph Graph; |
| 180 | 182 |
typedef GraphAdaptorExtender Adaptor; |
| 181 | 183 |
|
| 182 | 184 |
typedef typename Parent::Node Node; |
| 183 | 185 |
typedef typename Parent::Arc Arc; |
| 184 | 186 |
typedef typename Parent::Edge Edge; |
| 185 | 187 |
|
| 186 | 188 |
// Graph extension |
| ... | ... |
@@ -32,19 +32,20 @@ |
| 32 | 32 |
//\brief Extenders for the graph types |
| 33 | 33 |
namespace lemon {
|
| 34 | 34 |
|
| 35 | 35 |
// \ingroup graphbits |
| 36 | 36 |
// |
| 37 | 37 |
// \brief Extender for the digraph implementations |
| 38 | 38 |
template <typename Base> |
| 39 | 39 |
class DigraphExtender : public Base {
|
| 40 |
typedef Base Parent; |
|
| 41 |
|
|
| 40 | 42 |
public: |
| 41 | 43 |
|
| 42 |
typedef Base Parent; |
|
| 43 | 44 |
typedef DigraphExtender Digraph; |
| 44 | 45 |
|
| 45 | 46 |
// Base extensions |
| 46 | 47 |
|
| 47 | 48 |
typedef typename Parent::Node Node; |
| 48 | 49 |
typedef typename Parent::Arc Arc; |
| 49 | 50 |
|
| 50 | 51 |
int maxId(Node) const {
|
| ... | ... |
@@ -213,20 +214,19 @@ |
| 213 | 214 |
Node runningNode(const InArcIt &arc) const {
|
| 214 | 215 |
return Parent::source(arc); |
| 215 | 216 |
} |
| 216 | 217 |
|
| 217 | 218 |
|
| 218 | 219 |
template <typename _Value> |
| 219 | 220 |
class NodeMap |
| 220 | 221 |
: public MapExtender<DefaultMap<Digraph, Node, _Value> > {
|
| 221 |
public: |
|
| 222 |
typedef DigraphExtender Digraph; |
|
| 223 | 222 |
typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent; |
| 224 | 223 |
|
| 224 |
public: |
|
| 225 | 225 |
explicit NodeMap(const Digraph& digraph) |
| 226 | 226 |
: Parent(digraph) {}
|
| 227 | 227 |
NodeMap(const Digraph& digraph, const _Value& value) |
| 228 | 228 |
: Parent(digraph, value) {}
|
| 229 | 229 |
|
| 230 | 230 |
private: |
| 231 | 231 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 232 | 232 |
return operator=<NodeMap>(cmap); |
| ... | ... |
@@ -238,20 +238,19 @@ |
| 238 | 238 |
return *this; |
| 239 | 239 |
} |
| 240 | 240 |
|
| 241 | 241 |
}; |
| 242 | 242 |
|
| 243 | 243 |
template <typename _Value> |
| 244 | 244 |
class ArcMap |
| 245 | 245 |
: public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
|
| 246 |
public: |
|
| 247 |
typedef DigraphExtender Digraph; |
|
| 248 | 246 |
typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; |
| 249 | 247 |
|
| 248 |
public: |
|
| 250 | 249 |
explicit ArcMap(const Digraph& digraph) |
| 251 | 250 |
: Parent(digraph) {}
|
| 252 | 251 |
ArcMap(const Digraph& digraph, const _Value& value) |
| 253 | 252 |
: Parent(digraph, value) {}
|
| 254 | 253 |
|
| 255 | 254 |
private: |
| 256 | 255 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 257 | 256 |
return operator=<ArcMap>(cmap); |
| ... | ... |
@@ -325,19 +324,20 @@ |
| 325 | 324 |
} |
| 326 | 325 |
}; |
| 327 | 326 |
|
| 328 | 327 |
// \ingroup _graphbits |
| 329 | 328 |
// |
| 330 | 329 |
// \brief Extender for the Graphs |
| 331 | 330 |
template <typename Base> |
| 332 | 331 |
class GraphExtender : public Base {
|
| 332 |
typedef Base Parent; |
|
| 333 |
|
|
| 333 | 334 |
public: |
| 334 | 335 |
|
| 335 |
typedef Base Parent; |
|
| 336 | 336 |
typedef GraphExtender Graph; |
| 337 | 337 |
|
| 338 | 338 |
typedef True UndirectedTag; |
| 339 | 339 |
|
| 340 | 340 |
typedef typename Parent::Node Node; |
| 341 | 341 |
typedef typename Parent::Arc Arc; |
| 342 | 342 |
typedef typename Parent::Edge Edge; |
| 343 | 343 |
|
| ... | ... |
@@ -596,20 +596,19 @@ |
| 596 | 596 |
return edge._direction ? v(edge) : u(edge); |
| 597 | 597 |
} |
| 598 | 598 |
|
| 599 | 599 |
// Mappable extension |
| 600 | 600 |
|
| 601 | 601 |
template <typename _Value> |
| 602 | 602 |
class NodeMap |
| 603 | 603 |
: public MapExtender<DefaultMap<Graph, Node, _Value> > {
|
| 604 |
public: |
|
| 605 |
typedef GraphExtender Graph; |
|
| 606 | 604 |
typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent; |
| 607 | 605 |
|
| 606 |
public: |
|
| 608 | 607 |
NodeMap(const Graph& graph) |
| 609 | 608 |
: Parent(graph) {}
|
| 610 | 609 |
NodeMap(const Graph& graph, const _Value& value) |
| 611 | 610 |
: Parent(graph, value) {}
|
| 612 | 611 |
|
| 613 | 612 |
private: |
| 614 | 613 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 615 | 614 |
return operator=<NodeMap>(cmap); |
| ... | ... |
@@ -621,20 +620,19 @@ |
| 621 | 620 |
return *this; |
| 622 | 621 |
} |
| 623 | 622 |
|
| 624 | 623 |
}; |
| 625 | 624 |
|
| 626 | 625 |
template <typename _Value> |
| 627 | 626 |
class ArcMap |
| 628 | 627 |
: public MapExtender<DefaultMap<Graph, Arc, _Value> > {
|
| 629 |
public: |
|
| 630 |
typedef GraphExtender Graph; |
|
| 631 | 628 |
typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; |
| 632 | 629 |
|
| 630 |
public: |
|
| 633 | 631 |
ArcMap(const Graph& graph) |
| 634 | 632 |
: Parent(graph) {}
|
| 635 | 633 |
ArcMap(const Graph& graph, const _Value& value) |
| 636 | 634 |
: Parent(graph, value) {}
|
| 637 | 635 |
|
| 638 | 636 |
private: |
| 639 | 637 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 640 | 638 |
return operator=<ArcMap>(cmap); |
| ... | ... |
@@ -646,20 +644,19 @@ |
| 646 | 644 |
return *this; |
| 647 | 645 |
} |
| 648 | 646 |
}; |
| 649 | 647 |
|
| 650 | 648 |
|
| 651 | 649 |
template <typename _Value> |
| 652 | 650 |
class EdgeMap |
| 653 | 651 |
: public MapExtender<DefaultMap<Graph, Edge, _Value> > {
|
| 654 |
public: |
|
| 655 |
typedef GraphExtender Graph; |
|
| 656 | 652 |
typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; |
| 657 | 653 |
|
| 654 |
public: |
|
| 658 | 655 |
EdgeMap(const Graph& graph) |
| 659 | 656 |
: Parent(graph) {}
|
| 660 | 657 |
|
| 661 | 658 |
EdgeMap(const Graph& graph, const _Value& value) |
| 662 | 659 |
: Parent(graph, value) {}
|
| 663 | 660 |
|
| 664 | 661 |
private: |
| 665 | 662 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
| ... | ... |
@@ -31,60 +31,60 @@ |
| 31 | 31 |
|
| 32 | 32 |
namespace lemon {
|
| 33 | 33 |
|
| 34 | 34 |
// \ingroup graphbits |
| 35 | 35 |
// |
| 36 | 36 |
// \brief Extender for maps |
| 37 | 37 |
template <typename _Map> |
| 38 | 38 |
class MapExtender : public _Map {
|
| 39 |
typedef _Map Parent; |
|
| 40 |
typedef typename Parent::GraphType GraphType; |
|
| 41 |
|
|
| 39 | 42 |
public: |
| 40 | 43 |
|
| 41 |
typedef _Map Parent; |
|
| 42 | 44 |
typedef MapExtender Map; |
| 43 |
|
|
| 44 |
|
|
| 45 |
typedef typename Parent::Graph Graph; |
|
| 46 | 45 |
typedef typename Parent::Key Item; |
| 47 | 46 |
|
| 48 | 47 |
typedef typename Parent::Key Key; |
| 49 | 48 |
typedef typename Parent::Value Value; |
| 50 | 49 |
typedef typename Parent::Reference Reference; |
| 51 | 50 |
typedef typename Parent::ConstReference ConstReference; |
| 52 | 51 |
|
| 53 | 52 |
class MapIt; |
| 54 | 53 |
class ConstMapIt; |
| 55 | 54 |
|
| 56 | 55 |
friend class MapIt; |
| 57 | 56 |
friend class ConstMapIt; |
| 58 | 57 |
|
| 59 | 58 |
public: |
| 60 | 59 |
|
| 61 |
MapExtender(const |
|
| 60 |
MapExtender(const GraphType& graph) |
|
| 62 | 61 |
: Parent(graph) {}
|
| 63 | 62 |
|
| 64 |
MapExtender(const |
|
| 63 |
MapExtender(const GraphType& graph, const Value& value) |
|
| 65 | 64 |
: Parent(graph, value) {}
|
| 66 | 65 |
|
| 67 | 66 |
private: |
| 68 | 67 |
MapExtender& operator=(const MapExtender& cmap) {
|
| 69 | 68 |
return operator=<MapExtender>(cmap); |
| 70 | 69 |
} |
| 71 | 70 |
|
| 72 | 71 |
template <typename CMap> |
| 73 | 72 |
MapExtender& operator=(const CMap& cmap) {
|
| 74 | 73 |
Parent::operator=(cmap); |
| 75 | 74 |
return *this; |
| 76 | 75 |
} |
| 77 | 76 |
|
| 78 | 77 |
public: |
| 79 | 78 |
class MapIt : public Item {
|
| 79 |
typedef Item Parent; |
|
| 80 |
|
|
| 80 | 81 |
public: |
| 81 | 82 |
|
| 82 |
typedef Item Parent; |
|
| 83 | 83 |
typedef typename Map::Value Value; |
| 84 | 84 |
|
| 85 | 85 |
MapIt() {}
|
| 86 | 86 |
|
| 87 | 87 |
MapIt(Invalid i) : Parent(i) { }
|
| 88 | 88 |
|
| 89 | 89 |
explicit MapIt(Map& _map) : map(_map) {
|
| 90 | 90 |
map.notifier()->first(*this); |
| ... | ... |
@@ -111,20 +111,20 @@ |
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 | 113 |
protected: |
| 114 | 114 |
Map& map; |
| 115 | 115 |
|
| 116 | 116 |
}; |
| 117 | 117 |
|
| 118 | 118 |
class ConstMapIt : public Item {
|
| 119 |
typedef Item Parent; |
|
| 120 |
|
|
| 119 | 121 |
public: |
| 120 | 122 |
|
| 121 |
typedef Item Parent; |
|
| 122 |
|
|
| 123 | 123 |
typedef typename Map::Value Value; |
| 124 | 124 |
|
| 125 | 125 |
ConstMapIt() {}
|
| 126 | 126 |
|
| 127 | 127 |
ConstMapIt(Invalid i) : Parent(i) { }
|
| 128 | 128 |
|
| 129 | 129 |
explicit ConstMapIt(Map& _map) : map(_map) {
|
| 130 | 130 |
map.notifier()->first(*this); |
| ... | ... |
@@ -142,20 +142,20 @@ |
| 142 | 142 |
return map[*this]; |
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 | 145 |
protected: |
| 146 | 146 |
const Map& map; |
| 147 | 147 |
}; |
| 148 | 148 |
|
| 149 | 149 |
class ItemIt : public Item {
|
| 150 |
typedef Item Parent; |
|
| 151 |
|
|
| 150 | 152 |
public: |
| 151 | 153 |
|
| 152 |
typedef Item Parent; |
|
| 153 |
|
|
| 154 | 154 |
ItemIt() {}
|
| 155 | 155 |
|
| 156 | 156 |
ItemIt(Invalid i) : Parent(i) { }
|
| 157 | 157 |
|
| 158 | 158 |
explicit ItemIt(Map& _map) : map(_map) {
|
| 159 | 159 |
map.notifier()->first(*this); |
| 160 | 160 |
} |
| 161 | 161 |
|
| ... | ... |
@@ -173,42 +173,41 @@ |
| 173 | 173 |
}; |
| 174 | 174 |
}; |
| 175 | 175 |
|
| 176 | 176 |
// \ingroup graphbits |
| 177 | 177 |
// |
| 178 | 178 |
// \brief Extender for maps which use a subset of the items. |
| 179 | 179 |
template <typename _Graph, typename _Map> |
| 180 | 180 |
class SubMapExtender : public _Map {
|
| 181 |
typedef _Map Parent; |
|
| 182 |
typedef _Graph GraphType; |
|
| 183 |
|
|
| 181 | 184 |
public: |
| 182 | 185 |
|
| 183 |
typedef _Map Parent; |
|
| 184 | 186 |
typedef SubMapExtender Map; |
| 185 |
|
|
| 186 |
typedef _Graph Graph; |
|
| 187 |
|
|
| 188 | 187 |
typedef typename Parent::Key Item; |
| 189 | 188 |
|
| 190 | 189 |
typedef typename Parent::Key Key; |
| 191 | 190 |
typedef typename Parent::Value Value; |
| 192 | 191 |
typedef typename Parent::Reference Reference; |
| 193 | 192 |
typedef typename Parent::ConstReference ConstReference; |
| 194 | 193 |
|
| 195 | 194 |
class MapIt; |
| 196 | 195 |
class ConstMapIt; |
| 197 | 196 |
|
| 198 | 197 |
friend class MapIt; |
| 199 | 198 |
friend class ConstMapIt; |
| 200 | 199 |
|
| 201 | 200 |
public: |
| 202 | 201 |
|
| 203 |
SubMapExtender(const |
|
| 202 |
SubMapExtender(const GraphType& _graph) |
|
| 204 | 203 |
: Parent(_graph), graph(_graph) {}
|
| 205 | 204 |
|
| 206 |
SubMapExtender(const |
|
| 205 |
SubMapExtender(const GraphType& _graph, const Value& _value) |
|
| 207 | 206 |
: Parent(_graph, _value), graph(_graph) {}
|
| 208 | 207 |
|
| 209 | 208 |
private: |
| 210 | 209 |
SubMapExtender& operator=(const SubMapExtender& cmap) {
|
| 211 | 210 |
return operator=<MapExtender>(cmap); |
| 212 | 211 |
} |
| 213 | 212 |
|
| 214 | 213 |
template <typename CMap> |
| ... | ... |
@@ -218,19 +217,19 @@ |
| 218 | 217 |
for (graph.first(it); it != INVALID; graph.next(it)) {
|
| 219 | 218 |
Parent::set(it, cmap[it]); |
| 220 | 219 |
} |
| 221 | 220 |
return *this; |
| 222 | 221 |
} |
| 223 | 222 |
|
| 224 | 223 |
public: |
| 225 | 224 |
class MapIt : public Item {
|
| 225 |
typedef Item Parent; |
|
| 226 |
|
|
| 226 | 227 |
public: |
| 227 |
|
|
| 228 |
typedef Item Parent; |
|
| 229 | 228 |
typedef typename Map::Value Value; |
| 230 | 229 |
|
| 231 | 230 |
MapIt() {}
|
| 232 | 231 |
|
| 233 | 232 |
MapIt(Invalid i) : Parent(i) { }
|
| 234 | 233 |
|
| 235 | 234 |
explicit MapIt(Map& _map) : map(_map) {
|
| 236 | 235 |
map.graph.first(*this); |
| ... | ... |
@@ -257,20 +256,20 @@ |
| 257 | 256 |
} |
| 258 | 257 |
|
| 259 | 258 |
protected: |
| 260 | 259 |
Map& map; |
| 261 | 260 |
|
| 262 | 261 |
}; |
| 263 | 262 |
|
| 264 | 263 |
class ConstMapIt : public Item {
|
| 264 |
typedef Item Parent; |
|
| 265 |
|
|
| 265 | 266 |
public: |
| 266 | 267 |
|
| 267 |
typedef Item Parent; |
|
| 268 |
|
|
| 269 | 268 |
typedef typename Map::Value Value; |
| 270 | 269 |
|
| 271 | 270 |
ConstMapIt() {}
|
| 272 | 271 |
|
| 273 | 272 |
ConstMapIt(Invalid i) : Parent(i) { }
|
| 274 | 273 |
|
| 275 | 274 |
explicit ConstMapIt(Map& _map) : map(_map) {
|
| 276 | 275 |
map.graph.first(*this); |
| ... | ... |
@@ -288,20 +287,20 @@ |
| 288 | 287 |
return map[*this]; |
| 289 | 288 |
} |
| 290 | 289 |
|
| 291 | 290 |
protected: |
| 292 | 291 |
const Map& map; |
| 293 | 292 |
}; |
| 294 | 293 |
|
| 295 | 294 |
class ItemIt : public Item {
|
| 295 |
typedef Item Parent; |
|
| 296 |
|
|
| 296 | 297 |
public: |
| 297 | 298 |
|
| 298 |
typedef Item Parent; |
|
| 299 |
|
|
| 300 | 299 |
ItemIt() {}
|
| 301 | 300 |
|
| 302 | 301 |
ItemIt(Invalid i) : Parent(i) { }
|
| 303 | 302 |
|
| 304 | 303 |
explicit ItemIt(Map& _map) : map(_map) {
|
| 305 | 304 |
map.graph.first(*this); |
| 306 | 305 |
} |
| 307 | 306 |
|
| ... | ... |
@@ -315,15 +314,15 @@ |
| 315 | 314 |
|
| 316 | 315 |
protected: |
| 317 | 316 |
const Map& map; |
| 318 | 317 |
|
| 319 | 318 |
}; |
| 320 | 319 |
|
| 321 | 320 |
private: |
| 322 | 321 |
|
| 323 |
const |
|
| 322 |
const GraphType& graph; |
|
| 324 | 323 |
|
| 325 | 324 |
}; |
| 326 | 325 |
|
| 327 | 326 |
} |
| 328 | 327 |
|
| 329 | 328 |
#endif |
| ... | ... |
@@ -51,55 +51,59 @@ |
| 51 | 51 |
private: |
| 52 | 52 |
|
| 53 | 53 |
// The container type of the map. |
| 54 | 54 |
typedef std::vector<_Value> Container; |
| 55 | 55 |
|
| 56 | 56 |
public: |
| 57 | 57 |
|
| 58 | 58 |
// The graph type of the map. |
| 59 |
typedef _Graph |
|
| 59 |
typedef _Graph GraphType; |
|
| 60 | 60 |
// The item type of the map. |
| 61 | 61 |
typedef _Item Item; |
| 62 | 62 |
// The reference map tag. |
| 63 | 63 |
typedef True ReferenceMapTag; |
| 64 | 64 |
|
| 65 | 65 |
// The key type of the map. |
| 66 | 66 |
typedef _Item Key; |
| 67 | 67 |
// The value type of the map. |
| 68 | 68 |
typedef _Value Value; |
| 69 | 69 |
|
| 70 | 70 |
// The notifier type. |
| 71 | 71 |
typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; |
| 72 | 72 |
|
| 73 | 73 |
// The map type. |
| 74 | 74 |
typedef VectorMap Map; |
| 75 |
// The base class of the map. |
|
| 76 |
typedef typename Notifier::ObserverBase Parent; |
|
| 77 | 75 |
|
| 78 | 76 |
// The reference type of the map; |
| 79 | 77 |
typedef typename Container::reference Reference; |
| 80 | 78 |
// The const reference type of the map; |
| 81 | 79 |
typedef typename Container::const_reference ConstReference; |
| 82 | 80 |
|
| 81 |
private: |
|
| 82 |
|
|
| 83 |
// The base class of the map. |
|
| 84 |
typedef typename Notifier::ObserverBase Parent; |
|
| 85 |
|
|
| 86 |
public: |
|
| 83 | 87 |
|
| 84 | 88 |
// \brief Constructor to attach the new map into the notifier. |
| 85 | 89 |
// |
| 86 | 90 |
// It constructs a map and attachs it into the notifier. |
| 87 | 91 |
// It adds all the items of the graph to the map. |
| 88 |
VectorMap(const |
|
| 92 |
VectorMap(const GraphType& graph) {
|
|
| 89 | 93 |
Parent::attach(graph.notifier(Item())); |
| 90 | 94 |
container.resize(Parent::notifier()->maxId() + 1); |
| 91 | 95 |
} |
| 92 | 96 |
|
| 93 | 97 |
// \brief Constructor uses given value to initialize the map. |
| 94 | 98 |
// |
| 95 | 99 |
// It constructs a map uses a given value to initialize the map. |
| 96 | 100 |
// It adds all the items of the graph to the map. |
| 97 |
VectorMap(const |
|
| 101 |
VectorMap(const GraphType& graph, const Value& value) {
|
|
| 98 | 102 |
Parent::attach(graph.notifier(Item())); |
| 99 | 103 |
container.resize(Parent::notifier()->maxId() + 1, value); |
| 100 | 104 |
} |
| 101 | 105 |
|
| 102 | 106 |
private: |
| 103 | 107 |
// \brief Copy constructor |
| 104 | 108 |
// |
| 105 | 109 |
// Copy constructor. |
| ... | ... |
@@ -175,28 +175,31 @@ |
| 175 | 175 |
/// |
| 176 | 176 |
/// This class describes the base interface of undirected graph types. |
| 177 | 177 |
/// All graph %concepts have to conform to this class. |
| 178 | 178 |
/// It extends the interface of \ref BaseDigraphComponent with an |
| 179 | 179 |
/// \c Edge type and functions to get the end nodes of edges, |
| 180 | 180 |
/// to convert from arcs to edges and to get both direction of edges. |
| 181 | 181 |
class BaseGraphComponent : public BaseDigraphComponent {
|
| 182 | 182 |
public: |
| 183 |
|
|
| 184 |
typedef BaseGraphComponent Graph; |
|
| 185 |
|
|
| 183 | 186 |
typedef BaseDigraphComponent::Node Node; |
| 184 | 187 |
typedef BaseDigraphComponent::Arc Arc; |
| 185 | 188 |
|
| 186 | 189 |
/// \brief Undirected edge class of the graph. |
| 187 | 190 |
/// |
| 188 | 191 |
/// This class represents the undirected edges of the graph. |
| 189 | 192 |
/// Undirected graphs can be used as directed graphs, each edge is |
| 190 | 193 |
/// represented by two opposite directed arcs. |
| 191 | 194 |
class Edge : public GraphItem<'e'> {
|
| 192 |
public: |
|
| 193 | 195 |
typedef GraphItem<'e'> Parent; |
| 194 | 196 |
|
| 197 |
public: |
|
| 195 | 198 |
/// \brief Default constructor. |
| 196 | 199 |
/// |
| 197 | 200 |
/// Default constructor. |
| 198 | 201 |
/// \warning The default constructor is not required to set |
| 199 | 202 |
/// the item to some well-defined value. So you should consider it |
| 200 | 203 |
/// as uninitialized. |
| 201 | 204 |
Edge() {}
|
| 202 | 205 |
|
| ... | ... |
@@ -986,42 +989,40 @@ |
| 986 | 989 |
/// \brief Concept class for standard graph maps. |
| 987 | 990 |
/// |
| 988 | 991 |
/// This class describes the concept of standard graph maps, i.e. |
| 989 | 992 |
/// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and |
| 990 | 993 |
/// graph types, which can be used for associating data to graph items. |
| 991 | 994 |
/// The standard graph maps must conform to the ReferenceMap concept. |
| 992 | 995 |
template <typename GR, typename K, typename V> |
| 993 | 996 |
class GraphMap : public ReferenceMap<K, V, V&, const V&> {
|
| 997 |
typedef ReferenceMap<K, V, V&, const V&> Parent; |
|
| 998 |
|
|
| 994 | 999 |
public: |
| 995 | 1000 |
|
| 996 |
typedef ReadWriteMap<K, V> Parent; |
|
| 997 |
|
|
| 998 |
/// The graph type of the map. |
|
| 999 |
typedef GR Graph; |
|
| 1000 | 1001 |
/// The key type of the map. |
| 1001 | 1002 |
typedef K Key; |
| 1002 | 1003 |
/// The value type of the map. |
| 1003 | 1004 |
typedef V Value; |
| 1004 | 1005 |
/// The reference type of the map. |
| 1005 | 1006 |
typedef Value& Reference; |
| 1006 | 1007 |
/// The const reference type of the map. |
| 1007 | 1008 |
typedef const Value& ConstReference; |
| 1008 | 1009 |
|
| 1009 | 1010 |
// The reference map tag. |
| 1010 | 1011 |
typedef True ReferenceMapTag; |
| 1011 | 1012 |
|
| 1012 | 1013 |
/// \brief Construct a new map. |
| 1013 | 1014 |
/// |
| 1014 | 1015 |
/// Construct a new map for the graph. |
| 1015 |
explicit GraphMap(const |
|
| 1016 |
explicit GraphMap(const GR&) {}
|
|
| 1016 | 1017 |
/// \brief Construct a new map with default value. |
| 1017 | 1018 |
/// |
| 1018 | 1019 |
/// Construct a new map for the graph and initalize the values. |
| 1019 |
GraphMap(const |
|
| 1020 |
GraphMap(const GR&, const Value&) {}
|
|
| 1020 | 1021 |
|
| 1021 | 1022 |
private: |
| 1022 | 1023 |
/// \brief Copy constructor. |
| 1023 | 1024 |
/// |
| 1024 | 1025 |
/// Copy Constructor. |
| 1025 | 1026 |
GraphMap(const GraphMap&) : Parent() {}
|
| 1026 | 1027 |
|
| 1027 | 1028 |
/// \brief Assignment operator. |
| ... | ... |
@@ -1052,17 +1053,17 @@ |
| 1052 | 1053 |
// m3 = cmap; |
| 1053 | 1054 |
|
| 1054 | 1055 |
ignore_unused_variable_warning(m1); |
| 1055 | 1056 |
ignore_unused_variable_warning(m2); |
| 1056 | 1057 |
// ignore_unused_variable_warning(m3); |
| 1057 | 1058 |
} |
| 1058 | 1059 |
|
| 1059 | 1060 |
const _Map &m; |
| 1060 |
const |
|
| 1061 |
const GR &g; |
|
| 1061 | 1062 |
const typename GraphMap::Value &t; |
| 1062 | 1063 |
}; |
| 1063 | 1064 |
|
| 1064 | 1065 |
}; |
| 1065 | 1066 |
|
| 1066 | 1067 |
/// \brief Skeleton class for mappable directed graphs. |
| 1067 | 1068 |
/// |
| 1068 | 1069 |
/// This class describes the interface of mappable directed graphs. |
| ... | ... |
@@ -1080,19 +1081,19 @@ |
| 1080 | 1081 |
typedef MappableDigraphComponent Digraph; |
| 1081 | 1082 |
|
| 1082 | 1083 |
/// \brief Standard graph map for the nodes. |
| 1083 | 1084 |
/// |
| 1084 | 1085 |
/// Standard graph map for the nodes. |
| 1085 | 1086 |
/// It conforms to the ReferenceMap concept. |
| 1086 | 1087 |
template <typename V> |
| 1087 | 1088 |
class NodeMap : public GraphMap<MappableDigraphComponent, Node, V> {
|
| 1088 |
public: |
|
| 1089 | 1089 |
typedef GraphMap<MappableDigraphComponent, Node, V> Parent; |
| 1090 | 1090 |
|
| 1091 |
public: |
|
| 1091 | 1092 |
/// \brief Construct a new map. |
| 1092 | 1093 |
/// |
| 1093 | 1094 |
/// Construct a new map for the digraph. |
| 1094 | 1095 |
explicit NodeMap(const MappableDigraphComponent& digraph) |
| 1095 | 1096 |
: Parent(digraph) {}
|
| 1096 | 1097 |
|
| 1097 | 1098 |
/// \brief Construct a new map with default value. |
| 1098 | 1099 |
/// |
| ... | ... |
@@ -1118,19 +1119,19 @@ |
| 1118 | 1119 |
}; |
| 1119 | 1120 |
|
| 1120 | 1121 |
/// \brief Standard graph map for the arcs. |
| 1121 | 1122 |
/// |
| 1122 | 1123 |
/// Standard graph map for the arcs. |
| 1123 | 1124 |
/// It conforms to the ReferenceMap concept. |
| 1124 | 1125 |
template <typename V> |
| 1125 | 1126 |
class ArcMap : public GraphMap<MappableDigraphComponent, Arc, V> {
|
| 1126 |
public: |
|
| 1127 | 1127 |
typedef GraphMap<MappableDigraphComponent, Arc, V> Parent; |
| 1128 | 1128 |
|
| 1129 |
public: |
|
| 1129 | 1130 |
/// \brief Construct a new map. |
| 1130 | 1131 |
/// |
| 1131 | 1132 |
/// Construct a new map for the digraph. |
| 1132 | 1133 |
explicit ArcMap(const MappableDigraphComponent& digraph) |
| 1133 | 1134 |
: Parent(digraph) {}
|
| 1134 | 1135 |
|
| 1135 | 1136 |
/// \brief Construct a new map with default value. |
| 1136 | 1137 |
/// |
| ... | ... |
@@ -1216,19 +1217,19 @@ |
| 1216 | 1217 |
typedef MappableGraphComponent Graph; |
| 1217 | 1218 |
|
| 1218 | 1219 |
/// \brief Standard graph map for the edges. |
| 1219 | 1220 |
/// |
| 1220 | 1221 |
/// Standard graph map for the edges. |
| 1221 | 1222 |
/// It conforms to the ReferenceMap concept. |
| 1222 | 1223 |
template <typename V> |
| 1223 | 1224 |
class EdgeMap : public GraphMap<MappableGraphComponent, Edge, V> {
|
| 1224 |
public: |
|
| 1225 | 1225 |
typedef GraphMap<MappableGraphComponent, Edge, V> Parent; |
| 1226 | 1226 |
|
| 1227 |
public: |
|
| 1227 | 1228 |
/// \brief Construct a new map. |
| 1228 | 1229 |
/// |
| 1229 | 1230 |
/// Construct a new map for the graph. |
| 1230 | 1231 |
explicit EdgeMap(const MappableGraphComponent& graph) |
| 1231 | 1232 |
: Parent(graph) {}
|
| 1232 | 1233 |
|
| 1233 | 1234 |
/// \brief Construct a new map with default value. |
| 1234 | 1235 |
/// |
| ... | ... |
@@ -1031,47 +1031,46 @@ |
| 1031 | 1031 |
/// ... |
| 1032 | 1032 |
/// } |
| 1033 | 1033 |
///\endcode |
| 1034 | 1034 |
/// |
| 1035 | 1035 |
///\sa findArc() |
| 1036 | 1036 |
///\sa ArcLookUp, AllArcLookUp, DynArcLookUp |
| 1037 | 1037 |
template <typename GR> |
| 1038 | 1038 |
class ConArcIt : public GR::Arc {
|
| 1039 |
typedef typename GR::Arc Parent; |
|
| 1040 |
|
|
| 1039 | 1041 |
public: |
| 1040 | 1042 |
|
| 1041 |
typedef GR Graph; |
|
| 1042 |
typedef typename Graph::Arc Parent; |
|
| 1043 |
|
|
| 1044 |
typedef typename Graph::Arc Arc; |
|
| 1045 |
typedef typename |
|
| 1043 |
typedef typename GR::Arc Arc; |
|
| 1044 |
typedef typename GR::Node Node; |
|
| 1046 | 1045 |
|
| 1047 | 1046 |
/// \brief Constructor. |
| 1048 | 1047 |
/// |
| 1049 | 1048 |
/// Construct a new ConArcIt iterating on the arcs that |
| 1050 | 1049 |
/// connects nodes \c u and \c v. |
| 1051 |
ConArcIt(const |
|
| 1050 |
ConArcIt(const GR& g, Node u, Node v) : _graph(g) {
|
|
| 1052 | 1051 |
Parent::operator=(findArc(_graph, u, v)); |
| 1053 | 1052 |
} |
| 1054 | 1053 |
|
| 1055 | 1054 |
/// \brief Constructor. |
| 1056 | 1055 |
/// |
| 1057 | 1056 |
/// Construct a new ConArcIt that continues the iterating from arc \c a. |
| 1058 |
ConArcIt(const |
|
| 1057 |
ConArcIt(const GR& g, Arc a) : Parent(a), _graph(g) {}
|
|
| 1059 | 1058 |
|
| 1060 | 1059 |
/// \brief Increment operator. |
| 1061 | 1060 |
/// |
| 1062 | 1061 |
/// It increments the iterator and gives back the next arc. |
| 1063 | 1062 |
ConArcIt& operator++() {
|
| 1064 | 1063 |
Parent::operator=(findArc(_graph, _graph.source(*this), |
| 1065 | 1064 |
_graph.target(*this), *this)); |
| 1066 | 1065 |
return *this; |
| 1067 | 1066 |
} |
| 1068 | 1067 |
private: |
| 1069 |
const |
|
| 1068 |
const GR& _graph; |
|
| 1070 | 1069 |
}; |
| 1071 | 1070 |
|
| 1072 | 1071 |
namespace _core_bits {
|
| 1073 | 1072 |
|
| 1074 | 1073 |
template <typename Graph, typename Enable = void> |
| 1075 | 1074 |
struct FindEdgeSelector {
|
| 1076 | 1075 |
typedef typename Graph::Node Node; |
| 1077 | 1076 |
typedef typename Graph::Edge Edge; |
| ... | ... |
@@ -1154,46 +1153,45 @@ |
| 1154 | 1153 |
/// for (ConEdgeIt<Graph> it(g, u, v); it != INVALID; ++it) {
|
| 1155 | 1154 |
/// ... |
| 1156 | 1155 |
/// } |
| 1157 | 1156 |
///\endcode |
| 1158 | 1157 |
/// |
| 1159 | 1158 |
///\sa findEdge() |
| 1160 | 1159 |
template <typename GR> |
| 1161 | 1160 |
class ConEdgeIt : public GR::Edge {
|
| 1161 |
typedef typename GR::Edge Parent; |
|
| 1162 |
|
|
| 1162 | 1163 |
public: |
| 1163 | 1164 |
|
| 1164 |
typedef GR Graph; |
|
| 1165 |
typedef typename Graph::Edge Parent; |
|
| 1166 |
|
|
| 1167 |
typedef typename Graph::Edge Edge; |
|
| 1168 |
typedef typename |
|
| 1165 |
typedef typename GR::Edge Edge; |
|
| 1166 |
typedef typename GR::Node Node; |
|
| 1169 | 1167 |
|
| 1170 | 1168 |
/// \brief Constructor. |
| 1171 | 1169 |
/// |
| 1172 | 1170 |
/// Construct a new ConEdgeIt iterating on the edges that |
| 1173 | 1171 |
/// connects nodes \c u and \c v. |
| 1174 |
ConEdgeIt(const |
|
| 1172 |
ConEdgeIt(const GR& g, Node u, Node v) : _graph(g), _u(u), _v(v) {
|
|
| 1175 | 1173 |
Parent::operator=(findEdge(_graph, _u, _v)); |
| 1176 | 1174 |
} |
| 1177 | 1175 |
|
| 1178 | 1176 |
/// \brief Constructor. |
| 1179 | 1177 |
/// |
| 1180 | 1178 |
/// Construct a new ConEdgeIt that continues iterating from edge \c e. |
| 1181 |
ConEdgeIt(const |
|
| 1179 |
ConEdgeIt(const GR& g, Edge e) : Parent(e), _graph(g) {}
|
|
| 1182 | 1180 |
|
| 1183 | 1181 |
/// \brief Increment operator. |
| 1184 | 1182 |
/// |
| 1185 | 1183 |
/// It increments the iterator and gives back the next edge. |
| 1186 | 1184 |
ConEdgeIt& operator++() {
|
| 1187 | 1185 |
Parent::operator=(findEdge(_graph, _u, _v, *this)); |
| 1188 | 1186 |
return *this; |
| 1189 | 1187 |
} |
| 1190 | 1188 |
private: |
| 1191 |
const |
|
| 1189 |
const GR& _graph; |
|
| 1192 | 1190 |
Node _u, _v; |
| 1193 | 1191 |
}; |
| 1194 | 1192 |
|
| 1195 | 1193 |
|
| 1196 | 1194 |
///Dynamic arc look-up between given endpoints. |
| 1197 | 1195 |
|
| 1198 | 1196 |
///Using this class, you can find an arc in a digraph from a given |
| 1199 | 1197 |
///source to a given target in amortized time <em>O</em>(log<em>d</em>), |
| ... | ... |
@@ -1214,30 +1212,33 @@ |
| 1214 | 1212 |
///\tparam GR The type of the underlying digraph. |
| 1215 | 1213 |
/// |
| 1216 | 1214 |
///\sa ArcLookUp |
| 1217 | 1215 |
///\sa AllArcLookUp |
| 1218 | 1216 |
template <typename GR> |
| 1219 | 1217 |
class DynArcLookUp |
| 1220 | 1218 |
: protected ItemSetTraits<GR, typename GR::Arc>::ItemNotifier::ObserverBase |
| 1221 | 1219 |
{
|
| 1222 |
public: |
|
| 1223 | 1220 |
typedef typename ItemSetTraits<GR, typename GR::Arc> |
| 1224 | 1221 |
::ItemNotifier::ObserverBase Parent; |
| 1225 | 1222 |
|
| 1226 | 1223 |
TEMPLATE_DIGRAPH_TYPEDEFS(GR); |
| 1224 |
|
|
| 1225 |
public: |
|
| 1226 |
|
|
| 1227 |
/// The Digraph type |
|
| 1227 | 1228 |
typedef GR Digraph; |
| 1228 | 1229 |
|
| 1229 | 1230 |
protected: |
| 1230 | 1231 |
|
| 1231 | 1232 |
class AutoNodeMap : public ItemSetTraits<GR, Node>::template Map<Arc>::Type {
|
| 1233 |
typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent; |
|
| 1234 |
|
|
| 1232 | 1235 |
public: |
| 1233 | 1236 |
|
| 1234 |
typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent; |
|
| 1235 |
|
|
| 1236 | 1237 |
AutoNodeMap(const GR& digraph) : Parent(digraph, INVALID) {}
|
| 1237 | 1238 |
|
| 1238 | 1239 |
virtual void add(const Node& node) {
|
| 1239 | 1240 |
Parent::add(node); |
| 1240 | 1241 |
Parent::set(node, INVALID); |
| 1241 | 1242 |
} |
| 1242 | 1243 |
|
| 1243 | 1244 |
virtual void add(const std::vector<Node>& nodes) {
|
| ... | ... |
@@ -1252,32 +1253,34 @@ |
| 1252 | 1253 |
Node it; |
| 1253 | 1254 |
typename Parent::Notifier* nf = Parent::notifier(); |
| 1254 | 1255 |
for (nf->first(it); it != INVALID; nf->next(it)) {
|
| 1255 | 1256 |
Parent::set(it, INVALID); |
| 1256 | 1257 |
} |
| 1257 | 1258 |
} |
| 1258 | 1259 |
}; |
| 1259 | 1260 |
|
| 1260 |
const Digraph &_g; |
|
| 1261 |
AutoNodeMap _head; |
|
| 1262 |
typename Digraph::template ArcMap<Arc> _parent; |
|
| 1263 |
typename Digraph::template ArcMap<Arc> _left; |
|
| 1264 |
typename Digraph::template ArcMap<Arc> _right; |
|
| 1265 |
|
|
| 1266 | 1261 |
class ArcLess {
|
| 1267 | 1262 |
const Digraph &g; |
| 1268 | 1263 |
public: |
| 1269 | 1264 |
ArcLess(const Digraph &_g) : g(_g) {}
|
| 1270 | 1265 |
bool operator()(Arc a,Arc b) const |
| 1271 | 1266 |
{
|
| 1272 | 1267 |
return g.target(a)<g.target(b); |
| 1273 | 1268 |
} |
| 1274 | 1269 |
}; |
| 1275 | 1270 |
|
| 1271 |
protected: |
|
| 1272 |
|
|
| 1273 |
const Digraph &_g; |
|
| 1274 |
AutoNodeMap _head; |
|
| 1275 |
typename Digraph::template ArcMap<Arc> _parent; |
|
| 1276 |
typename Digraph::template ArcMap<Arc> _left; |
|
| 1277 |
typename Digraph::template ArcMap<Arc> _right; |
|
| 1278 |
|
|
| 1276 | 1279 |
public: |
| 1277 | 1280 |
|
| 1278 | 1281 |
///Constructor |
| 1279 | 1282 |
|
| 1280 | 1283 |
///Constructor. |
| 1281 | 1284 |
/// |
| 1282 | 1285 |
///It builds up the search database. |
| 1283 | 1286 |
DynArcLookUp(const Digraph &g) |
| ... | ... |
@@ -1625,18 +1628,21 @@ |
| 1625 | 1628 |
/// |
| 1626 | 1629 |
///\tparam GR The type of the underlying digraph. |
| 1627 | 1630 |
/// |
| 1628 | 1631 |
///\sa DynArcLookUp |
| 1629 | 1632 |
///\sa AllArcLookUp |
| 1630 | 1633 |
template<class GR> |
| 1631 | 1634 |
class ArcLookUp |
| 1632 | 1635 |
{
|
| 1636 |
TEMPLATE_DIGRAPH_TYPEDEFS(GR); |
|
| 1637 |
|
|
| 1633 | 1638 |
public: |
| 1634 |
|
|
| 1639 |
|
|
| 1640 |
/// The Digraph type |
|
| 1635 | 1641 |
typedef GR Digraph; |
| 1636 | 1642 |
|
| 1637 | 1643 |
protected: |
| 1638 | 1644 |
const Digraph &_g; |
| 1639 | 1645 |
typename Digraph::template NodeMap<Arc> _head; |
| 1640 | 1646 |
typename Digraph::template ArcMap<Arc> _left; |
| 1641 | 1647 |
typename Digraph::template ArcMap<Arc> _right; |
| 1642 | 1648 |
|
| ... | ... |
@@ -1741,19 +1747,18 @@ |
| 1741 | 1747 |
class AllArcLookUp : public ArcLookUp<GR> |
| 1742 | 1748 |
{
|
| 1743 | 1749 |
using ArcLookUp<GR>::_g; |
| 1744 | 1750 |
using ArcLookUp<GR>::_right; |
| 1745 | 1751 |
using ArcLookUp<GR>::_left; |
| 1746 | 1752 |
using ArcLookUp<GR>::_head; |
| 1747 | 1753 |
|
| 1748 | 1754 |
TEMPLATE_DIGRAPH_TYPEDEFS(GR); |
| 1749 |
typedef GR Digraph; |
|
| 1750 | 1755 |
|
| 1751 |
typename |
|
| 1756 |
typename GR::template ArcMap<Arc> _next; |
|
| 1752 | 1757 |
|
| 1753 | 1758 |
Arc refreshNext(Arc head,Arc next=INVALID) |
| 1754 | 1759 |
{
|
| 1755 | 1760 |
if(head==INVALID) return next; |
| 1756 | 1761 |
else {
|
| 1757 | 1762 |
next=refreshNext(_right[head],next); |
| 1758 | 1763 |
_next[head]=( next!=INVALID && _g.target(next)==_g.target(head)) |
| 1759 | 1764 |
? next : INVALID; |
| ... | ... |
@@ -1762,16 +1767,20 @@ |
| 1762 | 1767 |
} |
| 1763 | 1768 |
|
| 1764 | 1769 |
void refreshNext() |
| 1765 | 1770 |
{
|
| 1766 | 1771 |
for(NodeIt n(_g);n!=INVALID;++n) refreshNext(_head[n]); |
| 1767 | 1772 |
} |
| 1768 | 1773 |
|
| 1769 | 1774 |
public: |
| 1775 |
|
|
| 1776 |
/// The Digraph type |
|
| 1777 |
typedef GR Digraph; |
|
| 1778 |
|
|
| 1770 | 1779 |
///Constructor |
| 1771 | 1780 |
|
| 1772 | 1781 |
///Constructor. |
| 1773 | 1782 |
/// |
| 1774 | 1783 |
///It builds up the search database, which remains valid until the digraph |
| 1775 | 1784 |
///changes. |
| 1776 | 1785 |
AllArcLookUp(const Digraph &g) : ArcLookUp<GR>(g), _next(g) {refreshNext();}
|
| 1777 | 1786 |
| ... | ... |
@@ -28,17 +28,16 @@ |
| 28 | 28 |
/// |
| 29 | 29 |
/// Graphs which use another graph's node-set as own. |
| 30 | 30 |
namespace lemon {
|
| 31 | 31 |
|
| 32 | 32 |
template <typename GR> |
| 33 | 33 |
class ListArcSetBase {
|
| 34 | 34 |
public: |
| 35 | 35 |
|
| 36 |
typedef GR Graph; |
|
| 37 | 36 |
typedef typename GR::Node Node; |
| 38 | 37 |
typedef typename GR::NodeIt NodeIt; |
| 39 | 38 |
|
| 40 | 39 |
protected: |
| 41 | 40 |
|
| 42 | 41 |
struct NodeT {
|
| 43 | 42 |
int first_out, first_in; |
| 44 | 43 |
NodeT() : first_out(-1), first_in(-1) {}
|
| ... | ... |
@@ -203,20 +202,20 @@ |
| 203 | 202 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 204 | 203 |
|
| 205 | 204 |
NodeNotifier& notifier(Node) const {
|
| 206 | 205 |
return _graph->notifier(Node()); |
| 207 | 206 |
} |
| 208 | 207 |
|
| 209 | 208 |
template <typename V> |
| 210 | 209 |
class NodeMap : public GR::template NodeMap<V> {
|
| 210 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 211 |
|
|
| 211 | 212 |
public: |
| 212 | 213 |
|
| 213 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 214 |
|
|
| 215 | 214 |
explicit NodeMap(const ListArcSetBase<GR>& arcset) |
| 216 | 215 |
: Parent(*arcset._graph) {}
|
| 217 | 216 |
|
| 218 | 217 |
NodeMap(const ListArcSetBase<GR>& arcset, const V& value) |
| 219 | 218 |
: Parent(*arcset._graph, value) {}
|
| 220 | 219 |
|
| 221 | 220 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 222 | 221 |
return operator=<NodeMap>(cmap); |
| ... | ... |
@@ -254,27 +253,23 @@ |
| 254 | 253 |
/// this class. Its interface must conform to the |
| 255 | 254 |
/// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" |
| 256 | 255 |
/// concept. |
| 257 | 256 |
/// |
| 258 | 257 |
/// This class fully conforms to the \ref concepts::Digraph |
| 259 | 258 |
/// "Digraph" concept. |
| 260 | 259 |
template <typename GR> |
| 261 | 260 |
class ListArcSet : public ArcSetExtender<ListArcSetBase<GR> > {
|
| 261 |
typedef ArcSetExtender<ListArcSetBase<GR> > Parent; |
|
| 262 | 262 |
|
| 263 | 263 |
public: |
| 264 | 264 |
|
| 265 |
typedef ArcSetExtender<ListArcSetBase<GR> > Parent; |
|
| 266 |
|
|
| 267 | 265 |
typedef typename Parent::Node Node; |
| 268 | 266 |
typedef typename Parent::Arc Arc; |
| 269 | 267 |
|
| 270 |
typedef GR Graph; |
|
| 271 |
|
|
| 272 |
|
|
| 273 | 268 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 274 | 269 |
|
| 275 | 270 |
void eraseNode(const Node& node) {
|
| 276 | 271 |
Arc arc; |
| 277 | 272 |
Parent::firstOut(arc, node); |
| 278 | 273 |
while (arc != INVALID ) {
|
| 279 | 274 |
erase(arc); |
| 280 | 275 |
Parent::firstOut(arc, node); |
| ... | ... |
@@ -287,19 +282,19 @@ |
| 287 | 282 |
} |
| 288 | 283 |
} |
| 289 | 284 |
|
| 290 | 285 |
void clearNodes() {
|
| 291 | 286 |
Parent::clear(); |
| 292 | 287 |
} |
| 293 | 288 |
|
| 294 | 289 |
class NodesImpl : public NodesImplBase {
|
| 295 |
public: |
|
| 296 | 290 |
typedef NodesImplBase Parent; |
| 297 | 291 |
|
| 292 |
public: |
|
| 298 | 293 |
NodesImpl(const GR& graph, ListArcSet& arcset) |
| 299 | 294 |
: Parent(graph), _arcset(arcset) {}
|
| 300 | 295 |
|
| 301 | 296 |
virtual ~NodesImpl() {}
|
| 302 | 297 |
|
| 303 | 298 |
protected: |
| 304 | 299 |
|
| 305 | 300 |
virtual void erase(const Node& node) {
|
| ... | ... |
@@ -349,17 +344,16 @@ |
| 349 | 344 |
} |
| 350 | 345 |
|
| 351 | 346 |
}; |
| 352 | 347 |
|
| 353 | 348 |
template <typename GR> |
| 354 | 349 |
class ListEdgeSetBase {
|
| 355 | 350 |
public: |
| 356 | 351 |
|
| 357 |
typedef GR Graph; |
|
| 358 | 352 |
typedef typename GR::Node Node; |
| 359 | 353 |
typedef typename GR::NodeIt NodeIt; |
| 360 | 354 |
|
| 361 | 355 |
protected: |
| 362 | 356 |
|
| 363 | 357 |
struct NodeT {
|
| 364 | 358 |
int first_out; |
| 365 | 359 |
NodeT() : first_out(-1) {}
|
| ... | ... |
@@ -632,20 +626,20 @@ |
| 632 | 626 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 633 | 627 |
|
| 634 | 628 |
NodeNotifier& notifier(Node) const {
|
| 635 | 629 |
return _graph->notifier(Node()); |
| 636 | 630 |
} |
| 637 | 631 |
|
| 638 | 632 |
template <typename V> |
| 639 | 633 |
class NodeMap : public GR::template NodeMap<V> {
|
| 634 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 635 |
|
|
| 640 | 636 |
public: |
| 641 | 637 |
|
| 642 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 643 |
|
|
| 644 | 638 |
explicit NodeMap(const ListEdgeSetBase<GR>& arcset) |
| 645 | 639 |
: Parent(*arcset._graph) {}
|
| 646 | 640 |
|
| 647 | 641 |
NodeMap(const ListEdgeSetBase<GR>& arcset, const V& value) |
| 648 | 642 |
: Parent(*arcset._graph, value) {}
|
| 649 | 643 |
|
| 650 | 644 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 651 | 645 |
return operator=<NodeMap>(cmap); |
| ... | ... |
@@ -683,28 +677,24 @@ |
| 683 | 677 |
/// with this class. Its interface must conform to the |
| 684 | 678 |
/// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" |
| 685 | 679 |
/// concept. |
| 686 | 680 |
/// |
| 687 | 681 |
/// This class fully conforms to the \ref concepts::Graph "Graph" |
| 688 | 682 |
/// concept. |
| 689 | 683 |
template <typename GR> |
| 690 | 684 |
class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<GR> > {
|
| 685 |
typedef EdgeSetExtender<ListEdgeSetBase<GR> > Parent; |
|
| 691 | 686 |
|
| 692 | 687 |
public: |
| 693 | 688 |
|
| 694 |
typedef EdgeSetExtender<ListEdgeSetBase<GR> > Parent; |
|
| 695 |
|
|
| 696 | 689 |
typedef typename Parent::Node Node; |
| 697 | 690 |
typedef typename Parent::Arc Arc; |
| 698 | 691 |
typedef typename Parent::Edge Edge; |
| 699 | 692 |
|
| 700 |
typedef GR Graph; |
|
| 701 |
|
|
| 702 |
|
|
| 703 | 693 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 704 | 694 |
|
| 705 | 695 |
void eraseNode(const Node& node) {
|
| 706 | 696 |
Arc arc; |
| 707 | 697 |
Parent::firstOut(arc, node); |
| 708 | 698 |
while (arc != INVALID ) {
|
| 709 | 699 |
erase(arc); |
| 710 | 700 |
Parent::firstOut(arc, node); |
| ... | ... |
@@ -712,19 +702,19 @@ |
| 712 | 702 |
|
| 713 | 703 |
} |
| 714 | 704 |
|
| 715 | 705 |
void clearNodes() {
|
| 716 | 706 |
Parent::clear(); |
| 717 | 707 |
} |
| 718 | 708 |
|
| 719 | 709 |
class NodesImpl : public NodesImplBase {
|
| 720 |
public: |
|
| 721 | 710 |
typedef NodesImplBase Parent; |
| 722 | 711 |
|
| 712 |
public: |
|
| 723 | 713 |
NodesImpl(const GR& graph, ListEdgeSet& arcset) |
| 724 | 714 |
: Parent(graph), _arcset(arcset) {}
|
| 725 | 715 |
|
| 726 | 716 |
virtual ~NodesImpl() {}
|
| 727 | 717 |
|
| 728 | 718 |
protected: |
| 729 | 719 |
|
| 730 | 720 |
virtual void erase(const Node& node) {
|
| ... | ... |
@@ -774,19 +764,18 @@ |
| 774 | 764 |
} |
| 775 | 765 |
|
| 776 | 766 |
}; |
| 777 | 767 |
|
| 778 | 768 |
template <typename GR> |
| 779 | 769 |
class SmartArcSetBase {
|
| 780 | 770 |
public: |
| 781 | 771 |
|
| 782 |
typedef GR Graph; |
|
| 783 |
typedef typename Graph::Node Node; |
|
| 784 |
typedef typename |
|
| 772 |
typedef typename GR::Node Node; |
|
| 773 |
typedef typename GR::NodeIt NodeIt; |
|
| 785 | 774 |
|
| 786 | 775 |
protected: |
| 787 | 776 |
|
| 788 | 777 |
struct NodeT {
|
| 789 | 778 |
int first_out, first_in; |
| 790 | 779 |
NodeT() : first_out(-1), first_in(-1) {}
|
| 791 | 780 |
}; |
| 792 | 781 |
|
| ... | ... |
@@ -895,20 +884,20 @@ |
| 895 | 884 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 896 | 885 |
|
| 897 | 886 |
NodeNotifier& notifier(Node) const {
|
| 898 | 887 |
return _graph->notifier(Node()); |
| 899 | 888 |
} |
| 900 | 889 |
|
| 901 | 890 |
template <typename V> |
| 902 | 891 |
class NodeMap : public GR::template NodeMap<V> {
|
| 892 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 893 |
|
|
| 903 | 894 |
public: |
| 904 | 895 |
|
| 905 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 906 |
|
|
| 907 | 896 |
explicit NodeMap(const SmartArcSetBase<GR>& arcset) |
| 908 | 897 |
: Parent(*arcset._graph) { }
|
| 909 | 898 |
|
| 910 | 899 |
NodeMap(const SmartArcSetBase<GR>& arcset, const V& value) |
| 911 | 900 |
: Parent(*arcset._graph, value) { }
|
| 912 | 901 |
|
| 913 | 902 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 914 | 903 |
return operator=<NodeMap>(cmap); |
| ... | ... |
@@ -951,26 +940,23 @@ |
| 951 | 940 |
/// node is the source or target of one arc in the arc set, then |
| 952 | 941 |
/// the arc set is invalidated, and it cannot be used anymore. The |
| 953 | 942 |
/// validity can be checked with the \c valid() member function. |
| 954 | 943 |
/// |
| 955 | 944 |
/// This class fully conforms to the \ref concepts::Digraph |
| 956 | 945 |
/// "Digraph" concept. |
| 957 | 946 |
template <typename GR> |
| 958 | 947 |
class SmartArcSet : public ArcSetExtender<SmartArcSetBase<GR> > {
|
| 948 |
typedef ArcSetExtender<SmartArcSetBase<GR> > Parent; |
|
| 959 | 949 |
|
| 960 | 950 |
public: |
| 961 | 951 |
|
| 962 |
typedef ArcSetExtender<SmartArcSetBase<GR> > Parent; |
|
| 963 |
|
|
| 964 | 952 |
typedef typename Parent::Node Node; |
| 965 | 953 |
typedef typename Parent::Arc Arc; |
| 966 | 954 |
|
| 967 |
typedef GR Graph; |
|
| 968 |
|
|
| 969 | 955 |
protected: |
| 970 | 956 |
|
| 971 | 957 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 972 | 958 |
|
| 973 | 959 |
void eraseNode(const Node& node) {
|
| 974 | 960 |
if (typename Parent::InArcIt(*this, node) == INVALID && |
| 975 | 961 |
typename Parent::OutArcIt(*this, node) == INVALID) {
|
| 976 | 962 |
return; |
| ... | ... |
@@ -978,19 +964,19 @@ |
| 978 | 964 |
throw typename NodesImplBase::Notifier::ImmediateDetach(); |
| 979 | 965 |
} |
| 980 | 966 |
|
| 981 | 967 |
void clearNodes() {
|
| 982 | 968 |
Parent::clear(); |
| 983 | 969 |
} |
| 984 | 970 |
|
| 985 | 971 |
class NodesImpl : public NodesImplBase {
|
| 986 |
public: |
|
| 987 | 972 |
typedef NodesImplBase Parent; |
| 988 | 973 |
|
| 974 |
public: |
|
| 989 | 975 |
NodesImpl(const GR& graph, SmartArcSet& arcset) |
| 990 | 976 |
: Parent(graph), _arcset(arcset) {}
|
| 991 | 977 |
|
| 992 | 978 |
virtual ~NodesImpl() {}
|
| 993 | 979 |
|
| 994 | 980 |
bool attached() const {
|
| 995 | 981 |
return Parent::attached(); |
| 996 | 982 |
} |
| ... | ... |
@@ -1057,17 +1043,16 @@ |
| 1057 | 1043 |
|
| 1058 | 1044 |
}; |
| 1059 | 1045 |
|
| 1060 | 1046 |
|
| 1061 | 1047 |
template <typename GR> |
| 1062 | 1048 |
class SmartEdgeSetBase {
|
| 1063 | 1049 |
public: |
| 1064 | 1050 |
|
| 1065 |
typedef GR Graph; |
|
| 1066 | 1051 |
typedef typename GR::Node Node; |
| 1067 | 1052 |
typedef typename GR::NodeIt NodeIt; |
| 1068 | 1053 |
|
| 1069 | 1054 |
protected: |
| 1070 | 1055 |
|
| 1071 | 1056 |
struct NodeT {
|
| 1072 | 1057 |
int first_out; |
| 1073 | 1058 |
NodeT() : first_out(-1) {}
|
| ... | ... |
@@ -1244,20 +1229,20 @@ |
| 1244 | 1229 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 1245 | 1230 |
|
| 1246 | 1231 |
NodeNotifier& notifier(Node) const {
|
| 1247 | 1232 |
return _graph->notifier(Node()); |
| 1248 | 1233 |
} |
| 1249 | 1234 |
|
| 1250 | 1235 |
template <typename V> |
| 1251 | 1236 |
class NodeMap : public GR::template NodeMap<V> {
|
| 1237 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 1238 |
|
|
| 1252 | 1239 |
public: |
| 1253 | 1240 |
|
| 1254 |
typedef typename GR::template NodeMap<V> Parent; |
|
| 1255 |
|
|
| 1256 | 1241 |
explicit NodeMap(const SmartEdgeSetBase<GR>& arcset) |
| 1257 | 1242 |
: Parent(*arcset._graph) { }
|
| 1258 | 1243 |
|
| 1259 | 1244 |
NodeMap(const SmartEdgeSetBase<GR>& arcset, const V& value) |
| 1260 | 1245 |
: Parent(*arcset._graph, value) { }
|
| 1261 | 1246 |
|
| 1262 | 1247 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 1263 | 1248 |
return operator=<NodeMap>(cmap); |
| ... | ... |
@@ -1299,46 +1284,43 @@ |
| 1299 | 1284 |
/// node is incident to one edge in the edge set, then the edge set |
| 1300 | 1285 |
/// is invalidated, and it cannot be used anymore. The validity can |
| 1301 | 1286 |
/// be checked with the \c valid() member function. |
| 1302 | 1287 |
/// |
| 1303 | 1288 |
/// This class fully conforms to the \ref concepts::Graph |
| 1304 | 1289 |
/// "Graph" concept. |
| 1305 | 1290 |
template <typename GR> |
| 1306 | 1291 |
class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<GR> > {
|
| 1292 |
typedef EdgeSetExtender<SmartEdgeSetBase<GR> > Parent; |
|
| 1307 | 1293 |
|
| 1308 | 1294 |
public: |
| 1309 | 1295 |
|
| 1310 |
typedef EdgeSetExtender<SmartEdgeSetBase<GR> > Parent; |
|
| 1311 |
|
|
| 1312 | 1296 |
typedef typename Parent::Node Node; |
| 1313 | 1297 |
typedef typename Parent::Arc Arc; |
| 1314 | 1298 |
typedef typename Parent::Edge Edge; |
| 1315 | 1299 |
|
| 1316 |
typedef GR Graph; |
|
| 1317 |
|
|
| 1318 | 1300 |
protected: |
| 1319 | 1301 |
|
| 1320 | 1302 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 1321 | 1303 |
|
| 1322 | 1304 |
void eraseNode(const Node& node) {
|
| 1323 | 1305 |
if (typename Parent::IncEdgeIt(*this, node) == INVALID) {
|
| 1324 | 1306 |
return; |
| 1325 | 1307 |
} |
| 1326 | 1308 |
throw typename NodesImplBase::Notifier::ImmediateDetach(); |
| 1327 | 1309 |
} |
| 1328 | 1310 |
|
| 1329 | 1311 |
void clearNodes() {
|
| 1330 | 1312 |
Parent::clear(); |
| 1331 | 1313 |
} |
| 1332 | 1314 |
|
| 1333 | 1315 |
class NodesImpl : public NodesImplBase {
|
| 1334 |
public: |
|
| 1335 | 1316 |
typedef NodesImplBase Parent; |
| 1336 | 1317 |
|
| 1318 |
public: |
|
| 1337 | 1319 |
NodesImpl(const GR& graph, SmartEdgeSet& arcset) |
| 1338 | 1320 |
: Parent(graph), _arcset(arcset) {}
|
| 1339 | 1321 |
|
| 1340 | 1322 |
virtual ~NodesImpl() {}
|
| 1341 | 1323 |
|
| 1342 | 1324 |
bool attached() const {
|
| 1343 | 1325 |
return Parent::attached(); |
| 1344 | 1326 |
} |
| ... | ... |
@@ -26,17 +26,17 @@ |
| 26 | 26 |
///\file |
| 27 | 27 |
///\brief FullGraph and FullDigraph classes. |
| 28 | 28 |
|
| 29 | 29 |
namespace lemon {
|
| 30 | 30 |
|
| 31 | 31 |
class FullDigraphBase {
|
| 32 | 32 |
public: |
| 33 | 33 |
|
| 34 |
typedef FullDigraphBase |
|
| 34 |
typedef FullDigraphBase Digraph; |
|
| 35 | 35 |
|
| 36 | 36 |
class Node; |
| 37 | 37 |
class Arc; |
| 38 | 38 |
|
| 39 | 39 |
protected: |
| 40 | 40 |
|
| 41 | 41 |
int _node_num; |
| 42 | 42 |
int _arc_num; |
| ... | ... |
@@ -164,20 +164,20 @@ |
| 164 | 164 |
/// but there are two differences. While this class conforms only |
| 165 | 165 |
/// to the \ref concepts::Digraph "Digraph" concept, the \c FullGraph |
| 166 | 166 |
/// class conforms to the \ref concepts::Graph "Graph" concept, |
| 167 | 167 |
/// moreover \c FullGraph does not contain a loop arc for each |
| 168 | 168 |
/// node as \c FullDigraph does. |
| 169 | 169 |
/// |
| 170 | 170 |
/// \sa FullGraph |
| 171 | 171 |
class FullDigraph : public ExtendedFullDigraphBase {
|
| 172 |
typedef ExtendedFullDigraphBase Parent; |
|
| 173 |
|
|
| 172 | 174 |
public: |
| 173 | 175 |
|
| 174 |
typedef ExtendedFullDigraphBase Parent; |
|
| 175 |
|
|
| 176 | 176 |
/// \brief Constructor |
| 177 | 177 |
FullDigraph() { construct(0); }
|
| 178 | 178 |
|
| 179 | 179 |
/// \brief Constructor |
| 180 | 180 |
/// |
| 181 | 181 |
/// Constructor. |
| 182 | 182 |
/// \param n The number of the nodes. |
| 183 | 183 |
FullDigraph(int n) { construct(n); }
|
| ... | ... |
@@ -221,28 +221,29 @@ |
| 221 | 221 |
/// \brief Number of nodes. |
| 222 | 222 |
int nodeNum() const { return Parent::nodeNum(); }
|
| 223 | 223 |
/// \brief Number of arcs. |
| 224 | 224 |
int arcNum() const { return Parent::arcNum(); }
|
| 225 | 225 |
}; |
| 226 | 226 |
|
| 227 | 227 |
|
| 228 | 228 |
class FullGraphBase {
|
| 229 |
int _node_num; |
|
| 230 |
int _edge_num; |
|
| 231 | 229 |
public: |
| 232 | 230 |
|
| 233 | 231 |
typedef FullGraphBase Graph; |
| 234 | 232 |
|
| 235 | 233 |
class Node; |
| 236 | 234 |
class Arc; |
| 237 | 235 |
class Edge; |
| 238 | 236 |
|
| 239 | 237 |
protected: |
| 240 | 238 |
|
| 239 |
int _node_num; |
|
| 240 |
int _edge_num; |
|
| 241 |
|
|
| 241 | 242 |
FullGraphBase() {}
|
| 242 | 243 |
|
| 243 | 244 |
void construct(int n) { _node_num = n; _edge_num = n * (n - 1) / 2; }
|
| 244 | 245 |
|
| 245 | 246 |
int _uid(int e) const {
|
| 246 | 247 |
int u = e / _node_num; |
| 247 | 248 |
int v = e % _node_num; |
| 248 | 249 |
return u < v ? u : _node_num - 2 - u; |
| ... | ... |
@@ -532,20 +533,20 @@ |
| 532 | 533 |
/// but there are two differences. While the \c FullDigraph class |
| 533 | 534 |
/// conforms only to the \ref concepts::Digraph "Digraph" concept, |
| 534 | 535 |
/// this class conforms to the \ref concepts::Graph "Graph" concept, |
| 535 | 536 |
/// moreover \c FullGraph does not contain a loop arc for each |
| 536 | 537 |
/// node as \c FullDigraph does. |
| 537 | 538 |
/// |
| 538 | 539 |
/// \sa FullDigraph |
| 539 | 540 |
class FullGraph : public ExtendedFullGraphBase {
|
| 541 |
typedef ExtendedFullGraphBase Parent; |
|
| 542 |
|
|
| 540 | 543 |
public: |
| 541 | 544 |
|
| 542 |
typedef ExtendedFullGraphBase Parent; |
|
| 543 |
|
|
| 544 | 545 |
/// \brief Constructor |
| 545 | 546 |
FullGraph() { construct(0); }
|
| 546 | 547 |
|
| 547 | 548 |
/// \brief Constructor |
| 548 | 549 |
/// |
| 549 | 550 |
/// Constructor. |
| 550 | 551 |
/// \param n The number of the nodes. |
| 551 | 552 |
FullGraph(int n) { construct(n); }
|
| ... | ... |
@@ -64,16 +64,17 @@ |
| 64 | 64 |
|
| 65 | 65 |
///Default traits class of \ref GraphToEps. |
| 66 | 66 |
/// |
| 67 | 67 |
///\param GR is the type of the underlying graph. |
| 68 | 68 |
template<class GR> |
| 69 | 69 |
struct DefaultGraphToEpsTraits |
| 70 | 70 |
{
|
| 71 | 71 |
typedef GR Graph; |
| 72 |
typedef GR Digraph; |
|
| 72 | 73 |
typedef typename Graph::Node Node; |
| 73 | 74 |
typedef typename Graph::NodeIt NodeIt; |
| 74 | 75 |
typedef typename Graph::Arc Arc; |
| 75 | 76 |
typedef typename Graph::ArcIt ArcIt; |
| 76 | 77 |
typedef typename Graph::InArcIt InArcIt; |
| 77 | 78 |
typedef typename Graph::OutArcIt OutArcIt; |
| 78 | 79 |
|
| 79 | 80 |
|
| ... | ... |
@@ -236,16 +237,17 @@ |
| 236 | 237 |
|
| 237 | 238 |
|
| 238 | 239 |
using T::_negY; |
| 239 | 240 |
using T::_preScale; |
| 240 | 241 |
|
| 241 | 242 |
// dradnats ++C eht yb deriuqer si ti eveileb t'naC |
| 242 | 243 |
|
| 243 | 244 |
typedef typename T::Graph Graph; |
| 245 |
typedef typename T::Digraph Digraph; |
|
| 244 | 246 |
typedef typename Graph::Node Node; |
| 245 | 247 |
typedef typename Graph::NodeIt NodeIt; |
| 246 | 248 |
typedef typename Graph::Arc Arc; |
| 247 | 249 |
typedef typename Graph::ArcIt ArcIt; |
| 248 | 250 |
typedef typename Graph::InArcIt InArcIt; |
| 249 | 251 |
typedef typename Graph::OutArcIt OutArcIt; |
| 250 | 252 |
|
| 251 | 253 |
static const int INTERPOL_PREC; |
| ... | ... |
@@ -494,20 +494,20 @@ |
| 494 | 494 |
/// val[graph(i, j)] = i + j; |
| 495 | 495 |
/// } |
| 496 | 496 |
/// } |
| 497 | 497 |
///\endcode |
| 498 | 498 |
/// |
| 499 | 499 |
/// This graph type fully conforms to the \ref concepts::Graph |
| 500 | 500 |
/// "Graph concept". |
| 501 | 501 |
class GridGraph : public ExtendedGridGraphBase {
|
| 502 |
typedef ExtendedGridGraphBase Parent; |
|
| 503 |
|
|
| 502 | 504 |
public: |
| 503 | 505 |
|
| 504 |
typedef ExtendedGridGraphBase Parent; |
|
| 505 |
|
|
| 506 | 506 |
/// \brief Map to get the indices of the nodes as dim2::Point<int>. |
| 507 | 507 |
/// |
| 508 | 508 |
/// Map to get the indices of the nodes as dim2::Point<int>. |
| 509 | 509 |
class IndexMap {
|
| 510 | 510 |
public: |
| 511 | 511 |
/// \brief The key type of the map |
| 512 | 512 |
typedef GridGraph::Node Key; |
| 513 | 513 |
/// \brief The value type of the map |
| ... | ... |
@@ -289,20 +289,20 @@ |
| 289 | 289 |
/// |
| 290 | 290 |
/// \note The type of the indices is chosen to \c int for efficiency |
| 291 | 291 |
/// reasons. Thus the maximum dimension of this implementation is 26 |
| 292 | 292 |
/// (assuming that the size of \c int is 32 bit). |
| 293 | 293 |
/// |
| 294 | 294 |
/// This graph type fully conforms to the \ref concepts::Graph |
| 295 | 295 |
/// "Graph concept". |
| 296 | 296 |
class HypercubeGraph : public ExtendedHypercubeGraphBase {
|
| 297 |
typedef ExtendedHypercubeGraphBase Parent; |
|
| 298 |
|
|
| 297 | 299 |
public: |
| 298 | 300 |
|
| 299 |
typedef ExtendedHypercubeGraphBase Parent; |
|
| 300 |
|
|
| 301 | 301 |
/// \brief Constructs a hypercube graph with \c dim dimensions. |
| 302 | 302 |
/// |
| 303 | 303 |
/// Constructs a hypercube graph with \c dim dimensions. |
| 304 | 304 |
HypercubeGraph(int dim) { construct(dim); }
|
| 305 | 305 |
|
| 306 | 306 |
/// \brief The number of dimensions. |
| 307 | 307 |
/// |
| 308 | 308 |
/// Gives back the number of dimensions. |
| ... | ... |
@@ -318,32 +318,32 @@ |
| 318 | 318 |
///It conforms to the \ref concepts::Digraph "Digraph concept" and it |
| 319 | 319 |
///also provides several useful additional functionalities. |
| 320 | 320 |
///Most of the member functions and nested classes are documented |
| 321 | 321 |
///only in the concept class. |
| 322 | 322 |
/// |
| 323 | 323 |
///\sa concepts::Digraph |
| 324 | 324 |
|
| 325 | 325 |
class ListDigraph : public ExtendedListDigraphBase {
|
| 326 |
typedef ExtendedListDigraphBase Parent; |
|
| 327 |
|
|
| 326 | 328 |
private: |
| 327 | 329 |
///ListDigraph is \e not copy constructible. Use copyDigraph() instead. |
| 328 | 330 |
|
| 329 | 331 |
///ListDigraph is \e not copy constructible. Use copyDigraph() instead. |
| 330 | 332 |
/// |
| 331 | 333 |
ListDigraph(const ListDigraph &) :ExtendedListDigraphBase() {};
|
| 332 | 334 |
///\brief Assignment of ListDigraph to another one is \e not allowed. |
| 333 | 335 |
///Use copyDigraph() instead. |
| 334 | 336 |
|
| 335 | 337 |
///Assignment of ListDigraph to another one is \e not allowed. |
| 336 | 338 |
///Use copyDigraph() instead. |
| 337 | 339 |
void operator=(const ListDigraph &) {}
|
| 338 | 340 |
public: |
| 339 | 341 |
|
| 340 |
typedef ExtendedListDigraphBase Parent; |
|
| 341 |
|
|
| 342 | 342 |
/// Constructor |
| 343 | 343 |
|
| 344 | 344 |
/// Constructor. |
| 345 | 345 |
/// |
| 346 | 346 |
ListDigraph() {}
|
| 347 | 347 |
|
| 348 | 348 |
///Add a new node to the digraph. |
| 349 | 349 |
|
| ... | ... |
@@ -788,17 +788,17 @@ |
| 788 | 788 |
int first_free_node; |
| 789 | 789 |
|
| 790 | 790 |
std::vector<ArcT> arcs; |
| 791 | 791 |
|
| 792 | 792 |
int first_free_arc; |
| 793 | 793 |
|
| 794 | 794 |
public: |
| 795 | 795 |
|
| 796 |
typedef ListGraphBase |
|
| 796 |
typedef ListGraphBase Graph; |
|
| 797 | 797 |
|
| 798 | 798 |
class Node; |
| 799 | 799 |
class Arc; |
| 800 | 800 |
class Edge; |
| 801 | 801 |
|
| 802 | 802 |
class Node {
|
| 803 | 803 |
friend class ListGraphBase; |
| 804 | 804 |
protected: |
| ... | ... |
@@ -1171,16 +1171,18 @@ |
| 1171 | 1171 |
///It conforms to the \ref concepts::Graph "Graph concept" and it |
| 1172 | 1172 |
///also provides several useful additional functionalities. |
| 1173 | 1173 |
///Most of the member functions and nested classes are documented |
| 1174 | 1174 |
///only in the concept class. |
| 1175 | 1175 |
/// |
| 1176 | 1176 |
///\sa concepts::Graph |
| 1177 | 1177 |
|
| 1178 | 1178 |
class ListGraph : public ExtendedListGraphBase {
|
| 1179 |
typedef ExtendedListGraphBase Parent; |
|
| 1180 |
|
|
| 1179 | 1181 |
private: |
| 1180 | 1182 |
///ListGraph is \e not copy constructible. Use copyGraph() instead. |
| 1181 | 1183 |
|
| 1182 | 1184 |
///ListGraph is \e not copy constructible. Use copyGraph() instead. |
| 1183 | 1185 |
/// |
| 1184 | 1186 |
ListGraph(const ListGraph &) :ExtendedListGraphBase() {};
|
| 1185 | 1187 |
///\brief Assignment of ListGraph to another one is \e not allowed. |
| 1186 | 1188 |
///Use copyGraph() instead. |
| ... | ... |
@@ -1190,18 +1192,16 @@ |
| 1190 | 1192 |
void operator=(const ListGraph &) {}
|
| 1191 | 1193 |
public: |
| 1192 | 1194 |
/// Constructor |
| 1193 | 1195 |
|
| 1194 | 1196 |
/// Constructor. |
| 1195 | 1197 |
/// |
| 1196 | 1198 |
ListGraph() {}
|
| 1197 | 1199 |
|
| 1198 |
typedef ExtendedListGraphBase Parent; |
|
| 1199 |
|
|
| 1200 | 1200 |
typedef Parent::OutArcIt IncEdgeIt; |
| 1201 | 1201 |
|
| 1202 | 1202 |
/// \brief Add a new node to the graph. |
| 1203 | 1203 |
/// |
| 1204 | 1204 |
/// Add a new node to the graph. |
| 1205 | 1205 |
/// \return The new node. |
| 1206 | 1206 |
Node addNode() { return Parent::addNode(); }
|
| 1207 | 1207 |
| ... | ... |
@@ -1833,16 +1833,17 @@ |
| 1833 | 1833 |
/// \c GR::Edge). |
| 1834 | 1834 |
/// |
| 1835 | 1835 |
/// \see RangeIdMap |
| 1836 | 1836 |
template <typename GR, typename K> |
| 1837 | 1837 |
class IdMap : public MapBase<K, int> {
|
| 1838 | 1838 |
public: |
| 1839 | 1839 |
/// The graph type of IdMap. |
| 1840 | 1840 |
typedef GR Graph; |
| 1841 |
typedef GR Digraph; |
|
| 1841 | 1842 |
/// The key type of IdMap (\c Node, \c Arc or \c Edge). |
| 1842 | 1843 |
typedef K Item; |
| 1843 | 1844 |
/// The key type of IdMap (\c Node, \c Arc or \c Edge). |
| 1844 | 1845 |
typedef K Key; |
| 1845 | 1846 |
/// The value type of IdMap. |
| 1846 | 1847 |
typedef int Value; |
| 1847 | 1848 |
|
| 1848 | 1849 |
/// \brief Constructor. |
| ... | ... |
@@ -1924,16 +1925,17 @@ |
| 1924 | 1925 |
|
| 1925 | 1926 |
typedef std::map<V, K> Container; |
| 1926 | 1927 |
Container _inv_map; |
| 1927 | 1928 |
|
| 1928 | 1929 |
public: |
| 1929 | 1930 |
|
| 1930 | 1931 |
/// The graph type of CrossRefMap. |
| 1931 | 1932 |
typedef GR Graph; |
| 1933 |
typedef GR Digraph; |
|
| 1932 | 1934 |
/// The key type of CrossRefMap (\c Node, \c Arc or \c Edge). |
| 1933 | 1935 |
typedef K Item; |
| 1934 | 1936 |
/// The key type of CrossRefMap (\c Node, \c Arc or \c Edge). |
| 1935 | 1937 |
typedef K Key; |
| 1936 | 1938 |
/// The value type of CrossRefMap. |
| 1937 | 1939 |
typedef V Value; |
| 1938 | 1940 |
|
| 1939 | 1941 |
/// \brief Constructor. |
| ... | ... |
@@ -2127,16 +2129,17 @@ |
| 2127 | 2129 |
class RangeIdMap |
| 2128 | 2130 |
: protected ItemSetTraits<GR, K>::template Map<int>::Type {
|
| 2129 | 2131 |
|
| 2130 | 2132 |
typedef typename ItemSetTraits<GR, K>::template Map<int>::Type Map; |
| 2131 | 2133 |
|
| 2132 | 2134 |
public: |
| 2133 | 2135 |
/// The graph type of RangeIdMap. |
| 2134 | 2136 |
typedef GR Graph; |
| 2137 |
typedef GR Digraph; |
|
| 2135 | 2138 |
/// The key type of RangeIdMap (\c Node, \c Arc or \c Edge). |
| 2136 | 2139 |
typedef K Item; |
| 2137 | 2140 |
/// The key type of RangeIdMap (\c Node, \c Arc or \c Edge). |
| 2138 | 2141 |
typedef K Key; |
| 2139 | 2142 |
/// The value type of RangeIdMap. |
| 2140 | 2143 |
typedef int Value; |
| 2141 | 2144 |
|
| 2142 | 2145 |
/// \brief Constructor. |
| ... | ... |
@@ -2489,17 +2492,18 @@ |
| 2489 | 2492 |
/// \sa OutDegMap |
| 2490 | 2493 |
template <typename GR> |
| 2491 | 2494 |
class InDegMap |
| 2492 | 2495 |
: protected ItemSetTraits<GR, typename GR::Arc> |
| 2493 | 2496 |
::ItemNotifier::ObserverBase {
|
| 2494 | 2497 |
|
| 2495 | 2498 |
public: |
| 2496 | 2499 |
|
| 2497 |
/// The |
|
| 2500 |
/// The graph type of InDegMap |
|
| 2501 |
typedef GR Graph; |
|
| 2498 | 2502 |
typedef GR Digraph; |
| 2499 | 2503 |
/// The key type |
| 2500 | 2504 |
typedef typename Digraph::Node Key; |
| 2501 | 2505 |
/// The value type |
| 2502 | 2506 |
typedef int Value; |
| 2503 | 2507 |
|
| 2504 | 2508 |
typedef typename ItemSetTraits<Digraph, typename Digraph::Arc> |
| 2505 | 2509 |
::ItemNotifier::ObserverBase Parent; |
| ... | ... |
@@ -2618,17 +2622,18 @@ |
| 2618 | 2622 |
/// \sa InDegMap |
| 2619 | 2623 |
template <typename GR> |
| 2620 | 2624 |
class OutDegMap |
| 2621 | 2625 |
: protected ItemSetTraits<GR, typename GR::Arc> |
| 2622 | 2626 |
::ItemNotifier::ObserverBase {
|
| 2623 | 2627 |
|
| 2624 | 2628 |
public: |
| 2625 | 2629 |
|
| 2626 |
/// The |
|
| 2630 |
/// The graph type of OutDegMap |
|
| 2631 |
typedef GR Graph; |
|
| 2627 | 2632 |
typedef GR Digraph; |
| 2628 | 2633 |
/// The key type |
| 2629 | 2634 |
typedef typename Digraph::Node Key; |
| 2630 | 2635 |
/// The value type |
| 2631 | 2636 |
typedef int Value; |
| 2632 | 2637 |
|
| 2633 | 2638 |
typedef typename ItemSetTraits<Digraph, typename Digraph::Arc> |
| 2634 | 2639 |
::ItemNotifier::ObserverBase Parent; |
| ... | ... |
@@ -50,17 +50,17 @@ |
| 50 | 50 |
ArcT() {}
|
| 51 | 51 |
}; |
| 52 | 52 |
|
| 53 | 53 |
std::vector<NodeT> nodes; |
| 54 | 54 |
std::vector<ArcT> arcs; |
| 55 | 55 |
|
| 56 | 56 |
public: |
| 57 | 57 |
|
| 58 |
typedef SmartDigraphBase |
|
| 58 |
typedef SmartDigraphBase Digraph; |
|
| 59 | 59 |
|
| 60 | 60 |
class Node; |
| 61 | 61 |
class Arc; |
| 62 | 62 |
|
| 63 | 63 |
public: |
| 64 | 64 |
|
| 65 | 65 |
SmartDigraphBase() : nodes(), arcs() { }
|
| 66 | 66 |
SmartDigraphBase(const SmartDigraphBase &_g) |
| ... | ... |
@@ -190,18 +190,16 @@ |
| 190 | 190 |
///This is a simple and fast digraph implementation. |
| 191 | 191 |
///It is also quite memory efficient, but at the price |
| 192 | 192 |
///that <b> it does support only limited (only stack-like) |
| 193 | 193 |
///node and arc deletions</b>. |
| 194 | 194 |
///It fully conforms to the \ref concepts::Digraph "Digraph concept". |
| 195 | 195 |
/// |
| 196 | 196 |
///\sa concepts::Digraph. |
| 197 | 197 |
class SmartDigraph : public ExtendedSmartDigraphBase {
|
| 198 |
public: |
|
| 199 |
|
|
| 200 | 198 |
typedef ExtendedSmartDigraphBase Parent; |
| 201 | 199 |
|
| 202 | 200 |
private: |
| 203 | 201 |
|
| 204 | 202 |
///SmartDigraph is \e not copy constructible. Use DigraphCopy() instead. |
| 205 | 203 |
|
| 206 | 204 |
///SmartDigraph is \e not copy constructible. Use DigraphCopy() instead. |
| 207 | 205 |
/// |
| ... | ... |
@@ -415,17 +413,17 @@ |
| 415 | 413 |
|
| 416 | 414 |
std::vector<NodeT> nodes; |
| 417 | 415 |
std::vector<ArcT> arcs; |
| 418 | 416 |
|
| 419 | 417 |
int first_free_arc; |
| 420 | 418 |
|
| 421 | 419 |
public: |
| 422 | 420 |
|
| 423 |
typedef SmartGraphBase |
|
| 421 |
typedef SmartGraphBase Graph; |
|
| 424 | 422 |
|
| 425 | 423 |
class Node; |
| 426 | 424 |
class Arc; |
| 427 | 425 |
class Edge; |
| 428 | 426 |
|
| 429 | 427 |
class Node {
|
| 430 | 428 |
friend class SmartGraphBase; |
| 431 | 429 |
protected: |
| ... | ... |
@@ -626,16 +624,18 @@ |
| 626 | 624 |
/// This is a simple and fast graph implementation. |
| 627 | 625 |
/// It is also quite memory efficient, but at the price |
| 628 | 626 |
/// that <b> it does support only limited (only stack-like) |
| 629 | 627 |
/// node and arc deletions</b>. |
| 630 | 628 |
/// It fully conforms to the \ref concepts::Graph "Graph concept". |
| 631 | 629 |
/// |
| 632 | 630 |
/// \sa concepts::Graph. |
| 633 | 631 |
class SmartGraph : public ExtendedSmartGraphBase {
|
| 632 |
typedef ExtendedSmartGraphBase Parent; |
|
| 633 |
|
|
| 634 | 634 |
private: |
| 635 | 635 |
|
| 636 | 636 |
///SmartGraph is \e not copy constructible. Use GraphCopy() instead. |
| 637 | 637 |
|
| 638 | 638 |
///SmartGraph is \e not copy constructible. Use GraphCopy() instead. |
| 639 | 639 |
/// |
| 640 | 640 |
SmartGraph(const SmartGraph &) : ExtendedSmartGraphBase() {};
|
| 641 | 641 |
|
| ... | ... |
@@ -643,18 +643,16 @@ |
| 643 | 643 |
///Use GraphCopy() instead. |
| 644 | 644 |
|
| 645 | 645 |
///Assignment of SmartGraph to another one is \e not allowed. |
| 646 | 646 |
///Use GraphCopy() instead. |
| 647 | 647 |
void operator=(const SmartGraph &) {}
|
| 648 | 648 |
|
| 649 | 649 |
public: |
| 650 | 650 |
|
| 651 |
typedef ExtendedSmartGraphBase Parent; |
|
| 652 |
|
|
| 653 | 651 |
/// Constructor |
| 654 | 652 |
|
| 655 | 653 |
/// Constructor. |
| 656 | 654 |
/// |
| 657 | 655 |
SmartGraph() {}
|
| 658 | 656 |
|
| 659 | 657 |
///Add a new node to the graph. |
| 660 | 658 |
|
0 comments (0 inline)