Changeset 777:a82713ed19f3 in lemon-0.x for src/hugo/graph_wrapper.h
- Timestamp:
- 08/31/04 19:54:22 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1070
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/graph_wrapper.h
r775 r777 182 182 Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { } 183 183 EdgeIt(const GraphWrapper<Graph>& _gw, const Edge& e) : 184 Edge( w), gw(&_gw) { }184 Edge(e), gw(&_gw) { } 185 185 EdgeIt& operator++() { 186 186 *(static_cast<Edge*>(this))= … … 429 429 OutEdgeIt(Invalid i) : Edge(i) { } 430 430 OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 431 Edge(typename Graph::OutEdgeIt(*(_gw.graph) ), n), gw(&_gw) { }431 Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { } 432 432 OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 433 433 const Edge& e) : … … 451 451 InEdgeIt(Invalid i) : Edge(i) { } 452 452 InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 453 Edge(typename Graph::InEdgeIt(*(_gw.graph) ), n), gw(&_gw) { }453 Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { } 454 454 InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, 455 455 const Edge& e) : … … 2041 2041 // }; 2042 2042 typedef typename GraphWrapper<Graph>::Edge Edge; 2043 class OutEdgeIt {2043 class OutEdgeIt : public Edge { 2044 2044 friend class GraphWrapper<Graph>; 2045 2045 friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>; 2046 // typedef typename Graph::OutEdgeIt GraphOutEdgeIt; 2047 typename Graph::OutEdgeIt e; 2046 const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>* gw; 2048 2047 public: 2049 2048 OutEdgeIt() { } 2050 OutEdgeIt(const typename Graph::OutEdgeIt& _e) : e(_e) { } 2051 OutEdgeIt(const Invalid& i) : e(i) { } 2052 OutEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G, 2053 const Node& _n) : 2054 e((*_G.first_out_edges)[_n]) { } 2055 operator Edge() const { return Edge(typename Graph::Edge(e)); } 2056 }; 2057 class InEdgeIt { 2058 friend class GraphWrapper<Graph>; 2059 friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>; 2060 // typedef typename Graph::InEdgeIt GraphInEdgeIt; 2061 typename Graph::InEdgeIt e; 2062 public: 2063 InEdgeIt() { } 2064 InEdgeIt(const typename Graph::InEdgeIt& _e) : e(_e) { } 2065 InEdgeIt(const Invalid& i) : e(i) { } 2066 InEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G, 2067 const Node& _n) : 2068 e(*(_G.graph), typename Graph::Node(_n)) { } 2069 operator Edge() const { return Edge(typename Graph::Edge(e)); } 2070 }; 2049 //OutEdgeIt(const OutEdgeIt& e) : Edge(e), gw(e.gw) { } 2050 OutEdgeIt(Invalid i) : Edge(i) { } 2051 OutEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _gw, 2052 const Node& n) : 2053 Edge((*(_gw.first_out_edges))[n]), gw(&_gw) { } 2054 OutEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _gw, 2055 const Edge& e) : 2056 Edge(e), gw(&_gw) { } 2057 OutEdgeIt& operator++() { 2058 *(static_cast<Edge*>(this))= 2059 ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); 2060 return *this; 2061 } 2062 }; 2063 // class InEdgeIt { 2064 // friend class GraphWrapper<Graph>; 2065 // friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>; 2066 // // typedef typename Graph::InEdgeIt GraphInEdgeIt; 2067 // typename Graph::InEdgeIt e; 2068 // public: 2069 // InEdgeIt() { } 2070 // InEdgeIt(const typename Graph::InEdgeIt& _e) : e(_e) { } 2071 // InEdgeIt(const Invalid& i) : e(i) { } 2072 // InEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G, 2073 // const Node& _n) : 2074 // e(*(_G.graph), typename Graph::Node(_n)) { } 2075 // operator Edge() const { return Edge(typename Graph::Edge(e)); } 2076 // }; 2071 2077 //typedef typename Graph::SymEdgeIt SymEdgeIt; 2072 class EdgeIt {2073 friend class GraphWrapper<Graph>;2074 friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>;2075 // typedef typename Graph::EdgeIt GraphEdgeIt;2076 typename Graph::EdgeIt e;2077 public:2078 EdgeIt() { }2079 EdgeIt(const typename Graph::EdgeIt& _e) : e(_e) { }2080 EdgeIt(const Invalid& i) : e(i) { }2081 EdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G) :2082 e(*(_G.graph)) { }2083 operator Edge() const { return Edge(typename Graph::Edge(e)); }2084 };2078 // class EdgeIt { 2079 // friend class GraphWrapper<Graph>; 2080 // friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>; 2081 // // typedef typename Graph::EdgeIt GraphEdgeIt; 2082 // typename Graph::EdgeIt e; 2083 // public: 2084 // EdgeIt() { } 2085 // EdgeIt(const typename Graph::EdgeIt& _e) : e(_e) { } 2086 // EdgeIt(const Invalid& i) : e(i) { } 2087 // EdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G) : 2088 // e(*(_G.graph)) { } 2089 // operator Edge() const { return Edge(typename Graph::Edge(e)); } 2090 // }; 2085 2091 2086 2092 using GraphWrapper<Graph>::first; … … 2091 2097 i=OutEdgeIt(*this, p); return i; 2092 2098 } 2093 InEdgeIt& first(InEdgeIt& i, const Node& p) const {2094 i=InEdgeIt(*this, p); return i;2095 }2096 EdgeIt& first(EdgeIt& i) const {2097 i=EdgeIt(*this); return i;2098 }2099 2100 using GraphWrapper<Graph>::next;2101 // NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; }2102 OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; }2103 InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; }2104 EdgeIt& next(EdgeIt& i) const { this->graph->next(i.e); return i; }2099 // InEdgeIt& first(InEdgeIt& i, const Node& p) const { 2100 // i=InEdgeIt(*this, p); return i; 2101 // } 2102 // EdgeIt& first(EdgeIt& i) const { 2103 // i=EdgeIt(*this); return i; 2104 // } 2105 2106 // using GraphWrapper<Graph>::next; 2107 // // NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; } 2108 // OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; } 2109 // InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; } 2110 // EdgeIt& next(EdgeIt& i) const { this->graph->next(i.e); return i; } 2105 2111 2106 Node aNode(const OutEdgeIt& e) const { 2107 return Node(this->graph->aNode(e.e)); } 2108 Node aNode(const InEdgeIt& e) const { 2109 return Node(this->graph->aNode(e.e)); } 2110 Node bNode(const OutEdgeIt& e) const { 2111 return Node(this->graph->bNode(e.e)); } 2112 Node bNode(const InEdgeIt& e) const { 2113 return Node(this->graph->bNode(e.e)); } 2114 2115 void erase(const OutEdgeIt& e) const { 2116 OutEdgeIt f=e; 2117 this->next(f); 2118 first_out_edges->set(this->tail(e), f.e); 2112 // Node aNode(const OutEdgeIt& e) const { 2113 // return Node(this->graph->aNode(e.e)); } 2114 // Node aNode(const InEdgeIt& e) const { 2115 // return Node(this->graph->aNode(e.e)); } 2116 // Node bNode(const OutEdgeIt& e) const { 2117 // return Node(this->graph->bNode(e.e)); } 2118 // Node bNode(const InEdgeIt& e) const { 2119 // return Node(this->graph->bNode(e.e)); } 2120 2121 void erase(const Edge& e) const { 2122 Node n=tail(e); 2123 typename Graph::OutEdgeIt f(*graph, n); 2124 ++f; 2125 first_out_edges->set(n, f); 2119 2126 } 2120 2127 };
Note: See TracChangeset
for help on using the changeset viewer.