1.1 --- a/src/work/marci/graph_wrapper.h Fri Apr 16 13:42:03 2004 +0000
1.2 +++ b/src/work/marci/graph_wrapper.h Fri Apr 16 17:39:19 2004 +0000
1.3 @@ -852,6 +852,185 @@
1.4 }
1.5 };
1.6
1.7 +
1.8 +
1.9 +// /// experimentral, do not try it.
1.10 +// template<typename Graph>
1.11 +// class stGraphWrapper : public GraphWrapper<Graph> {
1.12 +// public:
1.13 +// class Node;
1.14 +// class NodeIt;
1.15 +// class Edge;
1.16 +// class OutEdgeIt;
1.17 +// class InEdgeIt;
1.18 +// class EdgeIt;
1.19 +
1.20 +// const Node s;
1.21 +// const Node t;
1.22 +
1.23 +// stGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph),
1.24 +// s(INVALID, 1), t(INVALID, 2) { }
1.25 +
1.26 +// class Node : public Graph::Node {
1.27 +// friend class GraphWrapper<Graph>;
1.28 +// friend class stGraphWrapper<Graph>;
1.29 +// protected:
1.30 +// int spec; //0 if real node, 1 iff s, 2 iff t
1.31 +// public:
1.32 +// Node() { }
1.33 +// Node(const typename Graph::Node& _n, int _spec=0) :
1.34 +// Graph::Node(_n), spec(_spec) { }
1.35 +// Node(const Invalid& i) : Graph::Node(i), spec(2) { }
1.36 +// //invalid: (invalid, 2);
1.37 +// };
1.38 +
1.39 +// class NodeIt {
1.40 +// friend class GraphWrapper<Graph>;
1.41 +// friend class stGraphWrapper<Graph>;
1.42 +// typename Graph::NodeIt n;
1.43 +// int spec;
1.44 +// public:
1.45 +// NodeIt() { }
1.46 +// NodeIt(const typename Graph::NodeIt& _n, int _spec=0) :
1.47 +// n(_n), spec(_spec) { }
1.48 +// NodeIt(const Invalid& i) : n(i), spec(2) { }
1.49 +// NodeIt(const GraphWrapper<Graph>& _G) : n(*(_G.graph)), spec(0) {
1.50 +// if (!_G->valid(n)) spec=1;
1.51 +// }
1.52 +// operator Node() const { return Node(n, spec); }
1.53 +// };
1.54 +// // typedef typename Graph::Edge Edge;
1.55 +// class Edge : public Graph::Edge {
1.56 +// friend class GraphWrapper<Graph>;
1.57 +// friend class stGraphWrapper<Graph>;
1.58 +// Node tail_spec;
1.59 +// Node head_spec;
1.60 +// public:
1.61 +// Edge() { }
1.62 +// Edge(const typename Graph::Edge& _e) :
1.63 +// Graph::Edge(_e), tail_spec(i, 0), head_spec(i, 0) {
1.64 +// //a tail-t es a head-et real node-ra csinaljuk
1.65 +// }
1.66 +// Edge(const Invalid& i) : Graph::Edge(i), tail_spec(i), head_spec(i) { }
1.67 +// };
1.68 +// class OutEdgeIt {
1.69 +// friend class GraphWrapper<Graph>;
1.70 +// friend class stGraphWrapper<Graph>;
1.71 +// typename Graph::OutEdgeIt e;
1.72 +// Node tail_spec;
1.73 +// Node head_spec;
1.74 +// public:
1.75 +// OutEdgeIt() { }
1.76 +// OutEdgeIt(const typename Graph::OutEdgeIt& _e) :
1.77 +// e(_e), tail_spec(i, 0), head_spec(i, 0) {
1.78 +// //a tail-t es a head-et real node-ra csinaljuk
1.79 +// }
1.80 +// OutEdgeIt(const Invalid& i) : e(i), tail_spec(i), head_spec(i) { }
1.81 +// //invalid: (barmi, 0, 2)
1.82 +// OutEdgeIt(const GraphWrapper<Graph>& _G, const Node& _n) {
1.83 +// switch (_n.spec) {
1.84 +// case 0 :
1.85 +// e=typename Graph::OutEdgeIt(*(_G.graph), typename Graph::Node(_n));
1.86 +// _tail.spec=0;
1.87 +// _head.spec=0;
1.88 +// if (!_G.graph->valid(e)) spec=1;
1.89 +// break;
1.90 +// case 1:
1.91 +// e=INVALID;
1.92 +// _tail.spec=1;
1.93 +// _head(_G.graph->first(typename Graph::NodeIt()));
1.94 +// if _head.spec==1
1.95 +// break;
1.96 +// };
1.97 +
1.98 +// }
1.99 +// operator Edge() const { return Edge(typename Graph::Edge(e)); }
1.100 +// };
1.101 +// class InEdgeIt {
1.102 +// friend class GraphWrapper<Graph>;
1.103 +// typename Graph::InEdgeIt e;
1.104 +// public:
1.105 +// InEdgeIt() { }
1.106 +// InEdgeIt(const typename Graph::InEdgeIt& _e) : e(_e) { }
1.107 +// InEdgeIt(const Invalid& i) : e(i) { }
1.108 +// InEdgeIt(const GraphWrapper<Graph>& _G, const Node& _n) :
1.109 +// e(*(_G.graph), typename Graph::Node(_n)) { }
1.110 +// operator Edge() const { return Edge(typename Graph::Edge(e)); }
1.111 +// };
1.112 +// //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.113 +// class EdgeIt {
1.114 +// friend class GraphWrapper<Graph>;
1.115 +// typename Graph::EdgeIt e;
1.116 +// public:
1.117 +// EdgeIt() { }
1.118 +// EdgeIt(const typename Graph::EdgeIt& _e) : e(_e) { }
1.119 +// EdgeIt(const Invalid& i) : e(i) { }
1.120 +// EdgeIt(const GraphWrapper<Graph>& _G) : e(*(_G.graph)) { }
1.121 +// operator Edge() const { return Edge(typename Graph::Edge(e)); }
1.122 +// };
1.123 +
1.124 +// NodeIt& first(NodeIt& i) const {
1.125 +// i=NodeIt(*this); return i;
1.126 +// }
1.127 +// OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
1.128 +// i=OutEdgeIt(*this, p); return i;
1.129 +// }
1.130 +// InEdgeIt& first(InEdgeIt& i, const Node& p) const {
1.131 +// i=InEdgeIt(*this, p); return i;
1.132 +// }
1.133 +// EdgeIt& first(EdgeIt& i) const {
1.134 +// i=EdgeIt(*this); return i;
1.135 +// }
1.136 +
1.137 +// NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; }
1.138 +// OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; }
1.139 +// InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; }
1.140 +// EdgeIt& next(EdgeIt& i) const { graph->next(i.e); return i; }
1.141 +
1.142 +// Node head(const Edge& e) const {
1.143 +// return Node(graph->head(static_cast<typename Graph::Edge>(e))); }
1.144 +// Node tail(const Edge& e) const {
1.145 +// return Node(graph->tail(static_cast<typename Graph::Edge>(e))); }
1.146 +
1.147 +// bool valid(const Node& n) const {
1.148 +// return graph->valid(static_cast<typename Graph::Node>(n)); }
1.149 +// bool valid(const Edge& e) const {
1.150 +// return graph->valid(static_cast<typename Graph::Edge>(e)); }
1.151 +
1.152 +// int nodeNum() const { return graph->nodeNum(); }
1.153 +// int edgeNum() const { return graph->edgeNum(); }
1.154 +
1.155 +// Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); }
1.156 +// Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); }
1.157 +// Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); }
1.158 +// Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); }
1.159 +
1.160 +// Node addNode() const { return Node(graph->addNode()); }
1.161 +// Edge addEdge(const Node& tail, const Node& head) const {
1.162 +// return Edge(graph->addEdge(tail, head)); }
1.163 +
1.164 +// void erase(const Node& i) const { graph->erase(i); }
1.165 +// void erase(const Edge& i) const { graph->erase(i); }
1.166 +
1.167 +// void clear() const { graph->clear(); }
1.168 +
1.169 +// template<typename T> class NodeMap : public Graph::NodeMap<T> {
1.170 +// public:
1.171 +// NodeMap(const GraphWrapper<Graph>& _G) :
1.172 +// Graph::NodeMap<T>(*(_G.graph)) { }
1.173 +// NodeMap(const GraphWrapper<Graph>& _G, T a) :
1.174 +// Graph::NodeMap<T>(*(_G.graph), a) { }
1.175 +// };
1.176 +
1.177 +// template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
1.178 +// public:
1.179 +// EdgeMap(const GraphWrapper<Graph>& _G) :
1.180 +// Graph::EdgeMap<T>(*(_G.graph)) { }
1.181 +// EdgeMap(const GraphWrapper<Graph>& _G, T a) :
1.182 +// Graph::EdgeMap<T>(*(_G.graph), a) { }
1.183 +// };
1.184 +// };
1.185 +
1.186 } //namespace hugo
1.187
1.188 #endif //HUGO_GRAPH_WRAPPER_H