Index: src/include/skeletons/graph.h
===================================================================
--- src/include/skeletons/graph.h	(revision 463)
+++ src/include/skeletons/graph.h	(revision 503)
@@ -1,5 +1,5 @@
 // -*- c++ -*-
-#ifndef HUGO_GRAPH_H
-#define HUGO_GRAPH_H
+#ifndef HUGO_SKELETON_GRAPH_H
+#define HUGO_SKELETON_GRAPH_H
 
 ///\file
@@ -59,11 +59,11 @@
       /// Two iterators are equal if and only if they point to the
       /// same object or both are invalid.
-      bool operator==(Node n) const { return true; }
+      bool operator==(Node) const { return true; }
 
       /// \sa \ref operator==(Node n)
       ///
-      bool operator!=(Node n) const { return true; }
-
-      bool operator<(Node n) const { return true; }
+      bool operator!=(Node) const { return true; }
+
+      bool operator<(Node) const { return true; }
     };
     
@@ -91,5 +91,5 @@
       /// @warning The default constructor sets the iterator
       /// to an undefined value.
-      NodeIt(const NodeIt &) {}
+      NodeIt(const NodeIt &n) : Node(n) {}
     };
     
@@ -105,7 +105,7 @@
       /// Two iterators are equal if and only if they point to the
       /// same object or both are invalid.
-      bool operator==(Edge n) const { return true; }
-      bool operator!=(Edge n) const { return true; }
-      bool operator<(Edge n) const { return true; }
+      bool operator==(Edge) const { return true; }
+      bool operator!=(Edge) const { return true; }
+      bool operator<(Edge) const { return true; }
     };
     
@@ -188,7 +188,7 @@
 
     /// The first incoming edge.
-    InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
+    InEdgeIt &first(InEdgeIt &i, Node) const { return i;}
     /// The first outgoing edge.
-    OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
+    OutEdgeIt &first(OutEdgeIt &i, Node) const { return i;}
     //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
     /// The first edge of the Graph.
@@ -259,5 +259,5 @@
     ///and head node \c head.
     ///\return the new edge.
-    Edge addEdge(Node tail, Node head) { return INVALID;}
+    Edge addEdge(Node, Node) { return INVALID;}
     
     /// Resets the graph.
@@ -295,9 +295,9 @@
       /// Sets the value associated with node \c i to the value \c t.
       ///
-      void set(Node i, T t) {}
-      /// Gets the value of a node.
-      T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary
-      T &operator[](Node i) {return *(T*)0;}
-      const T &operator[](Node i) const {return *(T*)0;}
+      void set(Node, T) {}
+      // Gets the value of a node.
+      //T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary?
+      T &operator[](Node) {return *(T*)0;}
+      const T &operator[](Node) const {return *(T*)0;}
 
       /// Updates the map if the graph has been changed
@@ -327,7 +327,12 @@
       EdgeMap(const GraphSkeleton &G, T t) {}
     
-      void set(Edge i, T t) {}
-      T get(Edge i) const {return *(T*)0;}
-      T &operator[](Edge i) {return *(T*)0;}
+      ///\todo It can copy between different types.
+      ///
+      template<typename TT> EdgeMap(const EdgeMap<TT> &m) {}
+
+      void set(Edge, T) {}
+      //T get(Edge) const {return *(T*)0;}
+      T &operator[](Edge) {return *(T*)0;}
+      const T &operator[](Edge) const {return *(T*)0;}
     
       void update() {}
@@ -392,3 +397,3 @@
 // }
 
-#endif // HUGO_GRAPH_H
+#endif // HUGO_SKELETON_GRAPH_H
Index: src/include/smart_graph.h
===================================================================
--- src/include/smart_graph.h	(revision 491)
+++ src/include/smart_graph.h	(revision 503)
@@ -81,4 +81,5 @@
   public:
 
+
     class NodeIt;
     class EdgeIt;
@@ -139,5 +140,15 @@
     bool valid(Node n) const { return n.n!=-1; }
     
+    ///\deprecated Use
+    ///\code
+    ///  e=INVALID;
+    ///\endcode
+    ///instead.
     void setInvalid(Edge &e) { e.n=-1; }
+    ///\deprecated Use
+    ///\code
+    ///  e=INVALID;
+    ///\endcode
+    ///instead.
     void setInvalid(Node &n) { n.n=-1; }
     
@@ -198,5 +209,5 @@
     public:
       Node() {}
-      Node (Invalid i) { n=-1; }
+      Node (Invalid) { n=-1; }
       bool operator==(const Node i) const {return n==i.n;}
       bool operator!=(const Node i) const {return n!=i.n;}
@@ -380,5 +391,5 @@
  	DynMapBase<Edge>(*m.G), container(m.container)
       {
- 	G->dyn_node_maps.push_back(this);
+ 	G->dyn_edge_maps.push_back(this);
       }
 
@@ -390,5 +401,5 @@
 	DynMapBase<Edge>(*m.G)
       {
-	G->dyn_node_maps.push_back(this);
+	G->dyn_edge_maps.push_back(this);
 	typename std::vector<TT>::const_iterator i;
 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
Index: src/test/graph_test.cc
===================================================================
--- src/test/graph_test.cc	(revision 503)
+++ src/test/graph_test.cc	(revision 503)
@@ -0,0 +1,304 @@
+#include<iostream>
+#include<smart_graph.h>
+#include<skeletons/graph.h>
+#include<../work/alpar/list_graph.h>
+
+/*
+This test makes consistency checks of list graph structures.
+
+G.addNode(), G.addEdge(), G.valid(), G.tail(), G.head()
+
+*/
+
+using namespace hugo;
+
+// void check(bool rc, const char *msg) {
+//   if(!rc) {
+//     std::cerr << msg << std::endl;
+//     exit(1);
+//   }
+// }
+
+#define check(rc, msg) \
+  if(!rc) { \
+    std::cerr << __FILE__ ":" << __LINE__ << ": error: " << msg << std::endl; \
+    exit(1); \
+  } else { } \
+
+
+template<class Graph> void checkCompile(Graph &G) 
+{
+  typedef typename Graph::Node Node;
+  typedef typename Graph::NodeIt NodeIt;
+  typedef typename Graph::Edge Edge;
+  typedef typename Graph::EdgeIt EdgeIt;
+  typedef typename Graph::InEdgeIt InEdgeIt;
+  typedef typename Graph::OutEdgeIt OutEdgeIt;
+  
+  {
+    Node i; Node j(i); Node k(INVALID);
+    i=j;
+    bool b=G.valid(i); b=b;
+    b=(i==j); b=(i!=j); b=(i<j);
+  }
+  {
+    NodeIt i; NodeIt j(i); NodeIt k(INVALID); NodeIt l(G);
+    i=j;
+    j=G.first(i);
+    j=G.next(i);
+    bool b=G.valid(i); b=b;
+    Node n(i);
+    n=i;
+    b=(i==j); b=(i!=j); b=(i<j);
+  }
+  {
+    Edge i; Edge j(i); Edge k(INVALID);
+    i=j;
+    bool b=G.valid(i); b=b;
+    b=(i==j); b=(i!=j); b=(i<j);
+  }
+  {
+    EdgeIt i; EdgeIt j(i); EdgeIt k(INVALID); EdgeIt l(G);
+    i=j;
+    j=G.first(i);
+    j=G.next(i);
+    bool b=G.valid(i); b=b;
+    Edge e(i);
+    e=i;
+    b=(i==j); b=(i!=j); b=(i<j);
+  }
+  {
+    Node n;
+    InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n);
+    i=j;
+    j=G.first(i,n);
+    j=G.next(i);
+    bool b=G.valid(i); b=b;
+    Edge e(i);
+    e=i;
+    b=(i==j); b=(i!=j); b=(i<j);
+  }
+  {
+    Node n;
+    OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n);
+    i=j;
+    j=G.first(i,n);
+    j=G.next(i);
+    bool b=G.valid(i); b=b;
+    Edge e(i);
+    e=i;
+    b=(i==j); b=(i!=j); b=(i<j);
+  }
+
+  Node n,m;
+  n=G.addNode();
+  Edge e;
+  e=G.addEdge(n,m);
+  n=G.tail(e);
+  n=G.head(e);
+
+  //aNode, bNode ?
+
+  // id tests
+  { int i=G.id(n); i=i; }
+  { int i=G.id(e); i=i; }
+  
+  G.clear();
+
+  //NodeMap tests
+  {
+    Node k;
+    typename Graph::NodeMap<int> m(G);
+    typename Graph::NodeMap<int> const &cm = m;  //Const map
+    typename Graph::NodeMap<int> mdef(G,12); //Inicialize with default value
+    typename Graph::NodeMap<int> mm(cm);   //Copy
+    typename Graph::NodeMap<double> dm(cm); //Copy from another type
+    int v;
+    v=m[k]; m[k]=v; m.set(k,v);
+    v=cm[k];
+    
+    m=cm;  
+    dm=cm; //Copy from another type
+  }  
+  { //bool NodeMap
+    Node k;
+    typename Graph::NodeMap<bool> m(G);
+    typename Graph::NodeMap<bool> const &cm = m;  //Const map
+    typename Graph::NodeMap<bool> mdef(G,12); //Inicialize with default value
+    typename Graph::NodeMap<bool> mm(cm);   //Copy
+    typename Graph::NodeMap<int> dm(cm); //Copy from another type
+    bool v;
+    v=m[k]; m[k]=v; m.set(k,v);
+    v=cm[k];
+    
+    m=cm;  
+    dm=cm; //Copy from another type
+  }
+  //EdgeMap tests
+  {
+    Edge k;
+    typename Graph::EdgeMap<int> m(G);
+    typename Graph::EdgeMap<int> const &cm = m;  //Const map
+    typename Graph::EdgeMap<int> mdef(G,12); //Inicialize with default value
+    typename Graph::EdgeMap<int> mm(cm);   //Copy
+    typename Graph::EdgeMap<double> dm(cm); //Copy from another type
+    int v;
+    v=m[k]; m[k]=v; m.set(k,v);
+    v=cm[k];
+    
+    m=cm;  
+    dm=cm; //Copy from another type
+  }  
+  { //bool EdgeMap
+    Edge k;
+    typename Graph::EdgeMap<bool> m(G);
+    typename Graph::EdgeMap<bool> const &cm = m;  //Const map
+    typename Graph::EdgeMap<bool> mdef(G,12); //Inicialize with default value
+    typename Graph::EdgeMap<bool> mm(cm);   //Copy
+    typename Graph::EdgeMap<int> dm(cm); //Copy from another type
+    bool v;
+    v=m[k]; m[k]=v; m.set(k,v);
+    v=cm[k];
+    
+    m=cm;  
+    dm=cm; //Copy from another type
+  }
+  
+}
+
+
+
+template<class Graph> void addPetersen(Graph &G)
+{
+  std::vector<typename Graph::Node> outer, inner;
+  
+  for(int i=0;i<5;i++) {
+    outer.push_back(G.addNode());
+    inner.push_back(G.addNode());
+  }
+
+ for(int i=0;i<5;i++) {
+    G.addEdge(outer[i],inner[i]);
+    G.addEdge(outer[i],outer[(i+1)%5]);
+    G.addEdge(inner[i],inner[(i+2)%5]);
+  }
+}
+
+template<class Graph> void checkNodeList(Graph &G, int nn)
+{
+  typename Graph::NodeIt n(G);
+  for(int i=0;i<nn;i++) {
+    check(G.valid(n),"Wrong Node list linking.");
+    G.next(n);
+  }
+  check(!G.valid(n),"Wrong Node list linking.");
+}
+
+template<class Graph> void checkEdgeList(Graph &G, int nn)
+{
+  typedef typename Graph::EdgeIt EdgeIt;
+
+  EdgeIt e(G);
+  for(int i=0;i<nn;i++) {
+    check(G.valid(e),"Wrong Edge list linking.");
+    G.next(e);
+  }
+  check(!G.valid(e),"Wrong Edge list linking.");
+}
+
+template<class Graph> void checkOutEdgeList(Graph &G,
+					    typename Graph::Node n,
+					    int nn)
+{
+  typename Graph::OutEdgeIt e(G,n);
+  for(int i=0;i<nn;i++) {
+    check(G.valid(e),"Wrong OutEdge list linking.");
+    G.next(e);
+  }
+  check(!G.valid(e),"Wrong OutEdge list linking.");
+}
+
+template<class Graph> void checkInEdgeList(Graph &G,
+					    typename Graph::Node n,
+					    int nn)
+{
+  typename Graph::InEdgeIt e(G,n);
+  for(int i=0;i<nn;i++) {
+    check(G.valid(e),"Wrong InEdge list linking.");
+    G.next(e);
+  }
+  check(!G.valid(e),"Wrong InEdge list linking.");
+}
+
+//Checks head(), tail() as well;
+template<class Graph> void bidirPetersen(Graph &G)
+{
+  typedef typename Graph::Edge Edge;
+  typedef typename Graph::EdgeIt EdgeIt;
+  
+  checkEdgeList(G,15);
+  
+  std::vector<Edge> ee;
+  
+  for(EdgeIt e(G);G.valid(e);G.next(e)) ee.push_back(e);
+
+  for(typename std::vector<Edge>::iterator p=ee.begin();p!=ee.end();p++)
+    G.addEdge(G.head(*p),G.tail(*p));
+}
+
+template<class Graph> void checkPetersen(Graph &G)
+{
+  typedef typename Graph::Node Node;
+
+  typedef typename Graph::EdgeIt EdgeIt;
+  typedef typename Graph::NodeIt NodeIt;
+
+  checkNodeList(G,10);
+  checkEdgeList(G,30);
+
+  for(NodeIt n(G);G.valid(n);G.next(n)) {
+    checkInEdgeList(G,n,3);
+    checkOutEdgeList(G,n,3);
+    G.next(n);
+  }  
+}
+
+template void checkCompile<GraphSkeleton>(GraphSkeleton &);
+template void checkCompile<SmartGraph>(SmartGraph &);
+template void checkCompile<SymSmartGraph>(SymSmartGraph &);
+template void checkCompile<ListGraph>(ListGraph &);
+template void checkCompile<SymListGraph>(SymListGraph &);
+//Due to some mysterious and some conceptual problems it does not work.
+//template void checkCompile<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
+
+int main() 
+{
+  {
+    SmartGraph G;
+    addPetersen(G);
+    bidirPetersen(G);
+    checkPetersen(G);
+  }
+  {
+    ListGraph G;
+    addPetersen(G);
+    bidirPetersen(G);
+    checkPetersen(G);
+  }
+  {
+    SymSmartGraph G;
+    addPetersen(G);
+    checkPetersen(G);
+  }
+  {
+    SymListGraph G;
+    addPetersen(G);
+    checkPetersen(G);
+  }
+
+  //\todo map tests.
+  //\todo copy constr tests.
+
+  std::cout << __FILE__ ": All tests passed.\n";
+
+}
Index: src/work/alpar/list_graph.h
===================================================================
--- src/work/alpar/list_graph.h	(revision 491)
+++ src/work/alpar/list_graph.h	(revision 503)
@@ -317,5 +317,5 @@
     public:
       Node() {}
-      Node (Invalid i) { n=-1; }
+      Node (Invalid) { n=-1; }
       bool operator==(const Node i) const {return n==i.n;}
       bool operator!=(const Node i) const {return n!=i.n;}
@@ -504,5 +504,5 @@
  	DynMapBase<Edge>(*m.G), container(m.container)
       {
- 	G->dyn_node_maps.push_back(this);
+ 	G->dyn_edge_maps.push_back(this);
       }
 
@@ -514,5 +514,5 @@
 	DynMapBase<Edge>(*m.G)
       {
-	G->dyn_node_maps.push_back(this);
+	G->dyn_edge_maps.push_back(this);
 	typename std::vector<TT>::const_iterator i;
 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
@@ -1295,9 +1295,9 @@
       }
       else {
-	typename NodeGraphType::Node n;
-	for(n=G.next(edges[it.n].head);
-	    G.valid(n) && nodes[n].first_in == -1;
-	    G.next(n)) ;
-	it.n = (G.valid(n))?-1:nodes[n].first_in;
+	NodeIt n;
+	for(n=next(edges[it.n].head);
+	    valid(n) && nodes[n].first_in == -1;
+	    next(n)) ;
+	it.n = (valid(n))?-1:nodes[n].first_in;
       }
       return it;
@@ -1386,4 +1386,5 @@
 //     }
 
+  public:
     class Node : public NodeGraphType::Node {
       friend class EdgeSet;
@@ -1445,8 +1446,9 @@
     public:
       EdgeIt(const EdgeSet& G) : Edge() {
-      	typename NodeGraphType::Node m;
+	//      	typename NodeGraphType::Node m;
+        NodeIt m;
 	for(G.first(m);
-	    G.valid(m) && nodes[m].first_in == -1;  G.next[m]);
-	n = G.valid(m)?-1:nodes[m].first_in;
+	    G.valid(m) && G.nodes[m].first_in == -1;  G.next(m));
+	n = G.valid(m)?-1:G.nodes[m].first_in;
       }
       EdgeIt (Invalid i) : Edge(i) { }
@@ -1515,5 +1517,5 @@
  	DynMapBase<Edge>(*m.G), container(m.container)
       {
- 	G->dyn_node_maps.push_back(this);
+ 	G->dyn_edge_maps.push_back(this);
       }
 
@@ -1525,5 +1527,5 @@
 	DynMapBase<Edge>(*m.G)
       {
-	G->dyn_node_maps.push_back(this);
+	G->dyn_edge_maps.push_back(this);
 	typename std::vector<TT>::const_iterator i;
 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
