# HG changeset patch # User marci # Date 1100521539 0 # Node ID 10d378f2821c337345ceacbbb2f8b619986e878f # Parent e619a466ca5de62d6dcf0d95d8af13e6f1271437 GraphWrapper changes for factory diff -r e619a466ca5d -r 10d378f2821c src/lemon/graph_wrapper.h --- a/src/lemon/graph_wrapper.h Sun Nov 14 13:15:46 2004 +0000 +++ b/src/lemon/graph_wrapper.h Mon Nov 15 12:25:39 2004 +0000 @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -123,7 +124,7 @@ public: GraphWrapperBase(Graph& _graph) : graph(&_graph) { } - GraphWrapperBase(const GraphWrapperBase<_Graph>& gw) : graph(gw.graph) { } +// GraphWrapperBase(const GraphWrapperBase<_Graph>& gw) : graph(gw.graph) { } typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; @@ -299,7 +300,118 @@ }; + + template + class SubGraphWrapperBase : public GraphWrapperBase<_Graph> { + public: + typedef _Graph Graph; + typedef GraphWrapperBase<_Graph> Parent; + protected: + NodeFilterMap* node_filter_map; + EdgeFilterMap* edge_filter_map; + SubGraphWrapperBase() : Parent(), + node_filter_map(0), edge_filter_map(0) { } + void setNodeFilterMap(NodeFilterMap& _node_filter_map) { + node_filter_map=&_node_filter_map; + } + void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) { + edge_filter_map=&_edge_filter_map; + } + + public: +// SubGraphWrapperBase(Graph& _graph, +// NodeFilterMap& _node_filter_map, +// EdgeFilterMap& _edge_filter_map) : +// Parent(&_graph), +// node_filter_map(&node_filter_map), +// edge_filter_map(&edge_filter_map) { } + + typedef typename Parent::Node Node; + typedef typename Parent::Edge Edge; + + void first(Node& i) const { + Parent::first(i); + while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i); + } + void first(Edge& i) const { + Parent::first(i); + while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i); + } + void firstIn(Edge& i, const Node& n) const { + Parent::firstIn(i, n); + while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i); + } + void firstOut(Edge& i, const Node& n) const { + Parent::firstOut(i, n); + while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i); + } + + void next(Node& i) const { + Parent::next(i); + while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i); + } + void next(Edge& i) const { + Parent::next(i); + while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i); + } + void nextIn(Edge& i) const { + Parent::nextIn(i); + while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i); + } + void nextOut(Edge& i) const { + Parent::nextOut(i); + while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i); + } + + /// This function hides \c n in the graph, i.e. the iteration + /// jumps over it. This is done by simply setting the value of \c n + /// to be false in the corresponding node-map. + void hide(const Node& n) const { node_filter_map->set(n, false); } + + /// This function hides \c e in the graph, i.e. the iteration + /// jumps over it. This is done by simply setting the value of \c e + /// to be false in the corresponding edge-map. + void hide(const Edge& e) const { edge_filter_map->set(e, false); } + + /// The value of \c n is set to be true in the node-map which stores + /// hide information. If \c n was hidden previuosly, then it is shown + /// again + void unHide(const Node& n) const { node_filter_map->set(n, true); } + + /// The value of \c e is set to be true in the edge-map which stores + /// hide information. If \c e was hidden previuosly, then it is shown + /// again + void unHide(const Edge& e) const { edge_filter_map->set(e, true); } + + /// Returns true if \c n is hidden. + bool hidden(const Node& n) const { return !(*node_filter_map)[n]; } + + /// Returns true if \c n is hidden. + bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; } + + /// \warning This is a linear time operation and works only if s + /// \c Graph::NodeIt is defined. + /// \todo assign tags. + int nodeNum() const { + int i=0; + Node n; + for (first(n); n!=INVALID; next(n)) ++i; + return i; + } + + /// \warning This is a linear time operation and works only if + /// \c Graph::EdgeIt is defined. + /// \todo assign tags. + int edgeNum() const { + int i=0; + Edge e; + for (first(e); e!=INVALID; next(e)) ++i; + return i; + } + + + }; /*! \brief A graph wrapper for hiding nodes and edges from a graph. @@ -347,195 +459,215 @@ \author Marton Makai */ - template - class SubGraphWrapper : public GraphWrapper { + class SubGraphWrapper : + public IterableGraphExtender< + SubGraphWrapperBase<_Graph, NodeFilterMap, EdgeFilterMap> > { public: - typedef GraphWrapper Parent; + typedef _Graph Graph; + typedef IterableGraphExtender< + SubGraphWrapperBase<_Graph, NodeFilterMap, EdgeFilterMap> > Parent; protected: - NodeFilterMap* node_filter_map; - EdgeFilterMap* edge_filter_map; + SubGraphWrapper() { } + public: + SubGraphWrapper(_Graph& _graph, NodeFilterMap& _node_filter_map, + EdgeFilterMap& _edge_filter_map) { + setGraph(_graph); + setNodeFilterMap(_node_filter_map); + setEdgeFilterMap(_edge_filter_map); + } + }; - SubGraphWrapper() : GraphWrapper(), - node_filter_map(0), edge_filter_map(0) { } - void setNodeFilterMap(NodeFilterMap& _node_filter_map) { - node_filter_map=&_node_filter_map; - } - void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) { - edge_filter_map=&_edge_filter_map; - } +// template +// class SubGraphWrapper : public GraphWrapper { +// public: +// typedef GraphWrapper Parent; +// protected: +// NodeFilterMap* node_filter_map; +// EdgeFilterMap* edge_filter_map; + +// SubGraphWrapper() : GraphWrapper(), +// node_filter_map(0), edge_filter_map(0) { } +// void setNodeFilterMap(NodeFilterMap& _node_filter_map) { +// node_filter_map=&_node_filter_map; +// } +// void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) { +// edge_filter_map=&_edge_filter_map; +// } - public: - SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, - EdgeFilterMap& _edge_filter_map) : - GraphWrapper(_graph), node_filter_map(&_node_filter_map), - edge_filter_map(&_edge_filter_map) { } +// public: +// SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map, +// EdgeFilterMap& _edge_filter_map) : +// GraphWrapper(_graph), node_filter_map(&_node_filter_map), +// edge_filter_map(&_edge_filter_map) { } - typedef typename GraphWrapper::Node Node; - class NodeIt : public Node { - const SubGraphWrapper* gw; - friend class SubGraphWrapper; - public: - NodeIt() { } - NodeIt(Invalid i) : Node(i) { } - NodeIt(const SubGraphWrapper& _gw) : - Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { - while (*static_cast(this)!=INVALID && - !(*(gw->node_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::NodeIt(*(gw->graph), *this)); - } - NodeIt(const SubGraphWrapper& _gw, - const Node& n) : - Node(n), gw(&_gw) { } - NodeIt& operator++() { - *(static_cast(this))= - ++(typename Graph::NodeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->node_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::NodeIt(*(gw->graph), *this)); - return *this; - } - }; - typedef typename GraphWrapper::Edge Edge; - class OutEdgeIt : public Edge { - const SubGraphWrapper* gw; - friend class SubGraphWrapper; - public: - OutEdgeIt() { } - OutEdgeIt(Invalid i) : Edge(i) { } - OutEdgeIt(const SubGraphWrapper& _gw, const Node& n) : - Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { - while (*static_cast(this)!=INVALID && - !(*(gw->edge_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - } - OutEdgeIt(const SubGraphWrapper& _gw, - const Edge& e) : - Edge(e), gw(&_gw) { } - OutEdgeIt& operator++() { - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->edge_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - return *this; - } - }; - class InEdgeIt : public Edge { - const SubGraphWrapper* gw; - friend class SubGraphWrapper; - public: - InEdgeIt() { } - // InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { } - InEdgeIt(Invalid i) : Edge(i) { } - InEdgeIt(const SubGraphWrapper& _gw, const Node& n) : - Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { - while (*static_cast(this)!=INVALID && - !(*(gw->edge_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - } - InEdgeIt(const SubGraphWrapper& _gw, - const Edge& e) : - Edge(e), gw(&_gw) { } - InEdgeIt& operator++() { - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->edge_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - return *this; - } - }; - class EdgeIt : public Edge { - const SubGraphWrapper* gw; - friend class SubGraphWrapper; - public: - EdgeIt() { } - EdgeIt(Invalid i) : Edge(i) { } - EdgeIt(const SubGraphWrapper& _gw) : - Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { - while (*static_cast(this)!=INVALID && - !(*(gw->edge_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - } - EdgeIt(const SubGraphWrapper& _gw, - const Edge& e) : - Edge(e), gw(&_gw) { } - EdgeIt& operator++() { - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->edge_filter_map))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - return *this; - } - }; +// typedef typename GraphWrapper::Node Node; +// class NodeIt : public Node { +// const SubGraphWrapper* gw; +// friend class SubGraphWrapper; +// public: +// NodeIt() { } +// NodeIt(Invalid i) : Node(i) { } +// NodeIt(const SubGraphWrapper& _gw) : +// Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { +// while (*static_cast(this)!=INVALID && +// !(*(gw->node_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::NodeIt(*(gw->graph), *this)); +// } +// NodeIt(const SubGraphWrapper& _gw, +// const Node& n) : +// Node(n), gw(&_gw) { } +// NodeIt& operator++() { +// *(static_cast(this))= +// ++(typename Graph::NodeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->node_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::NodeIt(*(gw->graph), *this)); +// return *this; +// } +// }; +// typedef typename GraphWrapper::Edge Edge; +// class OutEdgeIt : public Edge { +// const SubGraphWrapper* gw; +// friend class SubGraphWrapper; +// public: +// OutEdgeIt() { } +// OutEdgeIt(Invalid i) : Edge(i) { } +// OutEdgeIt(const SubGraphWrapper& _gw, const Node& n) : +// Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { +// while (*static_cast(this)!=INVALID && +// !(*(gw->edge_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// } +// OutEdgeIt(const SubGraphWrapper& _gw, +// const Edge& e) : +// Edge(e), gw(&_gw) { } +// OutEdgeIt& operator++() { +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->edge_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// return *this; +// } +// }; +// class InEdgeIt : public Edge { +// const SubGraphWrapper* gw; +// friend class SubGraphWrapper; +// public: +// InEdgeIt() { } +// // InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { } +// InEdgeIt(Invalid i) : Edge(i) { } +// InEdgeIt(const SubGraphWrapper& _gw, const Node& n) : +// Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { +// while (*static_cast(this)!=INVALID && +// !(*(gw->edge_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// } +// InEdgeIt(const SubGraphWrapper& _gw, +// const Edge& e) : +// Edge(e), gw(&_gw) { } +// InEdgeIt& operator++() { +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->edge_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// return *this; +// } +// }; +// class EdgeIt : public Edge { +// const SubGraphWrapper* gw; +// friend class SubGraphWrapper; +// public: +// EdgeIt() { } +// EdgeIt(Invalid i) : Edge(i) { } +// EdgeIt(const SubGraphWrapper& _gw) : +// Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { +// while (*static_cast(this)!=INVALID && +// !(*(gw->edge_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// } +// EdgeIt(const SubGraphWrapper& _gw, +// const Edge& e) : +// Edge(e), gw(&_gw) { } +// EdgeIt& operator++() { +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->edge_filter_map))[*this]) +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// return *this; +// } +// }; - NodeIt& first(NodeIt& i) const { - i=NodeIt(*this); 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; - } - EdgeIt& first(EdgeIt& i) const { - i=EdgeIt(*this); return i; - } +// NodeIt& first(NodeIt& i) const { +// i=NodeIt(*this); 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; +// } +// EdgeIt& first(EdgeIt& i) const { +// i=EdgeIt(*this); return i; +// } - /// This function hides \c n in the graph, i.e. the iteration - /// jumps over it. This is done by simply setting the value of \c n - /// to be false in the corresponding node-map. - void hide(const Node& n) const { node_filter_map->set(n, false); } +// /// This function hides \c n in the graph, i.e. the iteration +// /// jumps over it. This is done by simply setting the value of \c n +// /// to be false in the corresponding node-map. +// void hide(const Node& n) const { node_filter_map->set(n, false); } - /// This function hides \c e in the graph, i.e. the iteration - /// jumps over it. This is done by simply setting the value of \c e - /// to be false in the corresponding edge-map. - void hide(const Edge& e) const { edge_filter_map->set(e, false); } +// /// This function hides \c e in the graph, i.e. the iteration +// /// jumps over it. This is done by simply setting the value of \c e +// /// to be false in the corresponding edge-map. +// void hide(const Edge& e) const { edge_filter_map->set(e, false); } - /// The value of \c n is set to be true in the node-map which stores - /// hide information. If \c n was hidden previuosly, then it is shown - /// again - void unHide(const Node& n) const { node_filter_map->set(n, true); } +// /// The value of \c n is set to be true in the node-map which stores +// /// hide information. If \c n was hidden previuosly, then it is shown +// /// again +// void unHide(const Node& n) const { node_filter_map->set(n, true); } - /// The value of \c e is set to be true in the edge-map which stores - /// hide information. If \c e was hidden previuosly, then it is shown - /// again - void unHide(const Edge& e) const { edge_filter_map->set(e, true); } +// /// The value of \c e is set to be true in the edge-map which stores +// /// hide information. If \c e was hidden previuosly, then it is shown +// /// again +// void unHide(const Edge& e) const { edge_filter_map->set(e, true); } - /// Returns true if \c n is hidden. - bool hidden(const Node& n) const { return !(*node_filter_map)[n]; } +// /// Returns true if \c n is hidden. +// bool hidden(const Node& n) const { return !(*node_filter_map)[n]; } - /// Returns true if \c n is hidden. - bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; } +// /// Returns true if \c n is hidden. +// bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; } - /// \warning This is a linear time operation and works only if - /// \c Graph::NodeIt is defined. - int nodeNum() const { - int i=0; - for (NodeIt n(*this); n!=INVALID; ++n) ++i; - return i; - } +// /// \warning This is a linear time operation and works only if +// /// \c Graph::NodeIt is defined. +// int nodeNum() const { +// int i=0; +// for (NodeIt n(*this); n!=INVALID; ++n) ++i; +// return i; +// } - /// \warning This is a linear time operation and works only if - /// \c Graph::EdgeIt is defined. - int edgeNum() const { - int i=0; - for (EdgeIt e(*this); e!=INVALID; ++e) ++i; - return i; - } +// /// \warning This is a linear time operation and works only if +// /// \c Graph::EdgeIt is defined. +// int edgeNum() const { +// int i=0; +// for (EdgeIt e(*this); e!=INVALID; ++e) ++i; +// return i; +// } - // KEEP_MAPS(Parent, SubGraphWrapper); - }; +// // KEEP_MAPS(Parent, SubGraphWrapper); +// }; /*! \brief A wrapper for hiding nodes from a graph. @@ -799,6 +931,255 @@ // KEEP_MAPS(Parent, UndirGraph); }; + + template + class SubBidirGraphWrapperBase : public GraphWrapperBase<_Graph> { + public: + typedef _Graph Graph; + typedef GraphWrapperBase<_Graph> Parent; + protected: + ForwardFilterMap* forward_filter; + BackwardFilterMap* backward_filter; + SubBidirGraphWrapperBase() : Parent(), + forward_filter(0), backward_filter(0) { } + + void setForwardFilterMap(ForwardFilterMap& _forward_filter) { + forward_filter=&_forward_filter; + } + void setBackwardFilterMap(BackwardFilterMap& _backward_filter) { + backward_filter=&_backward_filter; + } + + public: +// SubGraphWrapperBase(Graph& _graph, +// NodeFilterMap& _node_filter_map, +// EdgeFilterMap& _edge_filter_map) : +// Parent(&_graph), +// node_filter_map(&node_filter_map), +// edge_filter_map(&edge_filter_map) { } + + typedef typename Parent::Node Node; + typedef typename _Graph::Edge GraphEdge; + template class EdgeMap; + /// SubBidirGraphWrapperBase<..., ..., ...>::Edge is inherited from + /// _Graph::Edge. It contains an extra bool flag which is true + /// if and only if the + /// edge is the backward version of the original edge. + class Edge : public _Graph::Edge { + friend class SubBidirGraphWrapperBase< + Graph, ForwardFilterMap, BackwardFilterMap>; + template friend class EdgeMap; + protected: + bool backward; //true, iff backward + public: + Edge() { } + /// \todo =false is needed, or causes problems? + /// If \c _backward is false, then we get an edge corresponding to the + /// original one, otherwise its oppositely directed pair is obtained. + Edge(const typename _Graph::Edge& e, bool _backward/*=false*/) : + _Graph::Edge(e), backward(_backward) { } + Edge(Invalid i) : _Graph::Edge(i), backward(true) { } + bool operator==(const Edge& v) const { + return (this->backward==v.backward && + static_cast(*this)== + static_cast(v)); + } + bool operator!=(const Edge& v) const { + return (this->backward!=v.backward || + static_cast(*this)!= + static_cast(v)); + } + }; + + void first(Node& i) const { + Parent::first(i); + } + + void first(Edge& i) const { + Parent::first(i); + i.backward=false; + while (*static_cast(&i)!=INVALID && + !(*forward_filter)[i]) Parent::next(i); + if (*static_cast(&i)==INVALID) { + Parent::first(i); + i.backward=true; + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::next(i); + } + } + + void firstIn(Edge& i, const Node& n) const { + Parent::firstIn(i, n); + i.backward=false; + while (*static_cast(&i)!=INVALID && + !(*forward_filter)[i]) Parent::nextOut(i); + if (*static_cast(&i)==INVALID) { + Parent::firstOut(i, n); + i.backward=true; + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::nextOut(i); + } + } + + void firstOut(Edge& i, const Node& n) const { + Parent::firstOut(i, n); + i.backward=false; + while (*static_cast(&i)!=INVALID && + !(*forward_filter)[i]) Parent::nextOut(i); + if (*static_cast(&i)==INVALID) { + Parent::firstIn(i, n); + i.backward=true; + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::nextIn(i); + } + } + + void next(Node& i) const { + Parent::next(i); + } + + void next(Edge& i) const { + if (!(i.backward)) { + Parent::next(i); + while (*static_cast(&i)!=INVALID && + !(*forward_filter)[i]) Parent::next(i); + if (*static_cast(&i)==INVALID) { + Parent::first(i); + i.backward=true; + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::next(i); + } + } else { + Parent::next(i); + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::next(i); + } + } + + void nextIn(Edge& i) const { + if (!(i.backward)) { + Node n=Parent::target(i); + Parent::nextIn(i); + while (*static_cast(&i)!=INVALID && + !(*forward_filter)[i]) Parent::nextIn(i); + if (*static_cast(&i)==INVALID) { + Parent::firstOut(i, n); + i.backward=true; + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::nextOut(i); + } + } else { + Parent::nextOut(i); + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::nextOut(i); + } + } + + void nextOut(Edge& i) const { + if (!(i.backward)) { + Node n=Parent::source(i); + Parent::nextOut(i); + while (*static_cast(&i)!=INVALID && + !(*forward_filter)[i]) Parent::nextOut(i); + if (*static_cast(&i)==INVALID) { + Parent::firstIn(i, n); + i.backward=true; + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::nextIn(i); + } + } else { + Parent::nextIn(i); + while (*static_cast(&i)!=INVALID && + !(*backward_filter)[i]) Parent::nextIn(i); + } + } + + Node source(Edge e) const { + return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); } + Node target(Edge e) const { + return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); } + + /// Gives back the opposite edge. + Edge opposite(const Edge& e) const { + Edge f=e; + f.backward=!f.backward; + return f; + } + + /// \warning This is a linear time operation and works only if + /// \c Graph::EdgeIt is defined. + /// \todo hmm + int edgeNum() const { + int i=0; + Edge e; + for (first(e); e!=INVALID; next(e)) ++i; + return i; + } + + bool forward(const Edge& e) const { return !e.backward; } + bool backward(const Edge& e) const { return e.backward; } + + template + /// \c SubBidirGraphWrapperBase<..., ..., ...>::EdgeMap contains two + /// _Graph::EdgeMap one for the forward edges and + /// one for the backward edges. + class EdgeMap { + template friend class EdgeMap; + typename _Graph::template EdgeMap forward_map, backward_map; + public: + typedef T Value; + typedef Edge Key; + + EdgeMap(const SubBidirGraphWrapperBase<_Graph, + ForwardFilterMap, BackwardFilterMap>& g) : + forward_map(*(g.graph)), backward_map(*(g.graph)) { } + + EdgeMap(const SubBidirGraphWrapperBase<_Graph, + ForwardFilterMap, BackwardFilterMap>& g, T a) : + forward_map(*(g.graph), a), backward_map(*(g.graph), a) { } + +// template +// EdgeMap(const EdgeMap& copy) +// : forward_map(copy.forward_map), backward_map(copy.backward_map) {} + +// template +// EdgeMap& operator=(const EdgeMap& copy) { +// forward_map = copy.forward_map; +// backward_map = copy.backward_map; +// return *this; +// } + + void set(Edge e, T a) { + if (!e.backward) + forward_map.set(e, a); + else + backward_map.set(e, a); + } + +// typename _Graph::template EdgeMap::ConstReference +// operator[](Edge e) const { +// if (!e.backward) +// return forward_map[e]; +// else +// return backward_map[e]; +// } + +// typename _Graph::template EdgeMap::Reference + T operator[](Edge e) { + if (!e.backward) + return forward_map[e]; + else + return backward_map[e]; + } + + void update() { + forward_map.update(); + backward_map.update(); + } + }; + + }; ///\brief A wrapper for composing a subgraph of a @@ -838,344 +1219,365 @@ /// As wrappers usually, the SubBidirGraphWrapper implements the /// above mentioned graph structure without its physical storage, /// that is the whole stuff is stored in constant memory. - template - class SubBidirGraphWrapper : public GraphWrapper { + class SubBidirGraphWrapper : + public IterableGraphExtender< + SubBidirGraphWrapperBase<_Graph, ForwardFilterMap, BackwardFilterMap> > { public: - typedef GraphWrapper Parent; + typedef _Graph Graph; + typedef IterableGraphExtender< + SubBidirGraphWrapperBase< + _Graph, ForwardFilterMap, BackwardFilterMap> > Parent; protected: - ForwardFilterMap* forward_filter; - BackwardFilterMap* backward_filter; + SubBidirGraphWrapper() { } + public: + SubBidirGraphWrapper(_Graph& _graph, ForwardFilterMap& _forward_filter, + BackwardFilterMap& _backward_filter) { + setGraph(_graph); + setForwardFilterMap(_forward_filter); + setBackwardFilterMap(_backward_filter); + } + }; - SubBidirGraphWrapper() : GraphWrapper() { } - void setForwardFilterMap(ForwardFilterMap& _forward_filter) { - forward_filter=&_forward_filter; - } - void setBackwardFilterMap(BackwardFilterMap& _backward_filter) { - backward_filter=&_backward_filter; - } +// template +// class SubBidirGraphWrapper : public GraphWrapper { +// public: +// typedef GraphWrapper Parent; +// protected: +// ForwardFilterMap* forward_filter; +// BackwardFilterMap* backward_filter; - public: +// SubBidirGraphWrapper() : GraphWrapper() { } +// void setForwardFilterMap(ForwardFilterMap& _forward_filter) { +// forward_filter=&_forward_filter; +// } +// void setBackwardFilterMap(BackwardFilterMap& _backward_filter) { +// backward_filter=&_backward_filter; +// } - SubBidirGraphWrapper(Graph& _graph, ForwardFilterMap& _forward_filter, - BackwardFilterMap& _backward_filter) : - GraphWrapper(_graph), - forward_filter(&_forward_filter), backward_filter(&_backward_filter) { } - SubBidirGraphWrapper(const SubBidirGraphWrapper& gw) : - Parent(gw), - forward_filter(gw.forward_filter), - backward_filter(gw.backward_filter) { } +// public: - class Edge; - class OutEdgeIt; - friend class Edge; - friend class OutEdgeIt; +// SubBidirGraphWrapper(Graph& _graph, ForwardFilterMap& _forward_filter, +// BackwardFilterMap& _backward_filter) : +// GraphWrapper(_graph), +// forward_filter(&_forward_filter), backward_filter(&_backward_filter) { } +// SubBidirGraphWrapper(const SubBidirGraphWrapper& gw) : +// Parent(gw), +// forward_filter(gw.forward_filter), +// backward_filter(gw.backward_filter) { } - template class EdgeMap; +// class Edge; +// class OutEdgeIt; +// friend class Edge; +// friend class OutEdgeIt; - typedef typename GraphWrapper::Node Node; +// template class EdgeMap; - typedef typename Graph::Edge GraphEdge; - /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from - /// Graph::Edge. It contains an extra bool flag which is true - /// if and only if the - /// edge is the backward version of the original edge. - class Edge : public Graph::Edge { - friend class SubBidirGraphWrapper; - template friend class EdgeMap; - protected: - bool backward; //true, iff backward - public: - Edge() { } - /// \todo =false is needed, or causes problems? - /// If \c _backward is false, then we get an edge corresponding to the - /// original one, otherwise its oppositely directed pair is obtained. - Edge(const typename Graph::Edge& e, bool _backward/*=false*/) : - Graph::Edge(e), backward(_backward) { } - Edge(Invalid i) : Graph::Edge(i), backward(true) { } - bool operator==(const Edge& v) const { - return (this->backward==v.backward && - static_cast(*this)== - static_cast(v)); - } - bool operator!=(const Edge& v) const { - return (this->backward!=v.backward || - static_cast(*this)!= - static_cast(v)); - } - }; +// typedef typename GraphWrapper::Node Node; - class OutEdgeIt : public Edge { - friend class SubBidirGraphWrapper; - protected: - const SubBidirGraphWrapper* gw; - public: - OutEdgeIt() { } - OutEdgeIt(Invalid i) : Edge(i) { } - OutEdgeIt(const SubBidirGraphWrapper& _gw, const Node& n) : - Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) { - while (*static_cast(this)!=INVALID && - !(*(gw->forward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) { - *static_cast(this)= - Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - } - } - OutEdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : - Edge(e), gw(&_gw) { } - OutEdgeIt& operator++() { - if (!this->backward) { - Node n=gw->source(*this); - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->forward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) { - *static_cast(this)= - Edge(typename Graph::InEdgeIt(*(gw->graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - } - } else { - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - } - return *this; - } - }; +// typedef typename Graph::Edge GraphEdge; +// /// SubBidirGraphWrapper<..., ..., ...>::Edge is inherited from +// /// Graph::Edge. It contains an extra bool flag which is true +// /// if and only if the +// /// edge is the backward version of the original edge. +// class Edge : public Graph::Edge { +// friend class SubBidirGraphWrapper; +// template friend class EdgeMap; +// protected: +// bool backward; //true, iff backward +// public: +// Edge() { } +// /// \todo =false is needed, or causes problems? +// /// If \c _backward is false, then we get an edge corresponding to the +// /// original one, otherwise its oppositely directed pair is obtained. +// Edge(const typename Graph::Edge& e, bool _backward/*=false*/) : +// Graph::Edge(e), backward(_backward) { } +// Edge(Invalid i) : Graph::Edge(i), backward(true) { } +// bool operator==(const Edge& v) const { +// return (this->backward==v.backward && +// static_cast(*this)== +// static_cast(v)); +// } +// bool operator!=(const Edge& v) const { +// return (this->backward!=v.backward || +// static_cast(*this)!= +// static_cast(v)); +// } +// }; - class InEdgeIt : public Edge { - friend class SubBidirGraphWrapper; - protected: - const SubBidirGraphWrapper* gw; - public: - InEdgeIt() { } - InEdgeIt(Invalid i) : Edge(i) { } - InEdgeIt(const SubBidirGraphWrapper& _gw, const Node& n) : - Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) { - while (*static_cast(this)!=INVALID && - !(*(gw->forward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) { - *static_cast(this)= - Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - } - } - InEdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : - Edge(e), gw(&_gw) { } - InEdgeIt& operator++() { - if (!this->backward) { - Node n=gw->source(*this); - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->forward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::InEdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) { - *static_cast(this)= - Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - } - } else { - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); - } - return *this; - } - }; +// class OutEdgeIt : public Edge { +// friend class SubBidirGraphWrapper; +// protected: +// const SubBidirGraphWrapper* gw; +// public: +// OutEdgeIt() { } +// OutEdgeIt(Invalid i) : Edge(i) { } +// OutEdgeIt(const SubBidirGraphWrapper& _gw, const Node& n) : +// Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) { +// while (*static_cast(this)!=INVALID && +// !(*(gw->forward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// if (*static_cast(this)==INVALID) { +// *static_cast(this)= +// Edge(typename Graph::InEdgeIt(*(_gw.graph), n), true); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// } +// } +// OutEdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : +// Edge(e), gw(&_gw) { } +// OutEdgeIt& operator++() { +// if (!this->backward) { +// Node n=gw->source(*this); +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->forward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// if (*static_cast(this)==INVALID) { +// *static_cast(this)= +// Edge(typename Graph::InEdgeIt(*(gw->graph), n), true); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// } +// } else { +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// } +// return *this; +// } +// }; - class EdgeIt : public Edge { - friend class SubBidirGraphWrapper; - protected: - const SubBidirGraphWrapper* gw; - public: - EdgeIt() { } - EdgeIt(Invalid i) : Edge(i) { } - EdgeIt(const SubBidirGraphWrapper& _gw) : - Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) { - while (*static_cast(this)!=INVALID && - !(*(gw->forward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) { - *static_cast(this)= - Edge(typename Graph::EdgeIt(*(_gw.graph)), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - } - } - EdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : - Edge(e), gw(&_gw) { } - EdgeIt& operator++() { - if (!this->backward) { - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->forward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - if (*static_cast(this)==INVALID) { - *static_cast(this)= - Edge(typename Graph::EdgeIt(*(gw->graph)), true); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - } - } else { - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - while (*static_cast(this)!=INVALID && - !(*(gw->backward_filter))[*this]) - *(static_cast(this))= - ++(typename Graph::EdgeIt(*(gw->graph), *this)); - } - return *this; - } - }; +// class InEdgeIt : public Edge { +// friend class SubBidirGraphWrapper; +// protected: +// const SubBidirGraphWrapper* gw; +// public: +// InEdgeIt() { } +// InEdgeIt(Invalid i) : Edge(i) { } +// InEdgeIt(const SubBidirGraphWrapper& _gw, const Node& n) : +// Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) { +// while (*static_cast(this)!=INVALID && +// !(*(gw->forward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// if (*static_cast(this)==INVALID) { +// *static_cast(this)= +// Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), true); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// } +// } +// InEdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : +// Edge(e), gw(&_gw) { } +// InEdgeIt& operator++() { +// if (!this->backward) { +// Node n=gw->source(*this); +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->forward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::InEdgeIt(*(gw->graph), *this)); +// if (*static_cast(this)==INVALID) { +// *static_cast(this)= +// Edge(typename Graph::OutEdgeIt(*(gw->graph), n), true); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// } +// } else { +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::OutEdgeIt(*(gw->graph), *this)); +// } +// return *this; +// } +// }; -// using GraphWrapper::first; -// 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; -// } -// EdgeIt& first(EdgeIt& i) const { -// i=EdgeIt(*this); return i; -// } +// class EdgeIt : public Edge { +// friend class SubBidirGraphWrapper; +// protected: +// const SubBidirGraphWrapper* gw; +// public: +// EdgeIt() { } +// EdgeIt(Invalid i) : Edge(i) { } +// EdgeIt(const SubBidirGraphWrapper& _gw) : +// Edge(typename Graph::EdgeIt(*(_gw.graph)), false), gw(&_gw) { +// while (*static_cast(this)!=INVALID && +// !(*(gw->forward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// if (*static_cast(this)==INVALID) { +// *static_cast(this)= +// Edge(typename Graph::EdgeIt(*(_gw.graph)), true); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// } +// } +// EdgeIt(const SubBidirGraphWrapper& _gw, const Edge& e) : +// Edge(e), gw(&_gw) { } +// EdgeIt& operator++() { +// if (!this->backward) { +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->forward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// if (*static_cast(this)==INVALID) { +// *static_cast(this)= +// Edge(typename Graph::EdgeIt(*(gw->graph)), true); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// } +// } else { +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// while (*static_cast(this)!=INVALID && +// !(*(gw->backward_filter))[*this]) +// *(static_cast(this))= +// ++(typename Graph::EdgeIt(*(gw->graph), *this)); +// } +// return *this; +// } +// }; + +// // using GraphWrapper::first; +// // 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; +// // } +// // EdgeIt& first(EdgeIt& i) const { +// // i=EdgeIt(*this); return i; +// // } - Node source(Edge e) const { - return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); } - Node target(Edge e) const { - return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); } +// Node source(Edge e) const { +// return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); } +// Node target(Edge e) const { +// return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); } - /// Gives back the opposite edge. - Edge opposite(const Edge& e) const { - Edge f=e; - f.backward=!f.backward; - return f; - } +// /// Gives back the opposite edge. +// Edge opposite(const Edge& e) const { +// Edge f=e; +// f.backward=!f.backward; +// return f; +// } - /// \warning This is a linear time operation and works only if - /// \c Graph::EdgeIt is defined. - int edgeNum() const { - int i=0; - for (EdgeIt e(*this); e!=INVALID; ++e) ++i; - return i; - } +// /// \warning This is a linear time operation and works only if +// /// \c Graph::EdgeIt is defined. +// int edgeNum() const { +// int i=0; +// for (EdgeIt e(*this); e!=INVALID; ++e) ++i; +// return i; +// } - bool forward(const Edge& e) const { return !e.backward; } - bool backward(const Edge& e) const { return e.backward; } +// bool forward(const Edge& e) const { return !e.backward; } +// bool backward(const Edge& e) const { return e.backward; } - template - /// \c SubBidirGraphWrapper<..., ..., ...>::EdgeMap contains two - /// Graph::EdgeMap one for the forward edges and - /// one for the backward edges. - class EdgeMap { - template friend class EdgeMap; - typename Graph::template EdgeMap forward_map, backward_map; - public: - typedef T Value; - typedef Edge Key; +// template +// /// \c SubBidirGraphWrapper<..., ..., ...>::EdgeMap contains two +// /// Graph::EdgeMap one for the forward edges and +// /// one for the backward edges. +// class EdgeMap { +// template friend class EdgeMap; +// typename Graph::template EdgeMap forward_map, backward_map; +// public: +// typedef T Value; +// typedef Edge Key; - EdgeMap(const SubBidirGraphWrapper& g) : - forward_map(*(g.graph)), backward_map(*(g.graph)) { } +// EdgeMap(const SubBidirGraphWrapper& g) : +// forward_map(*(g.graph)), backward_map(*(g.graph)) { } - EdgeMap(const SubBidirGraphWrapper& g, T a) : - forward_map(*(g.graph), a), backward_map(*(g.graph), a) { } +// EdgeMap(const SubBidirGraphWrapper& g, T a) : +// forward_map(*(g.graph), a), backward_map(*(g.graph), a) { } - template - EdgeMap(const EdgeMap& copy) - : forward_map(copy.forward_map), backward_map(copy.backward_map) {} +// template +// EdgeMap(const EdgeMap& copy) +// : forward_map(copy.forward_map), backward_map(copy.backward_map) {} - template - EdgeMap& operator=(const EdgeMap& copy) { - forward_map = copy.forward_map; - backward_map = copy.backward_map; - return *this; - } +// template +// EdgeMap& operator=(const EdgeMap& copy) { +// forward_map = copy.forward_map; +// backward_map = copy.backward_map; +// return *this; +// } - void set(Edge e, T a) { - if (!e.backward) - forward_map.set(e, a); - else - backward_map.set(e, a); - } +// void set(Edge e, T a) { +// if (!e.backward) +// forward_map.set(e, a); +// else +// backward_map.set(e, a); +// } - typename Graph::template EdgeMap::ConstReference - operator[](Edge e) const { - if (!e.backward) - return forward_map[e]; - else - return backward_map[e]; - } +// typename Graph::template EdgeMap::ConstReference +// operator[](Edge e) const { +// if (!e.backward) +// return forward_map[e]; +// else +// return backward_map[e]; +// } - typename Graph::template EdgeMap::Reference - operator[](Edge e) { - if (!e.backward) - return forward_map[e]; - else - return backward_map[e]; - } +// typename Graph::template EdgeMap::Reference +// operator[](Edge e) { +// if (!e.backward) +// return forward_map[e]; +// else +// return backward_map[e]; +// } - void update() { - forward_map.update(); - backward_map.update(); - } - }; +// void update() { +// forward_map.update(); +// backward_map.update(); +// } +// }; - // KEEP_NODE_MAP(Parent, SubBidirGraphWrapper); +// // KEEP_NODE_MAP(Parent, SubBidirGraphWrapper); - }; +// }; ///\brief A wrapper for composing bidirected graph from a directed one. diff -r e619a466ca5d -r 10d378f2821c src/test/graph_wrapper_test.cc --- a/src/test/graph_wrapper_test.cc Sun Nov 14 13:15:46 2004 +0000 +++ b/src/test/graph_wrapper_test.cc Mon Nov 15 12:25:39 2004 +0000 @@ -46,15 +46,20 @@ // function_requires > >(); -// function_requires , Graph::EdgeMap > > >(); -// function_requires > > >(); -// function_requires > > >(); + checkConcept , StaticGraph::EdgeMap > >(); + checkConcept > >(); + checkConcept > >(); + + checkConcept, StaticGraph::EdgeMap > >(); -// function_requires, Graph::EdgeMap > > > (); + checkConcept >(); -// function_requires > >(); - -// function_requires, Graph::EdgeMap > > >(); + checkConcept, StaticGraph::EdgeMap > >(); // function_requires > > >(); }