COIN-OR::LEMON - Graph Library

Changeset 1980:a954b780e3ab in lemon-0.x for lemon/ugraph_adaptor.h


Ignore:
Timestamp:
02/23/06 09:55:54 (18 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2573
Message:

Renaming to be convient to the naming of the adaptors
Concept checking of the ugraph adaptors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/ugraph_adaptor.h

    r1979 r1980  
    512512  /// graph.
    513513  ///
    514   /// \warning Graph adaptors are in even more experimental state than the
    515   /// other parts of the lib. Use them at you own risk.
    516   ///
    517514  /// SubUGraphAdaptor shows the undirected graph with filtered node-set and
    518515  /// edge-set. If the \c checked parameter is true then it filters the edgeset
     
    529526  /// \c Graph::Node that is why \c g.id(n) can be applied.
    530527  ///
    531   /// For examples see also the documentation of NodeSubUGraphAdaptor and
    532   /// EdgeSubUGraphAdaptor.
    533   ///
    534   /// \author Marton Makai
    535 
    536528  template<typename _UGraph, typename NodeFilterMap,
    537529           typename UEdgeFilterMap, bool checked = true>
     
    554546  };
    555547
     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
    556580  /// \ingroup graph_adaptors
    557581  ///
    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  ///
    563584  ///
    564585  /// An adaptor for hiding nodes from an undirected graph.
     
    568589  /// induced subgraph. But if the checked parameter is false then we can only
    569590  /// filter only isolated nodes.
    570   /// \author Marton Makai
    571591  template<typename _UGraph, typename NodeFilterMap, bool checked = true>
    572592  class NodeSubUGraphAdaptor :
     
    610630  /// only the edge-set
    611631  /// can be filtered.
    612   ///
    613   ///\author Marton Makai
    614632  template<typename _UGraph, typename UEdgeFilterMap>
    615633  class EdgeSubUGraphAdaptor :
     
    644662
    645663  template <typename _UGraph, typename _DirectionMap>
    646   class DirectUGraphAdaptorBase {
     664  class DirUGraphAdaptorBase {
    647665  public:
    648666   
     
    737755    public:
    738756      typedef typename _UGraph::template NodeMap<_Value> Parent;
    739       explicit NodeMap(const DirectUGraphAdaptorBase& ga)
     757      explicit NodeMap(const DirUGraphAdaptorBase& ga)
    740758        : Parent(*ga.graph) { }
    741       NodeMap(const DirectUGraphAdaptorBase& ga, const _Value& value)
     759      NodeMap(const DirUGraphAdaptorBase& ga, const _Value& value)
    742760        : Parent(*ga.graph, value) { }
    743761    };
     
    746764    class EdgeMap : public _UGraph::template UEdgeMap<_Value> {
    747765    public:
    748       typedef typename _UGraph::template EdgeMap<_Value> Parent;
    749       explicit EdgeMap(const DirectUGraphAdaptorBase& ga)
     766      typedef typename _UGraph::template UEdgeMap<_Value> Parent;
     767      explicit EdgeMap(const DirUGraphAdaptorBase& ga)
    750768        : Parent(*ga.graph) { }
    751       EdgeMap(const DirectUGraphAdaptorBase& ga, const _Value& value)
     769      EdgeMap(const DirUGraphAdaptorBase& ga, const _Value& value)
    752770        : Parent(*ga.graph, value) { }
    753771    };
     
    770788
    771789
    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 :
    774802    public GraphAdaptorExtender<
    775     DirectUGraphAdaptorBase<_Graph, DirectionMap> > {
     803    DirUGraphAdaptorBase<_Graph, DirectionMap> > {
    776804  public:
    777805    typedef _Graph Graph;
    778806    typedef GraphAdaptorExtender<
    779       DirectUGraphAdaptorBase<_Graph, DirectionMap> > Parent;
     807      DirUGraphAdaptorBase<_Graph, DirectionMap> > Parent;
    780808  protected:
    781     DirectUGraphAdaptor() { }
    782   public:
    783     DirectUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) {
     809    DirUGraphAdaptor() { }
     810  public:
     811    DirUGraphAdaptor(_Graph& _graph, DirectionMap& _direction_map) {
    784812      setGraph(_graph);
    785813      setDirectionMap(_direction_map);
     
    788816
    789817  template<typename UGraph, typename DirectionMap>
    790   DirectUGraphAdaptor<const UGraph, DirectionMap>
    791   directUGraphAdaptor(const UGraph& graph, DirectionMap& dm) {
    792     return DirectUGraphAdaptor<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);
    793821  }
    794822
    795823  template<typename UGraph, typename DirectionMap>
    796   DirectUGraphAdaptor<const UGraph, const DirectionMap>
    797   directUGraphAdaptor(const UGraph& graph, const DirectionMap& dm) {
    798     return DirectUGraphAdaptor<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);
    799827  }
    800828
Note: See TracChangeset for help on using the changeset viewer.