diff -r 60de0f16a4a1 -r f24f276e0b6b src/work/marci/graph_wrapper.h --- a/src/work/marci/graph_wrapper.h Mon Mar 29 21:43:27 2004 +0000 +++ b/src/work/marci/graph_wrapper.h Tue Mar 30 07:07:44 2004 +0000 @@ -91,7 +91,7 @@ GraphWrapper gw; public: - typedef typename GraphWrapper::BaseGraph BaseGraph; + //typedef typename GraphWrapper::BaseGraph BaseGraph; typedef typename GraphWrapper::Node Node; typedef typename GraphWrapper::NodeIt NodeIt; @@ -105,8 +105,8 @@ //GraphWrapperSkeleton() : gw() { } GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { } - void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); } - BaseGraph& getGraph() const { return gw.getGraph(); } + //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); } + //BaseGraph& getGraph() const { return gw.getGraph(); } template I& first(I& i) const { return gw.first(i); } template I& first(I& i, const P& p) const { @@ -342,6 +342,48 @@ { return GraphWrapperSkeleton::head(e); } }; + //Subgraph on the same node-set and partial edge-set + template + class SubGraphWrapper : public GraphWrapperSkeleton { + protected: + EdgeFilterMap* filter_map; + public: + typedef typename GraphWrapperSkeleton::Node Node; + typedef typename GraphWrapperSkeleton::NodeIt NodeIt; + typedef typename GraphWrapperSkeleton::Edge Edge; + typedef typename GraphWrapperSkeleton::EdgeIt EdgeIt; + typedef typename GraphWrapperSkeleton::InEdgeIt InEdgeIt; + typedef typename GraphWrapperSkeleton::OutEdgeIt OutEdgeIt; + + SubGraphWrapper(GraphWrapper _gw, EdgeFilterMap& _filter_map) : + GraphWrapperSkeleton(_gw), filter_map(&_filter_map) { } + + template I& first(I& i) const { + gw.first(i); + while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } + return i; + } + template I& first(I& i, const P& p) const { + gw.first(i, p); + while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } + return i; + } + + //template I getNext(const I& i) const { + // return gw.getNext(i); + //} + template I& next(I &i) const { + gw.next(i); + while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); } + return i; + } + + template< typename It > It first() const { + It e; this->first(e); return e; } + + template< typename It > It first(const Node& v) const { + It e; this->first(e, v); return e; } + }; // template // class UndirGraphWrapper { @@ -858,6 +900,9 @@ // } }; + //FIXME This is just for having InEdgeIt + typedef void InEdgeIt; + class EdgeIt : public Edge { friend class ResGraphWrapper; typename Graph::NodeIt v; @@ -1005,6 +1050,11 @@ Node bNode(OutEdgeIt e) const { return ((e.out_or_in) ? gw.bNode(e.out) : gw.bNode(e.in)); } + int nodeNum() const { return gw.nodeNum(); } + //FIXME + //int edgeNum() const { return gw.edgeNum(); } + + int id(Node v) const { return gw.id(v); } bool valid(Node n) const { return gw.valid(n); }