Changeset 902:309d81806228 in lemon-0.x for src/work/marci/bipartite_graph_wrapper.h
- Timestamp:
- 09/22/04 14:25:50 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1210
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/bipartite_graph_wrapper.h
r768 r902 72 72 class InEdgeIt; 73 73 friend class InEdgeIt; 74 class ClassNodeIt {74 class ClassNodeIt : public Node { 75 75 friend class BipartiteGraphWrapper<Graph>; 76 76 protected: 77 Node n;77 const BipartiteGraphWrapper<Graph>* gw; 78 78 public: 79 79 ClassNodeIt() { } 80 ClassNodeIt(const Invalid& i) : n(i) { } 81 ClassNodeIt(const BipartiteGraphWrapper<Graph>& _G, bool _class) { 82 _G.s_false_t_true_map->first(n, _class); 80 ClassNodeIt(Invalid i) : Node(i) { } 81 ClassNodeIt(const BipartiteGraphWrapper<Graph>& _gw, bool _class) : 82 Node(), gw(&_gw) { 83 _gw.s_false_t_true_map->first(*this, _class); 83 84 } 84 85 //FIXME needed in new concept, important here 85 ClassNodeIt(const Node& _n) : n(_n) { } 86 operator Node() const { return n; } 86 ClassNodeIt(const BipartiteGraphWrapper<Graph>& _gw, const Node& n) : 87 Node(n), gw(&_gw) { } 88 ClassNodeIt& operator++() { 89 gw->s_false_t_true_map->next(*this); 90 return *this; 91 } 87 92 }; 88 93 // class SNodeIt { … … 106 111 // operator Node() const { return n; } 107 112 // }; 108 class OutEdgeIt {109 friend class BipartiteGraphWrapper<Graph>;110 protected:111 typename Graph::OutEdgeIt e;112 public:113 OutEdgeIt() { }114 OutEdgeIt(const Invalid& i) : e(i) { }115 OutEdgeIt(const BipartiteGraphWrapper<Graph>& _G, const Node& _n) {116 if (!(*(_G.s_false_t_true_map))[_n])117 e=typename Graph::OutEdgeIt(*(_G.graph), typename Graph::Node(_n));118 else119 e=INVALID;120 }121 operator Edge() const { return Edge(typename Graph::Edge(e)); }122 };123 class InEdgeIt {124 friend class BipartiteGraphWrapper<Graph>;125 protected:126 typename Graph::InEdgeIt e;127 public:128 InEdgeIt() { }129 InEdgeIt(const Invalid& i) : e(i) { }130 InEdgeIt(const BipartiteGraphWrapper<Graph>& _G, const Node& _n) {131 if ((*(_G.s_false_t_true_map))[_n])132 e=typename Graph::InEdgeIt(*(_G.graph), typename Graph::Node(_n));133 else134 e=INVALID;135 }136 operator Edge() const { return Edge(typename Graph::Edge(e)); }137 };113 // class OutEdgeIt { 114 // friend class BipartiteGraphWrapper<Graph>; 115 // protected: 116 // typename Graph::OutEdgeIt e; 117 // public: 118 // OutEdgeIt() { } 119 // OutEdgeIt(const Invalid& i) : e(i) { } 120 // OutEdgeIt(const BipartiteGraphWrapper<Graph>& _G, const Node& _n) { 121 // if (!(*(_G.s_false_t_true_map))[_n]) 122 // e=typename Graph::OutEdgeIt(*(_G.graph), typename Graph::Node(_n)); 123 // else 124 // e=INVALID; 125 // } 126 // operator Edge() const { return Edge(typename Graph::Edge(e)); } 127 // }; 128 // class InEdgeIt { 129 // friend class BipartiteGraphWrapper<Graph>; 130 // protected: 131 // typename Graph::InEdgeIt e; 132 // public: 133 // InEdgeIt() { } 134 // InEdgeIt(const Invalid& i) : e(i) { } 135 // InEdgeIt(const BipartiteGraphWrapper<Graph>& _G, const Node& _n) { 136 // if ((*(_G.s_false_t_true_map))[_n]) 137 // e=typename Graph::InEdgeIt(*(_G.graph), typename Graph::Node(_n)); 138 // else 139 // e=INVALID; 140 // } 141 // operator Edge() const { return Edge(typename Graph::Edge(e)); } 142 // }; 138 143 139 144 using GraphWrapper<Graph>::first; 140 145 ClassNodeIt& first(ClassNodeIt& n, bool _class) const { 141 n=ClassNodeIt(*this, _class) ; return n; } 146 n=ClassNodeIt(*this, _class); return n; 147 } 142 148 // SNodeIt& first(SNodeIt& n) const { n=SNodeIt(*this); return n; } 143 149 // TNodeIt& first(TNodeIt& n) const { n=TNodeIt(*this); return n; } 144 OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {145 i=OutEdgeIt(*this, p); return i;146 }147 InEdgeIt& first(InEdgeIt& i, const Node& p) const {148 i=InEdgeIt(*this, p); return i;149 }150 151 using GraphWrapper<Graph>::next;152 ClassNodeIt& next(ClassNodeIt& n) const {153 this->s_false_t_true_map->next(n.n); return n;154 }150 // OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 151 // i=OutEdgeIt(*this, p); return i; 152 // } 153 // InEdgeIt& first(InEdgeIt& i, const Node& p) const { 154 // i=InEdgeIt(*this, p); return i; 155 // } 156 157 // using GraphWrapper<Graph>::next; 158 // ClassNodeIt& next(ClassNodeIt& n) const { 159 // this->s_false_t_true_map->next(n.n); return n; 160 // } 155 161 // SNodeIt& next(SNodeIt& n) const { 156 162 // this->s_false_t_true_map->next(n); return n; … … 159 165 // this->s_false_t_true_map->next(n); return n; 160 166 // } 161 OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; }162 InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; }163 164 Node tail(const Edge& e) {165 if (!(*(this->s_false_t_true_map))[this->graph->tail(e)])166 return Node(this->graph->tail(e));167 else168 return Node(this->graph->head(e));169 }170 Node head(const Edge& e) {171 if (!(*(this->s_false_t_true_map))[this->graph->tail(e)])172 return Node(this->graph->head(e));173 else174 return Node(this->graph->tail(e));175 }176 177 Node aNode(const OutEdgeIt& e) const {178 return Node(this->graph->aNode(e.e));179 }180 Node aNode(const InEdgeIt& e) const {181 return Node(this->graph->aNode(e.e));182 }183 Node bNode(const OutEdgeIt& e) const {184 return Node(this->graph->bNode(e.e));185 }186 Node bNode(const InEdgeIt& e) const {187 return Node(this->graph->bNode(e.e));188 }167 // OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; } 168 // InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; } 169 170 // Node tail(const Edge& e) { 171 // if (!(*(this->s_false_t_true_map))[this->graph->tail(e)]) 172 // return Node(this->graph->tail(e)); 173 // else 174 // return Node(this->graph->head(e)); 175 // } 176 // Node head(const Edge& e) { 177 // if (!(*(this->s_false_t_true_map))[this->graph->tail(e)]) 178 // return Node(this->graph->head(e)); 179 // else 180 // return Node(this->graph->tail(e)); 181 // } 182 183 // Node aNode(const OutEdgeIt& e) const { 184 // return Node(this->graph->aNode(e.e)); 185 // } 186 // Node aNode(const InEdgeIt& e) const { 187 // return Node(this->graph->aNode(e.e)); 188 // } 189 // Node bNode(const OutEdgeIt& e) const { 190 // return Node(this->graph->bNode(e.e)); 191 // } 192 // Node bNode(const InEdgeIt& e) const { 193 // return Node(this->graph->bNode(e.e)); 194 // } 189 195 190 196 /// Returns true iff \c n is in S.
Note: See TracChangeset
for help on using the changeset viewer.