test/graph_test.cc added.
authoralpar
Mon, 03 May 2004 07:27:29 +0000
changeset 503769f31e9f7b0
parent 502 1b41ebb5fee5
child 504 6ef30329dd50
test/graph_test.cc added.
It discovered several bugs and warnings in 'include/smart_graph.h',
in 'include/skeletons/graph.h' and in 'work/alpar/list_graph.h'.
They have also been fixed.
src/include/skeletons/graph.h
src/include/smart_graph.h
src/test/graph_test.cc
src/work/alpar/list_graph.h
     1.1 --- a/src/include/skeletons/graph.h	Fri Apr 30 19:02:40 2004 +0000
     1.2 +++ b/src/include/skeletons/graph.h	Mon May 03 07:27:29 2004 +0000
     1.3 @@ -1,6 +1,6 @@
     1.4  // -*- c++ -*-
     1.5 -#ifndef HUGO_GRAPH_H
     1.6 -#define HUGO_GRAPH_H
     1.7 +#ifndef HUGO_SKELETON_GRAPH_H
     1.8 +#define HUGO_SKELETON_GRAPH_H
     1.9  
    1.10  ///\file
    1.11  ///\brief Declaration of GraphSkeleton.
    1.12 @@ -58,13 +58,13 @@
    1.13  
    1.14        /// Two iterators are equal if and only if they point to the
    1.15        /// same object or both are invalid.
    1.16 -      bool operator==(Node n) const { return true; }
    1.17 +      bool operator==(Node) const { return true; }
    1.18  
    1.19        /// \sa \ref operator==(Node n)
    1.20        ///
    1.21 -      bool operator!=(Node n) const { return true; }
    1.22 +      bool operator!=(Node) const { return true; }
    1.23  
    1.24 -      bool operator<(Node n) const { return true; }
    1.25 +      bool operator<(Node) const { return true; }
    1.26      };
    1.27      
    1.28      /// This iterator goes through each node.
    1.29 @@ -90,7 +90,7 @@
    1.30        NodeIt(const GraphSkeleton &G) {}
    1.31        /// @warning The default constructor sets the iterator
    1.32        /// to an undefined value.
    1.33 -      NodeIt(const NodeIt &) {}
    1.34 +      NodeIt(const NodeIt &n) : Node(n) {}
    1.35      };
    1.36      
    1.37      
    1.38 @@ -104,9 +104,9 @@
    1.39        Edge(Invalid) {}
    1.40        /// Two iterators are equal if and only if they point to the
    1.41        /// same object or both are invalid.
    1.42 -      bool operator==(Edge n) const { return true; }
    1.43 -      bool operator!=(Edge n) const { return true; }
    1.44 -      bool operator<(Edge n) const { return true; }
    1.45 +      bool operator==(Edge) const { return true; }
    1.46 +      bool operator!=(Edge) const { return true; }
    1.47 +      bool operator<(Edge) const { return true; }
    1.48      };
    1.49      
    1.50      /// This iterator goes trough the outgoing edges of a node.
    1.51 @@ -187,9 +187,9 @@
    1.52      NodeIt &first(NodeIt &i) const { return i;}
    1.53  
    1.54      /// The first incoming edge.
    1.55 -    InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
    1.56 +    InEdgeIt &first(InEdgeIt &i, Node) const { return i;}
    1.57      /// The first outgoing edge.
    1.58 -    OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
    1.59 +    OutEdgeIt &first(OutEdgeIt &i, Node) const { return i;}
    1.60      //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
    1.61      /// The first edge of the Graph.
    1.62      EdgeIt &first(EdgeIt &i) const { return i;}
    1.63 @@ -258,7 +258,7 @@
    1.64      ///Add a new edge to the graph with tail node \c tail
    1.65      ///and head node \c head.
    1.66      ///\return the new edge.
    1.67 -    Edge addEdge(Node tail, Node head) { return INVALID;}
    1.68 +    Edge addEdge(Node, Node) { return INVALID;}
    1.69      
    1.70      /// Resets the graph.
    1.71  
    1.72 @@ -294,11 +294,11 @@
    1.73  
    1.74        /// Sets the value associated with node \c i to the value \c t.
    1.75        ///
    1.76 -      void set(Node i, T t) {}
    1.77 -      /// Gets the value of a node.
    1.78 -      T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary
    1.79 -      T &operator[](Node i) {return *(T*)0;}
    1.80 -      const T &operator[](Node i) const {return *(T*)0;}
    1.81 +      void set(Node, T) {}
    1.82 +      // Gets the value of a node.
    1.83 +      //T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary?
    1.84 +      T &operator[](Node) {return *(T*)0;}
    1.85 +      const T &operator[](Node) const {return *(T*)0;}
    1.86  
    1.87        /// Updates the map if the graph has been changed
    1.88  
    1.89 @@ -326,9 +326,14 @@
    1.90        EdgeMap(const GraphSkeleton &G) {}
    1.91        EdgeMap(const GraphSkeleton &G, T t) {}
    1.92      
    1.93 -      void set(Edge i, T t) {}
    1.94 -      T get(Edge i) const {return *(T*)0;}
    1.95 -      T &operator[](Edge i) {return *(T*)0;}
    1.96 +      ///\todo It can copy between different types.
    1.97 +      ///
    1.98 +      template<typename TT> EdgeMap(const EdgeMap<TT> &m) {}
    1.99 +
   1.100 +      void set(Edge, T) {}
   1.101 +      //T get(Edge) const {return *(T*)0;}
   1.102 +      T &operator[](Edge) {return *(T*)0;}
   1.103 +      const T &operator[](Edge) const {return *(T*)0;}
   1.104      
   1.105        void update() {}
   1.106        void update(T a) {}   //FIXME: Is it necessary
   1.107 @@ -391,4 +396,4 @@
   1.108  
   1.109  // }
   1.110  
   1.111 -#endif // HUGO_GRAPH_H
   1.112 +#endif // HUGO_SKELETON_GRAPH_H
     2.1 --- a/src/include/smart_graph.h	Fri Apr 30 19:02:40 2004 +0000
     2.2 +++ b/src/include/smart_graph.h	Mon May 03 07:27:29 2004 +0000
     2.3 @@ -80,6 +80,7 @@
     2.4      
     2.5    public:
     2.6  
     2.7 +
     2.8      class NodeIt;
     2.9      class EdgeIt;
    2.10      class OutEdgeIt;
    2.11 @@ -138,7 +139,17 @@
    2.12      bool valid(Edge e) const { return e.n!=-1; }
    2.13      bool valid(Node n) const { return n.n!=-1; }
    2.14      
    2.15 +    ///\deprecated Use
    2.16 +    ///\code
    2.17 +    ///  e=INVALID;
    2.18 +    ///\endcode
    2.19 +    ///instead.
    2.20      void setInvalid(Edge &e) { e.n=-1; }
    2.21 +    ///\deprecated Use
    2.22 +    ///\code
    2.23 +    ///  e=INVALID;
    2.24 +    ///\endcode
    2.25 +    ///instead.
    2.26      void setInvalid(Node &n) { n.n=-1; }
    2.27      
    2.28      template <typename It> It getNext(It it) const
    2.29 @@ -197,7 +208,7 @@
    2.30        Node(int nn) {n=nn;}
    2.31      public:
    2.32        Node() {}
    2.33 -      Node (Invalid i) { n=-1; }
    2.34 +      Node (Invalid) { n=-1; }
    2.35        bool operator==(const Node i) const {return n==i.n;}
    2.36        bool operator!=(const Node i) const {return n!=i.n;}
    2.37        bool operator<(const Node i) const {return n<i.n;}
    2.38 @@ -379,7 +390,7 @@
    2.39        EdgeMap(const EdgeMap<T> &m) :
    2.40   	DynMapBase<Edge>(*m.G), container(m.container)
    2.41        {
    2.42 - 	G->dyn_node_maps.push_back(this);
    2.43 + 	G->dyn_edge_maps.push_back(this);
    2.44        }
    2.45  
    2.46        template<typename TT> friend class EdgeMap;
    2.47 @@ -389,7 +400,7 @@
    2.48        template<typename TT> EdgeMap(const EdgeMap<TT> &m) :
    2.49  	DynMapBase<Edge>(*m.G)
    2.50        {
    2.51 -	G->dyn_node_maps.push_back(this);
    2.52 +	G->dyn_edge_maps.push_back(this);
    2.53  	typename std::vector<TT>::const_iterator i;
    2.54  	for(typename std::vector<TT>::const_iterator i=m.container.begin();
    2.55  	    i!=m.container.end();
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/test/graph_test.cc	Mon May 03 07:27:29 2004 +0000
     3.3 @@ -0,0 +1,304 @@
     3.4 +#include<iostream>
     3.5 +#include<smart_graph.h>
     3.6 +#include<skeletons/graph.h>
     3.7 +#include<../work/alpar/list_graph.h>
     3.8 +
     3.9 +/*
    3.10 +This test makes consistency checks of list graph structures.
    3.11 +
    3.12 +G.addNode(), G.addEdge(), G.valid(), G.tail(), G.head()
    3.13 +
    3.14 +*/
    3.15 +
    3.16 +using namespace hugo;
    3.17 +
    3.18 +// void check(bool rc, const char *msg) {
    3.19 +//   if(!rc) {
    3.20 +//     std::cerr << msg << std::endl;
    3.21 +//     exit(1);
    3.22 +//   }
    3.23 +// }
    3.24 +
    3.25 +#define check(rc, msg) \
    3.26 +  if(!rc) { \
    3.27 +    std::cerr << __FILE__ ":" << __LINE__ << ": error: " << msg << std::endl; \
    3.28 +    exit(1); \
    3.29 +  } else { } \
    3.30 +
    3.31 +
    3.32 +template<class Graph> void checkCompile(Graph &G) 
    3.33 +{
    3.34 +  typedef typename Graph::Node Node;
    3.35 +  typedef typename Graph::NodeIt NodeIt;
    3.36 +  typedef typename Graph::Edge Edge;
    3.37 +  typedef typename Graph::EdgeIt EdgeIt;
    3.38 +  typedef typename Graph::InEdgeIt InEdgeIt;
    3.39 +  typedef typename Graph::OutEdgeIt OutEdgeIt;
    3.40 +  
    3.41 +  {
    3.42 +    Node i; Node j(i); Node k(INVALID);
    3.43 +    i=j;
    3.44 +    bool b=G.valid(i); b=b;
    3.45 +    b=(i==j); b=(i!=j); b=(i<j);
    3.46 +  }
    3.47 +  {
    3.48 +    NodeIt i; NodeIt j(i); NodeIt k(INVALID); NodeIt l(G);
    3.49 +    i=j;
    3.50 +    j=G.first(i);
    3.51 +    j=G.next(i);
    3.52 +    bool b=G.valid(i); b=b;
    3.53 +    Node n(i);
    3.54 +    n=i;
    3.55 +    b=(i==j); b=(i!=j); b=(i<j);
    3.56 +  }
    3.57 +  {
    3.58 +    Edge i; Edge j(i); Edge k(INVALID);
    3.59 +    i=j;
    3.60 +    bool b=G.valid(i); b=b;
    3.61 +    b=(i==j); b=(i!=j); b=(i<j);
    3.62 +  }
    3.63 +  {
    3.64 +    EdgeIt i; EdgeIt j(i); EdgeIt k(INVALID); EdgeIt l(G);
    3.65 +    i=j;
    3.66 +    j=G.first(i);
    3.67 +    j=G.next(i);
    3.68 +    bool b=G.valid(i); b=b;
    3.69 +    Edge e(i);
    3.70 +    e=i;
    3.71 +    b=(i==j); b=(i!=j); b=(i<j);
    3.72 +  }
    3.73 +  {
    3.74 +    Node n;
    3.75 +    InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n);
    3.76 +    i=j;
    3.77 +    j=G.first(i,n);
    3.78 +    j=G.next(i);
    3.79 +    bool b=G.valid(i); b=b;
    3.80 +    Edge e(i);
    3.81 +    e=i;
    3.82 +    b=(i==j); b=(i!=j); b=(i<j);
    3.83 +  }
    3.84 +  {
    3.85 +    Node n;
    3.86 +    OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n);
    3.87 +    i=j;
    3.88 +    j=G.first(i,n);
    3.89 +    j=G.next(i);
    3.90 +    bool b=G.valid(i); b=b;
    3.91 +    Edge e(i);
    3.92 +    e=i;
    3.93 +    b=(i==j); b=(i!=j); b=(i<j);
    3.94 +  }
    3.95 +
    3.96 +  Node n,m;
    3.97 +  n=G.addNode();
    3.98 +  Edge e;
    3.99 +  e=G.addEdge(n,m);
   3.100 +  n=G.tail(e);
   3.101 +  n=G.head(e);
   3.102 +
   3.103 +  //aNode, bNode ?
   3.104 +
   3.105 +  // id tests
   3.106 +  { int i=G.id(n); i=i; }
   3.107 +  { int i=G.id(e); i=i; }
   3.108 +  
   3.109 +  G.clear();
   3.110 +
   3.111 +  //NodeMap tests
   3.112 +  {
   3.113 +    Node k;
   3.114 +    typename Graph::NodeMap<int> m(G);
   3.115 +    typename Graph::NodeMap<int> const &cm = m;  //Const map
   3.116 +    typename Graph::NodeMap<int> mdef(G,12); //Inicialize with default value
   3.117 +    typename Graph::NodeMap<int> mm(cm);   //Copy
   3.118 +    typename Graph::NodeMap<double> dm(cm); //Copy from another type
   3.119 +    int v;
   3.120 +    v=m[k]; m[k]=v; m.set(k,v);
   3.121 +    v=cm[k];
   3.122 +    
   3.123 +    m=cm;  
   3.124 +    dm=cm; //Copy from another type
   3.125 +  }  
   3.126 +  { //bool NodeMap
   3.127 +    Node k;
   3.128 +    typename Graph::NodeMap<bool> m(G);
   3.129 +    typename Graph::NodeMap<bool> const &cm = m;  //Const map
   3.130 +    typename Graph::NodeMap<bool> mdef(G,12); //Inicialize with default value
   3.131 +    typename Graph::NodeMap<bool> mm(cm);   //Copy
   3.132 +    typename Graph::NodeMap<int> dm(cm); //Copy from another type
   3.133 +    bool v;
   3.134 +    v=m[k]; m[k]=v; m.set(k,v);
   3.135 +    v=cm[k];
   3.136 +    
   3.137 +    m=cm;  
   3.138 +    dm=cm; //Copy from another type
   3.139 +  }
   3.140 +  //EdgeMap tests
   3.141 +  {
   3.142 +    Edge k;
   3.143 +    typename Graph::EdgeMap<int> m(G);
   3.144 +    typename Graph::EdgeMap<int> const &cm = m;  //Const map
   3.145 +    typename Graph::EdgeMap<int> mdef(G,12); //Inicialize with default value
   3.146 +    typename Graph::EdgeMap<int> mm(cm);   //Copy
   3.147 +    typename Graph::EdgeMap<double> dm(cm); //Copy from another type
   3.148 +    int v;
   3.149 +    v=m[k]; m[k]=v; m.set(k,v);
   3.150 +    v=cm[k];
   3.151 +    
   3.152 +    m=cm;  
   3.153 +    dm=cm; //Copy from another type
   3.154 +  }  
   3.155 +  { //bool EdgeMap
   3.156 +    Edge k;
   3.157 +    typename Graph::EdgeMap<bool> m(G);
   3.158 +    typename Graph::EdgeMap<bool> const &cm = m;  //Const map
   3.159 +    typename Graph::EdgeMap<bool> mdef(G,12); //Inicialize with default value
   3.160 +    typename Graph::EdgeMap<bool> mm(cm);   //Copy
   3.161 +    typename Graph::EdgeMap<int> dm(cm); //Copy from another type
   3.162 +    bool v;
   3.163 +    v=m[k]; m[k]=v; m.set(k,v);
   3.164 +    v=cm[k];
   3.165 +    
   3.166 +    m=cm;  
   3.167 +    dm=cm; //Copy from another type
   3.168 +  }
   3.169 +  
   3.170 +}
   3.171 +
   3.172 +
   3.173 +
   3.174 +template<class Graph> void addPetersen(Graph &G)
   3.175 +{
   3.176 +  std::vector<typename Graph::Node> outer, inner;
   3.177 +  
   3.178 +  for(int i=0;i<5;i++) {
   3.179 +    outer.push_back(G.addNode());
   3.180 +    inner.push_back(G.addNode());
   3.181 +  }
   3.182 +
   3.183 + for(int i=0;i<5;i++) {
   3.184 +    G.addEdge(outer[i],inner[i]);
   3.185 +    G.addEdge(outer[i],outer[(i+1)%5]);
   3.186 +    G.addEdge(inner[i],inner[(i+2)%5]);
   3.187 +  }
   3.188 +}
   3.189 +
   3.190 +template<class Graph> void checkNodeList(Graph &G, int nn)
   3.191 +{
   3.192 +  typename Graph::NodeIt n(G);
   3.193 +  for(int i=0;i<nn;i++) {
   3.194 +    check(G.valid(n),"Wrong Node list linking.");
   3.195 +    G.next(n);
   3.196 +  }
   3.197 +  check(!G.valid(n),"Wrong Node list linking.");
   3.198 +}
   3.199 +
   3.200 +template<class Graph> void checkEdgeList(Graph &G, int nn)
   3.201 +{
   3.202 +  typedef typename Graph::EdgeIt EdgeIt;
   3.203 +
   3.204 +  EdgeIt e(G);
   3.205 +  for(int i=0;i<nn;i++) {
   3.206 +    check(G.valid(e),"Wrong Edge list linking.");
   3.207 +    G.next(e);
   3.208 +  }
   3.209 +  check(!G.valid(e),"Wrong Edge list linking.");
   3.210 +}
   3.211 +
   3.212 +template<class Graph> void checkOutEdgeList(Graph &G,
   3.213 +					    typename Graph::Node n,
   3.214 +					    int nn)
   3.215 +{
   3.216 +  typename Graph::OutEdgeIt e(G,n);
   3.217 +  for(int i=0;i<nn;i++) {
   3.218 +    check(G.valid(e),"Wrong OutEdge list linking.");
   3.219 +    G.next(e);
   3.220 +  }
   3.221 +  check(!G.valid(e),"Wrong OutEdge list linking.");
   3.222 +}
   3.223 +
   3.224 +template<class Graph> void checkInEdgeList(Graph &G,
   3.225 +					    typename Graph::Node n,
   3.226 +					    int nn)
   3.227 +{
   3.228 +  typename Graph::InEdgeIt e(G,n);
   3.229 +  for(int i=0;i<nn;i++) {
   3.230 +    check(G.valid(e),"Wrong InEdge list linking.");
   3.231 +    G.next(e);
   3.232 +  }
   3.233 +  check(!G.valid(e),"Wrong InEdge list linking.");
   3.234 +}
   3.235 +
   3.236 +//Checks head(), tail() as well;
   3.237 +template<class Graph> void bidirPetersen(Graph &G)
   3.238 +{
   3.239 +  typedef typename Graph::Edge Edge;
   3.240 +  typedef typename Graph::EdgeIt EdgeIt;
   3.241 +  
   3.242 +  checkEdgeList(G,15);
   3.243 +  
   3.244 +  std::vector<Edge> ee;
   3.245 +  
   3.246 +  for(EdgeIt e(G);G.valid(e);G.next(e)) ee.push_back(e);
   3.247 +
   3.248 +  for(typename std::vector<Edge>::iterator p=ee.begin();p!=ee.end();p++)
   3.249 +    G.addEdge(G.head(*p),G.tail(*p));
   3.250 +}
   3.251 +
   3.252 +template<class Graph> void checkPetersen(Graph &G)
   3.253 +{
   3.254 +  typedef typename Graph::Node Node;
   3.255 +
   3.256 +  typedef typename Graph::EdgeIt EdgeIt;
   3.257 +  typedef typename Graph::NodeIt NodeIt;
   3.258 +
   3.259 +  checkNodeList(G,10);
   3.260 +  checkEdgeList(G,30);
   3.261 +
   3.262 +  for(NodeIt n(G);G.valid(n);G.next(n)) {
   3.263 +    checkInEdgeList(G,n,3);
   3.264 +    checkOutEdgeList(G,n,3);
   3.265 +    G.next(n);
   3.266 +  }  
   3.267 +}
   3.268 +
   3.269 +template void checkCompile<GraphSkeleton>(GraphSkeleton &);
   3.270 +template void checkCompile<SmartGraph>(SmartGraph &);
   3.271 +template void checkCompile<SymSmartGraph>(SymSmartGraph &);
   3.272 +template void checkCompile<ListGraph>(ListGraph &);
   3.273 +template void checkCompile<SymListGraph>(SymListGraph &);
   3.274 +//Due to some mysterious and some conceptual problems it does not work.
   3.275 +//template void checkCompile<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
   3.276 +
   3.277 +int main() 
   3.278 +{
   3.279 +  {
   3.280 +    SmartGraph G;
   3.281 +    addPetersen(G);
   3.282 +    bidirPetersen(G);
   3.283 +    checkPetersen(G);
   3.284 +  }
   3.285 +  {
   3.286 +    ListGraph G;
   3.287 +    addPetersen(G);
   3.288 +    bidirPetersen(G);
   3.289 +    checkPetersen(G);
   3.290 +  }
   3.291 +  {
   3.292 +    SymSmartGraph G;
   3.293 +    addPetersen(G);
   3.294 +    checkPetersen(G);
   3.295 +  }
   3.296 +  {
   3.297 +    SymListGraph G;
   3.298 +    addPetersen(G);
   3.299 +    checkPetersen(G);
   3.300 +  }
   3.301 +
   3.302 +  //\todo map tests.
   3.303 +  //\todo copy constr tests.
   3.304 +
   3.305 +  std::cout << __FILE__ ": All tests passed.\n";
   3.306 +
   3.307 +}
     4.1 --- a/src/work/alpar/list_graph.h	Fri Apr 30 19:02:40 2004 +0000
     4.2 +++ b/src/work/alpar/list_graph.h	Mon May 03 07:27:29 2004 +0000
     4.3 @@ -316,7 +316,7 @@
     4.4        Node(int nn) {n=nn;}
     4.5      public:
     4.6        Node() {}
     4.7 -      Node (Invalid i) { n=-1; }
     4.8 +      Node (Invalid) { n=-1; }
     4.9        bool operator==(const Node i) const {return n==i.n;}
    4.10        bool operator!=(const Node i) const {return n!=i.n;}
    4.11        bool operator<(const Node i) const {return n<i.n;}
    4.12 @@ -503,7 +503,7 @@
    4.13        EdgeMap(const EdgeMap<T> &m) :
    4.14   	DynMapBase<Edge>(*m.G), container(m.container)
    4.15        {
    4.16 - 	G->dyn_node_maps.push_back(this);
    4.17 + 	G->dyn_edge_maps.push_back(this);
    4.18        }
    4.19  
    4.20        template<typename TT> friend class EdgeMap;
    4.21 @@ -513,7 +513,7 @@
    4.22        template<typename TT> EdgeMap(const EdgeMap<TT> &m) :
    4.23  	DynMapBase<Edge>(*m.G)
    4.24        {
    4.25 -	G->dyn_node_maps.push_back(this);
    4.26 +	G->dyn_edge_maps.push_back(this);
    4.27  	typename std::vector<TT>::const_iterator i;
    4.28  	for(typename std::vector<TT>::const_iterator i=m.container.begin();
    4.29  	    i!=m.container.end();
    4.30 @@ -1294,11 +1294,11 @@
    4.31  	it.n=edges[it.n].next_in;
    4.32        }
    4.33        else {
    4.34 -	typename NodeGraphType::Node n;
    4.35 -	for(n=G.next(edges[it.n].head);
    4.36 -	    G.valid(n) && nodes[n].first_in == -1;
    4.37 -	    G.next(n)) ;
    4.38 -	it.n = (G.valid(n))?-1:nodes[n].first_in;
    4.39 +	NodeIt n;
    4.40 +	for(n=next(edges[it.n].head);
    4.41 +	    valid(n) && nodes[n].first_in == -1;
    4.42 +	    next(n)) ;
    4.43 +	it.n = (valid(n))?-1:nodes[n].first_in;
    4.44        }
    4.45        return it;
    4.46      }
    4.47 @@ -1385,6 +1385,7 @@
    4.48  //       first_node=first_free_node=first_free_edge=-1;
    4.49  //     }
    4.50  
    4.51 +  public:
    4.52      class Node : public NodeGraphType::Node {
    4.53        friend class EdgeSet;
    4.54        //      template <typename T> friend class NodeMap;
    4.55 @@ -1444,10 +1445,11 @@
    4.56        friend class EdgeSet;
    4.57      public:
    4.58        EdgeIt(const EdgeSet& G) : Edge() {
    4.59 -      	typename NodeGraphType::Node m;
    4.60 +	//      	typename NodeGraphType::Node m;
    4.61 +        NodeIt m;
    4.62  	for(G.first(m);
    4.63 -	    G.valid(m) && nodes[m].first_in == -1;  G.next[m]);
    4.64 -	n = G.valid(m)?-1:nodes[m].first_in;
    4.65 +	    G.valid(m) && G.nodes[m].first_in == -1;  G.next(m));
    4.66 +	n = G.valid(m)?-1:G.nodes[m].first_in;
    4.67        }
    4.68        EdgeIt (Invalid i) : Edge(i) { }
    4.69        EdgeIt() : Edge() { }
    4.70 @@ -1514,7 +1516,7 @@
    4.71        EdgeMap(const EdgeMap<T> &m) :
    4.72   	DynMapBase<Edge>(*m.G), container(m.container)
    4.73        {
    4.74 - 	G->dyn_node_maps.push_back(this);
    4.75 + 	G->dyn_edge_maps.push_back(this);
    4.76        }
    4.77  
    4.78        template<typename TT> friend class EdgeMap;
    4.79 @@ -1524,7 +1526,7 @@
    4.80        template<typename TT> EdgeMap(const EdgeMap<TT> &m) :
    4.81  	DynMapBase<Edge>(*m.G)
    4.82        {
    4.83 -	G->dyn_node_maps.push_back(this);
    4.84 +	G->dyn_edge_maps.push_back(this);
    4.85  	typename std::vector<TT>::const_iterator i;
    4.86  	for(typename std::vector<TT>::const_iterator i=m.container.begin();
    4.87  	    i!=m.container.end();