Changeset 1980:a954b780e3ab in lemon0.x for lemon/ugraph_adaptor.h
 Timestamp:
 02/23/06 09:55:54 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2573
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/ugraph_adaptor.h
r1979 r1980 512 512 /// graph. 513 513 /// 514 /// \warning Graph adaptors are in even more experimental state than the515 /// other parts of the lib. Use them at you own risk.516 ///517 514 /// SubUGraphAdaptor shows the undirected graph with filtered nodeset and 518 515 /// edgeset. If the \c checked parameter is true then it filters the edgeset … … 529 526 /// \c Graph::Node that is why \c g.id(n) can be applied. 530 527 /// 531 /// For examples see also the documentation of NodeSubUGraphAdaptor and532 /// EdgeSubUGraphAdaptor.533 ///534 /// \author Marton Makai535 536 528 template<typename _UGraph, typename NodeFilterMap, 537 529 typename UEdgeFilterMap, bool checked = true> … … 554 546 }; 555 547 548 template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap> 549 SubUGraphAdaptor<const UGraph, NodeFilterMap, EdgeFilterMap> 550 subUGraphAdaptor(const UGraph& graph, 551 NodeFilterMap& nfm, EdgeFilterMap& efm) { 552 return SubUGraphAdaptor<const UGraph, NodeFilterMap, EdgeFilterMap> 553 (graph, nfm, efm); 554 } 555 556 template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap> 557 SubUGraphAdaptor<const UGraph, const NodeFilterMap, EdgeFilterMap> 558 subUGraphAdaptor(const UGraph& graph, 559 NodeFilterMap& nfm, EdgeFilterMap& efm) { 560 return SubUGraphAdaptor<const UGraph, const NodeFilterMap, EdgeFilterMap> 561 (graph, nfm, efm); 562 } 563 564 template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap> 565 SubUGraphAdaptor<const UGraph, NodeFilterMap, const EdgeFilterMap> 566 subUGraphAdaptor(const UGraph& graph, 567 NodeFilterMap& nfm, EdgeFilterMap& efm) { 568 return SubUGraphAdaptor<const UGraph, NodeFilterMap, const EdgeFilterMap> 569 (graph, nfm, efm); 570 } 571 572 template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap> 573 SubUGraphAdaptor<const UGraph, const NodeFilterMap, const EdgeFilterMap> 574 subUGraphAdaptor(const UGraph& graph, 575 NodeFilterMap& nfm, EdgeFilterMap& efm) { 576 return SubUGraphAdaptor<const UGraph, const NodeFilterMap, 577 const EdgeFilterMap>(graph, nfm, efm); 578 } 579 556 580 /// \ingroup graph_adaptors 557 581 /// 558 /// \brief An adaptor for hiding nodes from an undorected graph. 559 /// 560 /// \warning Graph adaptors are in even more experimental state 561 /// than the other 562 /// parts of the lib. Use them at you own risk. 582 /// \brief An adaptor for hiding nodes from an undirected graph. 583 /// 563 584 /// 564 585 /// An adaptor for hiding nodes from an undirected graph. … … 568 589 /// induced subgraph. But if the checked parameter is false then we can only 569 590 /// filter only isolated nodes. 570 /// \author Marton Makai571 591 template<typename _UGraph, typename NodeFilterMap, bool checked = true> 572 592 class NodeSubUGraphAdaptor : … … 610 630 /// only the edgeset 611 631 /// can be filtered. 612 ///613 ///\author Marton Makai614 632 template<typename _UGraph, typename UEdgeFilterMap> 615 633 class EdgeSubUGraphAdaptor : … … 644 662 645 663 template <typename _UGraph, typename _DirectionMap> 646 class Dir ectUGraphAdaptorBase {664 class DirUGraphAdaptorBase { 647 665 public: 648 666 … … 737 755 public: 738 756 typedef typename _UGraph::template NodeMap<_Value> Parent; 739 explicit NodeMap(const Dir ectUGraphAdaptorBase& ga)757 explicit NodeMap(const DirUGraphAdaptorBase& ga) 740 758 : Parent(*ga.graph) { } 741 NodeMap(const Dir ectUGraphAdaptorBase& ga, const _Value& value)759 NodeMap(const DirUGraphAdaptorBase& ga, const _Value& value) 742 760 : Parent(*ga.graph, value) { } 743 761 }; … … 746 764 class EdgeMap : public _UGraph::template UEdgeMap<_Value> { 747 765 public: 748 typedef typename _UGraph::template EdgeMap<_Value> Parent;749 explicit EdgeMap(const Dir ectUGraphAdaptorBase& ga)766 typedef typename _UGraph::template UEdgeMap<_Value> Parent; 767 explicit EdgeMap(const DirUGraphAdaptorBase& ga) 750 768 : Parent(*ga.graph) { } 751 EdgeMap(const Dir ectUGraphAdaptorBase& ga, const _Value& value)769 EdgeMap(const DirUGraphAdaptorBase& ga, const _Value& value) 752 770 : Parent(*ga.graph, value) { } 753 771 }; … … 770 788 771 789 772 template<typename _Graph, typename DirectionMap> 773 class DirectUGraphAdaptor : 790 /// \ingroup graph_adaptors 791 /// \brief A directed graph is made from a undirected graph by an adaptor 792 /// 793 /// This adaptor gives a direction for each uedge in the undirected graph. 794 /// The direction of the edges stored in the DirectionMap. This map is 795 /// a bool map on the undirected edges. If the uedge is mapped to true 796 /// then the direction of the directed edge will be the same as the 797 /// default direction of the uedge. The edges can be easily reverted 798 /// by the reverseEdge member in the adaptor. 799 template<typename _Graph, 800 typename DirectionMap = typename _Graph::template UEdgeMap<bool> > 801 class DirUGraphAdaptor : 774 802 public GraphAdaptorExtender< 775 Dir ectUGraphAdaptorBase<_Graph, DirectionMap> > {803 DirUGraphAdaptorBase<_Graph, DirectionMap> > { 776 804 public: 777 805 typedef _Graph Graph; 778 806 typedef GraphAdaptorExtender< 779 Dir ectUGraphAdaptorBase<_Graph, DirectionMap> > Parent;807 DirUGraphAdaptorBase<_Graph, DirectionMap> > Parent; 780 808 protected: 781 Dir ectUGraphAdaptor() { }782 public: 783 Dir ectUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) {809 DirUGraphAdaptor() { } 810 public: 811 DirUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) { 784 812 setGraph(_graph); 785 813 setDirectionMap(_direction_map); … … 788 816 789 817 template<typename UGraph, typename DirectionMap> 790 Dir ectUGraphAdaptor<const UGraph, DirectionMap>791 dir ectUGraphAdaptor(const UGraph& graph, DirectionMap& dm) {792 return Dir ectUGraphAdaptor<const UGraph, DirectionMap>(graph, dm);818 DirUGraphAdaptor<const UGraph, DirectionMap> 819 dirUGraphAdaptor(const UGraph& graph, DirectionMap& dm) { 820 return DirUGraphAdaptor<const UGraph, DirectionMap>(graph, dm); 793 821 } 794 822 795 823 template<typename UGraph, typename DirectionMap> 796 Dir ectUGraphAdaptor<const UGraph, const DirectionMap>797 dir ectUGraphAdaptor(const UGraph& graph, const DirectionMap& dm) {798 return Dir ectUGraphAdaptor<const UGraph, const DirectionMap>(graph, dm);824 DirUGraphAdaptor<const UGraph, const DirectionMap> 825 dirUGraphAdaptor(const UGraph& graph, const DirectionMap& dm) { 826 return DirUGraphAdaptor<const UGraph, const DirectionMap>(graph, dm); 799 827 } 800 828
Note: See TracChangeset
for help on using the changeset viewer.