diff -r c2992fd74dad -r a954b780e3ab lemon/ugraph_adaptor.h --- a/lemon/ugraph_adaptor.h Wed Feb 22 18:26:56 2006 +0000 +++ b/lemon/ugraph_adaptor.h Thu Feb 23 08:55:54 2006 +0000 @@ -511,9 +511,6 @@ /// \brief A graph adaptor for hiding nodes and edges from an undirected /// graph. /// - /// \warning Graph adaptors are in even more experimental state than the - /// other parts of the lib. Use them at you own risk. - /// /// SubUGraphAdaptor shows the undirected graph with filtered node-set and /// edge-set. If the \c checked parameter is true then it filters the edgeset /// to do not get invalid edges without source or target. @@ -528,11 +525,6 @@ /// Note that \c n is of type \c SubGA::NodeIt, but it can be converted to /// \c Graph::Node that is why \c g.id(n) can be applied. /// - /// For examples see also the documentation of NodeSubUGraphAdaptor and - /// EdgeSubUGraphAdaptor. - /// - /// \author Marton Makai - template class SubUGraphAdaptor : @@ -553,13 +545,42 @@ } }; + template + SubUGraphAdaptor + subUGraphAdaptor(const UGraph& graph, + NodeFilterMap& nfm, EdgeFilterMap& efm) { + return SubUGraphAdaptor + (graph, nfm, efm); + } + + template + SubUGraphAdaptor + subUGraphAdaptor(const UGraph& graph, + NodeFilterMap& nfm, EdgeFilterMap& efm) { + return SubUGraphAdaptor + (graph, nfm, efm); + } + + template + SubUGraphAdaptor + subUGraphAdaptor(const UGraph& graph, + NodeFilterMap& nfm, EdgeFilterMap& efm) { + return SubUGraphAdaptor + (graph, nfm, efm); + } + + template + SubUGraphAdaptor + subUGraphAdaptor(const UGraph& graph, + NodeFilterMap& nfm, EdgeFilterMap& efm) { + return SubUGraphAdaptor(graph, nfm, efm); + } + /// \ingroup graph_adaptors /// - /// \brief An adaptor for hiding nodes from an undorected graph. + /// \brief An adaptor for hiding nodes from an undirected graph. /// - /// \warning Graph adaptors are in even more experimental state - /// than the other - /// parts of the lib. Use them at you own risk. /// /// An adaptor for hiding nodes from an undirected graph. /// This adaptor specializes SubUGraphAdaptor in the way that only @@ -567,7 +588,6 @@ /// can be filtered. In usual case the checked parameter is true, we get the /// induced subgraph. But if the checked parameter is false then we can only /// filter only isolated nodes. - /// \author Marton Makai template class NodeSubUGraphAdaptor : public SubUGraphAdaptor<_UGraph, NodeFilterMap, @@ -609,8 +629,6 @@ /// This adaptor specializes SubUGraphAdaptor in the way that /// only the edge-set /// can be filtered. - /// - ///\author Marton Makai template class EdgeSubUGraphAdaptor : public SubUGraphAdaptor<_UGraph, ConstMap, @@ -643,7 +661,7 @@ } template - class DirectUGraphAdaptorBase { + class DirUGraphAdaptorBase { public: typedef _UGraph Graph; @@ -736,19 +754,19 @@ class NodeMap : public _UGraph::template NodeMap<_Value> { public: typedef typename _UGraph::template NodeMap<_Value> Parent; - explicit NodeMap(const DirectUGraphAdaptorBase& ga) + explicit NodeMap(const DirUGraphAdaptorBase& ga) : Parent(*ga.graph) { } - NodeMap(const DirectUGraphAdaptorBase& ga, const _Value& value) + NodeMap(const DirUGraphAdaptorBase& ga, const _Value& value) : Parent(*ga.graph, value) { } }; template class EdgeMap : public _UGraph::template UEdgeMap<_Value> { public: - typedef typename _UGraph::template EdgeMap<_Value> Parent; - explicit EdgeMap(const DirectUGraphAdaptorBase& ga) + typedef typename _UGraph::template UEdgeMap<_Value> Parent; + explicit EdgeMap(const DirUGraphAdaptorBase& ga) : Parent(*ga.graph) { } - EdgeMap(const DirectUGraphAdaptorBase& ga, const _Value& value) + EdgeMap(const DirUGraphAdaptorBase& ga, const _Value& value) : Parent(*ga.graph, value) { } }; @@ -769,33 +787,43 @@ }; - template - class DirectUGraphAdaptor : + /// \ingroup graph_adaptors + /// \brief A directed graph is made from a undirected graph by an adaptor + /// + /// This adaptor gives a direction for each uedge in the undirected graph. + /// The direction of the edges stored in the DirectionMap. This map is + /// a bool map on the undirected edges. If the uedge is mapped to true + /// then the direction of the directed edge will be the same as the + /// default direction of the uedge. The edges can be easily reverted + /// by the reverseEdge member in the adaptor. + template > + class DirUGraphAdaptor : public GraphAdaptorExtender< - DirectUGraphAdaptorBase<_Graph, DirectionMap> > { + DirUGraphAdaptorBase<_Graph, DirectionMap> > { public: typedef _Graph Graph; typedef GraphAdaptorExtender< - DirectUGraphAdaptorBase<_Graph, DirectionMap> > Parent; + DirUGraphAdaptorBase<_Graph, DirectionMap> > Parent; protected: - DirectUGraphAdaptor() { } + DirUGraphAdaptor() { } public: - DirectUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) { + DirUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) { setGraph(_graph); setDirectionMap(_direction_map); } }; template - DirectUGraphAdaptor - directUGraphAdaptor(const UGraph& graph, DirectionMap& dm) { - return DirectUGraphAdaptor(graph, dm); + DirUGraphAdaptor + dirUGraphAdaptor(const UGraph& graph, DirectionMap& dm) { + return DirUGraphAdaptor(graph, dm); } template - DirectUGraphAdaptor - directUGraphAdaptor(const UGraph& graph, const DirectionMap& dm) { - return DirectUGraphAdaptor(graph, dm); + DirUGraphAdaptor + dirUGraphAdaptor(const UGraph& graph, const DirectionMap& dm) { + return DirUGraphAdaptor(graph, dm); } }