1.1 --- a/src/lemon/graph_wrapper.h Mon Nov 22 14:39:40 2004 +0000
1.2 +++ b/src/lemon/graph_wrapper.h Mon Nov 22 17:49:07 2004 +0000
1.3 @@ -125,7 +125,6 @@
1.4
1.5 public:
1.6 GraphWrapperBase(Graph& _graph) : graph(&_graph) { }
1.7 -// GraphWrapperBase(const GraphWrapperBase<_Graph>& gw) : graph(gw.graph) { }
1.8
1.9 typedef typename Graph::Node Node;
1.10 typedef typename Graph::Edge Edge;
1.11 @@ -134,18 +133,6 @@
1.12 void first(Edge& i) const { graph->first(i); }
1.13 void firstIn(Edge& i, const Node& n) const { graph->firstIn(i, n); }
1.14 void firstOut(Edge& i, const Node& n ) const { graph->firstOut(i, n); }
1.15 -// NodeIt& first(NodeIt& i) const {
1.16 -// i=NodeIt(*this); return i;
1.17 -// }
1.18 -// OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
1.19 -// i=OutEdgeIt(*this, p); return i;
1.20 -// }
1.21 -// InEdgeIt& first(InEdgeIt& i, const Node& p) const {
1.22 -// i=InEdgeIt(*this, p); return i;
1.23 -// }
1.24 -// EdgeIt& first(EdgeIt& i) const {
1.25 -// i=EdgeIt(*this); return i;
1.26 -// }
1.27
1.28 void next(Node& i) const { graph->next(i); }
1.29 void next(Edge& i) const { graph->next(i); }
1.30 @@ -154,10 +141,6 @@
1.31
1.32 Node source(const Edge& e) const { return graph->source(e); }
1.33 Node target(const Edge& e) const { return graph->target(e); }
1.34 -// Node source(const Edge& e) const {
1.35 -// return Node(graph->source(static_cast<typename Graph::Edge>(e))); }
1.36 -// Node target(const Edge& e) const {
1.37 -// return Node(graph->target(static_cast<typename Graph::Edge>(e))); }
1.38
1.39 int nodeNum() const { return graph->nodeNum(); }
1.40 int edgeNum() const { return graph->edgeNum(); }
1.41 @@ -271,71 +254,6 @@
1.42 public:
1.43 RevGraphWrapper(_Graph& _graph) { setGraph(_graph); }
1.44 };
1.45 -// template<typename Graph>
1.46 -// class RevGraphWrapper : public GraphWrapper<Graph> {
1.47 -// public:
1.48 -// typedef GraphWrapper<Graph> Parent;
1.49 -// protected:
1.50 -// RevGraphWrapper() : GraphWrapper<Graph>() { }
1.51 -// public:
1.52 -// RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }
1.53 -// RevGraphWrapper(const RevGraphWrapper<Graph>& gw) : Parent(gw) { }
1.54 -
1.55 -// typedef typename GraphWrapper<Graph>::Node Node;
1.56 -// typedef typename GraphWrapper<Graph>::Edge Edge;
1.57 -// //remark: OutEdgeIt and InEdgeIt cannot be typedef-ed to each other
1.58 -// //because this does not work is some of them are not defined in the
1.59 -// //original graph. The problem with this is that typedef-ed stuff
1.60 -// //are instantiated in c++.
1.61 -// class OutEdgeIt : public Edge {
1.62 -// const RevGraphWrapper<Graph>* gw;
1.63 -// friend class GraphWrapper<Graph>;
1.64 -// public:
1.65 -// OutEdgeIt() { }
1.66 -// OutEdgeIt(Invalid i) : Edge(i) { }
1.67 -// OutEdgeIt(const RevGraphWrapper<Graph>& _gw, const Node& n) :
1.68 -// Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
1.69 -// OutEdgeIt(const RevGraphWrapper<Graph>& _gw, const Edge& e) :
1.70 -// Edge(e), gw(&_gw) { }
1.71 -// OutEdgeIt& operator++() {
1.72 -// *(static_cast<Edge*>(this))=
1.73 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.74 -// return *this;
1.75 -// }
1.76 -// };
1.77 -// class InEdgeIt : public Edge {
1.78 -// const RevGraphWrapper<Graph>* gw;
1.79 -// friend class GraphWrapper<Graph>;
1.80 -// public:
1.81 -// InEdgeIt() { }
1.82 -// InEdgeIt(Invalid i) : Edge(i) { }
1.83 -// InEdgeIt(const RevGraphWrapper<Graph>& _gw, const Node& n) :
1.84 -// Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
1.85 -// InEdgeIt(const RevGraphWrapper<Graph>& _gw, const Edge& e) :
1.86 -// Edge(e), gw(&_gw) { }
1.87 -// InEdgeIt& operator++() {
1.88 -// *(static_cast<Edge*>(this))=
1.89 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.90 -// return *this;
1.91 -// }
1.92 -// };
1.93 -
1.94 -// using GraphWrapper<Graph>::first;
1.95 -// OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
1.96 -// i=OutEdgeIt(*this, p); return i;
1.97 -// }
1.98 -// InEdgeIt& first(InEdgeIt& i, const Node& p) const {
1.99 -// i=InEdgeIt(*this, p); return i;
1.100 -// }
1.101 -
1.102 -// Node source(const Edge& e) const {
1.103 -// return GraphWrapper<Graph>::target(e); }
1.104 -// Node target(const Edge& e) const {
1.105 -// return GraphWrapper<Graph>::source(e); }
1.106 -
1.107 -// // KEEP_MAPS(Parent, RevGraphWrapper);
1.108 -
1.109 -// };
1.110
1.111
1.112 template <typename _Graph, typename NodeFilterMap, typename EdgeFilterMap>
1.113 @@ -516,195 +434,6 @@
1.114 }
1.115 };
1.116
1.117 -// template<typename Graph, typename NodeFilterMap,
1.118 -// typename EdgeFilterMap>
1.119 -// class SubGraphWrapper : public GraphWrapper<Graph> {
1.120 -// public:
1.121 -// typedef GraphWrapper<Graph> Parent;
1.122 -// protected:
1.123 -// NodeFilterMap* node_filter_map;
1.124 -// EdgeFilterMap* edge_filter_map;
1.125 -
1.126 -// SubGraphWrapper() : GraphWrapper<Graph>(),
1.127 -// node_filter_map(0), edge_filter_map(0) { }
1.128 -// void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
1.129 -// node_filter_map=&_node_filter_map;
1.130 -// }
1.131 -// void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
1.132 -// edge_filter_map=&_edge_filter_map;
1.133 -// }
1.134 -
1.135 -// public:
1.136 -// SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map,
1.137 -// EdgeFilterMap& _edge_filter_map) :
1.138 -// GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map),
1.139 -// edge_filter_map(&_edge_filter_map) { }
1.140 -
1.141 -// typedef typename GraphWrapper<Graph>::Node Node;
1.142 -// class NodeIt : public Node {
1.143 -// const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
1.144 -// friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
1.145 -// public:
1.146 -// NodeIt() { }
1.147 -// NodeIt(Invalid i) : Node(i) { }
1.148 -// NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) :
1.149 -// Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) {
1.150 -// while (*static_cast<Node*>(this)!=INVALID &&
1.151 -// !(*(gw->node_filter_map))[*this])
1.152 -// *(static_cast<Node*>(this))=
1.153 -// ++(typename Graph::NodeIt(*(gw->graph), *this));
1.154 -// }
1.155 -// NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw,
1.156 -// const Node& n) :
1.157 -// Node(n), gw(&_gw) { }
1.158 -// NodeIt& operator++() {
1.159 -// *(static_cast<Node*>(this))=
1.160 -// ++(typename Graph::NodeIt(*(gw->graph), *this));
1.161 -// while (*static_cast<Node*>(this)!=INVALID &&
1.162 -// !(*(gw->node_filter_map))[*this])
1.163 -// *(static_cast<Node*>(this))=
1.164 -// ++(typename Graph::NodeIt(*(gw->graph), *this));
1.165 -// return *this;
1.166 -// }
1.167 -// };
1.168 -// typedef typename GraphWrapper<Graph>::Edge Edge;
1.169 -// class OutEdgeIt : public Edge {
1.170 -// const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
1.171 -// friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
1.172 -// public:
1.173 -// OutEdgeIt() { }
1.174 -// OutEdgeIt(Invalid i) : Edge(i) { }
1.175 -// OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) :
1.176 -// Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) {
1.177 -// while (*static_cast<Edge*>(this)!=INVALID &&
1.178 -// !(*(gw->edge_filter_map))[*this])
1.179 -// *(static_cast<Edge*>(this))=
1.180 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.181 -// }
1.182 -// OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw,
1.183 -// const Edge& e) :
1.184 -// Edge(e), gw(&_gw) { }
1.185 -// OutEdgeIt& operator++() {
1.186 -// *(static_cast<Edge*>(this))=
1.187 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.188 -// while (*static_cast<Edge*>(this)!=INVALID &&
1.189 -// !(*(gw->edge_filter_map))[*this])
1.190 -// *(static_cast<Edge*>(this))=
1.191 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.192 -// return *this;
1.193 -// }
1.194 -// };
1.195 -// class InEdgeIt : public Edge {
1.196 -// const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
1.197 -// friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
1.198 -// public:
1.199 -// InEdgeIt() { }
1.200 -// // InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { }
1.201 -// InEdgeIt(Invalid i) : Edge(i) { }
1.202 -// InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) :
1.203 -// Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) {
1.204 -// while (*static_cast<Edge*>(this)!=INVALID &&
1.205 -// !(*(gw->edge_filter_map))[*this])
1.206 -// *(static_cast<Edge*>(this))=
1.207 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.208 -// }
1.209 -// InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw,
1.210 -// const Edge& e) :
1.211 -// Edge(e), gw(&_gw) { }
1.212 -// InEdgeIt& operator++() {
1.213 -// *(static_cast<Edge*>(this))=
1.214 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.215 -// while (*static_cast<Edge*>(this)!=INVALID &&
1.216 -// !(*(gw->edge_filter_map))[*this])
1.217 -// *(static_cast<Edge*>(this))=
1.218 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.219 -// return *this;
1.220 -// }
1.221 -// };
1.222 -// class EdgeIt : public Edge {
1.223 -// const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>* gw;
1.224 -// friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
1.225 -// public:
1.226 -// EdgeIt() { }
1.227 -// EdgeIt(Invalid i) : Edge(i) { }
1.228 -// EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) :
1.229 -// Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) {
1.230 -// while (*static_cast<Edge*>(this)!=INVALID &&
1.231 -// !(*(gw->edge_filter_map))[*this])
1.232 -// *(static_cast<Edge*>(this))=
1.233 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.234 -// }
1.235 -// EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw,
1.236 -// const Edge& e) :
1.237 -// Edge(e), gw(&_gw) { }
1.238 -// EdgeIt& operator++() {
1.239 -// *(static_cast<Edge*>(this))=
1.240 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.241 -// while (*static_cast<Edge*>(this)!=INVALID &&
1.242 -// !(*(gw->edge_filter_map))[*this])
1.243 -// *(static_cast<Edge*>(this))=
1.244 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.245 -// return *this;
1.246 -// }
1.247 -// };
1.248 -
1.249 -// NodeIt& first(NodeIt& i) const {
1.250 -// i=NodeIt(*this); return i;
1.251 -// }
1.252 -// OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
1.253 -// i=OutEdgeIt(*this, p); return i;
1.254 -// }
1.255 -// InEdgeIt& first(InEdgeIt& i, const Node& p) const {
1.256 -// i=InEdgeIt(*this, p); return i;
1.257 -// }
1.258 -// EdgeIt& first(EdgeIt& i) const {
1.259 -// i=EdgeIt(*this); return i;
1.260 -// }
1.261 -
1.262 -// /// This function hides \c n in the graph, i.e. the iteration
1.263 -// /// jumps over it. This is done by simply setting the value of \c n
1.264 -// /// to be false in the corresponding node-map.
1.265 -// void hide(const Node& n) const { node_filter_map->set(n, false); }
1.266 -
1.267 -// /// This function hides \c e in the graph, i.e. the iteration
1.268 -// /// jumps over it. This is done by simply setting the value of \c e
1.269 -// /// to be false in the corresponding edge-map.
1.270 -// void hide(const Edge& e) const { edge_filter_map->set(e, false); }
1.271 -
1.272 -// /// The value of \c n is set to be true in the node-map which stores
1.273 -// /// hide information. If \c n was hidden previuosly, then it is shown
1.274 -// /// again
1.275 -// void unHide(const Node& n) const { node_filter_map->set(n, true); }
1.276 -
1.277 -// /// The value of \c e is set to be true in the edge-map which stores
1.278 -// /// hide information. If \c e was hidden previuosly, then it is shown
1.279 -// /// again
1.280 -// void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
1.281 -
1.282 -// /// Returns true if \c n is hidden.
1.283 -// bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
1.284 -
1.285 -// /// Returns true if \c n is hidden.
1.286 -// bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
1.287 -
1.288 -// /// \warning This is a linear time operation and works only if
1.289 -// /// \c Graph::NodeIt is defined.
1.290 -// int nodeNum() const {
1.291 -// int i=0;
1.292 -// for (NodeIt n(*this); n!=INVALID; ++n) ++i;
1.293 -// return i;
1.294 -// }
1.295 -
1.296 -// /// \warning This is a linear time operation and works only if
1.297 -// /// \c Graph::EdgeIt is defined.
1.298 -// int edgeNum() const {
1.299 -// int i=0;
1.300 -// for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
1.301 -// return i;
1.302 -// }
1.303 -
1.304 -// // KEEP_MAPS(Parent, SubGraphWrapper);
1.305 -// };
1.306
1.307
1.308 /*! \brief A wrapper for hiding nodes from a graph.
1.309 @@ -1266,344 +995,6 @@
1.310 }
1.311 };
1.312
1.313 -// template<typename Graph,
1.314 -// typename ForwardFilterMap, typename BackwardFilterMap>
1.315 -// class SubBidirGraphWrapper : public GraphWrapper<Graph> {
1.316 -// public:
1.317 -// typedef GraphWrapper<Graph> Parent;
1.318 -// protected:
1.319 -// ForwardFilterMap* forward_filter;
1.320 -// BackwardFilterMap* backward_filter;
1.321 -
1.322 -// SubBidirGraphWrapper() : GraphWrapper<Graph>() { }
1.323 -// void setForwardFilterMap(ForwardFilterMap& _forward_filter) {
1.324 -// forward_filter=&_forward_filter;
1.325 -// }
1.326 -// void setBackwardFilterMap(BackwardFilterMap& _backward_filter) {
1.327 -// backward_filter=&_backward_filter;
1.328 -// }
1.329 -
1.330 -// public:
1.331 -
1.332 -// SubBidirGraphWrapper(Graph& _graph, ForwardFilterMap& _forward_filter,
1.333 -// BackwardFilterMap& _backward_filter) :
1.334 -// GraphWrapper<Graph>(_graph),
1.335 -// forward_filter(&_forward_filter), backward_filter(&_backward_filter) { }
1.336 -// SubBidirGraphWrapper(const SubBidirGraphWrapper<Graph,
1.337 -// ForwardFilterMap, BackwardFilterMap>& gw) :
1.338 -// Parent(gw),
1.339 -// forward_filter(gw.forward_filter),
1.340 -// backward_filter(gw.backward_filter) { }
1.341 -
1.342 -// class Edge;
1.343 -// class OutEdgeIt;
1.344 -// friend class Edge;
1.345 -// friend class OutEdgeIt;
1.346 -
1.347 -// template<typename T> class EdgeMap;
1.348 -
1.349 -// typedef typename GraphWrapper<Graph>::Node Node;
1.350 -
1.351 -// typedef typename Graph::Edge GraphEdge;
1.352 -// /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from
1.353 -// /// Graph::Edge. It contains an extra bool flag which is true
1.354 -// /// if and only if the
1.355 -// /// edge is the backward version of the original edge.
1.356 -// class Edge : public Graph::Edge {
1.357 -// friend class SubBidirGraphWrapper<Graph,
1.358 -// ForwardFilterMap, BackwardFilterMap>;
1.359 -// template<typename T> friend class EdgeMap;
1.360 -// protected:
1.361 -// bool backward; //true, iff backward
1.362 -// public:
1.363 -// Edge() { }
1.364 -// /// \todo =false is needed, or causes problems?
1.365 -// /// If \c _backward is false, then we get an edge corresponding to the
1.366 -// /// original one, otherwise its oppositely directed pair is obtained.
1.367 -// Edge(const typename Graph::Edge& e, bool _backward/*=false*/) :
1.368 -// Graph::Edge(e), backward(_backward) { }
1.369 -// Edge(Invalid i) : Graph::Edge(i), backward(true) { }
1.370 -// bool operator==(const Edge& v) const {
1.371 -// return (this->backward==v.backward &&
1.372 -// static_cast<typename Graph::Edge>(*this)==
1.373 -// static_cast<typename Graph::Edge>(v));
1.374 -// }
1.375 -// bool operator!=(const Edge& v) const {
1.376 -// return (this->backward!=v.backward ||
1.377 -// static_cast<typename Graph::Edge>(*this)!=
1.378 -// static_cast<typename Graph::Edge>(v));
1.379 -// }
1.380 -// };
1.381 -
1.382 -// class OutEdgeIt : public Edge {
1.383 -// friend class SubBidirGraphWrapper<Graph,
1.384 -// ForwardFilterMap, BackwardFilterMap>;
1.385 -// protected:
1.386 -// const SubBidirGraphWrapper<Graph,
1.387 -// ForwardFilterMap, BackwardFilterMap>* gw;
1.388 -// public:
1.389 -// OutEdgeIt() { }
1.390 -// OutEdgeIt(Invalid i) : Edge(i) { }
1.391 -// OutEdgeIt(const SubBidirGraphWrapper<Graph,
1.392 -// ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) :
1.393 -// Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) {
1.394 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.395 -// !(*(gw->forward_filter))[*this])
1.396 -// *(static_cast<GraphEdge*>(this))=
1.397 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.398 -// if (*static_cast<GraphEdge*>(this)==INVALID) {
1.399 -// *static_cast<Edge*>(this)=
1.400 -// Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true);
1.401 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.402 -// !(*(gw->backward_filter))[*this])
1.403 -// *(static_cast<GraphEdge*>(this))=
1.404 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.405 -// }
1.406 -// }
1.407 -// OutEdgeIt(const SubBidirGraphWrapper<Graph,
1.408 -// ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) :
1.409 -// Edge(e), gw(&_gw) { }
1.410 -// OutEdgeIt& operator++() {
1.411 -// if (!this->backward) {
1.412 -// Node n=gw->source(*this);
1.413 -// *(static_cast<GraphEdge*>(this))=
1.414 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.415 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.416 -// !(*(gw->forward_filter))[*this])
1.417 -// *(static_cast<GraphEdge*>(this))=
1.418 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.419 -// if (*static_cast<GraphEdge*>(this)==INVALID) {
1.420 -// *static_cast<Edge*>(this)=
1.421 -// Edge(typename Graph::InEdgeIt(*(gw->graph), n), true);
1.422 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.423 -// !(*(gw->backward_filter))[*this])
1.424 -// *(static_cast<GraphEdge*>(this))=
1.425 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.426 -// }
1.427 -// } else {
1.428 -// *(static_cast<GraphEdge*>(this))=
1.429 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.430 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.431 -// !(*(gw->backward_filter))[*this])
1.432 -// *(static_cast<GraphEdge*>(this))=
1.433 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.434 -// }
1.435 -// return *this;
1.436 -// }
1.437 -// };
1.438 -
1.439 -// class InEdgeIt : public Edge {
1.440 -// friend class SubBidirGraphWrapper<Graph,
1.441 -// ForwardFilterMap, BackwardFilterMap>;
1.442 -// protected:
1.443 -// const SubBidirGraphWrapper<Graph,
1.444 -// ForwardFilterMap, BackwardFilterMap>* gw;
1.445 -// public:
1.446 -// InEdgeIt() { }
1.447 -// InEdgeIt(Invalid i) : Edge(i) { }
1.448 -// InEdgeIt(const SubBidirGraphWrapper<Graph,
1.449 -// ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) :
1.450 -// Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) {
1.451 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.452 -// !(*(gw->forward_filter))[*this])
1.453 -// *(static_cast<GraphEdge*>(this))=
1.454 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.455 -// if (*static_cast<GraphEdge*>(this)==INVALID) {
1.456 -// *static_cast<Edge*>(this)=
1.457 -// Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true);
1.458 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.459 -// !(*(gw->backward_filter))[*this])
1.460 -// *(static_cast<GraphEdge*>(this))=
1.461 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.462 -// }
1.463 -// }
1.464 -// InEdgeIt(const SubBidirGraphWrapper<Graph,
1.465 -// ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) :
1.466 -// Edge(e), gw(&_gw) { }
1.467 -// InEdgeIt& operator++() {
1.468 -// if (!this->backward) {
1.469 -// Node n=gw->source(*this);
1.470 -// *(static_cast<GraphEdge*>(this))=
1.471 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.472 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.473 -// !(*(gw->forward_filter))[*this])
1.474 -// *(static_cast<GraphEdge*>(this))=
1.475 -// ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.476 -// if (*static_cast<GraphEdge*>(this)==INVALID) {
1.477 -// *static_cast<Edge*>(this)=
1.478 -// Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true);
1.479 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.480 -// !(*(gw->backward_filter))[*this])
1.481 -// *(static_cast<GraphEdge*>(this))=
1.482 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.483 -// }
1.484 -// } else {
1.485 -// *(static_cast<GraphEdge*>(this))=
1.486 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.487 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.488 -// !(*(gw->backward_filter))[*this])
1.489 -// *(static_cast<GraphEdge*>(this))=
1.490 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.491 -// }
1.492 -// return *this;
1.493 -// }
1.494 -// };
1.495 -
1.496 -// class EdgeIt : public Edge {
1.497 -// friend class SubBidirGraphWrapper<Graph,
1.498 -// ForwardFilterMap, BackwardFilterMap>;
1.499 -// protected:
1.500 -// const SubBidirGraphWrapper<Graph,
1.501 -// ForwardFilterMap, BackwardFilterMap>* gw;
1.502 -// public:
1.503 -// EdgeIt() { }
1.504 -// EdgeIt(Invalid i) : Edge(i) { }
1.505 -// EdgeIt(const SubBidirGraphWrapper<Graph,
1.506 -// ForwardFilterMap, BackwardFilterMap>& _gw) :
1.507 -// Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) {
1.508 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.509 -// !(*(gw->forward_filter))[*this])
1.510 -// *(static_cast<GraphEdge*>(this))=
1.511 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.512 -// if (*static_cast<GraphEdge*>(this)==INVALID) {
1.513 -// *static_cast<Edge*>(this)=
1.514 -// Edge(typename Graph::EdgeIt(*(_gw.graph)), true);
1.515 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.516 -// !(*(gw->backward_filter))[*this])
1.517 -// *(static_cast<GraphEdge*>(this))=
1.518 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.519 -// }
1.520 -// }
1.521 -// EdgeIt(const SubBidirGraphWrapper<Graph,
1.522 -// ForwardFilterMap, BackwardFilterMap>& _gw, const Edge& e) :
1.523 -// Edge(e), gw(&_gw) { }
1.524 -// EdgeIt& operator++() {
1.525 -// if (!this->backward) {
1.526 -// *(static_cast<GraphEdge*>(this))=
1.527 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.528 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.529 -// !(*(gw->forward_filter))[*this])
1.530 -// *(static_cast<GraphEdge*>(this))=
1.531 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.532 -// if (*static_cast<GraphEdge*>(this)==INVALID) {
1.533 -// *static_cast<Edge*>(this)=
1.534 -// Edge(typename Graph::EdgeIt(*(gw->graph)), true);
1.535 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.536 -// !(*(gw->backward_filter))[*this])
1.537 -// *(static_cast<GraphEdge*>(this))=
1.538 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.539 -// }
1.540 -// } else {
1.541 -// *(static_cast<GraphEdge*>(this))=
1.542 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.543 -// while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.544 -// !(*(gw->backward_filter))[*this])
1.545 -// *(static_cast<GraphEdge*>(this))=
1.546 -// ++(typename Graph::EdgeIt(*(gw->graph), *this));
1.547 -// }
1.548 -// return *this;
1.549 -// }
1.550 -// };
1.551 -
1.552 -// // using GraphWrapper<Graph>::first;
1.553 -// // OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
1.554 -// // i=OutEdgeIt(*this, p); return i;
1.555 -// // }
1.556 -// // InEdgeIt& first(InEdgeIt& i, const Node& p) const {
1.557 -// // i=InEdgeIt(*this, p); return i;
1.558 -// // }
1.559 -// // EdgeIt& first(EdgeIt& i) const {
1.560 -// // i=EdgeIt(*this); return i;
1.561 -// // }
1.562 -
1.563 -
1.564 -// Node source(Edge e) const {
1.565 -// return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
1.566 -// Node target(Edge e) const {
1.567 -// return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
1.568 -
1.569 -// /// Gives back the opposite edge.
1.570 -// Edge opposite(const Edge& e) const {
1.571 -// Edge f=e;
1.572 -// f.backward=!f.backward;
1.573 -// return f;
1.574 -// }
1.575 -
1.576 -// /// \warning This is a linear time operation and works only if
1.577 -// /// \c Graph::EdgeIt is defined.
1.578 -// int edgeNum() const {
1.579 -// int i=0;
1.580 -// for (EdgeIt e(*this); e!=INVALID; ++e) ++i;
1.581 -// return i;
1.582 -// }
1.583 -
1.584 -// bool forward(const Edge& e) const { return !e.backward; }
1.585 -// bool backward(const Edge& e) const { return e.backward; }
1.586 -
1.587 -
1.588 -// template <typename T>
1.589 -// /// \c SubBidirGraphWrapper<..., ..., ...>::EdgeMap contains two
1.590 -// /// Graph::EdgeMap one for the forward edges and
1.591 -// /// one for the backward edges.
1.592 -// class EdgeMap {
1.593 -// template <typename TT> friend class EdgeMap;
1.594 -// typename Graph::template EdgeMap<T> forward_map, backward_map;
1.595 -// public:
1.596 -// typedef T Value;
1.597 -// typedef Edge Key;
1.598 -
1.599 -// EdgeMap(const SubBidirGraphWrapper<Graph,
1.600 -// ForwardFilterMap, BackwardFilterMap>& g) :
1.601 -// forward_map(*(g.graph)), backward_map(*(g.graph)) { }
1.602 -
1.603 -// EdgeMap(const SubBidirGraphWrapper<Graph,
1.604 -// ForwardFilterMap, BackwardFilterMap>& g, T a) :
1.605 -// forward_map(*(g.graph), a), backward_map(*(g.graph), a) { }
1.606 -
1.607 -// template <typename TT>
1.608 -// EdgeMap(const EdgeMap<TT>& copy)
1.609 -// : forward_map(copy.forward_map), backward_map(copy.backward_map) {}
1.610 -
1.611 -// template <typename TT>
1.612 -// EdgeMap& operator=(const EdgeMap<TT>& copy) {
1.613 -// forward_map = copy.forward_map;
1.614 -// backward_map = copy.backward_map;
1.615 -// return *this;
1.616 -// }
1.617 -
1.618 -// void set(Edge e, T a) {
1.619 -// if (!e.backward)
1.620 -// forward_map.set(e, a);
1.621 -// else
1.622 -// backward_map.set(e, a);
1.623 -// }
1.624 -
1.625 -// typename Graph::template EdgeMap<T>::ConstReference
1.626 -// operator[](Edge e) const {
1.627 -// if (!e.backward)
1.628 -// return forward_map[e];
1.629 -// else
1.630 -// return backward_map[e];
1.631 -// }
1.632 -
1.633 -// typename Graph::template EdgeMap<T>::Reference
1.634 -// operator[](Edge e) {
1.635 -// if (!e.backward)
1.636 -// return forward_map[e];
1.637 -// else
1.638 -// return backward_map[e];
1.639 -// }
1.640 -
1.641 -// void update() {
1.642 -// forward_map.update();
1.643 -// backward_map.update();
1.644 -// }
1.645 -// };
1.646 -
1.647 -
1.648 -// // KEEP_NODE_MAP(Parent, SubBidirGraphWrapper);
1.649 -
1.650 -// };
1.651
1.652
1.653 ///\brief A wrapper for composing bidirected graph from a directed one.
1.654 @@ -1809,19 +1200,6 @@
1.655 typedef typename Parent::Node Node;
1.656 typedef typename Parent::Edge Edge;
1.657
1.658 -// using Parent::first;
1.659 -// void first(Node& i) const {
1.660 -// Parent::first(i);
1.661 -// while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i);
1.662 -// }
1.663 -// void first(Edge& i) const {
1.664 -// Parent::first(i);
1.665 -// while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i);
1.666 -// }
1.667 -// void firstIn(Edge& i, const Node& n) const {
1.668 -// Parent::firstIn(i, n);
1.669 -// while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i);
1.670 -// }
1.671 void firstOut(Edge& i, const Node& n) const {
1.672 i=(*first_out_edges)[n];
1.673 }
1.674 @@ -1832,22 +1210,6 @@
1.675 Parent::nextOut(f);
1.676 first_out_edges->set(n, f);
1.677 }
1.678 -// void next(Node& i) const {
1.679 -// Parent::next(i);
1.680 -// while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i);
1.681 -// }
1.682 -// void next(Edge& i) const {
1.683 -// Parent::next(i);
1.684 -// while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i);
1.685 -// }
1.686 -// void nextIn(Edge& i) const {
1.687 -// Parent::nextIn(i);
1.688 -// while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i);
1.689 -// }
1.690 -// void nextOut(Edge& i) const {
1.691 -// Parent::nextOut(i);
1.692 -// while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i);
1.693 -// }
1.694 };
1.695
1.696
1.697 @@ -1878,57 +1240,8 @@
1.698 setGraph(_graph);
1.699 setFirstOutEdgesMap(_first_out_edges);
1.700 }
1.701 -// using GraphWrapper<Graph>::first;
1.702 -// OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
1.703 -// i=OutEdgeIt(*this, p); return i;
1.704 -// }
1.705 +
1.706 };
1.707 -// template<typename Graph, typename FirstOutEdgesMap>
1.708 -// class ErasingFirstGraphWrapper : public GraphWrapper<Graph> {
1.709 -// public:
1.710 -// typedef GraphWrapper<Graph> Parent;
1.711 -// protected:
1.712 -// FirstOutEdgesMap* first_out_edges;
1.713 -// public:
1.714 -// ErasingFirstGraphWrapper(Graph& _graph,
1.715 -// FirstOutEdgesMap& _first_out_edges) :
1.716 -// GraphWrapper<Graph>(_graph), first_out_edges(&_first_out_edges) { }
1.717 -
1.718 -// typedef typename GraphWrapper<Graph>::Node Node;
1.719 -// typedef typename GraphWrapper<Graph>::Edge Edge;
1.720 -// class OutEdgeIt : public Edge {
1.721 -// friend class GraphWrapper<Graph>;
1.722 -// friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>;
1.723 -// const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>* gw;
1.724 -// public:
1.725 -// OutEdgeIt() { }
1.726 -// OutEdgeIt(Invalid i) : Edge(i) { }
1.727 -// OutEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _gw,
1.728 -// const Node& n) :
1.729 -// Edge((*(_gw.first_out_edges))[n]), gw(&_gw) { }
1.730 -// OutEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _gw,
1.731 -// const Edge& e) :
1.732 -// Edge(e), gw(&_gw) { }
1.733 -// OutEdgeIt& operator++() {
1.734 -// *(static_cast<Edge*>(this))=
1.735 -// ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.736 -// return *this;
1.737 -// }
1.738 -// };
1.739 -
1.740 -// // using GraphWrapper<Graph>::first;
1.741 -// // OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
1.742 -// // i=OutEdgeIt(*this, p); return i;
1.743 -// // }
1.744 -// void erase(const Edge& e) const {
1.745 -// Node n=source(e);
1.746 -// typename Graph::OutEdgeIt f(*Parent::graph, n);
1.747 -// ++f;
1.748 -// first_out_edges->set(n, f);
1.749 -// }
1.750 -
1.751 -// // KEEP_MAPS(Parent, ErasingFirstGraphWrapper);
1.752 -// };
1.753
1.754 ///@}
1.755