diff -r 69a8e672acb1 -r 309d81806228 src/work/marci/bipartite_graph_wrapper.h --- a/src/work/marci/bipartite_graph_wrapper.h Wed Sep 22 10:47:59 2004 +0000 +++ b/src/work/marci/bipartite_graph_wrapper.h Wed Sep 22 12:25:50 2004 +0000 @@ -71,19 +71,24 @@ friend class OutEdgeIt; class InEdgeIt; friend class InEdgeIt; - class ClassNodeIt { + class ClassNodeIt : public Node { friend class BipartiteGraphWrapper; protected: - Node n; + const BipartiteGraphWrapper* gw; public: ClassNodeIt() { } - ClassNodeIt(const Invalid& i) : n(i) { } - ClassNodeIt(const BipartiteGraphWrapper& _G, bool _class) { - _G.s_false_t_true_map->first(n, _class); + ClassNodeIt(Invalid i) : Node(i) { } + ClassNodeIt(const BipartiteGraphWrapper& _gw, bool _class) : + Node(), gw(&_gw) { + _gw.s_false_t_true_map->first(*this, _class); } //FIXME needed in new concept, important here - ClassNodeIt(const Node& _n) : n(_n) { } - operator Node() const { return n; } + ClassNodeIt(const BipartiteGraphWrapper& _gw, const Node& n) : + Node(n), gw(&_gw) { } + ClassNodeIt& operator++() { + gw->s_false_t_true_map->next(*this); + return *this; + } }; // class SNodeIt { // Node n; @@ -105,87 +110,88 @@ // } // operator Node() const { return n; } // }; - class OutEdgeIt { - friend class BipartiteGraphWrapper; - protected: - typename Graph::OutEdgeIt e; - public: - OutEdgeIt() { } - OutEdgeIt(const Invalid& i) : e(i) { } - OutEdgeIt(const BipartiteGraphWrapper& _G, const Node& _n) { - if (!(*(_G.s_false_t_true_map))[_n]) - e=typename Graph::OutEdgeIt(*(_G.graph), typename Graph::Node(_n)); - else - e=INVALID; - } - operator Edge() const { return Edge(typename Graph::Edge(e)); } - }; - class InEdgeIt { - friend class BipartiteGraphWrapper; - protected: - typename Graph::InEdgeIt e; - public: - InEdgeIt() { } - InEdgeIt(const Invalid& i) : e(i) { } - InEdgeIt(const BipartiteGraphWrapper& _G, const Node& _n) { - if ((*(_G.s_false_t_true_map))[_n]) - e=typename Graph::InEdgeIt(*(_G.graph), typename Graph::Node(_n)); - else - e=INVALID; - } - operator Edge() const { return Edge(typename Graph::Edge(e)); } - }; +// class OutEdgeIt { +// friend class BipartiteGraphWrapper; +// protected: +// typename Graph::OutEdgeIt e; +// public: +// OutEdgeIt() { } +// OutEdgeIt(const Invalid& i) : e(i) { } +// OutEdgeIt(const BipartiteGraphWrapper& _G, const Node& _n) { +// if (!(*(_G.s_false_t_true_map))[_n]) +// e=typename Graph::OutEdgeIt(*(_G.graph), typename Graph::Node(_n)); +// else +// e=INVALID; +// } +// operator Edge() const { return Edge(typename Graph::Edge(e)); } +// }; +// class InEdgeIt { +// friend class BipartiteGraphWrapper; +// protected: +// typename Graph::InEdgeIt e; +// public: +// InEdgeIt() { } +// InEdgeIt(const Invalid& i) : e(i) { } +// InEdgeIt(const BipartiteGraphWrapper& _G, const Node& _n) { +// if ((*(_G.s_false_t_true_map))[_n]) +// e=typename Graph::InEdgeIt(*(_G.graph), typename Graph::Node(_n)); +// else +// e=INVALID; +// } +// operator Edge() const { return Edge(typename Graph::Edge(e)); } +// }; using GraphWrapper::first; ClassNodeIt& first(ClassNodeIt& n, bool _class) const { - n=ClassNodeIt(*this, _class) ; return n; } + n=ClassNodeIt(*this, _class); return n; + } // SNodeIt& first(SNodeIt& n) const { n=SNodeIt(*this); return n; } // TNodeIt& first(TNodeIt& n) const { n=TNodeIt(*this); return n; } - OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { - i=OutEdgeIt(*this, p); return i; - } - InEdgeIt& first(InEdgeIt& i, const Node& p) const { - i=InEdgeIt(*this, p); return i; - } +// OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { +// i=OutEdgeIt(*this, p); return i; +// } +// InEdgeIt& first(InEdgeIt& i, const Node& p) const { +// i=InEdgeIt(*this, p); return i; +// } - using GraphWrapper::next; - ClassNodeIt& next(ClassNodeIt& n) const { - this->s_false_t_true_map->next(n.n); return n; - } +// using GraphWrapper::next; +// ClassNodeIt& next(ClassNodeIt& n) const { +// this->s_false_t_true_map->next(n.n); return n; +// } // SNodeIt& next(SNodeIt& n) const { // this->s_false_t_true_map->next(n); return n; // } // TNodeIt& next(TNodeIt& n) const { // this->s_false_t_true_map->next(n); return n; // } - OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; } - InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; } +// OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; } +// InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; } - Node tail(const Edge& e) { - if (!(*(this->s_false_t_true_map))[this->graph->tail(e)]) - return Node(this->graph->tail(e)); - else - return Node(this->graph->head(e)); - } - Node head(const Edge& e) { - if (!(*(this->s_false_t_true_map))[this->graph->tail(e)]) - return Node(this->graph->head(e)); - else - return Node(this->graph->tail(e)); - } +// Node tail(const Edge& e) { +// if (!(*(this->s_false_t_true_map))[this->graph->tail(e)]) +// return Node(this->graph->tail(e)); +// else +// return Node(this->graph->head(e)); +// } +// Node head(const Edge& e) { +// if (!(*(this->s_false_t_true_map))[this->graph->tail(e)]) +// return Node(this->graph->head(e)); +// else +// return Node(this->graph->tail(e)); +// } - Node aNode(const OutEdgeIt& e) const { - return Node(this->graph->aNode(e.e)); - } - Node aNode(const InEdgeIt& e) const { - return Node(this->graph->aNode(e.e)); - } - Node bNode(const OutEdgeIt& e) const { - return Node(this->graph->bNode(e.e)); - } - Node bNode(const InEdgeIt& e) const { - return Node(this->graph->bNode(e.e)); - } +// Node aNode(const OutEdgeIt& e) const { +// return Node(this->graph->aNode(e.e)); +// } +// Node aNode(const InEdgeIt& e) const { +// return Node(this->graph->aNode(e.e)); +// } +// Node bNode(const OutEdgeIt& e) const { +// return Node(this->graph->bNode(e.e)); +// } +// Node bNode(const InEdgeIt& e) const { +// return Node(this->graph->bNode(e.e)); +// } /// Returns true iff \c n is in S. bool inSClass(const Node& n) const {