0
2
0
| ... | ... |
@@ -308,132 +308,136 @@ |
| 308 | 308 |
template <typename CMap> |
| 309 | 309 |
EdgeMap& operator=(const CMap& cmap) {
|
| 310 | 310 |
Parent::operator=(cmap); |
| 311 | 311 |
return *this; |
| 312 | 312 |
} |
| 313 | 313 |
}; |
| 314 | 314 |
|
| 315 | 315 |
}; |
| 316 | 316 |
|
| 317 | 317 |
template <typename _Digraph> |
| 318 | 318 |
class ReverseDigraphBase : public DigraphAdaptorBase<_Digraph> {
|
| 319 | 319 |
public: |
| 320 | 320 |
typedef _Digraph Digraph; |
| 321 | 321 |
typedef DigraphAdaptorBase<_Digraph> Parent; |
| 322 | 322 |
protected: |
| 323 | 323 |
ReverseDigraphBase() : Parent() { }
|
| 324 | 324 |
public: |
| 325 | 325 |
typedef typename Parent::Node Node; |
| 326 | 326 |
typedef typename Parent::Arc Arc; |
| 327 | 327 |
|
| 328 | 328 |
void firstIn(Arc& a, const Node& n) const { Parent::firstOut(a, n); }
|
| 329 | 329 |
void firstOut(Arc& a, const Node& n ) const { Parent::firstIn(a, n); }
|
| 330 | 330 |
|
| 331 | 331 |
void nextIn(Arc& a) const { Parent::nextOut(a); }
|
| 332 | 332 |
void nextOut(Arc& a) const { Parent::nextIn(a); }
|
| 333 | 333 |
|
| 334 | 334 |
Node source(const Arc& a) const { return Parent::target(a); }
|
| 335 | 335 |
Node target(const Arc& a) const { return Parent::source(a); }
|
| 336 | 336 |
|
| 337 | 337 |
Arc addArc(const Node& u, const Node& v) { return Parent::addArc(v, u); }
|
| 338 | 338 |
|
| 339 | 339 |
typedef FindArcTagIndicator<Digraph> FindArcTag; |
| 340 | 340 |
Arc findArc(const Node& u, const Node& v, |
| 341 | 341 |
const Arc& prev = INVALID) const {
|
| 342 | 342 |
return Parent::findArc(v, u, prev); |
| 343 | 343 |
} |
| 344 | 344 |
|
| 345 | 345 |
}; |
| 346 | 346 |
|
| 347 | 347 |
/// \ingroup graph_adaptors |
| 348 | 348 |
/// |
| 349 | 349 |
/// \brief Adaptor class for reversing the orientation of the arcs in |
| 350 | 350 |
/// a digraph. |
| 351 | 351 |
/// |
| 352 | 352 |
/// ReverseDigraph can be used for reversing the arcs in a digraph. |
| 353 | 353 |
/// It conforms to the \ref concepts::Digraph "Digraph" concept. |
| 354 | 354 |
/// |
| 355 | 355 |
/// The adapted digraph can also be modified through this adaptor |
| 356 |
/// by adding or removing nodes or arcs, unless the \c |
|
| 356 |
/// by adding or removing nodes or arcs, unless the \c GR template |
|
| 357 | 357 |
/// parameter is set to be \c const. |
| 358 | 358 |
/// |
| 359 |
/// \tparam |
|
| 359 |
/// \tparam GR The type of the adapted digraph. |
|
| 360 | 360 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept. |
| 361 | 361 |
/// It can also be specified to be \c const. |
| 362 | 362 |
/// |
| 363 | 363 |
/// \note The \c Node and \c Arc types of this adaptor and the adapted |
| 364 | 364 |
/// digraph are convertible to each other. |
| 365 |
template<typename |
|
| 365 |
template<typename GR> |
|
| 366 |
#ifdef DOXYGEN |
|
| 367 |
class ReverseDigraph {
|
|
| 368 |
#else |
|
| 366 | 369 |
class ReverseDigraph : |
| 367 |
public DigraphAdaptorExtender<ReverseDigraphBase< |
|
| 370 |
public DigraphAdaptorExtender<ReverseDigraphBase<GR> > {
|
|
| 371 |
#endif |
|
| 368 | 372 |
public: |
| 369 |
typedef _Digraph Digraph; |
|
| 370 |
typedef DigraphAdaptorExtender< |
|
| 371 |
|
|
| 373 |
/// The type of the adapted digraph. |
|
| 374 |
typedef GR Digraph; |
|
| 375 |
typedef DigraphAdaptorExtender<ReverseDigraphBase<GR> > Parent; |
|
| 372 | 376 |
protected: |
| 373 | 377 |
ReverseDigraph() { }
|
| 374 | 378 |
public: |
| 375 | 379 |
|
| 376 | 380 |
/// \brief Constructor |
| 377 | 381 |
/// |
| 378 | 382 |
/// Creates a reverse digraph adaptor for the given digraph. |
| 379 | 383 |
explicit ReverseDigraph(Digraph& digraph) {
|
| 380 | 384 |
Parent::setDigraph(digraph); |
| 381 | 385 |
} |
| 382 | 386 |
}; |
| 383 | 387 |
|
| 384 | 388 |
/// \brief Returns a read-only ReverseDigraph adaptor |
| 385 | 389 |
/// |
| 386 | 390 |
/// This function just returns a read-only \ref ReverseDigraph adaptor. |
| 387 | 391 |
/// \ingroup graph_adaptors |
| 388 | 392 |
/// \relates ReverseDigraph |
| 389 |
template<typename Digraph> |
|
| 390 |
ReverseDigraph<const Digraph> reverseDigraph(const Digraph& digraph) {
|
|
| 391 |
|
|
| 393 |
template<typename GR> |
|
| 394 |
ReverseDigraph<const GR> reverseDigraph(const GR& digraph) {
|
|
| 395 |
return ReverseDigraph<const GR>(digraph); |
|
| 392 | 396 |
} |
| 393 | 397 |
|
| 394 | 398 |
|
| 395 | 399 |
template <typename _Digraph, typename _NodeFilterMap, |
| 396 | 400 |
typename _ArcFilterMap, bool _checked = true> |
| 397 | 401 |
class SubDigraphBase : public DigraphAdaptorBase<_Digraph> {
|
| 398 | 402 |
public: |
| 399 | 403 |
typedef _Digraph Digraph; |
| 400 | 404 |
typedef _NodeFilterMap NodeFilterMap; |
| 401 | 405 |
typedef _ArcFilterMap ArcFilterMap; |
| 402 | 406 |
|
| 403 | 407 |
typedef SubDigraphBase Adaptor; |
| 404 | 408 |
typedef DigraphAdaptorBase<_Digraph> Parent; |
| 405 | 409 |
protected: |
| 406 | 410 |
NodeFilterMap* _node_filter; |
| 407 | 411 |
ArcFilterMap* _arc_filter; |
| 408 | 412 |
SubDigraphBase() |
| 409 | 413 |
: Parent(), _node_filter(0), _arc_filter(0) { }
|
| 410 | 414 |
|
| 411 | 415 |
void setNodeFilterMap(NodeFilterMap& node_filter) {
|
| 412 | 416 |
_node_filter = &node_filter; |
| 413 | 417 |
} |
| 414 | 418 |
void setArcFilterMap(ArcFilterMap& arc_filter) {
|
| 415 | 419 |
_arc_filter = &arc_filter; |
| 416 | 420 |
} |
| 417 | 421 |
|
| 418 | 422 |
public: |
| 419 | 423 |
|
| 420 | 424 |
typedef typename Parent::Node Node; |
| 421 | 425 |
typedef typename Parent::Arc Arc; |
| 422 | 426 |
|
| 423 | 427 |
void first(Node& i) const {
|
| 424 | 428 |
Parent::first(i); |
| 425 | 429 |
while (i != INVALID && !(*_node_filter)[i]) Parent::next(i); |
| 426 | 430 |
} |
| 427 | 431 |
|
| 428 | 432 |
void first(Arc& i) const {
|
| 429 | 433 |
Parent::first(i); |
| 430 | 434 |
while (i != INVALID && (!(*_arc_filter)[i] |
| 431 | 435 |
|| !(*_node_filter)[Parent::source(i)] |
| 432 | 436 |
|| !(*_node_filter)[Parent::target(i)])) |
| 433 | 437 |
Parent::next(i); |
| 434 | 438 |
} |
| 435 | 439 |
|
| 436 | 440 |
void firstIn(Arc& i, const Node& n) const {
|
| 437 | 441 |
Parent::firstIn(i, n); |
| 438 | 442 |
while (i != INVALID && (!(*_arc_filter)[i] |
| 439 | 443 |
|| !(*_node_filter)[Parent::source(i)])) |
| ... | ... |
@@ -651,256 +655,249 @@ |
| 651 | 655 |
|
| 652 | 656 |
private: |
| 653 | 657 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 654 | 658 |
return operator=<NodeMap>(cmap); |
| 655 | 659 |
} |
| 656 | 660 |
|
| 657 | 661 |
template <typename CMap> |
| 658 | 662 |
NodeMap& operator=(const CMap& cmap) {
|
| 659 | 663 |
MapParent::operator=(cmap); |
| 660 | 664 |
return *this; |
| 661 | 665 |
} |
| 662 | 666 |
}; |
| 663 | 667 |
|
| 664 | 668 |
template <typename _Value> |
| 665 | 669 |
class ArcMap : public SubMapExtender<Adaptor, |
| 666 | 670 |
typename Parent::template ArcMap<_Value> > {
|
| 667 | 671 |
public: |
| 668 | 672 |
typedef _Value Value; |
| 669 | 673 |
typedef SubMapExtender<Adaptor, typename Parent:: |
| 670 | 674 |
template ArcMap<Value> > MapParent; |
| 671 | 675 |
|
| 672 | 676 |
ArcMap(const Adaptor& adaptor) |
| 673 | 677 |
: MapParent(adaptor) {}
|
| 674 | 678 |
ArcMap(const Adaptor& adaptor, const Value& value) |
| 675 | 679 |
: MapParent(adaptor, value) {}
|
| 676 | 680 |
|
| 677 | 681 |
private: |
| 678 | 682 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 679 | 683 |
return operator=<ArcMap>(cmap); |
| 680 | 684 |
} |
| 681 | 685 |
|
| 682 | 686 |
template <typename CMap> |
| 683 | 687 |
ArcMap& operator=(const CMap& cmap) {
|
| 684 | 688 |
MapParent::operator=(cmap); |
| 685 | 689 |
return *this; |
| 686 | 690 |
} |
| 687 | 691 |
}; |
| 688 | 692 |
|
| 689 | 693 |
}; |
| 690 | 694 |
|
| 691 | 695 |
/// \ingroup graph_adaptors |
| 692 | 696 |
/// |
| 693 | 697 |
/// \brief Adaptor class for hiding nodes and arcs in a digraph |
| 694 | 698 |
/// |
| 695 | 699 |
/// SubDigraph can be used for hiding nodes and arcs in a digraph. |
| 696 | 700 |
/// A \c bool node map and a \c bool arc map must be specified, which |
| 697 | 701 |
/// define the filters for nodes and arcs. |
| 698 | 702 |
/// Only the nodes and arcs with \c true filter value are |
| 699 |
/// shown in the subdigraph. This adaptor conforms to the \ref |
|
| 700 |
/// concepts::Digraph "Digraph" concept. If the \c _checked parameter |
|
| 701 |
/// is \c true, then the arcs incident to hidden nodes are also |
|
| 702 |
/// filtered out. |
|
| 703 |
/// shown in the subdigraph. The arcs that are incident to hidden |
|
| 704 |
/// nodes are also filtered out. |
|
| 705 |
/// This adaptor conforms to the \ref concepts::Digraph "Digraph" concept. |
|
| 703 | 706 |
/// |
| 704 | 707 |
/// The adapted digraph can also be modified through this adaptor |
| 705 |
/// by adding or removing nodes or arcs, unless the \c |
|
| 708 |
/// by adding or removing nodes or arcs, unless the \c GR template |
|
| 706 | 709 |
/// parameter is set to be \c const. |
| 707 | 710 |
/// |
| 708 |
/// \tparam |
|
| 711 |
/// \tparam GR The type of the adapted digraph. |
|
| 709 | 712 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept. |
| 710 | 713 |
/// It can also be specified to be \c const. |
| 711 |
/// \tparam _NodeFilterMap A \c bool (or convertible) node map of the |
|
| 712 |
/// adapted digraph. The default map type is |
|
| 713 |
/// \ref concepts::Digraph::NodeMap "_Digraph::NodeMap<bool>". |
|
| 714 |
/// \tparam _ArcFilterMap A \c bool (or convertible) arc map of the |
|
| 715 |
/// adapted digraph. The default map type is |
|
| 716 |
/// \ref concepts::Digraph::ArcMap "_Digraph::ArcMap<bool>". |
|
| 717 |
/// \tparam _checked If this parameter is set to \c false, then the arc |
|
| 718 |
/// filtering is not checked with respect to the node filter. |
|
| 719 |
/// Otherwise, each arc that is incident to a hidden node is automatically |
|
| 720 |
/// filtered out. This is the default option. |
|
| 714 |
/// \tparam NF The type of the node filter map. |
|
| 715 |
/// It must be a \c bool (or convertible) node map of the |
|
| 716 |
/// adapted digraph. The default type is |
|
| 717 |
/// \ref concepts::Digraph::NodeMap "GR::NodeMap<bool>". |
|
| 718 |
/// \tparam AF The type of the arc filter map. |
|
| 719 |
/// It must be \c bool (or convertible) arc map of the |
|
| 720 |
/// adapted digraph. The default type is |
|
| 721 |
/// \ref concepts::Digraph::ArcMap "GR::ArcMap<bool>". |
|
| 721 | 722 |
/// |
| 722 | 723 |
/// \note The \c Node and \c Arc types of this adaptor and the adapted |
| 723 | 724 |
/// digraph are convertible to each other. |
| 724 | 725 |
/// |
| 725 | 726 |
/// \see FilterNodes |
| 726 | 727 |
/// \see FilterArcs |
| 727 | 728 |
#ifdef DOXYGEN |
| 728 |
template<typename _Digraph, |
|
| 729 |
typename _NodeFilterMap, |
|
| 730 |
typename _ArcFilterMap, |
|
| 731 |
bool _checked> |
|
| 729 |
template<typename GR, typename NF, typename AF> |
|
| 730 |
class SubDigraph {
|
|
| 732 | 731 |
#else |
| 733 |
template<typename _Digraph, |
|
| 734 |
typename _NodeFilterMap = typename _Digraph::template NodeMap<bool>, |
|
| 735 |
typename _ArcFilterMap = typename _Digraph::template ArcMap<bool>, |
|
| 736 |
bool _checked = true> |
|
| 732 |
template<typename GR, |
|
| 733 |
typename NF = typename GR::template NodeMap<bool>, |
|
| 734 |
typename AF = typename GR::template ArcMap<bool> > |
|
| 735 |
class SubDigraph : |
|
| 736 |
public DigraphAdaptorExtender<SubDigraphBase<GR, NF, AF, true> > {
|
|
| 737 | 737 |
#endif |
| 738 |
class SubDigraph |
|
| 739 |
: public DigraphAdaptorExtender< |
|
| 740 |
SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, _checked> > {
|
|
| 741 | 738 |
public: |
| 742 | 739 |
/// The type of the adapted digraph. |
| 743 |
typedef |
|
| 740 |
typedef GR Digraph; |
|
| 744 | 741 |
/// The type of the node filter map. |
| 745 |
typedef |
|
| 742 |
typedef NF NodeFilterMap; |
|
| 746 | 743 |
/// The type of the arc filter map. |
| 747 |
typedef _ArcFilterMap ArcFilterMap; |
|
| 748 |
|
|
| 749 |
typedef DigraphAdaptorExtender< |
|
| 750 |
SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, _checked> > |
|
| 744 |
typedef AF ArcFilterMap; |
|
| 745 |
|
|
| 746 |
typedef DigraphAdaptorExtender<SubDigraphBase<GR, NF, AF, true> > |
|
| 751 | 747 |
Parent; |
| 752 | 748 |
|
| 753 | 749 |
typedef typename Parent::Node Node; |
| 754 | 750 |
typedef typename Parent::Arc Arc; |
| 755 | 751 |
|
| 756 | 752 |
protected: |
| 757 | 753 |
SubDigraph() { }
|
| 758 | 754 |
public: |
| 759 | 755 |
|
| 760 | 756 |
/// \brief Constructor |
| 761 | 757 |
/// |
| 762 | 758 |
/// Creates a subdigraph for the given digraph with the |
| 763 | 759 |
/// given node and arc filter maps. |
| 764 | 760 |
SubDigraph(Digraph& digraph, NodeFilterMap& node_filter, |
| 765 | 761 |
ArcFilterMap& arc_filter) {
|
| 766 | 762 |
setDigraph(digraph); |
| 767 | 763 |
setNodeFilterMap(node_filter); |
| 768 | 764 |
setArcFilterMap(arc_filter); |
| 769 | 765 |
} |
| 770 | 766 |
|
| 771 | 767 |
/// \brief Sets the status of the given node |
| 772 | 768 |
/// |
| 773 | 769 |
/// This function sets the status of the given node. |
| 774 | 770 |
/// It is done by simply setting the assigned value of \c n |
| 775 | 771 |
/// to \c v in the node filter map. |
| 776 | 772 |
void status(const Node& n, bool v) const { Parent::status(n, v); }
|
| 777 | 773 |
|
| 778 | 774 |
/// \brief Sets the status of the given arc |
| 779 | 775 |
/// |
| 780 | 776 |
/// This function sets the status of the given arc. |
| 781 | 777 |
/// It is done by simply setting the assigned value of \c a |
| 782 | 778 |
/// to \c v in the arc filter map. |
| 783 | 779 |
void status(const Arc& a, bool v) const { Parent::status(a, v); }
|
| 784 | 780 |
|
| 785 | 781 |
/// \brief Returns the status of the given node |
| 786 | 782 |
/// |
| 787 | 783 |
/// This function returns the status of the given node. |
| 788 | 784 |
/// It is \c true if the given node is enabled (i.e. not hidden). |
| 789 | 785 |
bool status(const Node& n) const { return Parent::status(n); }
|
| 790 | 786 |
|
| 791 | 787 |
/// \brief Returns the status of the given arc |
| 792 | 788 |
/// |
| 793 | 789 |
/// This function returns the status of the given arc. |
| 794 | 790 |
/// It is \c true if the given arc is enabled (i.e. not hidden). |
| 795 | 791 |
bool status(const Arc& a) const { return Parent::status(a); }
|
| 796 | 792 |
|
| 797 | 793 |
/// \brief Disables the given node |
| 798 | 794 |
/// |
| 799 | 795 |
/// This function disables the given node in the subdigraph, |
| 800 | 796 |
/// so the iteration jumps over it. |
| 801 | 797 |
/// It is the same as \ref status() "status(n, false)". |
| 802 | 798 |
void disable(const Node& n) const { Parent::status(n, false); }
|
| 803 | 799 |
|
| 804 | 800 |
/// \brief Disables the given arc |
| 805 | 801 |
/// |
| 806 | 802 |
/// This function disables the given arc in the subdigraph, |
| 807 | 803 |
/// so the iteration jumps over it. |
| 808 | 804 |
/// It is the same as \ref status() "status(a, false)". |
| 809 | 805 |
void disable(const Arc& a) const { Parent::status(a, false); }
|
| 810 | 806 |
|
| 811 | 807 |
/// \brief Enables the given node |
| 812 | 808 |
/// |
| 813 | 809 |
/// This function enables the given node in the subdigraph. |
| 814 | 810 |
/// It is the same as \ref status() "status(n, true)". |
| 815 | 811 |
void enable(const Node& n) const { Parent::status(n, true); }
|
| 816 | 812 |
|
| 817 | 813 |
/// \brief Enables the given arc |
| 818 | 814 |
/// |
| 819 | 815 |
/// This function enables the given arc in the subdigraph. |
| 820 | 816 |
/// It is the same as \ref status() "status(a, true)". |
| 821 | 817 |
void enable(const Arc& a) const { Parent::status(a, true); }
|
| 822 | 818 |
|
| 823 | 819 |
}; |
| 824 | 820 |
|
| 825 | 821 |
/// \brief Returns a read-only SubDigraph adaptor |
| 826 | 822 |
/// |
| 827 | 823 |
/// This function just returns a read-only \ref SubDigraph adaptor. |
| 828 | 824 |
/// \ingroup graph_adaptors |
| 829 | 825 |
/// \relates SubDigraph |
| 830 |
template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 831 |
SubDigraph<const Digraph, NodeFilterMap, ArcFilterMap> |
|
| 832 |
subDigraph(const Digraph& digraph, NodeFilterMap& nfm, ArcFilterMap& afm) {
|
|
| 833 |
return SubDigraph<const Digraph, NodeFilterMap, ArcFilterMap> |
|
| 834 |
(digraph, nfm, afm); |
|
| 835 |
} |
|
| 836 |
|
|
| 837 |
template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 838 |
SubDigraph<const Digraph, const NodeFilterMap, ArcFilterMap> |
|
| 839 |
subDigraph(const Digraph& digraph, |
|
| 840 |
const NodeFilterMap& nfm, ArcFilterMap& afm) {
|
|
| 841 |
return SubDigraph<const Digraph, const NodeFilterMap, ArcFilterMap> |
|
| 842 |
(digraph, nfm, afm); |
|
| 843 |
} |
|
| 844 |
|
|
| 845 |
template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 846 |
SubDigraph<const Digraph, NodeFilterMap, const ArcFilterMap> |
|
| 847 |
subDigraph(const Digraph& digraph, |
|
| 848 |
NodeFilterMap& nfm, const ArcFilterMap& afm) {
|
|
| 849 |
return SubDigraph<const Digraph, NodeFilterMap, const ArcFilterMap> |
|
| 850 |
(digraph, nfm, afm); |
|
| 851 |
} |
|
| 852 |
|
|
| 853 |
template<typename Digraph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 854 |
SubDigraph<const Digraph, const NodeFilterMap, const ArcFilterMap> |
|
| 855 |
subDigraph(const Digraph& digraph, |
|
| 856 |
const NodeFilterMap& nfm, const ArcFilterMap& afm) {
|
|
| 857 |
return SubDigraph<const Digraph, const NodeFilterMap, |
|
| 858 |
|
|
| 826 |
template<typename GR, typename NF, typename AF> |
|
| 827 |
SubDigraph<const GR, NF, AF> |
|
| 828 |
subDigraph(const GR& digraph, |
|
| 829 |
NF& node_filter_map, AF& arc_filter_map) {
|
|
| 830 |
return SubDigraph<const GR, NF, AF> |
|
| 831 |
(digraph, node_filter_map, arc_filter_map); |
|
| 832 |
} |
|
| 833 |
|
|
| 834 |
template<typename GR, typename NF, typename AF> |
|
| 835 |
SubDigraph<const GR, const NF, AF> |
|
| 836 |
subDigraph(const GR& digraph, |
|
| 837 |
const NF& node_filter_map, AF& arc_filter_map) {
|
|
| 838 |
return SubDigraph<const GR, const NF, AF> |
|
| 839 |
(digraph, node_filter_map, arc_filter_map); |
|
| 840 |
} |
|
| 841 |
|
|
| 842 |
template<typename GR, typename NF, typename AF> |
|
| 843 |
SubDigraph<const GR, NF, const AF> |
|
| 844 |
subDigraph(const GR& digraph, |
|
| 845 |
NF& node_filter_map, const AF& arc_filter_map) {
|
|
| 846 |
return SubDigraph<const GR, NF, const AF> |
|
| 847 |
(digraph, node_filter_map, arc_filter_map); |
|
| 848 |
} |
|
| 849 |
|
|
| 850 |
template<typename GR, typename NF, typename AF> |
|
| 851 |
SubDigraph<const GR, const NF, const AF> |
|
| 852 |
subDigraph(const GR& digraph, |
|
| 853 |
const NF& node_filter_map, const AF& arc_filter_map) {
|
|
| 854 |
return SubDigraph<const GR, const NF, const AF> |
|
| 855 |
(digraph, node_filter_map, arc_filter_map); |
|
| 859 | 856 |
} |
| 860 | 857 |
|
| 861 | 858 |
|
| 862 | 859 |
template <typename _Graph, typename _NodeFilterMap, |
| 863 | 860 |
typename _EdgeFilterMap, bool _checked = true> |
| 864 | 861 |
class SubGraphBase : public GraphAdaptorBase<_Graph> {
|
| 865 | 862 |
public: |
| 866 | 863 |
typedef _Graph Graph; |
| 867 | 864 |
typedef _NodeFilterMap NodeFilterMap; |
| 868 | 865 |
typedef _EdgeFilterMap EdgeFilterMap; |
| 869 | 866 |
|
| 870 | 867 |
typedef SubGraphBase Adaptor; |
| 871 | 868 |
typedef GraphAdaptorBase<_Graph> Parent; |
| 872 | 869 |
protected: |
| 873 | 870 |
|
| 874 | 871 |
NodeFilterMap* _node_filter_map; |
| 875 | 872 |
EdgeFilterMap* _edge_filter_map; |
| 876 | 873 |
|
| 877 | 874 |
SubGraphBase() |
| 878 | 875 |
: Parent(), _node_filter_map(0), _edge_filter_map(0) { }
|
| 879 | 876 |
|
| 880 | 877 |
void setNodeFilterMap(NodeFilterMap& node_filter_map) {
|
| 881 | 878 |
_node_filter_map=&node_filter_map; |
| 882 | 879 |
} |
| 883 | 880 |
void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) {
|
| 884 | 881 |
_edge_filter_map=&edge_filter_map; |
| 885 | 882 |
} |
| 886 | 883 |
|
| 887 | 884 |
public: |
| 888 | 885 |
|
| 889 | 886 |
typedef typename Parent::Node Node; |
| 890 | 887 |
typedef typename Parent::Arc Arc; |
| 891 | 888 |
typedef typename Parent::Edge Edge; |
| 892 | 889 |
|
| 893 | 890 |
void first(Node& i) const {
|
| 894 | 891 |
Parent::first(i); |
| 895 | 892 |
while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); |
| 896 | 893 |
} |
| 897 | 894 |
|
| 898 | 895 |
void first(Arc& i) const {
|
| 899 | 896 |
Parent::first(i); |
| 900 | 897 |
while (i!=INVALID && (!(*_edge_filter_map)[i] |
| 901 | 898 |
|| !(*_node_filter_map)[Parent::source(i)] |
| 902 | 899 |
|| !(*_node_filter_map)[Parent::target(i)])) |
| 903 | 900 |
Parent::next(i); |
| 904 | 901 |
} |
| 905 | 902 |
|
| 906 | 903 |
void first(Edge& i) const {
|
| ... | ... |
@@ -1247,627 +1244,627 @@ |
| 1247 | 1244 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 1248 | 1245 |
return operator=<ArcMap>(cmap); |
| 1249 | 1246 |
} |
| 1250 | 1247 |
|
| 1251 | 1248 |
template <typename CMap> |
| 1252 | 1249 |
ArcMap& operator=(const CMap& cmap) {
|
| 1253 | 1250 |
MapParent::operator=(cmap); |
| 1254 | 1251 |
return *this; |
| 1255 | 1252 |
} |
| 1256 | 1253 |
}; |
| 1257 | 1254 |
|
| 1258 | 1255 |
template <typename _Value> |
| 1259 | 1256 |
class EdgeMap : public SubMapExtender<Adaptor, |
| 1260 | 1257 |
typename Parent::template EdgeMap<_Value> > {
|
| 1261 | 1258 |
public: |
| 1262 | 1259 |
typedef _Value Value; |
| 1263 | 1260 |
typedef SubMapExtender<Adaptor, typename Parent:: |
| 1264 | 1261 |
template EdgeMap<Value> > MapParent; |
| 1265 | 1262 |
|
| 1266 | 1263 |
EdgeMap(const Adaptor& adaptor) |
| 1267 | 1264 |
: MapParent(adaptor) {}
|
| 1268 | 1265 |
|
| 1269 | 1266 |
EdgeMap(const Adaptor& adaptor, const _Value& value) |
| 1270 | 1267 |
: MapParent(adaptor, value) {}
|
| 1271 | 1268 |
|
| 1272 | 1269 |
private: |
| 1273 | 1270 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
| 1274 | 1271 |
return operator=<EdgeMap>(cmap); |
| 1275 | 1272 |
} |
| 1276 | 1273 |
|
| 1277 | 1274 |
template <typename CMap> |
| 1278 | 1275 |
EdgeMap& operator=(const CMap& cmap) {
|
| 1279 | 1276 |
MapParent::operator=(cmap); |
| 1280 | 1277 |
return *this; |
| 1281 | 1278 |
} |
| 1282 | 1279 |
}; |
| 1283 | 1280 |
|
| 1284 | 1281 |
}; |
| 1285 | 1282 |
|
| 1286 | 1283 |
/// \ingroup graph_adaptors |
| 1287 | 1284 |
/// |
| 1288 | 1285 |
/// \brief Adaptor class for hiding nodes and edges in an undirected |
| 1289 | 1286 |
/// graph. |
| 1290 | 1287 |
/// |
| 1291 | 1288 |
/// SubGraph can be used for hiding nodes and edges in a graph. |
| 1292 | 1289 |
/// A \c bool node map and a \c bool edge map must be specified, which |
| 1293 | 1290 |
/// define the filters for nodes and edges. |
| 1294 | 1291 |
/// Only the nodes and edges with \c true filter value are |
| 1295 |
/// shown in the subgraph. This adaptor conforms to the \ref |
|
| 1296 |
/// concepts::Graph "Graph" concept. If the \c _checked parameter is |
|
| 1297 |
/// \c true, then the edges incident to hidden nodes are also |
|
| 1298 |
/// filtered out. |
|
| 1292 |
/// shown in the subgraph. The edges that are incident to hidden |
|
| 1293 |
/// nodes are also filtered out. |
|
| 1294 |
/// This adaptor conforms to the \ref concepts::Graph "Graph" concept. |
|
| 1299 | 1295 |
/// |
| 1300 | 1296 |
/// The adapted graph can also be modified through this adaptor |
| 1301 |
/// by adding or removing nodes or edges, unless the \c |
|
| 1297 |
/// by adding or removing nodes or edges, unless the \c GR template |
|
| 1302 | 1298 |
/// parameter is set to be \c const. |
| 1303 | 1299 |
/// |
| 1304 |
/// \tparam |
|
| 1300 |
/// \tparam GR The type of the adapted graph. |
|
| 1305 | 1301 |
/// It must conform to the \ref concepts::Graph "Graph" concept. |
| 1306 | 1302 |
/// It can also be specified to be \c const. |
| 1307 |
/// \tparam _NodeFilterMap A \c bool (or convertible) node map of the |
|
| 1308 |
/// adapted graph. The default map type is |
|
| 1309 |
/// \ref concepts::Graph::NodeMap "_Graph::NodeMap<bool>". |
|
| 1310 |
/// \tparam _EdgeFilterMap A \c bool (or convertible) edge map of the |
|
| 1311 |
/// adapted graph. The default map type is |
|
| 1312 |
/// \ref concepts::Graph::EdgeMap "_Graph::EdgeMap<bool>". |
|
| 1313 |
/// \tparam _checked If this parameter is set to \c false, then the edge |
|
| 1314 |
/// filtering is not checked with respect to the node filter. |
|
| 1315 |
/// Otherwise, each edge that is incident to a hidden node is automatically |
|
| 1316 |
/// filtered out. This is the default option. |
|
| 1303 |
/// \tparam NF The type of the node filter map. |
|
| 1304 |
/// It must be a \c bool (or convertible) node map of the |
|
| 1305 |
/// adapted graph. The default type is |
|
| 1306 |
/// \ref concepts::Graph::NodeMap "GR::NodeMap<bool>". |
|
| 1307 |
/// \tparam EF The type of the edge filter map. |
|
| 1308 |
/// It must be a \c bool (or convertible) edge map of the |
|
| 1309 |
/// adapted graph. The default type is |
|
| 1310 |
/// \ref concepts::Graph::EdgeMap "GR::EdgeMap<bool>". |
|
| 1317 | 1311 |
/// |
| 1318 | 1312 |
/// \note The \c Node, \c Edge and \c Arc types of this adaptor and the |
| 1319 | 1313 |
/// adapted graph are convertible to each other. |
| 1320 | 1314 |
/// |
| 1321 | 1315 |
/// \see FilterNodes |
| 1322 | 1316 |
/// \see FilterEdges |
| 1323 | 1317 |
#ifdef DOXYGEN |
| 1324 |
template<typename _Graph, |
|
| 1325 |
typename _NodeFilterMap, |
|
| 1326 |
typename _EdgeFilterMap, |
|
| 1327 |
bool _checked> |
|
| 1318 |
template<typename GR, typename NF, typename EF> |
|
| 1319 |
class SubGraph {
|
|
| 1328 | 1320 |
#else |
| 1329 |
template<typename _Graph, |
|
| 1330 |
typename _NodeFilterMap = typename _Graph::template NodeMap<bool>, |
|
| 1331 |
typename _EdgeFilterMap = typename _Graph::template EdgeMap<bool>, |
|
| 1332 |
bool _checked = true> |
|
| 1321 |
template<typename GR, |
|
| 1322 |
typename NF = typename GR::template NodeMap<bool>, |
|
| 1323 |
typename EF = typename GR::template EdgeMap<bool> > |
|
| 1324 |
class SubGraph : |
|
| 1325 |
public GraphAdaptorExtender<SubGraphBase<GR, NF, EF, true> > {
|
|
| 1333 | 1326 |
#endif |
| 1334 |
class SubGraph |
|
| 1335 |
: public GraphAdaptorExtender< |
|
| 1336 |
SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, _checked> > {
|
|
| 1337 | 1327 |
public: |
| 1338 | 1328 |
/// The type of the adapted graph. |
| 1339 |
typedef |
|
| 1329 |
typedef GR Graph; |
|
| 1340 | 1330 |
/// The type of the node filter map. |
| 1341 |
typedef |
|
| 1331 |
typedef NF NodeFilterMap; |
|
| 1342 | 1332 |
/// The type of the edge filter map. |
| 1343 |
typedef _EdgeFilterMap EdgeFilterMap; |
|
| 1344 |
|
|
| 1345 |
typedef GraphAdaptorExtender< |
|
| 1346 |
SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, _checked> > Parent; |
|
| 1333 |
typedef EF EdgeFilterMap; |
|
| 1334 |
|
|
| 1335 |
typedef GraphAdaptorExtender< SubGraphBase<GR, NF, EF, true> > |
|
| 1336 |
Parent; |
|
| 1347 | 1337 |
|
| 1348 | 1338 |
typedef typename Parent::Node Node; |
| 1349 | 1339 |
typedef typename Parent::Edge Edge; |
| 1350 | 1340 |
|
| 1351 | 1341 |
protected: |
| 1352 | 1342 |
SubGraph() { }
|
| 1353 | 1343 |
public: |
| 1354 | 1344 |
|
| 1355 | 1345 |
/// \brief Constructor |
| 1356 | 1346 |
/// |
| 1357 | 1347 |
/// Creates a subgraph for the given graph with the given node |
| 1358 | 1348 |
/// and edge filter maps. |
| 1359 | 1349 |
SubGraph(Graph& graph, NodeFilterMap& node_filter_map, |
| 1360 | 1350 |
EdgeFilterMap& edge_filter_map) {
|
| 1361 | 1351 |
setGraph(graph); |
| 1362 | 1352 |
setNodeFilterMap(node_filter_map); |
| 1363 | 1353 |
setEdgeFilterMap(edge_filter_map); |
| 1364 | 1354 |
} |
| 1365 | 1355 |
|
| 1366 | 1356 |
/// \brief Sets the status of the given node |
| 1367 | 1357 |
/// |
| 1368 | 1358 |
/// This function sets the status of the given node. |
| 1369 | 1359 |
/// It is done by simply setting the assigned value of \c n |
| 1370 | 1360 |
/// to \c v in the node filter map. |
| 1371 | 1361 |
void status(const Node& n, bool v) const { Parent::status(n, v); }
|
| 1372 | 1362 |
|
| 1373 | 1363 |
/// \brief Sets the status of the given edge |
| 1374 | 1364 |
/// |
| 1375 | 1365 |
/// This function sets the status of the given edge. |
| 1376 | 1366 |
/// It is done by simply setting the assigned value of \c e |
| 1377 | 1367 |
/// to \c v in the edge filter map. |
| 1378 | 1368 |
void status(const Edge& e, bool v) const { Parent::status(e, v); }
|
| 1379 | 1369 |
|
| 1380 | 1370 |
/// \brief Returns the status of the given node |
| 1381 | 1371 |
/// |
| 1382 | 1372 |
/// This function returns the status of the given node. |
| 1383 | 1373 |
/// It is \c true if the given node is enabled (i.e. not hidden). |
| 1384 | 1374 |
bool status(const Node& n) const { return Parent::status(n); }
|
| 1385 | 1375 |
|
| 1386 | 1376 |
/// \brief Returns the status of the given edge |
| 1387 | 1377 |
/// |
| 1388 | 1378 |
/// This function returns the status of the given edge. |
| 1389 | 1379 |
/// It is \c true if the given edge is enabled (i.e. not hidden). |
| 1390 | 1380 |
bool status(const Edge& e) const { return Parent::status(e); }
|
| 1391 | 1381 |
|
| 1392 | 1382 |
/// \brief Disables the given node |
| 1393 | 1383 |
/// |
| 1394 | 1384 |
/// This function disables the given node in the subdigraph, |
| 1395 | 1385 |
/// so the iteration jumps over it. |
| 1396 | 1386 |
/// It is the same as \ref status() "status(n, false)". |
| 1397 | 1387 |
void disable(const Node& n) const { Parent::status(n, false); }
|
| 1398 | 1388 |
|
| 1399 | 1389 |
/// \brief Disables the given edge |
| 1400 | 1390 |
/// |
| 1401 | 1391 |
/// This function disables the given edge in the subgraph, |
| 1402 | 1392 |
/// so the iteration jumps over it. |
| 1403 | 1393 |
/// It is the same as \ref status() "status(e, false)". |
| 1404 | 1394 |
void disable(const Edge& e) const { Parent::status(e, false); }
|
| 1405 | 1395 |
|
| 1406 | 1396 |
/// \brief Enables the given node |
| 1407 | 1397 |
/// |
| 1408 | 1398 |
/// This function enables the given node in the subdigraph. |
| 1409 | 1399 |
/// It is the same as \ref status() "status(n, true)". |
| 1410 | 1400 |
void enable(const Node& n) const { Parent::status(n, true); }
|
| 1411 | 1401 |
|
| 1412 | 1402 |
/// \brief Enables the given edge |
| 1413 | 1403 |
/// |
| 1414 | 1404 |
/// This function enables the given edge in the subgraph. |
| 1415 | 1405 |
/// It is the same as \ref status() "status(e, true)". |
| 1416 | 1406 |
void enable(const Edge& e) const { Parent::status(e, true); }
|
| 1417 | 1407 |
|
| 1418 | 1408 |
}; |
| 1419 | 1409 |
|
| 1420 | 1410 |
/// \brief Returns a read-only SubGraph adaptor |
| 1421 | 1411 |
/// |
| 1422 | 1412 |
/// This function just returns a read-only \ref SubGraph adaptor. |
| 1423 | 1413 |
/// \ingroup graph_adaptors |
| 1424 | 1414 |
/// \relates SubGraph |
| 1425 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 1426 |
SubGraph<const Graph, NodeFilterMap, ArcFilterMap> |
|
| 1427 |
subGraph(const Graph& graph, NodeFilterMap& nfm, ArcFilterMap& efm) {
|
|
| 1428 |
return SubGraph<const Graph, NodeFilterMap, ArcFilterMap>(graph, nfm, efm); |
|
| 1429 |
} |
|
| 1430 |
|
|
| 1431 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 1432 |
SubGraph<const Graph, const NodeFilterMap, ArcFilterMap> |
|
| 1433 |
subGraph(const Graph& graph, |
|
| 1434 |
const NodeFilterMap& nfm, ArcFilterMap& efm) {
|
|
| 1435 |
return SubGraph<const Graph, const NodeFilterMap, ArcFilterMap> |
|
| 1436 |
(graph, nfm, efm); |
|
| 1437 |
} |
|
| 1438 |
|
|
| 1439 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 1440 |
SubGraph<const Graph, NodeFilterMap, const ArcFilterMap> |
|
| 1441 |
subGraph(const Graph& graph, |
|
| 1442 |
NodeFilterMap& nfm, const ArcFilterMap& efm) {
|
|
| 1443 |
return SubGraph<const Graph, NodeFilterMap, const ArcFilterMap> |
|
| 1444 |
(graph, nfm, efm); |
|
| 1445 |
} |
|
| 1446 |
|
|
| 1447 |
template<typename Graph, typename NodeFilterMap, typename ArcFilterMap> |
|
| 1448 |
SubGraph<const Graph, const NodeFilterMap, const ArcFilterMap> |
|
| 1449 |
subGraph(const Graph& graph, |
|
| 1450 |
const NodeFilterMap& nfm, const ArcFilterMap& efm) {
|
|
| 1451 |
return SubGraph<const Graph, const NodeFilterMap, const ArcFilterMap> |
|
| 1452 |
(graph, nfm, efm); |
|
| 1415 |
template<typename GR, typename NF, typename EF> |
|
| 1416 |
SubGraph<const GR, NF, EF> |
|
| 1417 |
subGraph(const GR& graph, |
|
| 1418 |
NF& node_filter_map, EF& edge_filter_map) {
|
|
| 1419 |
return SubGraph<const GR, NF, EF> |
|
| 1420 |
(graph, node_filter_map, edge_filter_map); |
|
| 1421 |
} |
|
| 1422 |
|
|
| 1423 |
template<typename GR, typename NF, typename EF> |
|
| 1424 |
SubGraph<const GR, const NF, EF> |
|
| 1425 |
subGraph(const GR& graph, |
|
| 1426 |
const NF& node_filter_map, EF& edge_filter_map) {
|
|
| 1427 |
return SubGraph<const GR, const NF, EF> |
|
| 1428 |
(graph, node_filter_map, edge_filter_map); |
|
| 1429 |
} |
|
| 1430 |
|
|
| 1431 |
template<typename GR, typename NF, typename EF> |
|
| 1432 |
SubGraph<const GR, NF, const EF> |
|
| 1433 |
subGraph(const GR& graph, |
|
| 1434 |
NF& node_filter_map, const EF& edge_filter_map) {
|
|
| 1435 |
return SubGraph<const GR, NF, const EF> |
|
| 1436 |
(graph, node_filter_map, edge_filter_map); |
|
| 1437 |
} |
|
| 1438 |
|
|
| 1439 |
template<typename GR, typename NF, typename EF> |
|
| 1440 |
SubGraph<const GR, const NF, const EF> |
|
| 1441 |
subGraph(const GR& graph, |
|
| 1442 |
const NF& node_filter_map, const EF& edge_filter_map) {
|
|
| 1443 |
return SubGraph<const GR, const NF, const EF> |
|
| 1444 |
(graph, node_filter_map, edge_filter_map); |
|
| 1453 | 1445 |
} |
| 1454 | 1446 |
|
| 1455 | 1447 |
|
| 1456 | 1448 |
/// \ingroup graph_adaptors |
| 1457 | 1449 |
/// |
| 1458 | 1450 |
/// \brief Adaptor class for hiding nodes in a digraph or a graph. |
| 1459 | 1451 |
/// |
| 1460 | 1452 |
/// FilterNodes adaptor can be used for hiding nodes in a digraph or a |
| 1461 | 1453 |
/// graph. A \c bool node map must be specified, which defines the filter |
| 1462 | 1454 |
/// for the nodes. Only the nodes with \c true filter value and the |
| 1463 | 1455 |
/// arcs/edges incident to nodes both with \c true filter value are shown |
| 1464 | 1456 |
/// in the subgraph. This adaptor conforms to the \ref concepts::Digraph |
| 1465 | 1457 |
/// "Digraph" concept or the \ref concepts::Graph "Graph" concept |
| 1466 |
/// depending on the \c |
|
| 1458 |
/// depending on the \c GR template parameter. |
|
| 1467 | 1459 |
/// |
| 1468 | 1460 |
/// The adapted (di)graph can also be modified through this adaptor |
| 1469 |
/// by adding or removing nodes or arcs/edges, unless the \c |
|
| 1461 |
/// by adding or removing nodes or arcs/edges, unless the \c GR template |
|
| 1470 | 1462 |
/// parameter is set to be \c const. |
| 1471 | 1463 |
/// |
| 1472 |
/// \tparam |
|
| 1464 |
/// \tparam GR The type of the adapted digraph or graph. |
|
| 1473 | 1465 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept |
| 1474 | 1466 |
/// or the \ref concepts::Graph "Graph" concept. |
| 1475 | 1467 |
/// It can also be specified to be \c const. |
| 1476 |
/// \tparam _NodeFilterMap A \c bool (or convertible) node map of the |
|
| 1477 |
/// adapted (di)graph. The default map type is |
|
| 1478 |
/// \ref concepts::Graph::NodeMap "_Graph::NodeMap<bool>". |
|
| 1479 |
/// \tparam _checked If this parameter is set to \c false then the arc/edge |
|
| 1480 |
/// filtering is not checked with respect to the node filter. In this |
|
| 1481 |
/// case only isolated nodes can be filtered out from the graph. |
|
| 1482 |
/// Otherwise, each arc/edge that is incident to a hidden node is |
|
| 1483 |
/// automatically filtered out. This is the default option. |
|
| 1468 |
/// \tparam NF The type of the node filter map. |
|
| 1469 |
/// It must be a \c bool (or convertible) node map of the |
|
| 1470 |
/// adapted (di)graph. The default type is |
|
| 1471 |
/// \ref concepts::Graph::NodeMap "GR::NodeMap<bool>". |
|
| 1484 | 1472 |
/// |
| 1485 | 1473 |
/// \note The \c Node and <tt>Arc/Edge</tt> types of this adaptor and the |
| 1486 | 1474 |
/// adapted (di)graph are convertible to each other. |
| 1487 | 1475 |
#ifdef DOXYGEN |
| 1488 |
template<typename _Graph, |
|
| 1489 |
typename _NodeFilterMap, |
|
| 1490 |
|
|
| 1476 |
template<typename GR, typename NF> |
|
| 1477 |
class FilterNodes {
|
|
| 1491 | 1478 |
#else |
| 1492 |
template<typename _Digraph, |
|
| 1493 |
typename _NodeFilterMap = typename _Digraph::template NodeMap<bool>, |
|
| 1494 |
|
|
| 1479 |
template<typename GR, |
|
| 1480 |
typename NF = typename GR::template NodeMap<bool>, |
|
| 1495 | 1481 |
typename Enable = void> |
| 1482 |
class FilterNodes : |
|
| 1483 |
public DigraphAdaptorExtender< |
|
| 1484 |
SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, bool>, true> > {
|
|
| 1496 | 1485 |
#endif |
| 1497 |
class FilterNodes |
|
| 1498 |
: public SubDigraph<_Digraph, _NodeFilterMap, |
|
| 1499 |
ConstMap<typename _Digraph::Arc, bool>, _checked> {
|
|
| 1500 | 1486 |
public: |
| 1501 | 1487 |
|
| 1502 |
typedef _Digraph Digraph; |
|
| 1503 |
typedef _NodeFilterMap NodeFilterMap; |
|
| 1504 |
|
|
| 1505 |
typedef SubDigraph<Digraph, NodeFilterMap, |
|
| 1506 |
|
|
| 1488 |
typedef GR Digraph; |
|
| 1489 |
typedef NF NodeFilterMap; |
|
| 1490 |
|
|
| 1491 |
typedef DigraphAdaptorExtender< |
|
| 1492 |
SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, bool>, true> > |
|
| 1507 | 1493 |
Parent; |
| 1508 | 1494 |
|
| 1509 | 1495 |
typedef typename Parent::Node Node; |
| 1510 | 1496 |
|
| 1511 | 1497 |
protected: |
| 1512 | 1498 |
ConstMap<typename Digraph::Arc, bool> const_true_map; |
| 1513 | 1499 |
|
| 1514 | 1500 |
FilterNodes() : const_true_map(true) {
|
| 1515 | 1501 |
Parent::setArcFilterMap(const_true_map); |
| 1516 | 1502 |
} |
| 1517 | 1503 |
|
| 1518 | 1504 |
public: |
| 1519 | 1505 |
|
| 1520 | 1506 |
/// \brief Constructor |
| 1521 | 1507 |
/// |
| 1522 | 1508 |
/// Creates a subgraph for the given digraph or graph with the |
| 1523 | 1509 |
/// given node filter map. |
| 1524 |
#ifdef DOXYGEN |
|
| 1525 |
FilterNodes(_Graph& graph, _NodeFilterMap& node_filter) : |
|
| 1526 |
#else |
|
| 1527 |
FilterNodes(Digraph& graph, NodeFilterMap& node_filter) : |
|
| 1528 |
#endif |
|
| 1529 |
Parent(), const_true_map(true) {
|
|
| 1510 |
FilterNodes(GR& graph, NodeFilterMap& node_filter) : |
|
| 1511 |
Parent(), const_true_map(true) |
|
| 1512 |
{
|
|
| 1530 | 1513 |
Parent::setDigraph(graph); |
| 1531 | 1514 |
Parent::setNodeFilterMap(node_filter); |
| 1532 | 1515 |
Parent::setArcFilterMap(const_true_map); |
| 1533 | 1516 |
} |
| 1534 | 1517 |
|
| 1535 | 1518 |
/// \brief Sets the status of the given node |
| 1536 | 1519 |
/// |
| 1537 | 1520 |
/// This function sets the status of the given node. |
| 1538 | 1521 |
/// It is done by simply setting the assigned value of \c n |
| 1539 | 1522 |
/// to \c v in the node filter map. |
| 1540 | 1523 |
void status(const Node& n, bool v) const { Parent::status(n, v); }
|
| 1541 | 1524 |
|
| 1542 | 1525 |
/// \brief Returns the status of the given node |
| 1543 | 1526 |
/// |
| 1544 | 1527 |
/// This function returns the status of the given node. |
| 1545 | 1528 |
/// It is \c true if the given node is enabled (i.e. not hidden). |
| 1546 | 1529 |
bool status(const Node& n) const { return Parent::status(n); }
|
| 1547 | 1530 |
|
| 1548 | 1531 |
/// \brief Disables the given node |
| 1549 | 1532 |
/// |
| 1550 | 1533 |
/// This function disables the given node, so the iteration |
| 1551 | 1534 |
/// jumps over it. |
| 1552 | 1535 |
/// It is the same as \ref status() "status(n, false)". |
| 1553 | 1536 |
void disable(const Node& n) const { Parent::status(n, false); }
|
| 1554 | 1537 |
|
| 1555 | 1538 |
/// \brief Enables the given node |
| 1556 | 1539 |
/// |
| 1557 | 1540 |
/// This function enables the given node. |
| 1558 | 1541 |
/// It is the same as \ref status() "status(n, true)". |
| 1559 | 1542 |
void enable(const Node& n) const { Parent::status(n, true); }
|
| 1560 | 1543 |
|
| 1561 | 1544 |
}; |
| 1562 | 1545 |
|
| 1563 |
template<typename _Graph, typename _NodeFilterMap, bool _checked> |
|
| 1564 |
class FilterNodes<_Graph, _NodeFilterMap, _checked, |
|
| 1565 |
typename enable_if<UndirectedTagIndicator<_Graph> >::type> |
|
| 1566 |
: public SubGraph<_Graph, _NodeFilterMap, |
|
| 1567 |
|
|
| 1546 |
template<typename GR, typename NF> |
|
| 1547 |
class FilterNodes<GR, NF, |
|
| 1548 |
typename enable_if<UndirectedTagIndicator<GR> >::type> : |
|
| 1549 |
public GraphAdaptorExtender< |
|
| 1550 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, bool>, true> > {
|
|
| 1551 |
|
|
| 1568 | 1552 |
public: |
| 1569 |
typedef _Graph Graph; |
|
| 1570 |
typedef _NodeFilterMap NodeFilterMap; |
|
| 1571 |
typedef SubGraph<Graph, NodeFilterMap, |
|
| 1572 |
ConstMap<typename Graph::Edge, bool> > Parent; |
|
| 1553 |
typedef GR Graph; |
|
| 1554 |
typedef NF NodeFilterMap; |
|
| 1555 |
typedef GraphAdaptorExtender< |
|
| 1556 |
SubGraphBase<GR, NF, ConstMap<typename GR::Edge, bool>, true> > |
|
| 1557 |
Parent; |
|
| 1573 | 1558 |
|
| 1574 | 1559 |
typedef typename Parent::Node Node; |
| 1575 | 1560 |
protected: |
| 1576 | 1561 |
ConstMap<typename Graph::Edge, bool> const_true_map; |
| 1577 | 1562 |
|
| 1578 | 1563 |
FilterNodes() : const_true_map(true) {
|
| 1579 | 1564 |
Parent::setEdgeFilterMap(const_true_map); |
| 1580 | 1565 |
} |
| 1581 | 1566 |
|
| 1582 | 1567 |
public: |
| 1583 | 1568 |
|
| 1584 | 1569 |
FilterNodes(Graph& _graph, NodeFilterMap& node_filter_map) : |
| 1585 | 1570 |
Parent(), const_true_map(true) {
|
| 1586 | 1571 |
Parent::setGraph(_graph); |
| 1587 | 1572 |
Parent::setNodeFilterMap(node_filter_map); |
| 1588 | 1573 |
Parent::setEdgeFilterMap(const_true_map); |
| 1589 | 1574 |
} |
| 1590 | 1575 |
|
| 1591 | 1576 |
void status(const Node& n, bool v) const { Parent::status(n, v); }
|
| 1592 | 1577 |
bool status(const Node& n) const { return Parent::status(n); }
|
| 1593 | 1578 |
void disable(const Node& n) const { Parent::status(n, false); }
|
| 1594 | 1579 |
void enable(const Node& n) const { Parent::status(n, true); }
|
| 1595 | 1580 |
|
| 1596 | 1581 |
}; |
| 1597 | 1582 |
|
| 1598 | 1583 |
|
| 1599 | 1584 |
/// \brief Returns a read-only FilterNodes adaptor |
| 1600 | 1585 |
/// |
| 1601 | 1586 |
/// This function just returns a read-only \ref FilterNodes adaptor. |
| 1602 | 1587 |
/// \ingroup graph_adaptors |
| 1603 | 1588 |
/// \relates FilterNodes |
| 1604 |
template<typename Digraph, typename NodeFilterMap> |
|
| 1605 |
FilterNodes<const Digraph, NodeFilterMap> |
|
| 1606 |
filterNodes(const Digraph& digraph, NodeFilterMap& nfm) {
|
|
| 1607 |
return FilterNodes<const Digraph, NodeFilterMap>(digraph, nfm); |
|
| 1608 |
} |
|
| 1609 |
|
|
| 1610 |
template<typename Digraph, typename NodeFilterMap> |
|
| 1611 |
FilterNodes<const Digraph, const NodeFilterMap> |
|
| 1612 |
filterNodes(const Digraph& digraph, const NodeFilterMap& nfm) {
|
|
| 1613 |
return FilterNodes<const Digraph, const NodeFilterMap>(digraph, nfm); |
|
| 1589 |
template<typename GR, typename NF> |
|
| 1590 |
FilterNodes<const GR, NF> |
|
| 1591 |
filterNodes(const GR& graph, NF& node_filter_map) {
|
|
| 1592 |
return FilterNodes<const GR, NF>(graph, node_filter_map); |
|
| 1593 |
} |
|
| 1594 |
|
|
| 1595 |
template<typename GR, typename NF> |
|
| 1596 |
FilterNodes<const GR, const NF> |
|
| 1597 |
filterNodes(const GR& graph, const NF& node_filter_map) {
|
|
| 1598 |
return FilterNodes<const GR, const NF>(graph, node_filter_map); |
|
| 1614 | 1599 |
} |
| 1615 | 1600 |
|
| 1616 | 1601 |
/// \ingroup graph_adaptors |
| 1617 | 1602 |
/// |
| 1618 | 1603 |
/// \brief Adaptor class for hiding arcs in a digraph. |
| 1619 | 1604 |
/// |
| 1620 | 1605 |
/// FilterArcs adaptor can be used for hiding arcs in a digraph. |
| 1621 | 1606 |
/// A \c bool arc map must be specified, which defines the filter for |
| 1622 | 1607 |
/// the arcs. Only the arcs with \c true filter value are shown in the |
| 1623 | 1608 |
/// subdigraph. This adaptor conforms to the \ref concepts::Digraph |
| 1624 | 1609 |
/// "Digraph" concept. |
| 1625 | 1610 |
/// |
| 1626 | 1611 |
/// The adapted digraph can also be modified through this adaptor |
| 1627 |
/// by adding or removing nodes or arcs, unless the \c |
|
| 1612 |
/// by adding or removing nodes or arcs, unless the \c GR template |
|
| 1628 | 1613 |
/// parameter is set to be \c const. |
| 1629 | 1614 |
/// |
| 1630 |
/// \tparam |
|
| 1615 |
/// \tparam GR The type of the adapted digraph. |
|
| 1631 | 1616 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept. |
| 1632 | 1617 |
/// It can also be specified to be \c const. |
| 1633 |
/// \tparam _ArcFilterMap A \c bool (or convertible) arc map of the |
|
| 1634 |
/// adapted digraph. The default map type is |
|
| 1635 |
/// \ |
|
| 1618 |
/// \tparam AF The type of the arc filter map. |
|
| 1619 |
/// It must be a \c bool (or convertible) arc map of the |
|
| 1620 |
/// adapted digraph. The default type is |
|
| 1621 |
/// \ref concepts::Digraph::ArcMap "GR::ArcMap<bool>". |
|
| 1636 | 1622 |
/// |
| 1637 | 1623 |
/// \note The \c Node and \c Arc types of this adaptor and the adapted |
| 1638 | 1624 |
/// digraph are convertible to each other. |
| 1639 | 1625 |
#ifdef DOXYGEN |
| 1640 |
template<typename _Digraph, |
|
| 1641 |
typename _ArcFilterMap> |
|
| 1626 |
template<typename GR, |
|
| 1627 |
typename AF> |
|
| 1628 |
class FilterArcs {
|
|
| 1642 | 1629 |
#else |
| 1643 |
template<typename _Digraph, |
|
| 1644 |
typename _ArcFilterMap = typename _Digraph::template ArcMap<bool> > |
|
| 1630 |
template<typename GR, |
|
| 1631 |
typename AF = typename GR::template ArcMap<bool> > |
|
| 1632 |
class FilterArcs : |
|
| 1633 |
public DigraphAdaptorExtender< |
|
| 1634 |
SubDigraphBase<GR, ConstMap<typename GR::Node, bool>, AF, false> > {
|
|
| 1645 | 1635 |
#endif |
| 1646 |
class FilterArcs : |
|
| 1647 |
public SubDigraph<_Digraph, ConstMap<typename _Digraph::Node, bool>, |
|
| 1648 |
_ArcFilterMap, false> {
|
|
| 1649 | 1636 |
public: |
| 1650 |
|
|
| 1651 |
typedef _Digraph Digraph; |
|
| 1652 |
typedef _ArcFilterMap ArcFilterMap; |
|
| 1653 |
|
|
| 1654 |
typedef SubDigraph<Digraph, ConstMap<typename Digraph::Node, bool>, |
|
| 1655 |
ArcFilterMap, false> Parent; |
|
| 1637 |
/// The type of the adapted digraph. |
|
| 1638 |
typedef GR Digraph; |
|
| 1639 |
/// The type of the arc filter map. |
|
| 1640 |
typedef AF ArcFilterMap; |
|
| 1641 |
|
|
| 1642 |
typedef DigraphAdaptorExtender< |
|
| 1643 |
SubDigraphBase<GR, ConstMap<typename GR::Node, bool>, AF, false> > |
|
| 1644 |
Parent; |
|
| 1656 | 1645 |
|
| 1657 | 1646 |
typedef typename Parent::Arc Arc; |
| 1658 | 1647 |
|
| 1659 | 1648 |
protected: |
| 1660 | 1649 |
ConstMap<typename Digraph::Node, bool> const_true_map; |
| 1661 | 1650 |
|
| 1662 | 1651 |
FilterArcs() : const_true_map(true) {
|
| 1663 | 1652 |
Parent::setNodeFilterMap(const_true_map); |
| 1664 | 1653 |
} |
| 1665 | 1654 |
|
| 1666 | 1655 |
public: |
| 1667 | 1656 |
|
| 1668 | 1657 |
/// \brief Constructor |
| 1669 | 1658 |
/// |
| 1670 | 1659 |
/// Creates a subdigraph for the given digraph with the given arc |
| 1671 | 1660 |
/// filter map. |
| 1672 | 1661 |
FilterArcs(Digraph& digraph, ArcFilterMap& arc_filter) |
| 1673 | 1662 |
: Parent(), const_true_map(true) {
|
| 1674 | 1663 |
Parent::setDigraph(digraph); |
| 1675 | 1664 |
Parent::setNodeFilterMap(const_true_map); |
| 1676 | 1665 |
Parent::setArcFilterMap(arc_filter); |
| 1677 | 1666 |
} |
| 1678 | 1667 |
|
| 1679 | 1668 |
/// \brief Sets the status of the given arc |
| 1680 | 1669 |
/// |
| 1681 | 1670 |
/// This function sets the status of the given arc. |
| 1682 | 1671 |
/// It is done by simply setting the assigned value of \c a |
| 1683 | 1672 |
/// to \c v in the arc filter map. |
| 1684 | 1673 |
void status(const Arc& a, bool v) const { Parent::status(a, v); }
|
| 1685 | 1674 |
|
| 1686 | 1675 |
/// \brief Returns the status of the given arc |
| 1687 | 1676 |
/// |
| 1688 | 1677 |
/// This function returns the status of the given arc. |
| 1689 | 1678 |
/// It is \c true if the given arc is enabled (i.e. not hidden). |
| 1690 | 1679 |
bool status(const Arc& a) const { return Parent::status(a); }
|
| 1691 | 1680 |
|
| 1692 | 1681 |
/// \brief Disables the given arc |
| 1693 | 1682 |
/// |
| 1694 | 1683 |
/// This function disables the given arc in the subdigraph, |
| 1695 | 1684 |
/// so the iteration jumps over it. |
| 1696 | 1685 |
/// It is the same as \ref status() "status(a, false)". |
| 1697 | 1686 |
void disable(const Arc& a) const { Parent::status(a, false); }
|
| 1698 | 1687 |
|
| 1699 | 1688 |
/// \brief Enables the given arc |
| 1700 | 1689 |
/// |
| 1701 | 1690 |
/// This function enables the given arc in the subdigraph. |
| 1702 | 1691 |
/// It is the same as \ref status() "status(a, true)". |
| 1703 | 1692 |
void enable(const Arc& a) const { Parent::status(a, true); }
|
| 1704 | 1693 |
|
| 1705 | 1694 |
}; |
| 1706 | 1695 |
|
| 1707 | 1696 |
/// \brief Returns a read-only FilterArcs adaptor |
| 1708 | 1697 |
/// |
| 1709 | 1698 |
/// This function just returns a read-only \ref FilterArcs adaptor. |
| 1710 | 1699 |
/// \ingroup graph_adaptors |
| 1711 | 1700 |
/// \relates FilterArcs |
| 1712 |
template<typename Digraph, typename ArcFilterMap> |
|
| 1713 |
FilterArcs<const Digraph, ArcFilterMap> |
|
| 1714 |
filterArcs(const Digraph& digraph, ArcFilterMap& afm) {
|
|
| 1715 |
return FilterArcs<const Digraph, ArcFilterMap>(digraph, afm); |
|
| 1716 |
} |
|
| 1717 |
|
|
| 1718 |
template<typename Digraph, typename ArcFilterMap> |
|
| 1719 |
FilterArcs<const Digraph, const ArcFilterMap> |
|
| 1720 |
filterArcs(const Digraph& digraph, const ArcFilterMap& afm) {
|
|
| 1721 |
return FilterArcs<const Digraph, const ArcFilterMap>(digraph, afm); |
|
| 1701 |
template<typename GR, typename AF> |
|
| 1702 |
FilterArcs<const GR, AF> |
|
| 1703 |
filterArcs(const GR& digraph, AF& arc_filter_map) {
|
|
| 1704 |
return FilterArcs<const GR, AF>(digraph, arc_filter_map); |
|
| 1705 |
} |
|
| 1706 |
|
|
| 1707 |
template<typename GR, typename AF> |
|
| 1708 |
FilterArcs<const GR, const AF> |
|
| 1709 |
filterArcs(const GR& digraph, const AF& arc_filter_map) {
|
|
| 1710 |
return FilterArcs<const GR, const AF>(digraph, arc_filter_map); |
|
| 1722 | 1711 |
} |
| 1723 | 1712 |
|
| 1724 | 1713 |
/// \ingroup graph_adaptors |
| 1725 | 1714 |
/// |
| 1726 | 1715 |
/// \brief Adaptor class for hiding edges in a graph. |
| 1727 | 1716 |
/// |
| 1728 | 1717 |
/// FilterEdges adaptor can be used for hiding edges in a graph. |
| 1729 | 1718 |
/// A \c bool edge map must be specified, which defines the filter for |
| 1730 | 1719 |
/// the edges. Only the edges with \c true filter value are shown in the |
| 1731 | 1720 |
/// subgraph. This adaptor conforms to the \ref concepts::Graph |
| 1732 | 1721 |
/// "Graph" concept. |
| 1733 | 1722 |
/// |
| 1734 | 1723 |
/// The adapted graph can also be modified through this adaptor |
| 1735 |
/// by adding or removing nodes or edges, unless the \c |
|
| 1724 |
/// by adding or removing nodes or edges, unless the \c GR template |
|
| 1736 | 1725 |
/// parameter is set to be \c const. |
| 1737 | 1726 |
/// |
| 1738 |
/// \tparam |
|
| 1727 |
/// \tparam GR The type of the adapted graph. |
|
| 1739 | 1728 |
/// It must conform to the \ref concepts::Graph "Graph" concept. |
| 1740 | 1729 |
/// It can also be specified to be \c const. |
| 1741 |
/// \tparam _EdgeFilterMap A \c bool (or convertible) edge map of the |
|
| 1742 |
/// adapted graph. The default map type is |
|
| 1743 |
/// \ |
|
| 1730 |
/// \tparam EF The type of the edge filter map. |
|
| 1731 |
/// It must be a \c bool (or convertible) edge map of the |
|
| 1732 |
/// adapted graph. The default type is |
|
| 1733 |
/// \ref concepts::Graph::EdgeMap "GR::EdgeMap<bool>". |
|
| 1744 | 1734 |
/// |
| 1745 | 1735 |
/// \note The \c Node, \c Edge and \c Arc types of this adaptor and the |
| 1746 | 1736 |
/// adapted graph are convertible to each other. |
| 1747 | 1737 |
#ifdef DOXYGEN |
| 1748 |
template<typename _Graph, |
|
| 1749 |
typename _EdgeFilterMap> |
|
| 1738 |
template<typename GR, |
|
| 1739 |
typename EF> |
|
| 1740 |
class FilterEdges {
|
|
| 1750 | 1741 |
#else |
| 1751 |
template<typename _Graph, |
|
| 1752 |
typename _EdgeFilterMap = typename _Graph::template EdgeMap<bool> > |
|
| 1742 |
template<typename GR, |
|
| 1743 |
typename EF = typename GR::template EdgeMap<bool> > |
|
| 1744 |
class FilterEdges : |
|
| 1745 |
public GraphAdaptorExtender< |
|
| 1746 |
SubGraphBase<GR, ConstMap<typename GR::Node,bool>, EF, false> > {
|
|
| 1753 | 1747 |
#endif |
| 1754 |
class FilterEdges : |
|
| 1755 |
public SubGraph<_Graph, ConstMap<typename _Graph::Node,bool>, |
|
| 1756 |
_EdgeFilterMap, false> {
|
|
| 1757 | 1748 |
public: |
| 1758 |
typedef _Graph Graph; |
|
| 1759 |
typedef _EdgeFilterMap EdgeFilterMap; |
|
| 1760 |
typedef SubGraph<Graph, ConstMap<typename Graph::Node,bool>, |
|
| 1761 |
EdgeFilterMap, false> Parent; |
|
| 1749 |
/// The type of the adapted graph. |
|
| 1750 |
typedef GR Graph; |
|
| 1751 |
/// The type of the edge filter map. |
|
| 1752 |
typedef EF EdgeFilterMap; |
|
| 1753 |
|
|
| 1754 |
typedef GraphAdaptorExtender< |
|
| 1755 |
SubGraphBase<GR, ConstMap<typename GR::Node,bool>, EF, false> > |
|
| 1756 |
Parent; |
|
| 1757 |
|
|
| 1762 | 1758 |
typedef typename Parent::Edge Edge; |
| 1759 |
|
|
| 1763 | 1760 |
protected: |
| 1764 | 1761 |
ConstMap<typename Graph::Node, bool> const_true_map; |
| 1765 | 1762 |
|
| 1766 | 1763 |
FilterEdges() : const_true_map(true) {
|
| 1767 | 1764 |
Parent::setNodeFilterMap(const_true_map); |
| 1768 | 1765 |
} |
| 1769 | 1766 |
|
| 1770 | 1767 |
public: |
| 1771 | 1768 |
|
| 1772 | 1769 |
/// \brief Constructor |
| 1773 | 1770 |
/// |
| 1774 | 1771 |
/// Creates a subgraph for the given graph with the given edge |
| 1775 | 1772 |
/// filter map. |
| 1776 | 1773 |
FilterEdges(Graph& graph, EdgeFilterMap& edge_filter_map) : |
| 1777 | 1774 |
Parent(), const_true_map(true) {
|
| 1778 | 1775 |
Parent::setGraph(graph); |
| 1779 | 1776 |
Parent::setNodeFilterMap(const_true_map); |
| 1780 | 1777 |
Parent::setEdgeFilterMap(edge_filter_map); |
| 1781 | 1778 |
} |
| 1782 | 1779 |
|
| 1783 | 1780 |
/// \brief Sets the status of the given edge |
| 1784 | 1781 |
/// |
| 1785 | 1782 |
/// This function sets the status of the given edge. |
| 1786 | 1783 |
/// It is done by simply setting the assigned value of \c e |
| 1787 | 1784 |
/// to \c v in the edge filter map. |
| 1788 | 1785 |
void status(const Edge& e, bool v) const { Parent::status(e, v); }
|
| 1789 | 1786 |
|
| 1790 | 1787 |
/// \brief Returns the status of the given edge |
| 1791 | 1788 |
/// |
| 1792 | 1789 |
/// This function returns the status of the given edge. |
| 1793 | 1790 |
/// It is \c true if the given edge is enabled (i.e. not hidden). |
| 1794 | 1791 |
bool status(const Edge& e) const { return Parent::status(e); }
|
| 1795 | 1792 |
|
| 1796 | 1793 |
/// \brief Disables the given edge |
| 1797 | 1794 |
/// |
| 1798 | 1795 |
/// This function disables the given edge in the subgraph, |
| 1799 | 1796 |
/// so the iteration jumps over it. |
| 1800 | 1797 |
/// It is the same as \ref status() "status(e, false)". |
| 1801 | 1798 |
void disable(const Edge& e) const { Parent::status(e, false); }
|
| 1802 | 1799 |
|
| 1803 | 1800 |
/// \brief Enables the given edge |
| 1804 | 1801 |
/// |
| 1805 | 1802 |
/// This function enables the given edge in the subgraph. |
| 1806 | 1803 |
/// It is the same as \ref status() "status(e, true)". |
| 1807 | 1804 |
void enable(const Edge& e) const { Parent::status(e, true); }
|
| 1808 | 1805 |
|
| 1809 | 1806 |
}; |
| 1810 | 1807 |
|
| 1811 | 1808 |
/// \brief Returns a read-only FilterEdges adaptor |
| 1812 | 1809 |
/// |
| 1813 | 1810 |
/// This function just returns a read-only \ref FilterEdges adaptor. |
| 1814 | 1811 |
/// \ingroup graph_adaptors |
| 1815 | 1812 |
/// \relates FilterEdges |
| 1816 |
template<typename Graph, typename EdgeFilterMap> |
|
| 1817 |
FilterEdges<const Graph, EdgeFilterMap> |
|
| 1818 |
filterEdges(const Graph& graph, EdgeFilterMap& efm) {
|
|
| 1819 |
return FilterEdges<const Graph, EdgeFilterMap>(graph, efm); |
|
| 1820 |
} |
|
| 1821 |
|
|
| 1822 |
template<typename Graph, typename EdgeFilterMap> |
|
| 1823 |
FilterEdges<const Graph, const EdgeFilterMap> |
|
| 1824 |
filterEdges(const Graph& graph, const EdgeFilterMap& efm) {
|
|
| 1825 |
return FilterEdges<const Graph, const EdgeFilterMap>(graph, efm); |
|
| 1813 |
template<typename GR, typename EF> |
|
| 1814 |
FilterEdges<const GR, EF> |
|
| 1815 |
filterEdges(const GR& graph, EF& edge_filter_map) {
|
|
| 1816 |
return FilterEdges<const GR, EF>(graph, edge_filter_map); |
|
| 1817 |
} |
|
| 1818 |
|
|
| 1819 |
template<typename GR, typename EF> |
|
| 1820 |
FilterEdges<const GR, const EF> |
|
| 1821 |
filterEdges(const GR& graph, const EF& edge_filter_map) {
|
|
| 1822 |
return FilterEdges<const GR, const EF>(graph, edge_filter_map); |
|
| 1826 | 1823 |
} |
| 1827 | 1824 |
|
| 1828 | 1825 |
|
| 1829 | 1826 |
template <typename _Digraph> |
| 1830 | 1827 |
class UndirectorBase {
|
| 1831 | 1828 |
public: |
| 1832 | 1829 |
typedef _Digraph Digraph; |
| 1833 | 1830 |
typedef UndirectorBase Adaptor; |
| 1834 | 1831 |
|
| 1835 | 1832 |
typedef True UndirectedTag; |
| 1836 | 1833 |
|
| 1837 | 1834 |
typedef typename Digraph::Arc Edge; |
| 1838 | 1835 |
typedef typename Digraph::Node Node; |
| 1839 | 1836 |
|
| 1840 | 1837 |
class Arc : public Edge {
|
| 1841 | 1838 |
friend class UndirectorBase; |
| 1842 | 1839 |
protected: |
| 1843 | 1840 |
bool _forward; |
| 1844 | 1841 |
|
| 1845 | 1842 |
Arc(const Edge& edge, bool forward) : |
| 1846 | 1843 |
Edge(edge), _forward(forward) {}
|
| 1847 | 1844 |
|
| 1848 | 1845 |
public: |
| 1849 | 1846 |
Arc() {}
|
| 1850 | 1847 |
|
| 1851 | 1848 |
Arc(Invalid) : Edge(INVALID), _forward(true) {}
|
| 1852 | 1849 |
|
| 1853 | 1850 |
bool operator==(const Arc &other) const {
|
| 1854 | 1851 |
return _forward == other._forward && |
| 1855 | 1852 |
static_cast<const Edge&>(*this) == static_cast<const Edge&>(other); |
| 1856 | 1853 |
} |
| 1857 | 1854 |
bool operator!=(const Arc &other) const {
|
| 1858 | 1855 |
return _forward != other._forward || |
| 1859 | 1856 |
static_cast<const Edge&>(*this) != static_cast<const Edge&>(other); |
| 1860 | 1857 |
} |
| 1861 | 1858 |
bool operator<(const Arc &other) const {
|
| 1862 | 1859 |
return _forward < other._forward || |
| 1863 | 1860 |
(_forward == other._forward && |
| 1864 | 1861 |
static_cast<const Edge&>(*this) < static_cast<const Edge&>(other)); |
| 1865 | 1862 |
} |
| 1866 | 1863 |
}; |
| 1867 | 1864 |
|
| 1868 | 1865 |
void first(Node& n) const {
|
| 1869 | 1866 |
_digraph->first(n); |
| 1870 | 1867 |
} |
| 1871 | 1868 |
|
| 1872 | 1869 |
void next(Node& n) const {
|
| 1873 | 1870 |
_digraph->next(n); |
| ... | ... |
@@ -2181,230 +2178,231 @@ |
| 2181 | 2178 |
|
| 2182 | 2179 |
explicit EdgeMap(const Adaptor& adaptor) |
| 2183 | 2180 |
: Parent(*adaptor._digraph) {}
|
| 2184 | 2181 |
|
| 2185 | 2182 |
EdgeMap(const Adaptor& adaptor, const Value& value) |
| 2186 | 2183 |
: Parent(*adaptor._digraph, value) {}
|
| 2187 | 2184 |
|
| 2188 | 2185 |
private: |
| 2189 | 2186 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
| 2190 | 2187 |
return operator=<EdgeMap>(cmap); |
| 2191 | 2188 |
} |
| 2192 | 2189 |
|
| 2193 | 2190 |
template <typename CMap> |
| 2194 | 2191 |
EdgeMap& operator=(const CMap& cmap) {
|
| 2195 | 2192 |
Parent::operator=(cmap); |
| 2196 | 2193 |
return *this; |
| 2197 | 2194 |
} |
| 2198 | 2195 |
|
| 2199 | 2196 |
}; |
| 2200 | 2197 |
|
| 2201 | 2198 |
typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier; |
| 2202 | 2199 |
NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
|
| 2203 | 2200 |
|
| 2204 | 2201 |
typedef typename ItemSetTraits<Digraph, Edge>::ItemNotifier EdgeNotifier; |
| 2205 | 2202 |
EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
|
| 2206 | 2203 |
|
| 2207 | 2204 |
protected: |
| 2208 | 2205 |
|
| 2209 | 2206 |
UndirectorBase() : _digraph(0) {}
|
| 2210 | 2207 |
|
| 2211 | 2208 |
Digraph* _digraph; |
| 2212 | 2209 |
|
| 2213 | 2210 |
void setDigraph(Digraph& digraph) {
|
| 2214 | 2211 |
_digraph = &digraph; |
| 2215 | 2212 |
} |
| 2216 | 2213 |
|
| 2217 | 2214 |
}; |
| 2218 | 2215 |
|
| 2219 | 2216 |
/// \ingroup graph_adaptors |
| 2220 | 2217 |
/// |
| 2221 | 2218 |
/// \brief Adaptor class for viewing a digraph as an undirected graph. |
| 2222 | 2219 |
/// |
| 2223 | 2220 |
/// Undirector adaptor can be used for viewing a digraph as an undirected |
| 2224 | 2221 |
/// graph. All arcs of the underlying digraph are showed in the |
| 2225 | 2222 |
/// adaptor as an edge (and also as a pair of arcs, of course). |
| 2226 | 2223 |
/// This adaptor conforms to the \ref concepts::Graph "Graph" concept. |
| 2227 | 2224 |
/// |
| 2228 | 2225 |
/// The adapted digraph can also be modified through this adaptor |
| 2229 |
/// by adding or removing nodes or edges, unless the \c |
|
| 2226 |
/// by adding or removing nodes or edges, unless the \c GR template |
|
| 2230 | 2227 |
/// parameter is set to be \c const. |
| 2231 | 2228 |
/// |
| 2232 |
/// \tparam |
|
| 2229 |
/// \tparam GR The type of the adapted digraph. |
|
| 2233 | 2230 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept. |
| 2234 | 2231 |
/// It can also be specified to be \c const. |
| 2235 | 2232 |
/// |
| 2236 | 2233 |
/// \note The \c Node type of this adaptor and the adapted digraph are |
| 2237 | 2234 |
/// convertible to each other, moreover the \c Edge type of the adaptor |
| 2238 | 2235 |
/// and the \c Arc type of the adapted digraph are also convertible to |
| 2239 | 2236 |
/// each other. |
| 2240 | 2237 |
/// (Thus the \c Arc type of the adaptor is convertible to the \c Arc type |
| 2241 | 2238 |
/// of the adapted digraph.) |
| 2242 |
template<typename _Digraph> |
|
| 2243 |
class Undirector |
|
| 2244 |
|
|
| 2239 |
template<typename GR> |
|
| 2240 |
#ifdef DOXYGEN |
|
| 2241 |
class Undirector {
|
|
| 2242 |
#else |
|
| 2243 |
class Undirector : |
|
| 2244 |
public GraphAdaptorExtender<UndirectorBase<GR> > {
|
|
| 2245 |
#endif |
|
| 2245 | 2246 |
public: |
| 2246 |
typedef _Digraph Digraph; |
|
| 2247 |
typedef GraphAdaptorExtender<UndirectorBase<Digraph> > Parent; |
|
| 2247 |
/// The type of the adapted digraph. |
|
| 2248 |
typedef GR Digraph; |
|
| 2249 |
typedef GraphAdaptorExtender<UndirectorBase<GR> > Parent; |
|
| 2248 | 2250 |
protected: |
| 2249 | 2251 |
Undirector() { }
|
| 2250 | 2252 |
public: |
| 2251 | 2253 |
|
| 2252 | 2254 |
/// \brief Constructor |
| 2253 | 2255 |
/// |
| 2254 | 2256 |
/// Creates an undirected graph from the given digraph. |
| 2255 |
Undirector( |
|
| 2257 |
Undirector(Digraph& digraph) {
|
|
| 2256 | 2258 |
setDigraph(digraph); |
| 2257 | 2259 |
} |
| 2258 | 2260 |
|
| 2259 | 2261 |
/// \brief Arc map combined from two original arc maps |
| 2260 | 2262 |
/// |
| 2261 | 2263 |
/// This map adaptor class adapts two arc maps of the underlying |
| 2262 | 2264 |
/// digraph to get an arc map of the undirected graph. |
| 2263 | 2265 |
/// Its value type is inherited from the first arc map type |
| 2264 | 2266 |
/// (\c %ForwardMap). |
| 2265 |
template <typename |
|
| 2267 |
template <typename ForwardMap, typename BackwardMap> |
|
| 2266 | 2268 |
class CombinedArcMap {
|
| 2267 | 2269 |
public: |
| 2268 | 2270 |
|
| 2269 |
typedef _ForwardMap ForwardMap; |
|
| 2270 |
typedef _BackwardMap BackwardMap; |
|
| 2271 |
|
|
| 2272 |
typedef typename MapTraits<ForwardMap>::ReferenceMapTag ReferenceMapTag; |
|
| 2273 |
|
|
| 2274 | 2271 |
/// The key type of the map |
| 2275 | 2272 |
typedef typename Parent::Arc Key; |
| 2276 | 2273 |
/// The value type of the map |
| 2277 | 2274 |
typedef typename ForwardMap::Value Value; |
| 2278 | 2275 |
|
| 2276 |
typedef typename MapTraits<ForwardMap>::ReferenceMapTag ReferenceMapTag; |
|
| 2277 |
|
|
| 2279 | 2278 |
typedef typename MapTraits<ForwardMap>::ReturnValue ReturnValue; |
| 2280 | 2279 |
typedef typename MapTraits<ForwardMap>::ConstReturnValue ConstReturnValue; |
| 2281 | 2280 |
typedef typename MapTraits<ForwardMap>::ReturnValue Reference; |
| 2282 | 2281 |
typedef typename MapTraits<ForwardMap>::ConstReturnValue ConstReference; |
| 2283 | 2282 |
|
| 2284 | 2283 |
/// Constructor |
| 2285 | 2284 |
CombinedArcMap(ForwardMap& forward, BackwardMap& backward) |
| 2286 | 2285 |
: _forward(&forward), _backward(&backward) {}
|
| 2287 | 2286 |
|
| 2288 | 2287 |
/// Sets the value associated with the given key. |
| 2289 | 2288 |
void set(const Key& e, const Value& a) {
|
| 2290 | 2289 |
if (Parent::direction(e)) {
|
| 2291 | 2290 |
_forward->set(e, a); |
| 2292 | 2291 |
} else {
|
| 2293 | 2292 |
_backward->set(e, a); |
| 2294 | 2293 |
} |
| 2295 | 2294 |
} |
| 2296 | 2295 |
|
| 2297 | 2296 |
/// Returns the value associated with the given key. |
| 2298 | 2297 |
ConstReturnValue operator[](const Key& e) const {
|
| 2299 | 2298 |
if (Parent::direction(e)) {
|
| 2300 | 2299 |
return (*_forward)[e]; |
| 2301 | 2300 |
} else {
|
| 2302 | 2301 |
return (*_backward)[e]; |
| 2303 | 2302 |
} |
| 2304 | 2303 |
} |
| 2305 | 2304 |
|
| 2306 | 2305 |
/// Returns a reference to the value associated with the given key. |
| 2307 | 2306 |
ReturnValue operator[](const Key& e) {
|
| 2308 | 2307 |
if (Parent::direction(e)) {
|
| 2309 | 2308 |
return (*_forward)[e]; |
| 2310 | 2309 |
} else {
|
| 2311 | 2310 |
return (*_backward)[e]; |
| 2312 | 2311 |
} |
| 2313 | 2312 |
} |
| 2314 | 2313 |
|
| 2315 | 2314 |
protected: |
| 2316 | 2315 |
|
| 2317 | 2316 |
ForwardMap* _forward; |
| 2318 | 2317 |
BackwardMap* _backward; |
| 2319 | 2318 |
|
| 2320 | 2319 |
}; |
| 2321 | 2320 |
|
| 2322 | 2321 |
/// \brief Returns a combined arc map |
| 2323 | 2322 |
/// |
| 2324 | 2323 |
/// This function just returns a combined arc map. |
| 2325 | 2324 |
template <typename ForwardMap, typename BackwardMap> |
| 2326 | 2325 |
static CombinedArcMap<ForwardMap, BackwardMap> |
| 2327 | 2326 |
combinedArcMap(ForwardMap& forward, BackwardMap& backward) {
|
| 2328 | 2327 |
return CombinedArcMap<ForwardMap, BackwardMap>(forward, backward); |
| 2329 | 2328 |
} |
| 2330 | 2329 |
|
| 2331 | 2330 |
template <typename ForwardMap, typename BackwardMap> |
| 2332 | 2331 |
static CombinedArcMap<const ForwardMap, BackwardMap> |
| 2333 | 2332 |
combinedArcMap(const ForwardMap& forward, BackwardMap& backward) {
|
| 2334 | 2333 |
return CombinedArcMap<const ForwardMap, |
| 2335 | 2334 |
BackwardMap>(forward, backward); |
| 2336 | 2335 |
} |
| 2337 | 2336 |
|
| 2338 | 2337 |
template <typename ForwardMap, typename BackwardMap> |
| 2339 | 2338 |
static CombinedArcMap<ForwardMap, const BackwardMap> |
| 2340 | 2339 |
combinedArcMap(ForwardMap& forward, const BackwardMap& backward) {
|
| 2341 | 2340 |
return CombinedArcMap<ForwardMap, |
| 2342 | 2341 |
const BackwardMap>(forward, backward); |
| 2343 | 2342 |
} |
| 2344 | 2343 |
|
| 2345 | 2344 |
template <typename ForwardMap, typename BackwardMap> |
| 2346 | 2345 |
static CombinedArcMap<const ForwardMap, const BackwardMap> |
| 2347 | 2346 |
combinedArcMap(const ForwardMap& forward, const BackwardMap& backward) {
|
| 2348 | 2347 |
return CombinedArcMap<const ForwardMap, |
| 2349 | 2348 |
const BackwardMap>(forward, backward); |
| 2350 | 2349 |
} |
| 2351 | 2350 |
|
| 2352 | 2351 |
}; |
| 2353 | 2352 |
|
| 2354 | 2353 |
/// \brief Returns a read-only Undirector adaptor |
| 2355 | 2354 |
/// |
| 2356 | 2355 |
/// This function just returns a read-only \ref Undirector adaptor. |
| 2357 | 2356 |
/// \ingroup graph_adaptors |
| 2358 | 2357 |
/// \relates Undirector |
| 2359 |
template<typename Digraph> |
|
| 2360 |
Undirector<const Digraph> |
|
| 2361 |
undirector(const Digraph& digraph) {
|
|
| 2362 |
return Undirector<const Digraph>(digraph); |
|
| 2358 |
template<typename GR> |
|
| 2359 |
Undirector<const GR> undirector(const GR& digraph) {
|
|
| 2360 |
return Undirector<const GR>(digraph); |
|
| 2363 | 2361 |
} |
| 2364 | 2362 |
|
| 2365 | 2363 |
|
| 2366 | 2364 |
template <typename _Graph, typename _DirectionMap> |
| 2367 | 2365 |
class OrienterBase {
|
| 2368 | 2366 |
public: |
| 2369 | 2367 |
|
| 2370 | 2368 |
typedef _Graph Graph; |
| 2371 | 2369 |
typedef _DirectionMap DirectionMap; |
| 2372 | 2370 |
|
| 2373 | 2371 |
typedef typename Graph::Node Node; |
| 2374 | 2372 |
typedef typename Graph::Edge Arc; |
| 2375 | 2373 |
|
| 2376 | 2374 |
void reverseArc(const Arc& arc) {
|
| 2377 | 2375 |
_direction->set(arc, !(*_direction)[arc]); |
| 2378 | 2376 |
} |
| 2379 | 2377 |
|
| 2380 | 2378 |
void first(Node& i) const { _graph->first(i); }
|
| 2381 | 2379 |
void first(Arc& i) const { _graph->first(i); }
|
| 2382 | 2380 |
void firstIn(Arc& i, const Node& n) const {
|
| 2383 | 2381 |
bool d = true; |
| 2384 | 2382 |
_graph->firstInc(i, d, n); |
| 2385 | 2383 |
while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d); |
| 2386 | 2384 |
} |
| 2387 | 2385 |
void firstOut(Arc& i, const Node& n ) const {
|
| 2388 | 2386 |
bool d = true; |
| 2389 | 2387 |
_graph->firstInc(i, d, n); |
| 2390 | 2388 |
while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d); |
| 2391 | 2389 |
} |
| 2392 | 2390 |
|
| 2393 | 2391 |
void next(Node& i) const { _graph->next(i); }
|
| 2394 | 2392 |
void next(Arc& i) const { _graph->next(i); }
|
| 2395 | 2393 |
void nextIn(Arc& i) const {
|
| 2396 | 2394 |
bool d = !(*_direction)[i]; |
| 2397 | 2395 |
_graph->nextInc(i, d); |
| 2398 | 2396 |
while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d); |
| 2399 | 2397 |
} |
| 2400 | 2398 |
void nextOut(Arc& i) const {
|
| 2401 | 2399 |
bool d = (*_direction)[i]; |
| 2402 | 2400 |
_graph->nextInc(i, d); |
| 2403 | 2401 |
while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d); |
| 2404 | 2402 |
} |
| 2405 | 2403 |
|
| 2406 | 2404 |
Node source(const Arc& e) const {
|
| 2407 | 2405 |
return (*_direction)[e] ? _graph->u(e) : _graph->v(e); |
| 2408 | 2406 |
} |
| 2409 | 2407 |
Node target(const Arc& e) const {
|
| 2410 | 2408 |
return (*_direction)[e] ? _graph->v(e) : _graph->u(e); |
| ... | ... |
@@ -2488,305 +2486,293 @@ |
| 2488 | 2486 |
typedef typename Graph::template EdgeMap<_Value> Parent; |
| 2489 | 2487 |
|
| 2490 | 2488 |
explicit ArcMap(const OrienterBase& adapter) |
| 2491 | 2489 |
: Parent(*adapter._graph) { }
|
| 2492 | 2490 |
|
| 2493 | 2491 |
ArcMap(const OrienterBase& adapter, const _Value& value) |
| 2494 | 2492 |
: Parent(*adapter._graph, value) { }
|
| 2495 | 2493 |
|
| 2496 | 2494 |
private: |
| 2497 | 2495 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 2498 | 2496 |
return operator=<ArcMap>(cmap); |
| 2499 | 2497 |
} |
| 2500 | 2498 |
|
| 2501 | 2499 |
template <typename CMap> |
| 2502 | 2500 |
ArcMap& operator=(const CMap& cmap) {
|
| 2503 | 2501 |
Parent::operator=(cmap); |
| 2504 | 2502 |
return *this; |
| 2505 | 2503 |
} |
| 2506 | 2504 |
}; |
| 2507 | 2505 |
|
| 2508 | 2506 |
|
| 2509 | 2507 |
|
| 2510 | 2508 |
protected: |
| 2511 | 2509 |
Graph* _graph; |
| 2512 | 2510 |
DirectionMap* _direction; |
| 2513 | 2511 |
|
| 2514 | 2512 |
void setDirectionMap(DirectionMap& direction) {
|
| 2515 | 2513 |
_direction = &direction; |
| 2516 | 2514 |
} |
| 2517 | 2515 |
|
| 2518 | 2516 |
void setGraph(Graph& graph) {
|
| 2519 | 2517 |
_graph = &graph; |
| 2520 | 2518 |
} |
| 2521 | 2519 |
|
| 2522 | 2520 |
}; |
| 2523 | 2521 |
|
| 2524 | 2522 |
/// \ingroup graph_adaptors |
| 2525 | 2523 |
/// |
| 2526 | 2524 |
/// \brief Adaptor class for orienting the edges of a graph to get a digraph |
| 2527 | 2525 |
/// |
| 2528 | 2526 |
/// Orienter adaptor can be used for orienting the edges of a graph to |
| 2529 | 2527 |
/// get a digraph. A \c bool edge map of the underlying graph must be |
| 2530 | 2528 |
/// specified, which define the direction of the arcs in the adaptor. |
| 2531 | 2529 |
/// The arcs can be easily reversed by the \c reverseArc() member function |
| 2532 | 2530 |
/// of the adaptor. |
| 2533 | 2531 |
/// This class conforms to the \ref concepts::Digraph "Digraph" concept. |
| 2534 | 2532 |
/// |
| 2535 | 2533 |
/// The adapted graph can also be modified through this adaptor |
| 2536 |
/// by adding or removing nodes or arcs, unless the \c |
|
| 2534 |
/// by adding or removing nodes or arcs, unless the \c GR template |
|
| 2537 | 2535 |
/// parameter is set to be \c const. |
| 2538 | 2536 |
/// |
| 2539 |
/// \tparam |
|
| 2537 |
/// \tparam GR The type of the adapted graph. |
|
| 2540 | 2538 |
/// It must conform to the \ref concepts::Graph "Graph" concept. |
| 2541 | 2539 |
/// It can also be specified to be \c const. |
| 2542 |
/// \tparam _DirectionMap A \c bool (or convertible) edge map of the |
|
| 2543 |
/// adapted graph. The default map type is |
|
| 2544 |
/// \ |
|
| 2540 |
/// \tparam DM The type of the direction map. |
|
| 2541 |
/// It must be a \c bool (or convertible) edge map of the |
|
| 2542 |
/// adapted graph. The default type is |
|
| 2543 |
/// \ref concepts::Graph::EdgeMap "GR::EdgeMap<bool>". |
|
| 2545 | 2544 |
/// |
| 2546 | 2545 |
/// \note The \c Node type of this adaptor and the adapted graph are |
| 2547 | 2546 |
/// convertible to each other, moreover the \c Arc type of the adaptor |
| 2548 | 2547 |
/// and the \c Edge type of the adapted graph are also convertible to |
| 2549 | 2548 |
/// each other. |
| 2550 | 2549 |
#ifdef DOXYGEN |
| 2551 |
template<typename _Graph, |
|
| 2552 |
typename _DirectionMap> |
|
| 2550 |
template<typename GR, |
|
| 2551 |
typename DM> |
|
| 2552 |
class Orienter {
|
|
| 2553 | 2553 |
#else |
| 2554 |
template<typename _Graph, |
|
| 2555 |
typename _DirectionMap = typename _Graph::template EdgeMap<bool> > |
|
| 2554 |
template<typename GR, |
|
| 2555 |
typename DM = typename GR::template EdgeMap<bool> > |
|
| 2556 |
class Orienter : |
|
| 2557 |
public DigraphAdaptorExtender<OrienterBase<GR, DM> > {
|
|
| 2556 | 2558 |
#endif |
| 2557 |
class Orienter : |
|
| 2558 |
public DigraphAdaptorExtender<OrienterBase<_Graph, _DirectionMap> > {
|
|
| 2559 | 2559 |
public: |
| 2560 | 2560 |
|
| 2561 | 2561 |
/// The type of the adapted graph. |
| 2562 |
typedef |
|
| 2562 |
typedef GR Graph; |
|
| 2563 | 2563 |
/// The type of the direction edge map. |
| 2564 |
typedef _DirectionMap DirectionMap; |
|
| 2565 |
|
|
| 2566 |
typedef DigraphAdaptorExtender< |
|
| 2567 |
OrienterBase<_Graph, _DirectionMap> > Parent; |
|
| 2564 |
typedef DM DirectionMap; |
|
| 2565 |
|
|
| 2566 |
typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent; |
|
| 2568 | 2567 |
typedef typename Parent::Arc Arc; |
| 2569 | 2568 |
protected: |
| 2570 | 2569 |
Orienter() { }
|
| 2571 | 2570 |
public: |
| 2572 | 2571 |
|
| 2573 | 2572 |
/// \brief Constructor |
| 2574 | 2573 |
/// |
| 2575 | 2574 |
/// Constructor of the adaptor. |
| 2576 | 2575 |
Orienter(Graph& graph, DirectionMap& direction) {
|
| 2577 | 2576 |
setGraph(graph); |
| 2578 | 2577 |
setDirectionMap(direction); |
| 2579 | 2578 |
} |
| 2580 | 2579 |
|
| 2581 | 2580 |
/// \brief Reverses the given arc |
| 2582 | 2581 |
/// |
| 2583 | 2582 |
/// This function reverses the given arc. |
| 2584 | 2583 |
/// It is done by simply negate the assigned value of \c a |
| 2585 | 2584 |
/// in the direction map. |
| 2586 | 2585 |
void reverseArc(const Arc& a) {
|
| 2587 | 2586 |
Parent::reverseArc(a); |
| 2588 | 2587 |
} |
| 2589 | 2588 |
}; |
| 2590 | 2589 |
|
| 2591 | 2590 |
/// \brief Returns a read-only Orienter adaptor |
| 2592 | 2591 |
/// |
| 2593 | 2592 |
/// This function just returns a read-only \ref Orienter adaptor. |
| 2594 | 2593 |
/// \ingroup graph_adaptors |
| 2595 | 2594 |
/// \relates Orienter |
| 2596 |
template<typename Graph, typename DirectionMap> |
|
| 2597 |
Orienter<const Graph, DirectionMap> |
|
| 2598 |
orienter(const Graph& graph, DirectionMap& dm) {
|
|
| 2599 |
return Orienter<const Graph, DirectionMap>(graph, dm); |
|
| 2600 |
} |
|
| 2601 |
|
|
| 2602 |
template<typename Graph, typename DirectionMap> |
|
| 2603 |
Orienter<const Graph, const DirectionMap> |
|
| 2604 |
orienter(const Graph& graph, const DirectionMap& dm) {
|
|
| 2605 |
return Orienter<const Graph, const DirectionMap>(graph, dm); |
|
| 2595 |
template<typename GR, typename DM> |
|
| 2596 |
Orienter<const GR, DM> |
|
| 2597 |
orienter(const GR& graph, DM& direction_map) {
|
|
| 2598 |
return Orienter<const GR, DM>(graph, direction_map); |
|
| 2599 |
} |
|
| 2600 |
|
|
| 2601 |
template<typename GR, typename DM> |
|
| 2602 |
Orienter<const GR, const DM> |
|
| 2603 |
orienter(const GR& graph, const DM& direction_map) {
|
|
| 2604 |
return Orienter<const GR, const DM>(graph, direction_map); |
|
| 2606 | 2605 |
} |
| 2607 | 2606 |
|
| 2608 | 2607 |
namespace _adaptor_bits {
|
| 2609 | 2608 |
|
| 2610 |
template<typename _Digraph, |
|
| 2611 |
typename _CapacityMap = typename _Digraph::template ArcMap<int>, |
|
| 2612 |
typename _FlowMap = _CapacityMap, |
|
| 2613 |
typename _Tolerance = Tolerance<typename _CapacityMap::Value> > |
|
| 2609 |
template<typename Digraph, |
|
| 2610 |
typename CapacityMap, |
|
| 2611 |
typename FlowMap, |
|
| 2612 |
typename Tolerance> |
|
| 2614 | 2613 |
class ResForwardFilter {
|
| 2615 | 2614 |
public: |
| 2616 | 2615 |
|
| 2617 |
typedef _Digraph Digraph; |
|
| 2618 |
typedef _CapacityMap CapacityMap; |
|
| 2619 |
typedef _FlowMap FlowMap; |
|
| 2620 |
typedef _Tolerance Tolerance; |
|
| 2621 |
|
|
| 2622 | 2616 |
typedef typename Digraph::Arc Key; |
| 2623 | 2617 |
typedef bool Value; |
| 2624 | 2618 |
|
| 2625 | 2619 |
private: |
| 2626 | 2620 |
|
| 2627 | 2621 |
const CapacityMap* _capacity; |
| 2628 | 2622 |
const FlowMap* _flow; |
| 2629 | 2623 |
Tolerance _tolerance; |
| 2630 | 2624 |
public: |
| 2631 | 2625 |
|
| 2632 | 2626 |
ResForwardFilter(const CapacityMap& capacity, const FlowMap& flow, |
| 2633 | 2627 |
const Tolerance& tolerance = Tolerance()) |
| 2634 | 2628 |
: _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { }
|
| 2635 | 2629 |
|
| 2636 | 2630 |
bool operator[](const typename Digraph::Arc& a) const {
|
| 2637 | 2631 |
return _tolerance.positive((*_capacity)[a] - (*_flow)[a]); |
| 2638 | 2632 |
} |
| 2639 | 2633 |
}; |
| 2640 | 2634 |
|
| 2641 |
template<typename _Digraph, |
|
| 2642 |
typename _CapacityMap = typename _Digraph::template ArcMap<int>, |
|
| 2643 |
typename _FlowMap = _CapacityMap, |
|
| 2644 |
typename _Tolerance = Tolerance<typename _CapacityMap::Value> > |
|
| 2635 |
template<typename Digraph, |
|
| 2636 |
typename CapacityMap, |
|
| 2637 |
typename FlowMap, |
|
| 2638 |
typename Tolerance> |
|
| 2645 | 2639 |
class ResBackwardFilter {
|
| 2646 | 2640 |
public: |
| 2647 | 2641 |
|
| 2648 |
typedef _Digraph Digraph; |
|
| 2649 |
typedef _CapacityMap CapacityMap; |
|
| 2650 |
typedef _FlowMap FlowMap; |
|
| 2651 |
typedef _Tolerance Tolerance; |
|
| 2652 |
|
|
| 2653 | 2642 |
typedef typename Digraph::Arc Key; |
| 2654 | 2643 |
typedef bool Value; |
| 2655 | 2644 |
|
| 2656 | 2645 |
private: |
| 2657 | 2646 |
|
| 2658 | 2647 |
const CapacityMap* _capacity; |
| 2659 | 2648 |
const FlowMap* _flow; |
| 2660 | 2649 |
Tolerance _tolerance; |
| 2661 | 2650 |
|
| 2662 | 2651 |
public: |
| 2663 | 2652 |
|
| 2664 | 2653 |
ResBackwardFilter(const CapacityMap& capacity, const FlowMap& flow, |
| 2665 | 2654 |
const Tolerance& tolerance = Tolerance()) |
| 2666 | 2655 |
: _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { }
|
| 2667 | 2656 |
|
| 2668 | 2657 |
bool operator[](const typename Digraph::Arc& a) const {
|
| 2669 | 2658 |
return _tolerance.positive((*_flow)[a]); |
| 2670 | 2659 |
} |
| 2671 | 2660 |
}; |
| 2672 | 2661 |
|
| 2673 | 2662 |
} |
| 2674 | 2663 |
|
| 2675 | 2664 |
/// \ingroup graph_adaptors |
| 2676 | 2665 |
/// |
| 2677 | 2666 |
/// \brief Adaptor class for composing the residual digraph for directed |
| 2678 | 2667 |
/// flow and circulation problems. |
| 2679 | 2668 |
/// |
| 2680 | 2669 |
/// Residual can be used for composing the \e residual digraph for directed |
| 2681 | 2670 |
/// flow and circulation problems. Let \f$ G=(V, A) \f$ be a directed graph |
| 2682 | 2671 |
/// and let \f$ F \f$ be a number type. Let \f$ flow, cap: A\to F \f$ be |
| 2683 | 2672 |
/// functions on the arcs. |
| 2684 | 2673 |
/// This adaptor implements a digraph structure with node set \f$ V \f$ |
| 2685 | 2674 |
/// and arc set \f$ A_{forward}\cup A_{backward} \f$,
|
| 2686 | 2675 |
/// where \f$ A_{forward}=\{uv : uv\in A, flow(uv)<cap(uv)\} \f$ and
|
| 2687 | 2676 |
/// \f$ A_{backward}=\{vu : uv\in A, flow(uv)>0\} \f$, i.e. the so
|
| 2688 | 2677 |
/// called residual digraph. |
| 2689 | 2678 |
/// When the union \f$ A_{forward}\cup A_{backward} \f$ is taken,
|
| 2690 | 2679 |
/// multiplicities are counted, i.e. the adaptor has exactly |
| 2691 | 2680 |
/// \f$ |A_{forward}| + |A_{backward}|\f$ arcs (it may have parallel
|
| 2692 | 2681 |
/// arcs). |
| 2693 | 2682 |
/// This class conforms to the \ref concepts::Digraph "Digraph" concept. |
| 2694 | 2683 |
/// |
| 2695 |
/// \tparam |
|
| 2684 |
/// \tparam GR The type of the adapted digraph. |
|
| 2696 | 2685 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept. |
| 2697 | 2686 |
/// It is implicitly \c const. |
| 2698 |
/// \tparam |
|
| 2687 |
/// \tparam CM The type of the capacity map. |
|
| 2688 |
/// It must be an arc map of some numerical type, which defines |
|
| 2699 | 2689 |
/// the capacities in the flow problem. It is implicitly \c const. |
| 2700 |
/// The default map type is |
|
| 2701 |
/// \ref concepts::Digraph::ArcMap "_Digraph::ArcMap<int>". |
|
| 2702 |
/// \tparam _FlowMap An arc map of some numerical type, which defines |
|
| 2703 |
/// the flow values in the flow problem. |
|
| 2704 |
/// The default map type is \c _CapacityMap. |
|
| 2705 |
/// \tparam _Tolerance Tolerance type for handling inexact computation. |
|
| 2690 |
/// The default type is |
|
| 2691 |
/// \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
|
| 2692 |
/// \tparam FM The type of the flow map. |
|
| 2693 |
/// It must be an arc map of some numerical type, which defines |
|
| 2694 |
/// the flow values in the flow problem. The default type is \c CM. |
|
| 2695 |
/// \tparam TL The tolerance type for handling inexact computation. |
|
| 2706 | 2696 |
/// The default tolerance type depends on the value type of the |
| 2707 | 2697 |
/// capacity map. |
| 2708 | 2698 |
/// |
| 2709 | 2699 |
/// \note This adaptor is implemented using Undirector and FilterArcs |
| 2710 | 2700 |
/// adaptors. |
| 2711 | 2701 |
/// |
| 2712 | 2702 |
/// \note The \c Node type of this adaptor and the adapted digraph are |
| 2713 | 2703 |
/// convertible to each other, moreover the \c Arc type of the adaptor |
| 2714 | 2704 |
/// is convertible to the \c Arc type of the adapted digraph. |
| 2715 | 2705 |
#ifdef DOXYGEN |
| 2716 |
template<typename _Digraph, |
|
| 2717 |
typename _CapacityMap, |
|
| 2718 |
typename _FlowMap, |
|
| 2719 |
typename _Tolerance> |
|
| 2706 |
template<typename GR, typename CM, typename FM, typename TL> |
|
| 2720 | 2707 |
class Residual |
| 2721 | 2708 |
#else |
| 2722 |
template<typename _Digraph, |
|
| 2723 |
typename _CapacityMap = typename _Digraph::template ArcMap<int>, |
|
| 2724 |
typename _FlowMap = _CapacityMap, |
|
| 2725 |
typename _Tolerance = Tolerance<typename _CapacityMap::Value> > |
|
| 2709 |
template<typename GR, |
|
| 2710 |
typename CM = typename GR::template ArcMap<int>, |
|
| 2711 |
typename FM = CM, |
|
| 2712 |
typename TL = Tolerance<typename CM::Value> > |
|
| 2726 | 2713 |
class Residual : |
| 2727 | 2714 |
public FilterArcs< |
| 2728 |
Undirector<const _Digraph>, |
|
| 2729 |
typename Undirector<const _Digraph>::template CombinedArcMap< |
|
| 2730 |
_adaptor_bits::ResForwardFilter<const _Digraph, _CapacityMap, |
|
| 2731 |
_FlowMap, _Tolerance>, |
|
| 2732 |
_adaptor_bits::ResBackwardFilter<const _Digraph, _CapacityMap, |
|
| 2733 |
_FlowMap, _Tolerance> > > |
|
| 2715 |
Undirector<const GR>, |
|
| 2716 |
typename Undirector<const GR>::template CombinedArcMap< |
|
| 2717 |
_adaptor_bits::ResForwardFilter<const GR, CM, FM, TL>, |
|
| 2718 |
_adaptor_bits::ResBackwardFilter<const GR, CM, FM, TL> > > |
|
| 2734 | 2719 |
#endif |
| 2735 | 2720 |
{
|
| 2736 | 2721 |
public: |
| 2737 | 2722 |
|
| 2738 | 2723 |
/// The type of the underlying digraph. |
| 2739 |
typedef |
|
| 2724 |
typedef GR Digraph; |
|
| 2740 | 2725 |
/// The type of the capacity map. |
| 2741 |
typedef |
|
| 2726 |
typedef CM CapacityMap; |
|
| 2742 | 2727 |
/// The type of the flow map. |
| 2743 |
typedef _FlowMap FlowMap; |
|
| 2744 |
typedef _Tolerance Tolerance; |
|
| 2728 |
typedef FM FlowMap; |
|
| 2729 |
/// The tolerance type. |
|
| 2730 |
typedef TL Tolerance; |
|
| 2745 | 2731 |
|
| 2746 | 2732 |
typedef typename CapacityMap::Value Value; |
| 2747 | 2733 |
typedef Residual Adaptor; |
| 2748 | 2734 |
|
| 2749 | 2735 |
protected: |
| 2750 | 2736 |
|
| 2751 | 2737 |
typedef Undirector<const Digraph> Undirected; |
| 2752 | 2738 |
|
| 2753 | 2739 |
typedef _adaptor_bits::ResForwardFilter<const Digraph, CapacityMap, |
| 2754 | 2740 |
FlowMap, Tolerance> ForwardFilter; |
| 2755 | 2741 |
|
| 2756 | 2742 |
typedef _adaptor_bits::ResBackwardFilter<const Digraph, CapacityMap, |
| 2757 | 2743 |
FlowMap, Tolerance> BackwardFilter; |
| 2758 | 2744 |
|
| 2759 | 2745 |
typedef typename Undirected:: |
| 2760 | 2746 |
template CombinedArcMap<ForwardFilter, BackwardFilter> ArcFilter; |
| 2761 | 2747 |
|
| 2762 | 2748 |
typedef FilterArcs<Undirected, ArcFilter> Parent; |
| 2763 | 2749 |
|
| 2764 | 2750 |
const CapacityMap* _capacity; |
| 2765 | 2751 |
FlowMap* _flow; |
| 2766 | 2752 |
|
| 2767 | 2753 |
Undirected _graph; |
| 2768 | 2754 |
ForwardFilter _forward_filter; |
| 2769 | 2755 |
BackwardFilter _backward_filter; |
| 2770 | 2756 |
ArcFilter _arc_filter; |
| 2771 | 2757 |
|
| 2772 | 2758 |
public: |
| 2773 | 2759 |
|
| 2774 | 2760 |
/// \brief Constructor |
| 2775 | 2761 |
/// |
| 2776 | 2762 |
/// Constructor of the residual digraph adaptor. The parameters are the |
| 2777 | 2763 |
/// digraph, the capacity map, the flow map, and a tolerance object. |
| 2778 | 2764 |
Residual(const Digraph& digraph, const CapacityMap& capacity, |
| 2779 | 2765 |
FlowMap& flow, const Tolerance& tolerance = Tolerance()) |
| 2780 | 2766 |
: Parent(), _capacity(&capacity), _flow(&flow), _graph(digraph), |
| 2781 | 2767 |
_forward_filter(capacity, flow, tolerance), |
| 2782 | 2768 |
_backward_filter(capacity, flow, tolerance), |
| 2783 | 2769 |
_arc_filter(_forward_filter, _backward_filter) |
| 2784 | 2770 |
{
|
| 2785 | 2771 |
Parent::setDigraph(_graph); |
| 2786 | 2772 |
Parent::setArcFilterMap(_arc_filter); |
| 2787 | 2773 |
} |
| 2788 | 2774 |
|
| 2789 | 2775 |
typedef typename Parent::Arc Arc; |
| 2790 | 2776 |
|
| 2791 | 2777 |
/// \brief Returns the residual capacity of the given arc. |
| 2792 | 2778 |
/// |
| ... | ... |
@@ -2811,129 +2797,127 @@ |
| 2811 | 2797 |
_flow->set(a, (*_flow)[a] - v); |
| 2812 | 2798 |
} |
| 2813 | 2799 |
} |
| 2814 | 2800 |
|
| 2815 | 2801 |
/// \brief Returns \c true if the given residual arc is a forward arc. |
| 2816 | 2802 |
/// |
| 2817 | 2803 |
/// Returns \c true if the given residual arc has the same orientation |
| 2818 | 2804 |
/// as the original arc, i.e. it is a so called forward arc. |
| 2819 | 2805 |
static bool forward(const Arc& a) {
|
| 2820 | 2806 |
return Undirected::direction(a); |
| 2821 | 2807 |
} |
| 2822 | 2808 |
|
| 2823 | 2809 |
/// \brief Returns \c true if the given residual arc is a backward arc. |
| 2824 | 2810 |
/// |
| 2825 | 2811 |
/// Returns \c true if the given residual arc has the opposite orientation |
| 2826 | 2812 |
/// than the original arc, i.e. it is a so called backward arc. |
| 2827 | 2813 |
static bool backward(const Arc& a) {
|
| 2828 | 2814 |
return !Undirected::direction(a); |
| 2829 | 2815 |
} |
| 2830 | 2816 |
|
| 2831 | 2817 |
/// \brief Returns the forward oriented residual arc. |
| 2832 | 2818 |
/// |
| 2833 | 2819 |
/// Returns the forward oriented residual arc related to the given |
| 2834 | 2820 |
/// arc of the underlying digraph. |
| 2835 | 2821 |
static Arc forward(const typename Digraph::Arc& a) {
|
| 2836 | 2822 |
return Undirected::direct(a, true); |
| 2837 | 2823 |
} |
| 2838 | 2824 |
|
| 2839 | 2825 |
/// \brief Returns the backward oriented residual arc. |
| 2840 | 2826 |
/// |
| 2841 | 2827 |
/// Returns the backward oriented residual arc related to the given |
| 2842 | 2828 |
/// arc of the underlying digraph. |
| 2843 | 2829 |
static Arc backward(const typename Digraph::Arc& a) {
|
| 2844 | 2830 |
return Undirected::direct(a, false); |
| 2845 | 2831 |
} |
| 2846 | 2832 |
|
| 2847 | 2833 |
/// \brief Residual capacity map. |
| 2848 | 2834 |
/// |
| 2849 | 2835 |
/// This map adaptor class can be used for obtaining the residual |
| 2850 | 2836 |
/// capacities as an arc map of the residual digraph. |
| 2851 | 2837 |
/// Its value type is inherited from the capacity map. |
| 2852 | 2838 |
class ResidualCapacity {
|
| 2853 | 2839 |
protected: |
| 2854 | 2840 |
const Adaptor* _adaptor; |
| 2855 | 2841 |
public: |
| 2856 | 2842 |
/// The key type of the map |
| 2857 | 2843 |
typedef Arc Key; |
| 2858 | 2844 |
/// The value type of the map |
| 2859 |
typedef typename |
|
| 2845 |
typedef typename CapacityMap::Value Value; |
|
| 2860 | 2846 |
|
| 2861 | 2847 |
/// Constructor |
| 2862 | 2848 |
ResidualCapacity(const Adaptor& adaptor) : _adaptor(&adaptor) {}
|
| 2863 | 2849 |
|
| 2864 | 2850 |
/// Returns the value associated with the given residual arc |
| 2865 | 2851 |
Value operator[](const Arc& a) const {
|
| 2866 | 2852 |
return _adaptor->residualCapacity(a); |
| 2867 | 2853 |
} |
| 2868 | 2854 |
|
| 2869 | 2855 |
}; |
| 2870 | 2856 |
|
| 2871 | 2857 |
/// \brief Returns a residual capacity map |
| 2872 | 2858 |
/// |
| 2873 | 2859 |
/// This function just returns a residual capacity map. |
| 2874 | 2860 |
ResidualCapacity residualCapacity() const {
|
| 2875 | 2861 |
return ResidualCapacity(*this); |
| 2876 | 2862 |
} |
| 2877 | 2863 |
|
| 2878 | 2864 |
}; |
| 2879 | 2865 |
|
| 2880 | 2866 |
/// \brief Returns a (read-only) Residual adaptor |
| 2881 | 2867 |
/// |
| 2882 | 2868 |
/// This function just returns a (read-only) \ref Residual adaptor. |
| 2883 | 2869 |
/// \ingroup graph_adaptors |
| 2884 | 2870 |
/// \relates Residual |
| 2885 |
template<typename Digraph, typename CapacityMap, typename FlowMap> |
|
| 2886 |
Residual<Digraph, CapacityMap, FlowMap> |
|
| 2887 |
residual(const Digraph& digraph, |
|
| 2888 |
const CapacityMap& capacity, |
|
| 2889 |
FlowMap& flow) |
|
| 2890 |
{
|
|
| 2891 |
|
|
| 2871 |
template<typename GR, typename CM, typename FM> |
|
| 2872 |
Residual<GR, CM, FM> residual(const GR& digraph, |
|
| 2873 |
const CM& capacity_map, |
|
| 2874 |
FM& flow_map) {
|
|
| 2875 |
return Residual<GR, CM, FM> (digraph, capacity_map, flow_map); |
|
| 2892 | 2876 |
} |
| 2893 | 2877 |
|
| 2894 | 2878 |
|
| 2895 | 2879 |
template <typename _Digraph> |
| 2896 | 2880 |
class SplitNodesBase {
|
| 2897 | 2881 |
public: |
| 2898 | 2882 |
|
| 2899 | 2883 |
typedef _Digraph Digraph; |
| 2900 | 2884 |
typedef DigraphAdaptorBase<const _Digraph> Parent; |
| 2901 | 2885 |
typedef SplitNodesBase Adaptor; |
| 2902 | 2886 |
|
| 2903 | 2887 |
typedef typename Digraph::Node DigraphNode; |
| 2904 | 2888 |
typedef typename Digraph::Arc DigraphArc; |
| 2905 | 2889 |
|
| 2906 | 2890 |
class Node; |
| 2907 | 2891 |
class Arc; |
| 2908 | 2892 |
|
| 2909 | 2893 |
private: |
| 2910 | 2894 |
|
| 2911 | 2895 |
template <typename T> class NodeMapBase; |
| 2912 | 2896 |
template <typename T> class ArcMapBase; |
| 2913 | 2897 |
|
| 2914 | 2898 |
public: |
| 2915 | 2899 |
|
| 2916 | 2900 |
class Node : public DigraphNode {
|
| 2917 | 2901 |
friend class SplitNodesBase; |
| 2918 | 2902 |
template <typename T> friend class NodeMapBase; |
| 2919 | 2903 |
private: |
| 2920 | 2904 |
|
| 2921 | 2905 |
bool _in; |
| 2922 | 2906 |
Node(DigraphNode node, bool in) |
| 2923 | 2907 |
: DigraphNode(node), _in(in) {}
|
| 2924 | 2908 |
|
| 2925 | 2909 |
public: |
| 2926 | 2910 |
|
| 2927 | 2911 |
Node() {}
|
| 2928 | 2912 |
Node(Invalid) : DigraphNode(INVALID), _in(true) {}
|
| 2929 | 2913 |
|
| 2930 | 2914 |
bool operator==(const Node& node) const {
|
| 2931 | 2915 |
return DigraphNode::operator==(node) && _in == node._in; |
| 2932 | 2916 |
} |
| 2933 | 2917 |
|
| 2934 | 2918 |
bool operator!=(const Node& node) const {
|
| 2935 | 2919 |
return !(*this == node); |
| 2936 | 2920 |
} |
| 2937 | 2921 |
|
| 2938 | 2922 |
bool operator<(const Node& node) const {
|
| 2939 | 2923 |
return DigraphNode::operator<(node) || |
| ... | ... |
@@ -3294,108 +3278,112 @@ |
| 3294 | 3278 |
ArcMap(const Adaptor& adaptor, const Value& value) |
| 3295 | 3279 |
: Parent(adaptor, value) {}
|
| 3296 | 3280 |
|
| 3297 | 3281 |
private: |
| 3298 | 3282 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 3299 | 3283 |
return operator=<ArcMap>(cmap); |
| 3300 | 3284 |
} |
| 3301 | 3285 |
|
| 3302 | 3286 |
template <typename CMap> |
| 3303 | 3287 |
ArcMap& operator=(const CMap& cmap) {
|
| 3304 | 3288 |
Parent::operator=(cmap); |
| 3305 | 3289 |
return *this; |
| 3306 | 3290 |
} |
| 3307 | 3291 |
}; |
| 3308 | 3292 |
|
| 3309 | 3293 |
protected: |
| 3310 | 3294 |
|
| 3311 | 3295 |
SplitNodesBase() : _digraph(0) {}
|
| 3312 | 3296 |
|
| 3313 | 3297 |
Digraph* _digraph; |
| 3314 | 3298 |
|
| 3315 | 3299 |
void setDigraph(Digraph& digraph) {
|
| 3316 | 3300 |
_digraph = &digraph; |
| 3317 | 3301 |
} |
| 3318 | 3302 |
|
| 3319 | 3303 |
}; |
| 3320 | 3304 |
|
| 3321 | 3305 |
/// \ingroup graph_adaptors |
| 3322 | 3306 |
/// |
| 3323 | 3307 |
/// \brief Adaptor class for splitting the nodes of a digraph. |
| 3324 | 3308 |
/// |
| 3325 | 3309 |
/// SplitNodes adaptor can be used for splitting each node into an |
| 3326 | 3310 |
/// \e in-node and an \e out-node in a digraph. Formaly, the adaptor |
| 3327 | 3311 |
/// replaces each node \f$ u \f$ in the digraph with two nodes, |
| 3328 | 3312 |
/// namely node \f$ u_{in} \f$ and node \f$ u_{out} \f$.
|
| 3329 | 3313 |
/// If there is a \f$ (v, u) \f$ arc in the original digraph, then the |
| 3330 | 3314 |
/// new target of the arc will be \f$ u_{in} \f$ and similarly the
|
| 3331 | 3315 |
/// source of each original \f$ (u, v) \f$ arc will be \f$ u_{out} \f$.
|
| 3332 | 3316 |
/// The adaptor adds an additional \e bind \e arc from \f$ u_{in} \f$
|
| 3333 | 3317 |
/// to \f$ u_{out} \f$ for each node \f$ u \f$ of the original digraph.
|
| 3334 | 3318 |
/// |
| 3335 | 3319 |
/// The aim of this class is running an algorithm with respect to node |
| 3336 | 3320 |
/// costs or capacities if the algorithm considers only arc costs or |
| 3337 | 3321 |
/// capacities directly. |
| 3338 | 3322 |
/// In this case you can use \c SplitNodes adaptor, and set the node |
| 3339 | 3323 |
/// costs/capacities of the original digraph to the \e bind \e arcs |
| 3340 | 3324 |
/// in the adaptor. |
| 3341 | 3325 |
/// |
| 3342 |
/// \tparam |
|
| 3326 |
/// \tparam GR The type of the adapted digraph. |
|
| 3343 | 3327 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept. |
| 3344 | 3328 |
/// It is implicitly \c const. |
| 3345 | 3329 |
/// |
| 3346 | 3330 |
/// \note The \c Node type of this adaptor is converible to the \c Node |
| 3347 | 3331 |
/// type of the adapted digraph. |
| 3348 |
template <typename |
|
| 3332 |
template <typename GR> |
|
| 3333 |
#ifdef DOXYGEN |
|
| 3334 |
class SplitNodes {
|
|
| 3335 |
#else |
|
| 3349 | 3336 |
class SplitNodes |
| 3350 |
: public DigraphAdaptorExtender<SplitNodesBase<const |
|
| 3337 |
: public DigraphAdaptorExtender<SplitNodesBase<const GR> > {
|
|
| 3338 |
#endif |
|
| 3351 | 3339 |
public: |
| 3352 |
typedef _Digraph Digraph; |
|
| 3353 |
typedef DigraphAdaptorExtender<SplitNodesBase<const Digraph> > Parent; |
|
| 3340 |
typedef GR Digraph; |
|
| 3341 |
typedef DigraphAdaptorExtender<SplitNodesBase<const GR> > Parent; |
|
| 3354 | 3342 |
|
| 3355 | 3343 |
typedef typename Digraph::Node DigraphNode; |
| 3356 | 3344 |
typedef typename Digraph::Arc DigraphArc; |
| 3357 | 3345 |
|
| 3358 | 3346 |
typedef typename Parent::Node Node; |
| 3359 | 3347 |
typedef typename Parent::Arc Arc; |
| 3360 | 3348 |
|
| 3361 | 3349 |
/// \brief Constructor |
| 3362 | 3350 |
/// |
| 3363 | 3351 |
/// Constructor of the adaptor. |
| 3364 | 3352 |
SplitNodes(const Digraph& g) {
|
| 3365 | 3353 |
Parent::setDigraph(g); |
| 3366 | 3354 |
} |
| 3367 | 3355 |
|
| 3368 | 3356 |
/// \brief Returns \c true if the given node is an in-node. |
| 3369 | 3357 |
/// |
| 3370 | 3358 |
/// Returns \c true if the given node is an in-node. |
| 3371 | 3359 |
static bool inNode(const Node& n) {
|
| 3372 | 3360 |
return Parent::inNode(n); |
| 3373 | 3361 |
} |
| 3374 | 3362 |
|
| 3375 | 3363 |
/// \brief Returns \c true if the given node is an out-node. |
| 3376 | 3364 |
/// |
| 3377 | 3365 |
/// Returns \c true if the given node is an out-node. |
| 3378 | 3366 |
static bool outNode(const Node& n) {
|
| 3379 | 3367 |
return Parent::outNode(n); |
| 3380 | 3368 |
} |
| 3381 | 3369 |
|
| 3382 | 3370 |
/// \brief Returns \c true if the given arc is an original arc. |
| 3383 | 3371 |
/// |
| 3384 | 3372 |
/// Returns \c true if the given arc is one of the arcs in the |
| 3385 | 3373 |
/// original digraph. |
| 3386 | 3374 |
static bool origArc(const Arc& a) {
|
| 3387 | 3375 |
return Parent::origArc(a); |
| 3388 | 3376 |
} |
| 3389 | 3377 |
|
| 3390 | 3378 |
/// \brief Returns \c true if the given arc is a bind arc. |
| 3391 | 3379 |
/// |
| 3392 | 3380 |
/// Returns \c true if the given arc is a bind arc, i.e. it connects |
| 3393 | 3381 |
/// an in-node and an out-node. |
| 3394 | 3382 |
static bool bindArc(const Arc& a) {
|
| 3395 | 3383 |
return Parent::bindArc(a); |
| 3396 | 3384 |
} |
| 3397 | 3385 |
|
| 3398 | 3386 |
/// \brief Returns the in-node created from the given original node. |
| 3399 | 3387 |
/// |
| 3400 | 3388 |
/// Returns the in-node created from the given original node. |
| 3401 | 3389 |
static Node inNode(const DigraphNode& n) {
|
| ... | ... |
@@ -3476,153 +3464,143 @@ |
| 3476 | 3464 |
_in_map.set(key, value); |
| 3477 | 3465 |
} else {
|
| 3478 | 3466 |
_out_map.set(key, value); |
| 3479 | 3467 |
} |
| 3480 | 3468 |
} |
| 3481 | 3469 |
|
| 3482 | 3470 |
private: |
| 3483 | 3471 |
|
| 3484 | 3472 |
InNodeMap& _in_map; |
| 3485 | 3473 |
OutNodeMap& _out_map; |
| 3486 | 3474 |
|
| 3487 | 3475 |
}; |
| 3488 | 3476 |
|
| 3489 | 3477 |
|
| 3490 | 3478 |
/// \brief Returns a combined node map |
| 3491 | 3479 |
/// |
| 3492 | 3480 |
/// This function just returns a combined node map. |
| 3493 | 3481 |
template <typename InNodeMap, typename OutNodeMap> |
| 3494 | 3482 |
static CombinedNodeMap<InNodeMap, OutNodeMap> |
| 3495 | 3483 |
combinedNodeMap(InNodeMap& in_map, OutNodeMap& out_map) {
|
| 3496 | 3484 |
return CombinedNodeMap<InNodeMap, OutNodeMap>(in_map, out_map); |
| 3497 | 3485 |
} |
| 3498 | 3486 |
|
| 3499 | 3487 |
template <typename InNodeMap, typename OutNodeMap> |
| 3500 | 3488 |
static CombinedNodeMap<const InNodeMap, OutNodeMap> |
| 3501 | 3489 |
combinedNodeMap(const InNodeMap& in_map, OutNodeMap& out_map) {
|
| 3502 | 3490 |
return CombinedNodeMap<const InNodeMap, OutNodeMap>(in_map, out_map); |
| 3503 | 3491 |
} |
| 3504 | 3492 |
|
| 3505 | 3493 |
template <typename InNodeMap, typename OutNodeMap> |
| 3506 | 3494 |
static CombinedNodeMap<InNodeMap, const OutNodeMap> |
| 3507 | 3495 |
combinedNodeMap(InNodeMap& in_map, const OutNodeMap& out_map) {
|
| 3508 | 3496 |
return CombinedNodeMap<InNodeMap, const OutNodeMap>(in_map, out_map); |
| 3509 | 3497 |
} |
| 3510 | 3498 |
|
| 3511 | 3499 |
template <typename InNodeMap, typename OutNodeMap> |
| 3512 | 3500 |
static CombinedNodeMap<const InNodeMap, const OutNodeMap> |
| 3513 | 3501 |
combinedNodeMap(const InNodeMap& in_map, const OutNodeMap& out_map) {
|
| 3514 | 3502 |
return CombinedNodeMap<const InNodeMap, |
| 3515 | 3503 |
const OutNodeMap>(in_map, out_map); |
| 3516 | 3504 |
} |
| 3517 | 3505 |
|
| 3518 | 3506 |
/// \brief Arc map combined from an arc map and a node map of the |
| 3519 | 3507 |
/// original digraph. |
| 3520 | 3508 |
/// |
| 3521 | 3509 |
/// This map adaptor class adapts an arc map and a node map of the |
| 3522 | 3510 |
/// original digraph to get an arc map of the split digraph. |
| 3523 | 3511 |
/// Its value type is inherited from the original arc map type |
| 3524 |
/// (\c DigraphArcMap). |
|
| 3525 |
template <typename DigraphArcMap, typename DigraphNodeMap> |
|
| 3512 |
/// (\c ArcMap). |
|
| 3513 |
template <typename ArcMap, typename NodeMap> |
|
| 3526 | 3514 |
class CombinedArcMap {
|
| 3527 | 3515 |
public: |
| 3528 | 3516 |
|
| 3529 | 3517 |
/// The key type of the map |
| 3530 | 3518 |
typedef Arc Key; |
| 3531 | 3519 |
/// The value type of the map |
| 3532 |
typedef typename DigraphArcMap::Value Value; |
|
| 3533 |
|
|
| 3534 |
typedef typename MapTraits<DigraphArcMap>::ReferenceMapTag |
|
| 3535 |
ReferenceMapTag; |
|
| 3536 |
typedef typename MapTraits<DigraphArcMap>::ReturnValue |
|
| 3537 |
ReturnValue; |
|
| 3538 |
typedef typename MapTraits<DigraphArcMap>::ConstReturnValue |
|
| 3539 |
ConstReturnValue; |
|
| 3540 |
typedef typename MapTraits<DigraphArcMap>::ReturnValue |
|
| 3541 |
Reference; |
|
| 3542 |
typedef typename MapTraits<DigraphArcMap>::ConstReturnValue |
|
| 3543 |
ConstReference; |
|
| 3520 |
typedef typename ArcMap::Value Value; |
|
| 3521 |
|
|
| 3522 |
typedef typename MapTraits<ArcMap>::ReferenceMapTag ReferenceMapTag; |
|
| 3523 |
typedef typename MapTraits<ArcMap>::ReturnValue ReturnValue; |
|
| 3524 |
typedef typename MapTraits<ArcMap>::ConstReturnValue ConstReturnValue; |
|
| 3525 |
typedef typename MapTraits<ArcMap>::ReturnValue Reference; |
|
| 3526 |
typedef typename MapTraits<ArcMap>::ConstReturnValue ConstReference; |
|
| 3544 | 3527 |
|
| 3545 | 3528 |
/// Constructor |
| 3546 |
CombinedArcMap( |
|
| 3529 |
CombinedArcMap(ArcMap& arc_map, NodeMap& node_map) |
|
| 3547 | 3530 |
: _arc_map(arc_map), _node_map(node_map) {}
|
| 3548 | 3531 |
|
| 3549 | 3532 |
/// Returns the value associated with the given key. |
| 3550 | 3533 |
Value operator[](const Key& arc) const {
|
| 3551 | 3534 |
if (Parent::origArc(arc)) {
|
| 3552 | 3535 |
return _arc_map[arc]; |
| 3553 | 3536 |
} else {
|
| 3554 | 3537 |
return _node_map[arc]; |
| 3555 | 3538 |
} |
| 3556 | 3539 |
} |
| 3557 | 3540 |
|
| 3558 | 3541 |
/// Returns a reference to the value associated with the given key. |
| 3559 | 3542 |
Value& operator[](const Key& arc) {
|
| 3560 | 3543 |
if (Parent::origArc(arc)) {
|
| 3561 | 3544 |
return _arc_map[arc]; |
| 3562 | 3545 |
} else {
|
| 3563 | 3546 |
return _node_map[arc]; |
| 3564 | 3547 |
} |
| 3565 | 3548 |
} |
| 3566 | 3549 |
|
| 3567 | 3550 |
/// Sets the value associated with the given key. |
| 3568 | 3551 |
void set(const Arc& arc, const Value& val) {
|
| 3569 | 3552 |
if (Parent::origArc(arc)) {
|
| 3570 | 3553 |
_arc_map.set(arc, val); |
| 3571 | 3554 |
} else {
|
| 3572 | 3555 |
_node_map.set(arc, val); |
| 3573 | 3556 |
} |
| 3574 | 3557 |
} |
| 3575 | 3558 |
|
| 3576 | 3559 |
private: |
| 3577 |
DigraphArcMap& _arc_map; |
|
| 3578 |
DigraphNodeMap& _node_map; |
|
| 3560 |
ArcMap& _arc_map; |
|
| 3561 |
NodeMap& _node_map; |
|
| 3579 | 3562 |
}; |
| 3580 | 3563 |
|
| 3581 | 3564 |
/// \brief Returns a combined arc map |
| 3582 | 3565 |
/// |
| 3583 | 3566 |
/// This function just returns a combined arc map. |
| 3584 |
template <typename DigraphArcMap, typename DigraphNodeMap> |
|
| 3585 |
static CombinedArcMap<DigraphArcMap, DigraphNodeMap> |
|
| 3586 |
combinedArcMap(DigraphArcMap& arc_map, DigraphNodeMap& node_map) {
|
|
| 3587 |
return CombinedArcMap<DigraphArcMap, DigraphNodeMap>(arc_map, node_map); |
|
| 3588 |
} |
|
| 3589 |
|
|
| 3590 |
template <typename DigraphArcMap, typename DigraphNodeMap> |
|
| 3591 |
static CombinedArcMap<const DigraphArcMap, DigraphNodeMap> |
|
| 3592 |
combinedArcMap(const DigraphArcMap& arc_map, DigraphNodeMap& node_map) {
|
|
| 3593 |
return CombinedArcMap<const DigraphArcMap, |
|
| 3594 |
DigraphNodeMap>(arc_map, node_map); |
|
| 3595 |
} |
|
| 3596 |
|
|
| 3597 |
template <typename DigraphArcMap, typename DigraphNodeMap> |
|
| 3598 |
static CombinedArcMap<DigraphArcMap, const DigraphNodeMap> |
|
| 3599 |
combinedArcMap(DigraphArcMap& arc_map, const DigraphNodeMap& node_map) {
|
|
| 3600 |
return CombinedArcMap<DigraphArcMap, |
|
| 3601 |
const DigraphNodeMap>(arc_map, node_map); |
|
| 3602 |
} |
|
| 3603 |
|
|
| 3604 |
template <typename DigraphArcMap, typename DigraphNodeMap> |
|
| 3605 |
static CombinedArcMap<const DigraphArcMap, const DigraphNodeMap> |
|
| 3606 |
combinedArcMap(const DigraphArcMap& arc_map, |
|
| 3607 |
const DigraphNodeMap& node_map) {
|
|
| 3608 |
return CombinedArcMap<const DigraphArcMap, |
|
| 3609 |
const DigraphNodeMap>(arc_map, node_map); |
|
| 3567 |
template <typename ArcMap, typename NodeMap> |
|
| 3568 |
static CombinedArcMap<ArcMap, NodeMap> |
|
| 3569 |
combinedArcMap(ArcMap& arc_map, NodeMap& node_map) {
|
|
| 3570 |
return CombinedArcMap<ArcMap, NodeMap>(arc_map, node_map); |
|
| 3571 |
} |
|
| 3572 |
|
|
| 3573 |
template <typename ArcMap, typename NodeMap> |
|
| 3574 |
static CombinedArcMap<const ArcMap, NodeMap> |
|
| 3575 |
combinedArcMap(const ArcMap& arc_map, NodeMap& node_map) {
|
|
| 3576 |
return CombinedArcMap<const ArcMap, NodeMap>(arc_map, node_map); |
|
| 3577 |
} |
|
| 3578 |
|
|
| 3579 |
template <typename ArcMap, typename NodeMap> |
|
| 3580 |
static CombinedArcMap<ArcMap, const NodeMap> |
|
| 3581 |
combinedArcMap(ArcMap& arc_map, const NodeMap& node_map) {
|
|
| 3582 |
return CombinedArcMap<ArcMap, const NodeMap>(arc_map, node_map); |
|
| 3583 |
} |
|
| 3584 |
|
|
| 3585 |
template <typename ArcMap, typename NodeMap> |
|
| 3586 |
static CombinedArcMap<const ArcMap, const NodeMap> |
|
| 3587 |
combinedArcMap(const ArcMap& arc_map, const NodeMap& node_map) {
|
|
| 3588 |
return CombinedArcMap<const ArcMap, const NodeMap>(arc_map, node_map); |
|
| 3610 | 3589 |
} |
| 3611 | 3590 |
|
| 3612 | 3591 |
}; |
| 3613 | 3592 |
|
| 3614 | 3593 |
/// \brief Returns a (read-only) SplitNodes adaptor |
| 3615 | 3594 |
/// |
| 3616 | 3595 |
/// This function just returns a (read-only) \ref SplitNodes adaptor. |
| 3617 | 3596 |
/// \ingroup graph_adaptors |
| 3618 | 3597 |
/// \relates SplitNodes |
| 3619 |
template<typename Digraph> |
|
| 3620 |
SplitNodes<Digraph> |
|
| 3621 |
splitNodes(const Digraph& digraph) {
|
|
| 3622 |
return SplitNodes<Digraph>(digraph); |
|
| 3623 |
} |
|
| 3624 |
|
|
| 3598 |
template<typename GR> |
|
| 3599 |
SplitNodes<GR> |
|
| 3600 |
splitNodes(const GR& digraph) {
|
|
| 3601 |
return SplitNodes<GR>(digraph); |
|
| 3602 |
} |
|
| 3625 | 3603 |
|
| 3626 | 3604 |
} //namespace lemon |
| 3627 | 3605 |
|
| 3628 | 3606 |
#endif //LEMON_ADAPTORS_H |
| ... | ... |
@@ -128,100 +128,96 @@ |
| 128 | 128 |
|
| 129 | 129 |
OutArcIt& operator++() {
|
| 130 | 130 |
_adaptor->nextOut(*this); |
| 131 | 131 |
return *this; |
| 132 | 132 |
} |
| 133 | 133 |
|
| 134 | 134 |
}; |
| 135 | 135 |
|
| 136 | 136 |
|
| 137 | 137 |
class InArcIt : public Arc {
|
| 138 | 138 |
const Adaptor* _adaptor; |
| 139 | 139 |
public: |
| 140 | 140 |
|
| 141 | 141 |
InArcIt() { }
|
| 142 | 142 |
|
| 143 | 143 |
InArcIt(Invalid i) : Arc(i) { }
|
| 144 | 144 |
|
| 145 | 145 |
InArcIt(const Adaptor& adaptor, const Node& node) |
| 146 | 146 |
: _adaptor(&adaptor) {
|
| 147 | 147 |
_adaptor->firstIn(*this, node); |
| 148 | 148 |
} |
| 149 | 149 |
|
| 150 | 150 |
InArcIt(const Adaptor& adaptor, const Arc& arc) : |
| 151 | 151 |
Arc(arc), _adaptor(&adaptor) {}
|
| 152 | 152 |
|
| 153 | 153 |
InArcIt& operator++() {
|
| 154 | 154 |
_adaptor->nextIn(*this); |
| 155 | 155 |
return *this; |
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 | 158 |
}; |
| 159 | 159 |
|
| 160 | 160 |
Node baseNode(const OutArcIt &e) const {
|
| 161 | 161 |
return Parent::source(e); |
| 162 | 162 |
} |
| 163 | 163 |
Node runningNode(const OutArcIt &e) const {
|
| 164 | 164 |
return Parent::target(e); |
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 | 167 |
Node baseNode(const InArcIt &e) const {
|
| 168 | 168 |
return Parent::target(e); |
| 169 | 169 |
} |
| 170 | 170 |
Node runningNode(const InArcIt &e) const {
|
| 171 | 171 |
return Parent::source(e); |
| 172 | 172 |
} |
| 173 | 173 |
|
| 174 | 174 |
}; |
| 175 | 175 |
|
| 176 |
|
|
| 177 |
/// \ingroup digraphbits |
|
| 178 |
/// |
|
| 179 |
/// \brief Extender for the GraphAdaptors |
|
| 180 | 176 |
template <typename _Graph> |
| 181 | 177 |
class GraphAdaptorExtender : public _Graph {
|
| 182 | 178 |
public: |
| 183 | 179 |
|
| 184 | 180 |
typedef _Graph Parent; |
| 185 | 181 |
typedef _Graph Graph; |
| 186 | 182 |
typedef GraphAdaptorExtender Adaptor; |
| 187 | 183 |
|
| 188 | 184 |
typedef typename Parent::Node Node; |
| 189 | 185 |
typedef typename Parent::Arc Arc; |
| 190 | 186 |
typedef typename Parent::Edge Edge; |
| 191 | 187 |
|
| 192 | 188 |
// Graph extension |
| 193 | 189 |
|
| 194 | 190 |
int maxId(Node) const {
|
| 195 | 191 |
return Parent::maxNodeId(); |
| 196 | 192 |
} |
| 197 | 193 |
|
| 198 | 194 |
int maxId(Arc) const {
|
| 199 | 195 |
return Parent::maxArcId(); |
| 200 | 196 |
} |
| 201 | 197 |
|
| 202 | 198 |
int maxId(Edge) const {
|
| 203 | 199 |
return Parent::maxEdgeId(); |
| 204 | 200 |
} |
| 205 | 201 |
|
| 206 | 202 |
Node fromId(int id, Node) const {
|
| 207 | 203 |
return Parent::nodeFromId(id); |
| 208 | 204 |
} |
| 209 | 205 |
|
| 210 | 206 |
Arc fromId(int id, Arc) const {
|
| 211 | 207 |
return Parent::arcFromId(id); |
| 212 | 208 |
} |
| 213 | 209 |
|
| 214 | 210 |
Edge fromId(int id, Edge) const {
|
| 215 | 211 |
return Parent::edgeFromId(id); |
| 216 | 212 |
} |
| 217 | 213 |
|
| 218 | 214 |
Node oppositeNode(const Node &n, const Edge &e) const {
|
| 219 | 215 |
if( n == Parent::u(e)) |
| 220 | 216 |
return Parent::v(e); |
| 221 | 217 |
else if( n == Parent::v(e)) |
| 222 | 218 |
return Parent::u(e); |
| 223 | 219 |
else |
| 224 | 220 |
return INVALID; |
| 225 | 221 |
} |
| 226 | 222 |
|
| 227 | 223 |
Arc oppositeArc(const Arc &a) const {
|
0 comments (0 inline)