.
1.1 --- a/doc/etikol.texi Mon Feb 09 13:11:10 2004 +0000
1.2 +++ b/doc/etikol.texi Tue Feb 10 13:29:15 2004 +0000
1.3 @@ -1,5 +1,5 @@
1.4 \input texinfo @c -*-texinfo-*-
1.5 -@comment $Id: etikol.texi,v 1.4 2004/01/21 08:39:33 alpar Exp $
1.6 +@comment $Id: etikol.texi,v 1.5 2004/02/10 13:29:15 alpar Exp $
1.7 @comment %**start of header
1.8 @setfilename etikol.info
1.9 @include version.texi
1.10 @@ -35,26 +35,26 @@
1.11
1.12 @comment %**end of header
1.13
1.14 -@c @copying
1.15 -@c This manual is for GNU ETIL-OL Optimization Library
1.16 -@c (version @value{VERSION}, @value{UPDATED}).
1.17 +@copying
1.18 +This manual is for GNU ETIL-OL Optimization Library
1.19 +(version @value{VERSION}, @value{UPDATED}).
1.20
1.21 -@c Copyright @copyright{} 2003 ETIK.
1.22 +Copyright @copyright{} 2003 ETIK.
1.23
1.24 -@c @quotation
1.25 -@c Permission is granted to copy, distribute and/or modify this document
1.26 -@c under the terms of the GNU Free Documentation License, Version 1.1 or
1.27 -@c any later version published by the Free Software Foundation; with no
1.28 -@c Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
1.29 -@c and with the Back-Cover Texts as in (a) below. A copy of the
1.30 -@c license is included in the section entitled ``GNU Free Documentation
1.31 -@c License.''
1.32 +@quotation
1.33 +Permission is granted to copy, distribute and/or modify this document
1.34 +under the terms of the GNU Free Documentation License, Version 1.1 or
1.35 +any later version published by the Free Software Foundation; with no
1.36 +Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
1.37 +and with the Back-Cover Texts as in (a) below. A copy of the
1.38 +license is included in the section entitled ``GNU Free Documentation
1.39 +License.''
1.40
1.41 -@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
1.42 -@c this GNU Manual, like GNU software. Copies published by the Free
1.43 -@c Software Foundation raise funds for GNU development.''
1.44 -@c @end quotation
1.45 -@c @end copying
1.46 +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
1.47 +this GNU Manual, like GNU software. Copies published by the Free
1.48 +Software Foundation raise funds for GNU development.''
1.49 +@end quotation
1.50 +@end copying
1.51
1.52 @dircategory Texinfo documentation system
1.53 @direntry
2.1 --- a/doc/flf-graph.texi Mon Feb 09 13:11:10 2004 +0000
2.2 +++ b/doc/flf-graph.texi Tue Feb 10 13:29:15 2004 +0000
2.3 @@ -27,45 +27,45 @@
2.4 @end deftp
2.5
2.6 @anchor{Graph-NodeIterator}
2.7 -@deftp {Type} Graph::NodePoint
2.8 +@deftp {Type} Graph::NodeIt
2.9 @deftpx {Type} Graph::NodeIterator
2.10 These types points a node uniquely. The difference between the
2.11 -@code{NodePoint} and the @code{NodeIterator} is that @code{NodePoint}
2.12 +@code{NodeIt} and the @code{NodeIterator} is that @code{NodeIt}
2.13 requires the graph structure itself for most of the operations.
2.14 For examples using iterators you can go through all nodes as follows.
2.15 @quotation
2.16 @verbatim
2.17 Graph G;
2.18 int nodenum=0;
2.19 -for(Graph::NodeIterator n(G);n.Valid();++n) ++nodenum;
2.20 +for(Graph::NodeIterator n(G);n.valid();++n) ++nodenum;
2.21 @end verbatim
2.22 @end quotation
2.23 -Using @code{NodePoint} the last line looks like this.
2.24 +Using @code{NodeIt} the last line looks like this.
2.25 @quotation
2.26 @verbatim
2.27 -for(MyGraph::NodePoint n(G);n.Valid();n=G.Next(n)) ++nodenum;
2.28 +for(Graph::NodeIt n(G);n.valid();n=G.next(n)) ++nodenum;
2.29 @end verbatim
2.30 @end quotation
2.31 or
2.32 @quotation
2.33 @verbatim
2.34 -MyGraph::NodePoint n;
2.35 -for(G.GetFirst(n);G.Valid(n);G.GoNext(n)) ++nodenum;
2.36 +MyGraph::NodeIt n;
2.37 +for(G.getFirst(n);G.valid(n);G.goNext(n)) ++nodenum;
2.38 @end verbatim
2.39 @end quotation
2.40 @end deftp
2.41
2.42 -@deftp {Type} Graph::EdgePoint
2.43 -@deftpx {Type} Graph::InEdgePoint
2.44 -@deftpx {Type} Graph::OutEdgePoint
2.45 -@deftpx {Type} Graph::BiEdgePoint
2.46 -@deftpx {Type} Graph::SymEdgePoint
2.47 +@deftp {Type} Graph::EdgeIt
2.48 +@deftpx {Type} Graph::InEdgeIt
2.49 +@deftpx {Type} Graph::OutEdgeIt
2.50 +@deftpx {Type} Graph::BiEdgeIt
2.51 +@deftpx {Type} Graph::SymEdgeIt
2.52 Each of these types points an edge uniquely. The difference between the
2.53 -@code{EdgePoint} and the
2.54 +@code{EdgeIt} and the
2.55 @c @mref{Graph-NodeIterator,@code{EdgeIterator}}
2.56 @mref{Graph-NodeIterator , EdgeIterator}
2.57 series is that
2.58 -@code{EdgePoint} requires the graph structure itself for most of the
2.59 +@code{EdgeIt} requires the graph structure itself for most of the
2.60 operations.
2.61 @end deftp
2.62
2.63 @@ -75,10 +75,10 @@
2.64 @deftpx {Type} Graph::OutEdgeIterator
2.65 @deftpx {Type} Graph::BiEdgeIterator
2.66 @deftpx {Type} Graph::SymEdgeIterator
2.67 -@deftpx {Type} Graph::AllEdgeIterator
2.68 +@deftpx {Type} Graph::EachEdgeIterator
2.69 Each of these types points an edge uniquely. The difference between the
2.70 -@code{EdgePoint} and the @code{EdgeIterator} series is that
2.71 -@code{EdgePoint} requires the graph structure itself for most of the
2.72 +@code{EdgeIt} and the @code{EdgeIterator} series is that
2.73 +@code{EdgeIt} requires the graph structure itself for most of the
2.74 operations.
2.75
2.76 For the @code{EdgeIterator} types you can use operator @code{++}
2.77 @@ -107,118 +107,118 @@
2.78
2.79 @subsubsection Graph Maintenence Operations
2.80
2.81 -@deftypefun NodeIterator Graph::AddNode ()
2.82 +@deftypefun NodeIterator Graph::addNode ()
2.83 Adds a new node to the graph and returns a @code{NodeIterator} pointing to it.
2.84 @end deftypefun
2.85
2.86 -@deftypefun EdgeIterator Graph::AddEdge (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{from}}, @w{const @mref{Graph-NodeIterator,NodeIterator} @var{to}})
2.87 +@deftypefun EdgeIterator Graph::addEdge (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{from}}, @w{const @mref{Graph-NodeIterator,NodeIterator} @var{to}})
2.88 Adds a new edge with tail @var{from} and head @var{to} to the graph
2.89 and returns an @code{EdgeIterator} pointing to it.
2.90 @end deftypefun
2.91
2.92 -@deftypefun void Graph::Delete (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{n}})
2.93 +@deftypefun void Graph::delete (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{n}})
2.94 Deletes the node @var{n}. It also deletes the adjacent edges.
2.95 @end deftypefun
2.96
2.97 -@deftypefun void Graph::Delete (@w{const @mref{Graph-EdgeIterator,EdgeIterator} @var{e}})
2.98 +@deftypefun void Graph::delete (@w{const @mref{Graph-EdgeIterator,EdgeIterator} @var{e}})
2.99 Deletes the edge @var{n}.
2.100 @end deftypefun
2.101
2.102 -@deftypefun void Graph::Clean ()
2.103 +@deftypefun void Graph::clean ()
2.104 Deletes all edges and nodes from the graph.
2.105 @end deftypefun
2.106
2.107 -@deftypefun int Graph::NodeNum ()
2.108 +@deftypefun int Graph::nodeNum ()
2.109 Returns the number of the nodes in the graph.
2.110 @end deftypefun
2.111
2.112 -@subsubsection NodePoint Operations
2.113 +@subsubsection NodeIt Operations
2.114
2.115 -@deftypefun NodePoint Graph::GetFirst (NodePoint &@var{n})
2.116 -@deftypefunx NodePoint Graph::Next (const NodePoint @var{n})
2.117 -@deftypefunx {NodePoint &} Graph::GoNext (NodePoint &@var{n})
2.118 +@deftypefun NodeIt Graph::getFirst (NodeIt &@var{n})
2.119 +@deftypefunx NodeIt Graph::next (const NodeIt @var{n})
2.120 +@deftypefunx {NodeIt &} Graph::goNext (NodeIt &@var{n})
2.121 The nodes in the graph forms a list. @code{GetFirst(n)} sets @var{n} to
2.122 -be the first node. @code{Next(n)} gives back the subsequent
2.123 +be the first node. @code{next(n)} gives back the subsequent
2.124 node. @code{Next(n)} is equivalent to @code{n=Next(n)}, though it
2.125 might be faster. ??? What should be the return value ???
2.126 @end deftypefun
2.127
2.128 -@deftypefun bool Graph::Valid (NodePoint &@var{e})
2.129 -@deftypefunx bool NodePoint::Valid ()
2.130 -These functions check if and NodePoint is valid or not.
2.131 +@deftypefun bool Graph::valid (NodeIt &@var{e})
2.132 +@deftypefunx bool NodeIt::valid ()
2.133 +These functions check if and NodeIt is valid or not.
2.134 ??? Which one should be implemented ???
2.135 @end deftypefun
2.136
2.137 -@subsubsection EdgePoint Operations
2.138 +@subsubsection EdgeIt Operations
2.139
2.140 -@deftypefun AllEdgePoint Graph::GetFirst (const AllEdgePoint & @var{e})
2.141 -@deftypefunx AllEdgePoint Graph::Next (const AllEdgePoint @var{n})
2.142 -@deftypefunx {AllEdgePoint &} Graph::GoNext (AllEdgePoint &@var{n})
2.143 +@deftypefun EachEdgeIt Graph::getFirst (const EachEdgeIt & @var{e})
2.144 +@deftypefunx EachEdgeIt Graph::next (const EachEdgeIt @var{n})
2.145 +@deftypefunx {EachEdgeIt &} Graph::goNext (EachEdgeIt &@var{n})
2.146 With these functions you can go though all the edges of the graph.
2.147 ??? What should be the return value ???
2.148 @end deftypefun
2.149
2.150 -@deftypefun InEdgePoint Graph::GetFirst (const InEdgePoint & @var{e}, const NodePoint @var{n})
2.151 -@deftypefunx OutEdgePoint Graph::GetFirst (const OutEdgePoint & @var{e}, const NodePoint @var{n})
2.152 -@deftypefunx SymEdgePoint Graph::GetFirst (const SymEdgePoint & @var{e}, const NodePoint @var{n})
2.153 +@deftypefun InEdgeIt Graph::getFirst (const InEdgeIt & @var{e}, const NodeIt @var{n})
2.154 +@deftypefunx OutEdgeIt Graph::getFirst (const OutEdgeIt & @var{e}, const NodeIt @var{n})
2.155 +@deftypefunx SymEdgeIt Graph::getFirst (const SymEdgeIt & @var{e}, const NodeIt @var{n})
2.156 The edges leaving from, arriving at or adjacent with a node forms a
2.157 list. These functions give back the first elements of these
2.158 lists. The exact behavior depends on the type of @var{e}.
2.159
2.160 -If @var{e} is an @code{InEdgePoint} or an @code{OutEdgePoint} then
2.161 -@code{GetFirst} sets @var{e} to be the first incoming or outgoing edge
2.162 +If @var{e} is an @code{InEdgeIt} or an @code{OutEdgeIt} then
2.163 +@code{getFirst} sets @var{e} to be the first incoming or outgoing edge
2.164 of the node @var{n}, respectively.
2.165
2.166 -If @var{e} is a @code{SymEdgePoint} then
2.167 -@code{GetFirst} sets @var{e} to be the first incoming if there exists one
2.168 +If @var{e} is a @code{SymEdgeIt} then
2.169 +@code{getFirst} sets @var{e} to be the first incoming if there exists one
2.170 otherwise the first outgoing edge.
2.171
2.172 If there are no such edges, @var{e} will be invalid.
2.173
2.174 @end deftypefun
2.175
2.176 -@deftypefun InEdgePoint Graph::Next (const InEdgePoint @var{e})
2.177 -@deftypefunx OutEdgePoint Graph::Next (const OutEdgePoint @var{e})
2.178 -@deftypefunx SymEdgePoint Graph::Next (const SymEdgePoint @var{e})
2.179 +@deftypefun InEdgeIt Graph::next (const InEdgeIt @var{e})
2.180 +@deftypefunx OutEdgeIt Graph::next (const OutEdgeIt @var{e})
2.181 +@deftypefunx SymEdgeIt Graph::next (const SymEdgeIt @var{e})
2.182 These functions give back the edge that follows @var{e}
2.183 @end deftypefun
2.184
2.185 -@deftypefun {InEdgePoint &} Graph::GoNext (InEdgePoint &@var{e})
2.186 -@deftypefunx {OutEdgePoint &} Graph::GoNext (OutEdgePoint &@var{e})
2.187 -@deftypefunx {SymEdgePoint &} Graph::GoNext (SymEdgePoint &@var{e})
2.188 -@code{G.GoNext(e)} is equivalent to @code{e=G.Next(e)}, though it
2.189 +@deftypefun {InEdgeIt &} Graph::goNext (InEdgeIt &@var{e})
2.190 +@deftypefunx {OutEdgeIt &} Graph::goNext (OutEdgeIt &@var{e})
2.191 +@deftypefunx {SymEdgeIt &} Graph::goNext (SymEdgeIt &@var{e})
2.192 +@code{G.goNext(e)} is equivalent to @code{e=G.next(e)}, though it
2.193 might be faster.
2.194 ??? What should be the return value ???
2.195 @end deftypefun
2.196
2.197 -@deftypefun bool Graph::Valid (EdgePoint &@var{e})
2.198 -@deftypefunx bool EdgePoint::Valid ()
2.199 -These functions check if and EdgePoint is valid or not.
2.200 +@deftypefun bool Graph::valid (EdgeIt &@var{e})
2.201 +@deftypefunx bool EdgeIt::valid ()
2.202 +These functions check if and EdgeIt is valid or not.
2.203 ??? Which one should be implemented ???
2.204 @end deftypefun
2.205
2.206 -@deftypefun NodePoint Graph::From (const EdgePoint @var{e})
2.207 -@deftypefunx NodePoint Graph::To (const EdgePoint @var{e})
2.208 -@deftypefunx NodePoint Graph::ANode (const InEdgePoint @var{e})
2.209 -@deftypefunx NodePoint Graph::ANode (const OutEdgePoint @var{e})
2.210 -@deftypefunx NodePoint Graph::ANode (const SymEdgePoint @var{e})
2.211 -@deftypefunx NodePoint Graph::BNode (const InEdgePoint @var{e})
2.212 -@deftypefunx NodePoint Graph::BNode (const OutEdgePoint @var{e})
2.213 -@deftypefunx NodePoint Graph::BNode (const SymEdgePoint @var{e})
2.214 +@deftypefun NodeIt Graph::tail (const EdgeIt @var{e})
2.215 +@deftypefunx NodeIt Graph::head (const EdgeIt @var{e})
2.216 +@deftypefunx NodeIt Graph::aNode (const InEdgeIt @var{e})
2.217 +@deftypefunx NodeIt Graph::aNode (const OutEdgeIt @var{e})
2.218 +@deftypefunx NodeIt Graph::aNode (const SymEdgeIt @var{e})
2.219 +@deftypefunx NodeIt Graph::bNode (const InEdgeIt @var{e})
2.220 +@deftypefunx NodeIt Graph::bNode (const OutEdgeIt @var{e})
2.221 +@deftypefunx NodeIt Graph::bNode (const SymEdgeIt @var{e})
2.222 There queries give back the two endpoints of the edge @var{e}. For a
2.223 -directed edge @var{e}, @code{From(e)} and @code{To(e)} is its tail and
2.224 +directed edge @var{e}, @code{tail(e)} and @code{head(e)} is its tail and
2.225 its head, respectively. For an undirected @var{e}, they are two
2.226 endpoints, but you should not rely on which end is which.
2.227
2.228 -@code{ANode(e)} is the node which @var{e} is bounded to, i.e. it is
2.229 -equal to @code{From(e)} if @var{e} is an @code{OutEdgePoint} and
2.230 -@code{To(e)} if @var{e} is an @code{InEdgePoint}. If @var{e} is a
2.231 -@code{SymEdgePoint} and it or its first preceding edge was created by
2.232 -@code{GetFirst(e,n)}, then @code{ANode(e)} is equal to @var{n}.
2.233 +@code{aNode(e)} is the node which @var{e} is bounded to, i.e. it is
2.234 +equal to @code{tail(e)} if @var{e} is an @code{OutEdgeIt} and
2.235 +@code{head(e)} if @var{e} is an @code{InEdgeIt}. If @var{e} is a
2.236 +@code{SymEdgeIt} and it or its first preceding edge was created by
2.237 +@code{getFirst(e,n)}, then @code{aNode(e)} is equal to @var{n}.
2.238
2.239 -@code{BNode(e)} is the other end of the edge.
2.240 +@code{bNode(e)} is the other end of the edge.
2.241
2.242 -???It it implemented in an other way now. (Member function <-> Graph global)???
2.243 +???It is implemented in an other way now. (Member function <-> Graph global)???
2.244 @end deftypefun
2.245
2.246
3.1 --- a/src/include/graph.h Mon Feb 09 13:11:10 2004 +0000
3.2 +++ b/src/include/graph.h Tue Feb 10 13:29:15 2004 +0000
3.3 @@ -18,19 +18,21 @@
3.4 typedef E EdgeType;
3.5 typedef N NodeType;
3.6
3.7 - class EdgePoint
3.8 + class EdgeIt
3.9 {
3.10 public:
3.11 NEGRO::EdgePoint e;
3.12 - bool isValid() { return e; }
3.13 + bool valid() { return e; }
3.14 };
3.15
3.16 - class InEdgePoint : public EdgePoint {};
3.17 - class OutEdgePoint : public EdgePoint {};
3.18 - class BiEdgePoint : public EdgePoint {};
3.19 - class SymEdgePoint : public EdgePoint {};
3.20 + class InEdgeIt : public EdgeIt {};
3.21 + class OutEdgeIt : public EdgeIt {};
3.22 + class BiEdgeIt : public EdgeIt {};
3.23 + class SymEdgeIt : public EdgeIt {};
3.24
3.25 - typedef int NodePoint;
3.26 + typedef int NodeIt;
3.27 +
3.28 + typedef NodeIt EachNodeIt;
3.29
3.30 class NodeIterator;
3.31
3.32 @@ -49,7 +51,7 @@
3.33 friend class OutEdgeIterator;
3.34 friend class BiEdgeIterator;
3.35 friend class SymEdgeIterator;
3.36 - friend class AllEdgeIterator;
3.37 + friend class EachEdgeIterator;
3.38
3.39 class NodeIterator
3.40 {
3.41 @@ -62,12 +64,12 @@
3.42 {G=&Gr;n=Gr.OldGraph<N,E>::FirstNode();}
3.43 NodeIterator(const NodeIterator &i) {G=i.G;n=i.n;}
3.44
3.45 - NodeIterator &GoNext() { n=G->NextNode(n); return *this;}
3.46 - NodeIterator Next() const { return NodeIterator(*this).GoNext();}
3.47 - NodeIterator &operator++() { return GoNext();}
3.48 + NodeIterator &goNext() { n=G->NextNode(n); return *this;}
3.49 + NodeIterator next() const { return NodeIterator(*this).goNext();}
3.50 + NodeIterator &operator++() { return goNext();}
3.51 NodeIterator operator++(int)
3.52 - {NodeIterator tmp(*this); GoNext(); return tmp;}
3.53 - bool isValid() { return n!=INVALID; }
3.54 + {NodeIterator tmp(*this); goNext(); return tmp;}
3.55 + bool valid() { return n!=INVALID; }
3.56
3.57 N &operator*() const { return G->Data(n); }
3.58 N *operator->() const { return &G->Data(n); }
3.59 @@ -75,14 +77,14 @@
3.60 bool operator==(const NodeIterator &i) const {return n==i.n;}
3.61 bool operator!=(const NodeIterator &i) const {return n!=i.n;}
3.62
3.63 - int Index() const { return n; } //If the nodes are indexable
3.64 + int index() const { return n; } //If the nodes are indexable
3.65 friend class Graph;
3.66 friend class EdgeIterator;
3.67 friend class InEdgeIterator;
3.68 friend class OutEdgeIterator;
3.69 friend class BiEdgeIterator;
3.70 friend class SymEdgeIterator;
3.71 - friend class AllEdgeIterator;
3.72 + friend class EachEdgeIterator;
3.73 friend class FirstAnythingTypeNode;
3.74
3.75 //Nem kellene egy:
3.76 @@ -96,7 +98,7 @@
3.77 //Ez csak kicsit baj, de:
3.78 // Meg a From() es To() miatt!!!!!!!!!!
3.79
3.80 - NEGRO::EdgePoint e;
3.81 + NEGRO::EdgeIt e;
3.82
3.83 public:
3.84 EdgeIterator() {;} //Kell inicializalni? (Nem)
3.85 @@ -104,10 +106,12 @@
3.86
3.87 // Lehet, hogy ez a ketto nem kell!!!
3.88
3.89 - NodeIterator From() const {NodeIterator i;i.G=G;i.n=e->From();return i;}
3.90 - NodeIterator To() const {NodeIterator i;i.G=G;i.n=e->To();return i;}
3.91 + NodeIterator tail() const {NodeIterator i;i.G=G;i.n=e->From();return i;}
3.92 + NodeIterator head() const {NodeIterator i;i.G=G;i.n=e->To();return i;}
3.93 + NodeIterator opposite(const NodeIterator &n) const
3.94 + {return n==tail()?head():tail();}
3.95
3.96 - bool isValid() {return e;}
3.97 + bool valid() {return e;}
3.98 E &operator*() const { return G->Data(e); }
3.99 E *operator->() const { return &G->Data(e); }
3.100
3.101 @@ -119,7 +123,7 @@
3.102 bool operator==(const EdgeIterator &i) const {return e==i.e;}
3.103 bool operator!=(const EdgeIterator &i) const {return e!=i.e;}
3.104
3.105 - int Index() const { return e.index.block*EDGE_BLOCK_SIZE+e.index.index; }
3.106 + int Index() const {return e->index.block*EDGE_BLOCK_SIZE+e->index.index;}
3.107 //If the edges are indexable
3.108
3.109 friend class Graph;
3.110 @@ -127,16 +131,16 @@
3.111 friend class OutEdgeIterator;
3.112 friend class BiEdgeIterator;
3.113 friend class SymEdgeIterator;
3.114 - friend class AllEdgeIterator;
3.115 + friend class EachEdgeIterator;
3.116 };
3.117
3.118 class BiEdgeIterator : public EdgeIterator
3.119 {
3.120 public:
3.121 - BiEdgeIterator &GoNextIn() { e=e->NextIn(); return *this;}
3.122 - BiEdgeIterator &GoNextOut() { e=e->NextOut(); return *this;}
3.123 - BiEdgeIterator NextIn() const {return BiEdgeIterator(*this).GoNextIn();}
3.124 - BiEdgeIterator NextOut() const {return BiEdgeIterator(*this).GoNextOut();}
3.125 + BiEdgeIterator &goNextIn() { e=e->NextIn(); return *this;}
3.126 + BiEdgeIterator &goNextOut() { e=e->NextOut(); return *this;}
3.127 + BiEdgeIterator nextIn() const {return BiEdgeIterator(*this).goNextIn();}
3.128 + BiEdgeIterator nextOut() const {return BiEdgeIterator(*this).goNextOut();}
3.129
3.130 operator InEdgeIterator ()
3.131 {InEdgeIterator i; i.G=G;i.e=e;return i;}
3.132 @@ -152,7 +156,7 @@
3.133 {
3.134 public:
3.135 InEdgeIterator() {}
3.136 - InEdgeIterator(const Graph<N,E> &Gr,const NodeIterator &n)
3.137 + InEdgeIterator(Graph<N,E> &Gr,const NodeIterator &n)
3.138 { G=&Gr; e=Gr.OldGraph<N,E>::FirstIn(n.n);}
3.139
3.140 InEdgeIterator &GoNext() { e=e->NextIn(); return *this;}
3.141 @@ -180,14 +184,14 @@
3.142 OutEdgeIterator(Graph<N,E> &Gr,const NodeIterator &n)
3.143 { G=&Gr; e=Gr.OldGraph<N,E>::FirstOut(n.n);}
3.144
3.145 - OutEdgeIterator &GoNext() { e=e->NextOut(); return *this;}
3.146 - OutEdgeIterator Next() const {return OutEdgeIterator(*this).GoNext();}
3.147 - OutEdgeIterator &operator++() { return GoNext();}
3.148 + OutEdgeIterator &goNext() { e=e->NextOut(); return *this;}
3.149 + OutEdgeIterator next() const {return OutEdgeIterator(*this).goNext();}
3.150 + OutEdgeIterator &operator++() { return goNext();}
3.151 OutEdgeIterator operator++(int)
3.152 - {OutEdgeIterator tmp(*this); GoNext(); return tmp;}
3.153 + {OutEdgeIterator tmp(*this); goNext(); return tmp;}
3.154
3.155 - NodeIterator Anode() const {return From();}
3.156 - NodeIterator Bnode() const {return To();}
3.157 + NodeIterator aNode() const {return tail();}
3.158 + NodeIterator bNode() const {return head();}
3.159
3.160 operator const InEdgeIterator ()
3.161 {InEdgeIterator i; i.G=G;i.e=e;return i;}
3.162 @@ -204,17 +208,17 @@
3.163
3.164 public:
3.165 SymEdgeIterator() {}
3.166 - SymEdgeIterator(const Graph<N,E> &Gr,const NodeIterator &nn)
3.167 - { G=&Gr; n=nn; e=Gr.FirstSym(nn.n); }
3.168 + SymEdgeIterator(Graph<N,E> &Gr,const NodeIterator &nn)
3.169 + { G=&Gr; n=nn; e=Gr.OldGraph<N,E>::FirstEdge(nn.n); }
3.170
3.171 - SymEdgeIterator &GoNext() { e=e->NextEdge(n.n); return *this;}
3.172 - SymEdgeIterator Next() const {return SymEdgeIterator(*this).GoNext();}
3.173 - SymEdgeIterator &operator++() { return GoNext();}
3.174 + SymEdgeIterator &goNext() { e=G->NextEdge(n.n,e); return *this;}
3.175 + SymEdgeIterator next() const {return SymEdgeIterator(*this).goNext();}
3.176 + SymEdgeIterator &operator++() { return goNext();}
3.177 SymEdgeIterator operator++(int)
3.178 - {SymEdgeIterator tmp(*this); GoNext(); return tmp;}
3.179 + {SymEdgeIterator tmp(*this); goNext(); return tmp;}
3.180
3.181 - NodeIterator Anode() const {return n;}
3.182 - NodeIterator Bnode() const {return n.n==From().n?To():From();}
3.183 + NodeIterator aNode() const {return n;}
3.184 + NodeIterator bNode() const {return n.n==tail().n?head():tail();}
3.185
3.186 operator const InEdgeIterator ()
3.187 {InEdgeIterator i; i.G=G;i.e=e;return i;}
3.188 @@ -226,32 +230,34 @@
3.189 friend class Graph;
3.190 };
3.191
3.192 - class AllEdgeIterator : public EdgeIterator
3.193 + class EachEdgeIterator : public EdgeIterator
3.194 {
3.195 NodeIterator n; // Itt ketszer van a G
3.196
3.197 public:
3.198 - AllEdgeIterator() {}
3.199 - AllEdgeIterator(Graph<N,E> &Gr) : n(Gr)
3.200 + EachEdgeIterator() {}
3.201 + EachEdgeIterator(Graph<N,E> &Gr) : n(Gr)
3.202 {
3.203 - e=n.isValid()?Gr.OldGraph<N,E>::FirstOut(n.n):NULL;
3.204 + e=n.valid()?Gr.OldGraph<N,E>::FirstOut(n.n):NULL;
3.205 }
3.206
3.207 - AllEdgeIterator &GoNext()
3.208 + EachEdgeIterator &goNext()
3.209 {
3.210 e=e->NextOut();
3.211 - if(!e && (++n).isValid()) e=G->OldGraph<N,E>::FirstOut(n.n);
3.212 + if(!e && (++n).valid()) e=G->OldGraph<N,E>::FirstOut(n.n);
3.213 return *this;
3.214 }
3.215 - AllEdgeIterator Next() const {return AllEdgeIterator(*this).GoNext();}
3.216 - AllEdgeIterator &operator++() { return GoNext();}
3.217 - AllEdgeIterator operator++(int)
3.218 - {AllEdgeIterator tmp(*this); GoNext(); return tmp;}
3.219 + EachEdgeIterator next() const {return EachEdgeIterator(*this).goNext();}
3.220 + EachEdgeIterator &operator++() { return goNext();}
3.221 + EachEdgeIterator operator++(int)
3.222 + {EachEdgeIterator tmp(*this); goNext(); return tmp;}
3.223
3.224
3.225 - NodeIterator Anode() const {return n;}
3.226 - NodeIterator Bnode() const {return n.n==From().n?To():From();}
3.227 + NodeIterator aNode() const {return n;}
3.228 + NodeIterator bNode() const {return n.n==tail().n?head():tail();}
3.229
3.230 + operator const EdgeIterator ()
3.231 + {EdgeIterator i; i.G=G;i.e=e;return i;}
3.232 operator const InEdgeIterator ()
3.233 {InEdgeIterator i; i.G=G;i.e=e;return i;}
3.234 operator const OutEdgeIterator ()
3.235 @@ -269,55 +275,55 @@
3.236 typedef InEdgeIterator DeletingInEdgeIterator;
3.237 typedef SymEdgeIterator DeletingSymEdgeIterator;
3.238
3.239 - const NodeIterator FirstNode()
3.240 + const NodeIterator firstNode()
3.241 {
3.242 NodeIterator i;
3.243 i.G=this;i.n=OldGraph<N,E>::FirstNode();
3.244 return i;
3.245 }
3.246
3.247 - void GetFirst(NodePoint &p) { p=OldGraph<N,E>::FirstNode(); }
3.248 + void getFirst(NodeIt &p) { p=OldGraph<N,E>::FirstNode(); }
3.249
3.250 - void GetFirst(InEdgePoint &p,const NodePoint &n)
3.251 + void getFirst(InEdgeIt &p,const NodeIt &n)
3.252 { p=OldGraph<N,E>::FirstIn(n); }
3.253 - void GetFirst(OutEdgePoint &p,const NodePoint &n)
3.254 + void getFirst(OutEdgeIt &p,const NodeIt &n)
3.255 { p=OldGraph<N,E>::FirstOut(n); }
3.256 - void GetFirst(SymEdgePoint &p,const NodePoint &n)
3.257 + void getFirst(SymEdgeIt &p,const NodeIt &n)
3.258 { p=OldGraph<N,E>::FirstEdge(n); }
3.259 - void GetFirst(EdgePoint &p) //Vegigmegy mindenen
3.260 - { p.e=NodeNum()?OldGraph<N,E>::FirstOut(OldGraph<N,E>::FirstNode()):NULL;}
3.261 + void getFirst(EdgeIt &p) //Vegigmegy mindenen
3.262 + { p.e=nodeNum()?OldGraph<N,E>::FirstOut(OldGraph<N,E>::FirstNode()):NULL;}
3.263
3.264 - void GetFirst(NodeIterator &i) { i.G=this;i.n=OldGraph<N,E>::FirstNode();}
3.265 + void getFirst(NodeIterator &i) { i.G=this;i.n=OldGraph<N,E>::FirstNode();}
3.266
3.267 - void GetFirst(InEdgeIterator &i,const NodeIterator &n)
3.268 + void getFirst(InEdgeIterator &i,const NodeIterator &n)
3.269 { i.G=this;i.e=OldGraph<N,E>::FirstIn(n.n); }
3.270 - void GetFirst(OutEdgeIterator &i,const NodeIterator &n)
3.271 + void getFirst(OutEdgeIterator &i,const NodeIterator &n)
3.272 { i.G=this;i.e=OldGraph<N,E>::FirstOut(n.n); }
3.273 - void GetFirst(SymEdgeIterator &i,const NodeIterator &n)
3.274 - { i.G=this;i.e=OldGraph<N,E>::FirstSym(n.n); }
3.275 - void GetFirst(AllEdgeIterator &i) //Vegigmegy mindenen
3.276 + void getFirst(SymEdgeIterator &i,const NodeIterator &n)
3.277 + { i.G=this;i.e=OldGraph<N,E>::FirstEdge(n.n); }
3.278 + void getFirst(EachEdgeIterator &i) //Vegigmegy mindenen
3.279 {
3.280 i.G=this;
3.281 - GetFirst(i.n);
3.282 + getFirst(i.n);
3.283 i.e=OldGraph<N,E>::NodeNum()?OldGraph<N,E>::FirstOut(i.n.n):NULL;
3.284 }
3.285
3.286
3.287
3.288 //Vagy beginnode()?
3.289 - const DeletingEdgeIterator FirstOut(const NodeIterator &n)
3.290 + const DeletingEdgeIterator firstOut(const NodeIterator &n)
3.291 {
3.292 EdgeIterator i;
3.293 i.G=n.G;i.edge=n.G->OldGraph<N,E>::FirstOut(n.n);
3.294 return i;
3.295 }
3.296 - const DeletingEdgeIterator FirstIn(const NodeIterator &n)
3.297 + const DeletingEdgeIterator firstIn(const NodeIterator &n)
3.298 {
3.299 EdgeIterator i;
3.300 i.G=n.G;i.edge=n.G->OldGraph<N,E>::FirstIn(n.n);
3.301 return i;
3.302 }
3.303 - const DeletingSymEdgeIterator FirstSym(const NodeIterator &n)
3.304 + const DeletingSymEdgeIterator firstSym(const NodeIterator &n)
3.305 {
3.306 EdgeIterator i;
3.307 i.G=n.G;i.n=n.n;
3.308 @@ -341,12 +347,12 @@
3.309 operator const SymEdgeIterator () const
3.310 {SymEdgeIterator i; n.G->GetFirst(i,n);return i;}
3.311
3.312 - operator const InEdgePoint () const
3.313 - {InEdgePoint i; n.G->GetFirst(i,n);return i;}
3.314 - operator const OutEdgePoint () const
3.315 - {OutEdgePoint i; n.G->GetFirst(i,n);return i;}
3.316 - operator const SymEdgePoint () const
3.317 - {SymEdgePoint i; n.G->GetFirst(i,n);return i;}
3.318 + operator const InEdgeIt () const
3.319 + {InEdgeIt i; n.G->GetFirst(i,n);return i;}
3.320 + operator const OutEdgeIt () const
3.321 + {OutEdgeIt i; n.G->GetFirst(i,n);return i;}
3.322 + operator const SymEdgeIt () const
3.323 + {SymEdgeIt i; n.G->GetFirst(i,n);return i;}
3.324 };
3.325
3.326 class FirstAnythingType
3.327 @@ -355,31 +361,31 @@
3.328 public:
3.329 FirstAnythingType(Graph<N,E> *gg) : G(gg) {}
3.330
3.331 - operator const AllEdgeIterator () const
3.332 - {AllEdgeIterator i; G->GetFirst(i);return i;}
3.333 - operator const EdgePoint () const
3.334 - {EdgePoint i; G->GetFirst(i);return i;}
3.335 + operator const EachEdgeIterator () const
3.336 + {EachEdgeIterator i; G->GetFirst(i);return i;}
3.337 + operator const EdgeIt () const
3.338 + {EdgeIt i; G->GetFirst(i);return i;}
3.339 operator const NodeIterator () const
3.340 {NodeIterator i; G->GetFirst(i);return i;}
3.341 - operator const NodePoint () const
3.342 - {NodePoint i; G->GetFirst(i);return i;}
3.343 + operator const NodeIt () const
3.344 + {NodeIt i; G->GetFirst(i);return i;}
3.345 } _FST;
3.346
3.347 // const NodeIterator First() {NodeIterator i;GetFirst(i); return i;}
3.348 - FirstAnythingTypeNode First(NodeIterator &i)
3.349 + FirstAnythingTypeNode first(NodeIterator &i)
3.350 {FirstAnythingTypeNode t(i); return t;}
3.351 - const FirstAnythingType &First() {return _FST;}
3.352 + const FirstAnythingType &first() {return _FST;}
3.353
3.354 // LastNode() vagy endnode() stb. Nem kell?
3.355
3.356 - DeletingNodeIterator AddNode()
3.357 + DeletingNodeIterator addNode()
3.358 {
3.359 DeletingNodeIterator i;
3.360 i.G=this; i.n=OldGraph<N,E>::AddNode();
3.361 return i;
3.362 }
3.363 DeletingEdgeIterator
3.364 - AddEdge(const NodeIterator from,const NodeIterator to)
3.365 + addEdge(const NodeIterator from,const NodeIterator to)
3.366 {
3.367 DeletingEdgeIterator i;
3.368 i.G=this;i.e=OldGraph<N,E>::AddEdge(from.n,to.n);return i;
3.369 @@ -388,8 +394,8 @@
3.370 void Delete(DeletingNodeIterator n) {n.G->OldGraph<N,E>::Delete(n.n);}
3.371 void Delete(DeletingEdgeIterator e) {e.G->OldGraph<N,E>::Delete(e.e);}
3.372
3.373 - int NodeNum() { OldGraph<N,E>::NodeNum(); }
3.374 - void Clean() { OldGraph<N,E>::Clean(); }
3.375 + int nodeNum() { OldGraph<N,E>::NodeNum(); }
3.376 + void clean() { OldGraph<N,E>::Clean(); }
3.377
3.378 Graph() : _FST(this) {}
3.379
3.380 @@ -401,14 +407,14 @@
3.381
3.382 public:
3.383 typedef T value_type;
3.384 - void Put(const NodeIterator i, const T &t) {map[i.Index()]=t;}
3.385 - T Get(const NodeIterator i) const {return map[i.Index()];}
3.386 + void put(const NodeIterator i, const T &t) {map[i.Index()]=t;}
3.387 + T get(const NodeIterator i) const {return map[i.Index()];}
3.388 T operator[](NodeIterator i) {return map[i.Index()];}
3.389
3.390 void update() { map.resize(G->MaxNode());}
3.391
3.392 NodeMap() {}
3.393 - void SetG(Graph<N,E> &Gr) { G=&Gr; update();}
3.394 + void setG(Graph<N,E> &Gr) { G=&Gr; update();}
3.395 };
3.396
3.397 template<class T> class EdgeMap
3.398 @@ -418,32 +424,70 @@
3.399
3.400 public:
3.401 typedef T value_type;
3.402 - void Put(const NodeIterator i, const T &t) {map[i.Index()]=t;}
3.403 - T &Get(const NodeIterator i) {return map[i.Index()];}
3.404 - T &operator[](NodeIterator i) {return map[i.Index()];}
3.405 + void put(const EdgeIterator i, const T &t) {map[i.Index()]=t;}
3.406 + T get(const EdgeIterator i) const {return map[i.Index()];}
3.407 + T &operator[](EdgeIterator i) {return map[i.Index()];}
3.408
3.409 void update()
3.410 { map.resize(G->MaxEdge());}
3.411
3.412 EdgeMap() {}
3.413 - void SetG(Graph<N,E> &Gr)
3.414 + void setG(Graph<N,E> &Gr)
3.415 { G=&Gr ;update();}
3.416
3.417 };
3.418
3.419
3.420 - int MaxNode() { return OldGraph<N,E>::MaxNode();}
3.421 - int MaxEdge() { return ::edge_block_num*EDGE_BLOCK_SIZE;}
3.422 + int maxNode() { return OldGraph<N,E>::MaxNode();}
3.423 + int maxEdge() { return ::edge_block_num*EDGE_BLOCK_SIZE;}
3.424
3.425 };
3.426
3.427 + template <class G> //G is a graph-type
3.428 + class Path
3.429 + {
3.430 + public:
3.431 + typedef G Graph;
3.432 + typedef typename G::NodeIterator NodeIterator;
3.433 + typedef typename G::EdgeIterator EdgeIterator;
3.434 + typedef typename G::SymEdgeIterator SymEdgeIterator;
3.435 +
3.436 + private:
3.437 + std::vector<EdgeIterator> path;
3.438 + std::vector<bool> reversed;
3.439 +
3.440 + public:
3.441 + void setLength(int n) { path.resize(n);reversed.resize(n);}
3.442 + int getLength() { return path.size(); }
3.443 + EdgeIterator &operator[](int n) {return path[n];}
3.444 + NodeIterator GetNode(int n) // What about path of length 1?
3.445 + {
3.446 + return n?
3.447 + reversed[n-1]?path[n-1].tail():path[n-1].head():
3.448 + reversed[0]?path[0].head():path[0].tail();
3.449 + }
3.450 + void setRevert(int n,bool r=true) {reversed[n]=r;}
3.451 + void setEdge(int n,SymEdgeIterator i)
3.452 + {
3.453 + path[n]=i;
3.454 + reversed[n] = i.head()==i.aNode();
3.455 + }
3.456 + void setEdge(int n,EdgeIterator i,bool r)
3.457 + {
3.458 + path[n]=i;
3.459 + reversed[n] = r;
3.460 + }
3.461 +
3.462 + NodeIterator tail() { return getNode(0); }
3.463 + NodeIterator head() { return getNode(getLength()); }
3.464 + };
3.465 +
3.466 /* Ez itt a fiam kommentje:
3.467 <v n nnnnnnnnnnnnnncncccccccccccccccccvvvvvv
3.468 vvnvnvnvnvnvvnnvnvnvnnvnbbbvfffffvvffffffffffffffffffffz
3.469 << < < < < < < .cx..x.c.cc.c
3.470 mcmn
3.471 */
3.472 -
3.473 -}
3.474 +};
3.475
3.476 #endif
4.1 --- a/src/work/alpar/gwrapper.h Mon Feb 09 13:11:10 2004 +0000
4.2 +++ b/src/work/alpar/gwrapper.h Tue Feb 10 13:29:15 2004 +0000
4.3 @@ -112,6 +112,194 @@
4.4 RevGraphWrapper(G &g) {graph = &g;}
4.5 };
4.6
4.7 +template<typename G>
4.8 +class SymGraphWrapper
4.9 +{
4.10 + G *graph;
4.11 +
4.12 +public:
4.13 + typedef G BaseGraph;
4.14 +
4.15 + typedef typename G::EdgeIt EdgeIt;
4.16 +
4.17 + typedef typename G::InEdgeIt SymEdgeIt;
4.18 + typedef typename G::OutEdgeIt SymEdgeIt;
4.19 + typedef typename G::SymEdgeIt SymEdgeIt;
4.20 + typedef typename G::EachEdgeIt EachEdgeIt;
4.21 +
4.22 + typedef typename G::NodeIt NodeIt;
4.23 +
4.24 + template<typename I> I &getFirst(I &i); { return graph->getFirst(i); }
4.25 + template<typename I,typename P> I &getFirst(I &i,const P &p);
4.26 + { return graph->getFirst(i,p); }
4.27 + template<typename I> I next(const I i); { return graph->goNext(i); }
4.28 + template<typename I> I &goNext(I &i); { return graph->goNext(i); }
4.29 +
4.30 + NodeIt head(const EdgeIt &e);
4.31 + { return graph->head(e); }
4.32 + NodeIt tail(const EdgeIt &e);
4.33 + { return graph->tail(e); }
4.34 +
4.35 + template<typename I> NodeIt aNode(const I e);
4.36 + { return graph->aNode(e); }
4.37 + template<typename I> NodeIt bNode(const I e);
4.38 + { return graph->bNode(e); }
4.39 +
4.40 + template<typename I> bool valid(const I i);
4.41 + { return graph->valid(i); }
4.42 +
4.43 + template<typename I> void setInvalid(const I &i);
4.44 + { return graph->setInvalid(i); }
4.45 +
4.46 + NodeIt addNode(); { return graph->addNode(); }
4.47 + EdgeIt addEdge(const NodeIt from,const NodeIt to);
4.48 + { return graph->addEdge(to,from); }
4.49 +
4.50 + template<I> void delete(I i); { graph->delete(i); }
4.51 +
4.52 + void clean(); { graph->clean(); }
4.53 +
4.54 + template<class T> class NodeMap : public typename G::NodeMap<T>;
4.55 + template<class T> class EdgeMap : public typename G::EdgeMap<T>;
4.56 +
4.57 + void SetG(G &g) {graph = &g;}
4.58 +
4.59 + RevGraphWrapper() {graph = NULL;}
4.60 + RevGraphWrapper(G &g) {graph = &g;}
4.61 +};
4.62 +
4.63 +
4.64 +// FIXME: comparison should be made better!!!
4.65 +template<typename G, typename lomap, typename fmap, typename himap>
4.66 +class ResGraphWrapper
4.67 +{
4.68 + G *graph;
4.69 +
4.70 +public:
4.71 + typedef G BaseGraph;
4.72 +
4.73 + typedef typename G::EdgeIt EdgeIt;
4.74 +
4.75 + class InEdgeIt
4.76 + {
4.77 + public:
4.78 + G::NodeIt n;
4.79 + G::InEdgeIt i;
4.80 + G::OutEdgeIt o;
4.81 + }
4.82 + class OutEdgeIt
4.83 + {
4.84 + public:
4.85 + G::NodeIt n;
4.86 + G::InEdgeIt i;
4.87 + G::OutEdgeIt o;
4.88 + }
4.89 + typedef typename G::SymEdgeIt SymEdgeIt;
4.90 + typedef typename G::EachEdgeIt EachEdgeIt;
4.91 +
4.92 + typedef typename G::NodeIt NodeIt;
4.93 +
4.94 + NodeIt &getFirst(NodeIt &n); { return graph->getFirst(n); }
4.95 +
4.96 + // EachEdge and SymEdge is missing!!!!
4.97 + // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
4.98 +
4.99 + InEdgeIt &getFirst(InEdgeIt &e,const NodeIt &n)
4.100 + {
4.101 + e.n=n;
4.102 + graph->getFirst(e.i,n);
4.103 + while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
4.104 + graph->goNext(e.i);
4.105 + if(!graph->valid(e.i)) {
4.106 + graph->getFirst(e.o,n);
4.107 + while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
4.108 + graph->goNext(e.o);
4.109 + }
4.110 + return e;
4.111 + }
4.112 + InEdgeIt &goNext(InEdgeIt &e)
4.113 + {
4.114 + if(graph->valid(e.i)) {
4.115 + while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
4.116 + graph->goNext(e.i);
4.117 + if(graph->valid(e.i)) return e;
4.118 + else graph->getFirst(e.o,e.n);
4.119 + }
4.120 + else {
4.121 + while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
4.122 + graph->goNext(e.o);
4.123 + return e;
4.124 + }
4.125 + }
4.126 + InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
4.127 + bool valid(const InEdgeIt e) { return graph->valid(e.i)||graph->valid(e.o);}
4.128 +
4.129 + OutEdgeIt &getFirst(OutEdgeIt &e,const NodeIt &n)
4.130 + {
4.131 + e.n=n;
4.132 + graph->getFirst(e.o,n);
4.133 + while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
4.134 + graph->goNext(e.o);
4.135 + if(!graph->valid(e.o)) {
4.136 + graph->getFirst(e.i,n);
4.137 + while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
4.138 + graph->goNext(e.i);
4.139 + }
4.140 + return e;
4.141 + }
4.142 + OutEdgeIt &goNext(OutEdgeIt &e)
4.143 + {
4.144 + if(graph->valid(e.o)) {
4.145 + while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
4.146 + graph->goNext(e.o);
4.147 + if(graph->valid(e.o)) return e;
4.148 + else graph->getFirst(e.i,e.n);
4.149 + }
4.150 + else {
4.151 + while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
4.152 + graph->goNext(e.i);
4.153 + return e;
4.154 + }
4.155 + }
4.156 + OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
4.157 + bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
4.158 +
4.159 + template<typename I> I &goNext(I &i); { return graph->goNext(i); }
4.160 + template<typename I> I next(const I i); { return graph->goNext(i); }
4.161 +
4.162 + NodeIt head(const EdgeIt &e);
4.163 + { return graph->head(e); }
4.164 + NodeIt tail(const EdgeIt &e);
4.165 + { return graph->tail(e); }
4.166 +
4.167 + template<typename I> NodeIt aNode(const I e);
4.168 + { return graph->aNode(e); }
4.169 + template<typename I> NodeIt bNode(const I e);
4.170 + { return graph->bNode(e); }
4.171 +
4.172 + template<typename I> bool valid(const I i);
4.173 + { return graph->valid(i); }
4.174 +
4.175 + template<typename I> void setInvalid(const I &i);
4.176 + { return graph->setInvalid(i); }
4.177 +
4.178 + NodeIt addNode(); { return graph->addNode(); }
4.179 + EdgeIt addEdge(const NodeIt from,const NodeIt to);
4.180 + { return graph->addEdge(to,from); }
4.181 +
4.182 + template<I> void delete(I i); { graph->delete(i); }
4.183 +
4.184 + void clean(); { graph->clean(); }
4.185 +
4.186 + template<class T> class NodeMap : public typename G::NodeMap<T>;
4.187 + template<class T> class EdgeMap : public typename G::EdgeMap<T>;
4.188 +
4.189 + void SetG(G &g) {graph = &g;}
4.190 +
4.191 + RevGraphWrapper() {graph = NULL;}
4.192 + RevGraphWrapper(G &g) {graph = &g;}
4.193 +};
4.194 +
4.195
4.196
4.197 // NodeIt &getFirst(NodeIt &n) { return graph->getFirst(n); }