diff -r cc8629dc2935 -r 7ab7f083760a src/work/marci/graph_wrapper.h --- a/src/work/marci/graph_wrapper.h Mon Apr 26 09:21:27 2004 +0000 +++ b/src/work/marci/graph_wrapper.h Mon Apr 26 09:54:24 2004 +0000 @@ -923,12 +923,17 @@ SFalseTTrueMap* s_false_t_true_map; public: - static const bool S_CLASS=false; - static const bool T_CLASS=true; + //marci + //FIXME vhogy igy kellene, csak az en forditom nem eszi meg + //static const bool S_CLASS=false; + //static const bool T_CLASS=true; + bool S_CLASS; + bool T_CLASS; + BipartiteGraphWrapper(Graph& _graph, SFalseTTrueMap& _s_false_t_true_map) - : GraphWrapper(_graph), s_false_t_true_map(&_s_false_t_true_map) { - } + : GraphWrapper(_graph), s_false_t_true_map(&_s_false_t_true_map), + S_CLASS(false), T_CLASS(true) { } typedef typename GraphWrapper::Node Node; //using GraphWrapper::NodeIt; typedef typename GraphWrapper::Edge Edge; @@ -1102,7 +1107,7 @@ //(invalid, 2, vmi) //invalid, 3, invalid) template class NodeMap; - template class EdgeMap; + template class EdgeMap; // template friend class NodeMap; // template friend class EdgeMap; @@ -1141,9 +1146,11 @@ return (v.spec!=u.spec || static_cast(u)!= static_cast(v)); - } + } + friend std::ostream& operator<<(std::ostream& os, const Node& i); int getSpec() const { return spec; } }; + class NodeIt { friend class GraphWrapper; friend class stGraphWrapper; @@ -1155,14 +1162,15 @@ n(_n), spec(_spec) { } NodeIt(const Invalid& i) : n(i), spec(3) { } NodeIt(const stGraphWrapper& _G) : n(*(_G.graph)), spec(0) { - if (!_G->valid(n)) spec=1; + if (!_G.graph->valid(n)) spec=1; } operator Node() const { return Node(n, spec); } }; + class Edge : public Graph::Edge { friend class GraphWrapper; friend class stGraphWrapper; - template friend class EdgeMap; + template friend class EdgeMap; int spec; typename Graph::Node n; public: @@ -1184,8 +1192,10 @@ static_cast(v) || u.n!=v.n); } + friend std::ostream& operator<<(std::ostream& os, const Edge& i); int getSpec() const { return spec; } }; + class OutEdgeIt { friend class GraphWrapper; friend class stGraphWrapper; @@ -1229,6 +1239,7 @@ } operator Edge() const { return Edge(e, spec, n); } }; + class InEdgeIt { friend class GraphWrapper; friend class stGraphWrapper; @@ -1261,9 +1272,10 @@ e=INVALID; spec=3; n=INVALID; + break; case 2: e=INVALID; - spec=1; + spec=2; _G.graph->first(n, T_CLASS); //vmi->t; if (!_G.graph->valid(n)) spec=3; //Ha T ures break; @@ -1271,6 +1283,7 @@ } operator Edge() const { return Edge(e, spec, n); } }; + class EdgeIt { friend class GraphWrapper; friend class stGraphWrapper; @@ -1334,7 +1347,7 @@ typename Graph::Node v; switch (i.spec) { case 0: //normal edge - this->graph->aNode(i.e); + v=this->graph->aNode(i.e); this->graph->next(i.e); if (!this->graph->valid(i.e)) { //Az igazi elek vegere ertunk if (this->graph->inSClass(v)) { //S, nincs kiel @@ -1447,14 +1460,19 @@ bool valid(const Node& n) const { return (n.spec<3); } bool valid(const Edge& e) const { return (e.spec<3); } -// int nodeNum() const { return this->graph->nodeNum(); } -// int edgeNum() const { return this->graph->edgeNum(); } + int nodeNum() const { return this->graph->nodeNum()+2; } + int edgeNum() const { + return this->graph->edgeNum()+this->graph->nodeNum(); + } Node aNode(const OutEdgeIt& e) const { return tail(e); } Node aNode(const InEdgeIt& e) const { return head(e); } Node bNode(const OutEdgeIt& e) const { return head(e); } Node bNode(const InEdgeIt& e) const { return tail(e); } - + + void addNode() const { } + void addEdge() const { } + // Node addNode() const { return Node(this->graph->addNode()); } // Edge addEdge(const Node& tail, const Node& head) const { // return Edge(this->graph->addEdge(tail, head)); } @@ -1468,7 +1486,9 @@ typedef typename GraphWrapper::template NodeMap Parent; T s_value, t_value; public: - NodeMap(const stGraphWrapper& _G) : Parent(_G) { } + NodeMap(const stGraphWrapper& _G) : Parent(_G), + s_value(), + t_value() { } NodeMap(const stGraphWrapper& _G, T a) : Parent(_G, a), s_value(a), t_value(a) { } @@ -1502,8 +1522,11 @@ } }; - template class EdgeMap : public GraphWrapper::template EdgeMap { - typedef typename GraphWrapper::template EdgeMap Parent; + template::template EdgeMap > + class EdgeMap : public Parent { + //typedef typename GraphWrapper::template EdgeMap Parent; typename GraphWrapper::template NodeMap node_value; public: EdgeMap(const stGraphWrapper& _G) : Parent(_G), @@ -1527,7 +1550,7 @@ void set(const Edge& e, T t) { switch (e.spec) { case 0: - GraphWrapper::template EdgeMap::set(e, t); + Parent::set(e, t); break; case 1: node_value.set(e.n, t); @@ -1539,6 +1562,55 @@ } } }; + +// template class EdgeMap : public GraphWrapper::template EdgeMap { +// typedef typename GraphWrapper::template EdgeMap Parent; +// typename GraphWrapper::template NodeMap node_value; +// public: +// EdgeMap(const stGraphWrapper& _G) : Parent(_G), +// node_value(_G) { } +// EdgeMap(const stGraphWrapper& _G, T a) : Parent(_G, a), +// node_value(_G, a) { } +// T operator[](const Edge& e) const { +// switch (e.spec) { +// case 0: +// return Parent::operator[](e); +// break; +// case 1: +// return node_value[e.n]; +// break; +// case 2: +// default: +// return node_value[e.n]; +// break; +// } +// } +// void set(const Edge& e, T t) { +// switch (e.spec) { +// case 0: +// GraphWrapper::template EdgeMap::set(e, t); +// break; +// case 1: +// node_value.set(e.n, t); +// break; +// case 2: +// default: +// node_value.set(e.n, t); +// break; +// } +// } +// }; + + friend std::ostream& operator<<(std::ostream& os, const Node& i) { + os << "(node: " << typename Graph::Node(i) << " spec: " << i.spec <<")"; + return os; + } + friend std::ostream& operator<<(std::ostream& os, const Edge& i) { + os << "(edge: " << typename Graph::Edge(i) << " spec: " << i.spec << + " node: " << i.n << ")"; + return os; + } + }; ///@}