COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
03/30/04 09:07:44 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@369
Message:

ResGraphWrapper? ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/graph_wrapper.h

    r259 r263  
    9292 
    9393  public:
    94     typedef typename GraphWrapper::BaseGraph BaseGraph;
     94    //typedef typename GraphWrapper::BaseGraph BaseGraph;
    9595
    9696    typedef typename GraphWrapper::Node Node;
     
    106106    GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { }
    107107
    108     void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
    109     BaseGraph& getGraph() const { return gw.getGraph(); }
     108    //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
     109    //BaseGraph& getGraph() const { return gw.getGraph(); }
    110110   
    111111    template<typename I> I& first(I& i) const { return gw.first(i); }
     
    343343  };
    344344
     345  //Subgraph on the same node-set and partial edge-set
     346  template<typename GraphWrapper, typename EdgeFilterMap>
     347  class SubGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
     348  protected:
     349    EdgeFilterMap* filter_map;
     350  public:
     351    typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
     352    typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
     353    typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
     354    typedef typename GraphWrapperSkeleton<GraphWrapper>::EdgeIt EdgeIt;
     355    typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt InEdgeIt;
     356    typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt OutEdgeIt;
     357
     358    SubGraphWrapper(GraphWrapper _gw, EdgeFilterMap& _filter_map) :
     359      GraphWrapperSkeleton<GraphWrapper>(_gw), filter_map(&_filter_map) { } 
     360
     361    template<typename I> I& first(I& i) const {
     362      gw.first(i);
     363      while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     364      return i;
     365    }
     366    template<typename I, typename P> I& first(I& i, const P& p) const {
     367      gw.first(i, p);
     368      while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     369      return i;
     370    }
     371   
     372    //template<typename I> I getNext(const I& i) const {
     373    //  return gw.getNext(i);
     374    //}
     375    template<typename I> I& next(I &i) const {
     376      gw.next(i);
     377      while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     378      return i;
     379    }
     380   
     381    template< typename It > It first() const {
     382      It e; this->first(e); return e; }
     383   
     384    template< typename It > It first(const Node& v) const {
     385      It e; this->first(e, v); return e; }
     386  };
    345387
    346388//   template<typename GraphWrapper>
     
    858900//       }
    859901    };
     902
     903    //FIXME This is just for having InEdgeIt
     904    typedef void InEdgeIt;
    860905
    861906    class EdgeIt : public Edge {
     
    10061051      return ((e.out_or_in) ? gw.bNode(e.out) : gw.bNode(e.in)); }
    10071052
     1053    int nodeNum() const { return gw.nodeNum(); }
     1054    //FIXME
     1055    //int edgeNum() const { return gw.edgeNum(); }
     1056
     1057
    10081058    int id(Node v) const { return gw.id(v); }
    10091059
Note: See TracChangeset for help on using the changeset viewer.