lemon/ugraph_adaptor.h
changeset 1980 a954b780e3ab
parent 1979 c2992fd74dad
child 1985 8782ff6fd98a
     1.1 --- a/lemon/ugraph_adaptor.h	Wed Feb 22 18:26:56 2006 +0000
     1.2 +++ b/lemon/ugraph_adaptor.h	Thu Feb 23 08:55:54 2006 +0000
     1.3 @@ -511,9 +511,6 @@
     1.4    /// \brief A graph adaptor for hiding nodes and edges from an undirected 
     1.5    /// graph.
     1.6    /// 
     1.7 -  /// \warning Graph adaptors are in even more experimental state than the
     1.8 -  /// other parts of the lib. Use them at you own risk.
     1.9 -  /// 
    1.10    /// SubUGraphAdaptor shows the undirected graph with filtered node-set and 
    1.11    /// edge-set. If the \c checked parameter is true then it filters the edgeset
    1.12    /// to do not get invalid edges without source or target.
    1.13 @@ -528,11 +525,6 @@
    1.14    /// Note that \c n is of type \c SubGA::NodeIt, but it can be converted to
    1.15    /// \c Graph::Node that is why \c g.id(n) can be applied.
    1.16    /// 
    1.17 -  /// For examples see also the documentation of NodeSubUGraphAdaptor and 
    1.18 -  /// EdgeSubUGraphAdaptor.
    1.19 -  /// 
    1.20 -  /// \author Marton Makai
    1.21 -
    1.22    template<typename _UGraph, typename NodeFilterMap, 
    1.23  	   typename UEdgeFilterMap, bool checked = true>
    1.24    class SubUGraphAdaptor : 
    1.25 @@ -553,13 +545,42 @@
    1.26      }
    1.27    };
    1.28  
    1.29 +  template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap>
    1.30 +  SubUGraphAdaptor<const UGraph, NodeFilterMap, EdgeFilterMap>
    1.31 +  subUGraphAdaptor(const UGraph& graph, 
    1.32 +                   NodeFilterMap& nfm, EdgeFilterMap& efm) {
    1.33 +    return SubUGraphAdaptor<const UGraph, NodeFilterMap, EdgeFilterMap>
    1.34 +      (graph, nfm, efm);
    1.35 +  }
    1.36 +
    1.37 +  template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap>
    1.38 +  SubUGraphAdaptor<const UGraph, const NodeFilterMap, EdgeFilterMap>
    1.39 +  subUGraphAdaptor(const UGraph& graph, 
    1.40 +                   NodeFilterMap& nfm, EdgeFilterMap& efm) {
    1.41 +    return SubUGraphAdaptor<const UGraph, const NodeFilterMap, EdgeFilterMap>
    1.42 +      (graph, nfm, efm);
    1.43 +  }
    1.44 +
    1.45 +  template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap>
    1.46 +  SubUGraphAdaptor<const UGraph, NodeFilterMap, const EdgeFilterMap>
    1.47 +  subUGraphAdaptor(const UGraph& graph, 
    1.48 +                   NodeFilterMap& nfm, EdgeFilterMap& efm) {
    1.49 +    return SubUGraphAdaptor<const UGraph, NodeFilterMap, const EdgeFilterMap>
    1.50 +      (graph, nfm, efm);
    1.51 +  }
    1.52 +
    1.53 +  template<typename UGraph, typename NodeFilterMap, typename EdgeFilterMap>
    1.54 +  SubUGraphAdaptor<const UGraph, const NodeFilterMap, const EdgeFilterMap>
    1.55 +  subUGraphAdaptor(const UGraph& graph, 
    1.56 +                   NodeFilterMap& nfm, EdgeFilterMap& efm) {
    1.57 +    return SubUGraphAdaptor<const UGraph, const NodeFilterMap, 
    1.58 +      const EdgeFilterMap>(graph, nfm, efm);
    1.59 +  }
    1.60 +
    1.61    /// \ingroup graph_adaptors
    1.62    ///
    1.63 -  /// \brief An adaptor for hiding nodes from an undorected graph.
    1.64 +  /// \brief An adaptor for hiding nodes from an undirected graph.
    1.65    ///
    1.66 -  /// \warning Graph adaptors are in even more experimental state
    1.67 -  /// than the other
    1.68 -  /// parts of the lib. Use them at you own risk.
    1.69    ///
    1.70    /// An adaptor for hiding nodes from an undirected graph.
    1.71    /// This adaptor specializes SubUGraphAdaptor in the way that only
    1.72 @@ -567,7 +588,6 @@
    1.73    /// can be filtered. In usual case the checked parameter is true, we get the
    1.74    /// induced subgraph. But if the checked parameter is false then we can only
    1.75    /// filter only isolated nodes.
    1.76 -  /// \author Marton Makai
    1.77    template<typename _UGraph, typename NodeFilterMap, bool checked = true>
    1.78    class NodeSubUGraphAdaptor : 
    1.79      public SubUGraphAdaptor<_UGraph, NodeFilterMap, 
    1.80 @@ -609,8 +629,6 @@
    1.81    /// This adaptor specializes SubUGraphAdaptor in the way that
    1.82    /// only the edge-set 
    1.83    /// can be filtered.
    1.84 -  ///
    1.85 -  ///\author Marton Makai
    1.86    template<typename _UGraph, typename UEdgeFilterMap>
    1.87    class EdgeSubUGraphAdaptor : 
    1.88      public SubUGraphAdaptor<_UGraph, ConstMap<typename _UGraph::Node,bool>, 
    1.89 @@ -643,7 +661,7 @@
    1.90    }
    1.91  
    1.92    template <typename _UGraph, typename _DirectionMap>
    1.93 -  class DirectUGraphAdaptorBase {
    1.94 +  class DirUGraphAdaptorBase {
    1.95    public:
    1.96      
    1.97      typedef _UGraph Graph;
    1.98 @@ -736,19 +754,19 @@
    1.99      class NodeMap : public _UGraph::template NodeMap<_Value> {
   1.100      public:
   1.101        typedef typename _UGraph::template NodeMap<_Value> Parent;
   1.102 -      explicit NodeMap(const DirectUGraphAdaptorBase& ga) 
   1.103 +      explicit NodeMap(const DirUGraphAdaptorBase& ga) 
   1.104  	: Parent(*ga.graph) { }
   1.105 -      NodeMap(const DirectUGraphAdaptorBase& ga, const _Value& value)
   1.106 +      NodeMap(const DirUGraphAdaptorBase& ga, const _Value& value)
   1.107  	: Parent(*ga.graph, value) { }
   1.108      };
   1.109  
   1.110      template <typename _Value>
   1.111      class EdgeMap : public _UGraph::template UEdgeMap<_Value> {
   1.112      public:
   1.113 -      typedef typename _UGraph::template EdgeMap<_Value> Parent;
   1.114 -      explicit EdgeMap(const DirectUGraphAdaptorBase& ga) 
   1.115 +      typedef typename _UGraph::template UEdgeMap<_Value> Parent;
   1.116 +      explicit EdgeMap(const DirUGraphAdaptorBase& ga) 
   1.117  	: Parent(*ga.graph) { }
   1.118 -      EdgeMap(const DirectUGraphAdaptorBase& ga, const _Value& value)
   1.119 +      EdgeMap(const DirUGraphAdaptorBase& ga, const _Value& value)
   1.120  	: Parent(*ga.graph, value) { }
   1.121      };
   1.122  
   1.123 @@ -769,33 +787,43 @@
   1.124    };
   1.125  
   1.126  
   1.127 -  template<typename _Graph, typename DirectionMap> 
   1.128 -  class DirectUGraphAdaptor : 
   1.129 +  /// \ingroup graph_adaptors
   1.130 +  /// \brief A directed graph is made from a undirected graph by an adaptor
   1.131 +  ///
   1.132 +  /// This adaptor gives a direction for each uedge in the undirected graph.
   1.133 +  /// The direction of the edges stored in the DirectionMap. This map is
   1.134 +  /// a bool map on the undirected edges. If the uedge is mapped to true
   1.135 +  /// then the direction of the directed edge will be the same as the
   1.136 +  /// default direction of the uedge. The edges can be easily reverted
   1.137 +  /// by the reverseEdge member in the adaptor.  
   1.138 +  template<typename _Graph, 
   1.139 +           typename DirectionMap = typename _Graph::template UEdgeMap<bool> > 
   1.140 +  class DirUGraphAdaptor : 
   1.141      public GraphAdaptorExtender<
   1.142 -    DirectUGraphAdaptorBase<_Graph, DirectionMap> > {
   1.143 +    DirUGraphAdaptorBase<_Graph, DirectionMap> > {
   1.144    public:
   1.145      typedef _Graph Graph;
   1.146      typedef GraphAdaptorExtender<
   1.147 -      DirectUGraphAdaptorBase<_Graph, DirectionMap> > Parent;
   1.148 +      DirUGraphAdaptorBase<_Graph, DirectionMap> > Parent;
   1.149    protected:
   1.150 -    DirectUGraphAdaptor() { }
   1.151 +    DirUGraphAdaptor() { }
   1.152    public:
   1.153 -    DirectUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) { 
   1.154 +    DirUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) { 
   1.155        setGraph(_graph);
   1.156        setDirectionMap(_direction_map);
   1.157      }
   1.158    };
   1.159  
   1.160    template<typename UGraph, typename DirectionMap>
   1.161 -  DirectUGraphAdaptor<const UGraph, DirectionMap>
   1.162 -  directUGraphAdaptor(const UGraph& graph, DirectionMap& dm) {
   1.163 -    return DirectUGraphAdaptor<const UGraph, DirectionMap>(graph, dm);
   1.164 +  DirUGraphAdaptor<const UGraph, DirectionMap>
   1.165 +  dirUGraphAdaptor(const UGraph& graph, DirectionMap& dm) {
   1.166 +    return DirUGraphAdaptor<const UGraph, DirectionMap>(graph, dm);
   1.167    }
   1.168  
   1.169    template<typename UGraph, typename DirectionMap>
   1.170 -  DirectUGraphAdaptor<const UGraph, const DirectionMap>
   1.171 -  directUGraphAdaptor(const UGraph& graph, const DirectionMap& dm) {
   1.172 -    return DirectUGraphAdaptor<const UGraph, const DirectionMap>(graph, dm);
   1.173 +  DirUGraphAdaptor<const UGraph, const DirectionMap>
   1.174 +  dirUGraphAdaptor(const UGraph& graph, const DirectionMap& dm) {
   1.175 +    return DirUGraphAdaptor<const UGraph, const DirectionMap>(graph, dm);
   1.176    }
   1.177  
   1.178  }