.
1.1 --- a/src/work/marci/graph_wrapper.h Mon Mar 22 10:21:30 2004 +0000
1.2 +++ b/src/work/marci/graph_wrapper.h Mon Mar 22 12:17:44 2004 +0000
1.3 @@ -103,7 +103,7 @@
1.4 typedef typename GraphWrapper::EdgeIt EdgeIt;
1.5
1.6 //GraphWrapperSkeleton() : gw() { }
1.7 - GraphWrapperSkeleton(GraphWrapper& _gw) : gw(_gw) { }
1.8 + GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { }
1.9
1.10 void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
1.11 BaseGraph& getGraph() const { return gw.getGraph(); }
1.12 @@ -160,87 +160,173 @@
1.13 };
1.14 };
1.15
1.16 +// template<typename Graph>
1.17 +// class RevGraphWrapper
1.18 +// {
1.19 +// protected:
1.20 +// Graph* graph;
1.21 +
1.22 +// public:
1.23 +// typedef Graph BaseGraph;
1.24 +
1.25 +// typedef typename Graph::Node Node;
1.26 +// typedef typename Graph::NodeIt NodeIt;
1.27 +
1.28 +// typedef typename Graph::Edge Edge;
1.29 +// typedef typename Graph::OutEdgeIt InEdgeIt;
1.30 +// typedef typename Graph::InEdgeIt OutEdgeIt;
1.31 +// //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.32 +// typedef typename Graph::EdgeIt EdgeIt;
1.33 +
1.34 +// //RevGraphWrapper() : graph(0) { }
1.35 +// RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
1.36 +
1.37 +// void setGraph(Graph& _graph) { graph = &_graph; }
1.38 +// Graph& getGraph() const { return (*graph); }
1.39 +
1.40 +// template<typename I> I& first(I& i) const { return graph->first(i); }
1.41 +// template<typename I, typename P> I& first(I& i, const P& p) const {
1.42 +// return graph->first(i, p); }
1.43 +
1.44 +// template<typename I> I getNext(const I& i) const {
1.45 +// return graph->getNext(i); }
1.46 +// template<typename I> I& next(I &i) const { return graph->next(i); }
1.47 +
1.48 +// template< typename It > It first() const {
1.49 +// It e; first(e); return e; }
1.50 +
1.51 +// template< typename It > It first(const Node& v) const {
1.52 +// It e; first(e, v); return e; }
1.53 +
1.54 +// Node head(const Edge& e) const { return graph->tail(e); }
1.55 +// Node tail(const Edge& e) const { return graph->head(e); }
1.56 +
1.57 +// template<typename I> bool valid(const I& i) const
1.58 +// { return graph->valid(i); }
1.59 +
1.60 +// //template<typename I> void setInvalid(const I &i);
1.61 +// //{ return graph->setInvalid(i); }
1.62 +
1.63 +// template<typename I> Node aNode(const I& e) const {
1.64 +// return graph->aNode(e); }
1.65 +// template<typename I> Node bNode(const I& e) const {
1.66 +// return graph->bNode(e); }
1.67 +
1.68 +// Node addNode() const { return graph->addNode(); }
1.69 +// Edge addEdge(const Node& tail, const Node& head) const {
1.70 +// return graph->addEdge(tail, head); }
1.71 +
1.72 +// int nodeNum() const { return graph->nodeNum(); }
1.73 +// int edgeNum() const { return graph->edgeNum(); }
1.74 +
1.75 +// template<typename I> void erase(const I& i) const { graph->erase(i); }
1.76 +
1.77 +// void clear() const { graph->clear(); }
1.78 +
1.79 +// template<typename T> class NodeMap : public Graph::NodeMap<T> {
1.80 +// public:
1.81 +// NodeMap(const RevGraphWrapper<Graph>& _G) :
1.82 +// Graph::NodeMap<T>(_G.getGraph()) { }
1.83 +// NodeMap(const RevGraphWrapper<Graph>& _G, T a) :
1.84 +// Graph::NodeMap<T>(_G.getGraph(), a) { }
1.85 +// };
1.86 +
1.87 +// template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
1.88 +// public:
1.89 +// EdgeMap(const RevGraphWrapper<Graph>& _G) :
1.90 +// Graph::EdgeMap<T>(_G.getGraph()) { }
1.91 +// EdgeMap(const RevGraphWrapper<Graph>& _G, T a) :
1.92 +// Graph::EdgeMap<T>(_G.getGraph(), a) { }
1.93 +// };
1.94 +// };
1.95 +
1.96 template<typename Graph>
1.97 - class RevGraphWrapper
1.98 - {
1.99 + class RevGraphWrapper :
1.100 + public GraphWrapperSkeleton< TrivGraphWrapper<Graph> > {
1.101 protected:
1.102 - Graph* graph;
1.103 + //Graph* graph;
1.104 +
1.105 + public:
1.106 + //typedef Graph BaseGraph;
1.107 +
1.108 + //typedef typename Graph::Node Node;
1.109 + //typedef typename Graph::NodeIt NodeIt;
1.110
1.111 - public:
1.112 - typedef Graph BaseGraph;
1.113 -
1.114 - typedef typename Graph::Node Node;
1.115 - typedef typename Graph::NodeIt NodeIt;
1.116 -
1.117 - typedef typename Graph::Edge Edge;
1.118 - typedef typename Graph::OutEdgeIt InEdgeIt;
1.119 - typedef typename Graph::InEdgeIt OutEdgeIt;
1.120 + //typedef typename Graph::Edge Edge;
1.121 + typedef typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::OutEdgeIt InEdgeIt;
1.122 + typedef typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::InEdgeIt OutEdgeIt;
1.123 //typedef typename Graph::SymEdgeIt SymEdgeIt;
1.124 - typedef typename Graph::EdgeIt EdgeIt;
1.125 + //typedef typename Graph::EdgeIt EdgeIt;
1.126
1.127 //RevGraphWrapper() : graph(0) { }
1.128 - RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
1.129 + RevGraphWrapper(Graph& _graph) : GraphWrapperSkeleton< TrivGraphWrapper<Graph> >(TrivGraphWrapper<Graph>(_graph)) { }
1.130 +
1.131 + //void setGraph(Graph& _graph) { graph = &_graph; }
1.132 + //Graph& getGraph() const { return (*graph); }
1.133 +
1.134 + //template<typename I> I& first(I& i) const { return graph->first(i); }
1.135 + //template<typename I, typename P> I& first(I& i, const P& p) const {
1.136 + // return graph->first(i, p); }
1.137
1.138 - void setGraph(Graph& _graph) { graph = &_graph; }
1.139 - Graph& getGraph() const { return (*graph); }
1.140 -
1.141 - template<typename I> I& first(I& i) const { return graph->first(i); }
1.142 - template<typename I, typename P> I& first(I& i, const P& p) const {
1.143 - return graph->first(i, p); }
1.144 + //template<typename I> I getNext(const I& i) const {
1.145 + // return graph->getNext(i); }
1.146 + //template<typename I> I& next(I &i) const { return graph->next(i); }
1.147
1.148 - template<typename I> I getNext(const I& i) const {
1.149 - return graph->getNext(i); }
1.150 - template<typename I> I& next(I &i) const { return graph->next(i); }
1.151 + //template< typename It > It first() const {
1.152 + // It e; first(e); return e; }
1.153
1.154 - template< typename It > It first() const {
1.155 - It e; first(e); return e; }
1.156 + //template< typename It > It first(const Node& v) const {
1.157 + // It e; first(e, v); return e; }
1.158
1.159 - template< typename It > It first(const Node& v) const {
1.160 - It e; first(e, v); return e; }
1.161 -
1.162 - Node head(const Edge& e) const { return graph->tail(e); }
1.163 - Node tail(const Edge& e) const { return graph->head(e); }
1.164 + //Node head(const Edge& e) const { return graph->tail(e); }
1.165 + //Node tail(const Edge& e) const { return graph->head(e); }
1.166
1.167 - template<typename I> bool valid(const I& i) const
1.168 - { return graph->valid(i); }
1.169 + //template<typename I> bool valid(const I& i) const
1.170 + // { return graph->valid(i); }
1.171
1.172 //template<typename I> void setInvalid(const I &i);
1.173 //{ return graph->setInvalid(i); }
1.174
1.175 - template<typename I> Node aNode(const I& e) const {
1.176 - return graph->aNode(e); }
1.177 - template<typename I> Node bNode(const I& e) const {
1.178 - return graph->bNode(e); }
1.179 + //template<typename I> Node aNode(const I& e) const {
1.180 + // return graph->aNode(e); }
1.181 + //template<typename I> Node bNode(const I& e) const {
1.182 + // return graph->bNode(e); }
1.183
1.184 - Node addNode() const { return graph->addNode(); }
1.185 - Edge addEdge(const Node& tail, const Node& head) const {
1.186 - return graph->addEdge(tail, head); }
1.187 + //Node addNode() const { return graph->addNode(); }
1.188 + //Edge addEdge(const Node& tail, const Node& head) const {
1.189 + // return graph->addEdge(tail, head); }
1.190
1.191 - int nodeNum() const { return graph->nodeNum(); }
1.192 - int edgeNum() const { return graph->edgeNum(); }
1.193 + //int nodeNum() const { return graph->nodeNum(); }
1.194 + //int edgeNum() const { return graph->edgeNum(); }
1.195
1.196 - template<typename I> void erase(const I& i) const { graph->erase(i); }
1.197 + //template<typename I> void erase(const I& i) const { graph->erase(i); }
1.198
1.199 - void clear() const { graph->clear(); }
1.200 + //void clear() const { graph->clear(); }
1.201
1.202 - template<typename T> class NodeMap : public Graph::NodeMap<T> {
1.203 + template<typename T> class NodeMap :
1.204 + public GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T>
1.205 + {
1.206 public:
1.207 NodeMap(const RevGraphWrapper<Graph>& _G) :
1.208 - Graph::NodeMap<T>(_G.getGraph()) { }
1.209 + GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T>(_G) { }
1.210 NodeMap(const RevGraphWrapper<Graph>& _G, T a) :
1.211 - Graph::NodeMap<T>(_G.getGraph(), a) { }
1.212 + GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T>(_G, a) { }
1.213 };
1.214 -
1.215 - template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
1.216 +
1.217 + template<typename T> class EdgeMap :
1.218 + public GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T> {
1.219 public:
1.220 EdgeMap(const RevGraphWrapper<Graph>& _G) :
1.221 - Graph::EdgeMap<T>(_G.getGraph()) { }
1.222 + GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T>(_G) { }
1.223 EdgeMap(const RevGraphWrapper<Graph>& _G, T a) :
1.224 - Graph::EdgeMap<T>(_G.getGraph(), a) { }
1.225 + GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T>(_G, a) { }
1.226 };
1.227 };
1.228
1.229
1.230 +
1.231 +
1.232 +
1.233 template<typename Graph>
1.234 class UndirGraphWrapper {
1.235 protected: