Index: src/lemon/concept/graph.h
===================================================================
--- src/lemon/concept/graph.h	(revision 987)
+++ src/lemon/concept/graph.h	(revision 989)
@@ -102,12 +102,4 @@
 // 	bool operator!=(Node) const { return true; }
 
-//  	///Comparison operator.
-
-// 	///This is a strict ordering between the nodes.
-// 	///
-// 	///This ordering can be different from the order in which NodeIt
-// 	///goes through the nodes.
-// 	///\todo Possibly we don't need it.
-// 	bool operator<(Node) const { return true; }
 //       };
     
@@ -189,12 +181,4 @@
 // 	///
 // 	bool operator!=(Edge) const { return true; }
-//  	///Comparison operator.
-
-// 	///This is a strict ordering between the nodes.
-// 	///
-// 	///This ordering can be different from the order in which NodeIt
-// 	///goes through the nodes.
-// 	///\todo Possibly we don't need it.
-//  	bool operator<(Edge) const { return true; }
 //       };
     
@@ -340,28 +324,4 @@
 // 	EdgeIt& operator++() { return *this; }
 //       };
-
-//       /// First node of the graph.
-
-//       /// \retval i the first node.
-//       /// \return the first node.
-//       ///
-//       NodeIt& first(NodeIt& i) const { return i; }
-
-//       /// The first incoming edge.
-
-//       /// The first incoming edge.
-//       ///
-//       InEdgeIt& first(InEdgeIt &i, Node) const { return i; }
-//       /// The first outgoing edge.
-
-//       /// The first outgoing edge.
-//       ///
-//       OutEdgeIt& first(OutEdgeIt& i, Node) const { return i; }
-//       /// The first edge of the Graph.
-
-//       /// The first edge of the Graph.
-//       ///
-//       EdgeIt& first(EdgeIt& i) const { return i; }
-
 //       ///Gives back the target node of an edge.
 
@@ -374,38 +334,13 @@
 //       ///
 //       Node source(Edge) const { return INVALID; }
-  
-//       ///Gives back the \e id of a node.
-
-//       ///\warning Not all graph structures provide this feature.
-//       ///
-//       ///\todo Should each graph provide \c id?
-//       int id(const Node&) const { return 0; }
-//       ///Gives back the \e id of an edge.
-
-//       ///\warning Not all graph structures provide this feature.
-//       ///
-//       ///\todo Should each graph provide \c id?
-//       int id(const Edge&) const { return 0; }
-
-//       ///\e
-      
-//       ///\todo Should it be in the concept?
-//       ///
-//       int nodeNum() const { return 0; }
-//       ///\e
-
-//       ///\todo Should it be in the concept?
-//       ///
-//       int edgeNum() const { return 0; }
-
-
-//       ///Reference map of the nodes to type \c T.
+//       /// Read write map of the nodes to type \c T.
 
 //       /// \ingroup concept
-//       ///Reference map of the nodes to type \c T.
+//       /// ReadWrite map of the nodes to type \c T.
 //       /// \sa Reference
 //       /// \warning Making maps that can handle bool type (NodeMap<bool>)
 //       /// needs some extra attention!
-//       template<class T> class NodeMap : public ReferenceMap< Node, T >
+//       template<class T> 
+//       class NodeMap : public ReadWriteMap< Node, T >
 //       {
 //       public:
@@ -417,11 +352,11 @@
 
 // 	///Copy constructor
-// 	template<typename TT> NodeMap(const NodeMap<TT>&) { }
+// 	NodeMap(const NodeMap&) { }
 // 	///Assignment operator
-// 	template<typename TT> NodeMap& operator=(const NodeMap<TT>&)
-// 	{ return *this; }
-//       };
-
-//       ///Reference map of the edges to type \c T.
+// 	NodeMap& operator=(const NodeMap&) { return *this; }
+// 	// \todo fix this concept
+//       };
+
+//       /// Read write map of the edges to type \c T.
 
 //       /// \ingroup concept
@@ -430,6 +365,6 @@
 //       /// \warning Making maps that can handle bool type (EdgeMap<bool>)
 //       /// needs some extra attention!
-//       template<class T> class EdgeMap
-// 	: public ReferenceMap<Edge,T>
+//       template<class T> 
+//       class EdgeMap : public ReadWriteMap<Edge,T>
 //       {
 //       public:
@@ -439,211 +374,12 @@
 // 	///\e
 // 	EdgeMap(const StaticGraph&, T) { }
-    
 // 	///Copy constructor
-// 	template<typename TT> EdgeMap(const EdgeMap<TT>&) { }
+// 	EdgeMap(const EdgeMap&) { }
 // 	///Assignment operator
-// 	template<typename TT> EdgeMap &operator=(const EdgeMap<TT>&)
-// 	{ return *this; }
+// 	EdgeMap& operator=(const EdgeMap&) { return *this; }
+// 	// \todo fix this concept    
 //       };
 //     };
 
-//     struct DummyType {
-//       int value;
-//       DummyType() {}
-//       DummyType(int p) : value(p) {}
-//       DummyType& operator=(int p) { value = p; return *this;}
-//     };
-    
-//     ///\brief Checks whether \c G meets the
-//     ///\ref lemon::concept::StaticGraph "StaticGraph" concept
-//     template<class Graph> void checkCompileStaticGraph(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; b=true;
-// 	b=(i==INVALID); b=(i!=INVALID);
-// 	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=++i;
-// 	bool b; b=true;
-// 	b=(i==INVALID); b=(i!=INVALID);
-// 	Node n(i);
-// 	n=i;
-// 	b=(i==j); b=(i!=j); b=(i<j);
-// 	//Node ->NodeIt conversion
-// 	NodeIt ni(G,n);
-//       }
-//       {
-// 	Edge i; Edge j(i); Edge k(INVALID);
-// 	i=j;
-// 	bool b; b=true;
-// 	b=(i==INVALID); b=(i!=INVALID);
-// 	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=++i;
-// 	bool b; b=true;
-// 	b=(i==INVALID); b=(i!=INVALID);
-// 	Edge e(i);
-// 	e=i;
-// 	b=(i==j); b=(i!=j); b=(i<j);
-// 	//Edge ->EdgeIt conversion
-// 	EdgeIt ei(G,e);
-//       }
-//       {
-// 	Node n;
-// 	InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n);
-// 	i=j;
-// 	j=G.first(i,n);
-// 	j=++i;
-// 	bool b; b=true;
-// 	b=(i==INVALID); b=(i!=INVALID);
-// 	Edge e(i);
-// 	e=i;
-// 	b=(i==j); b=(i!=j); b=(i<j);
-// 	//Edge ->InEdgeIt conversion
-// 	InEdgeIt ei(G,e);
-//       }
-//       {
-// 	Node n;
-// 	OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n);
-// 	i=j;
-// 	j=G.first(i,n);
-// 	j=++i;
-// 	bool b; b=true;
-// 	b=(i==INVALID); b=(i!=INVALID);
-// 	Edge e(i);
-// 	e=i;
-// 	b=(i==j); b=(i!=j); b=(i<j);
-// 	//Edge ->OutEdgeIt conversion
-// 	OutEdgeIt ei(G,e);
-//       }
-//       {
-// 	Node n,m;
-// 	n=m=INVALID;
-// 	Edge e;
-// 	e=INVALID;
-// 	n=G.source(e);
-// 	n=G.target(e);
-//       }
-//       // id tests
-//       { Node n; int i=G.id(n); i=i; }
-//       { Edge e; int i=G.id(e); i=i; }
-//       //NodeMap tests
-//       {
-// 	Node k;
-// 	typename Graph::template NodeMap<int> m(G);
-// 	//Const map
-// 	typename Graph::template NodeMap<int> const &cm = m;
-// 	//Inicialize with default value
-// 	typename Graph::template NodeMap<int> mdef(G,12);
-// 	//Copy
-// 	typename Graph::template NodeMap<int> mm(cm);
-// 	//Copy from another type
-// 	typename Graph::template NodeMap<double> dm(cm);
-// 	//Copy to more complex type
-// 	typename Graph::template NodeMap<DummyType> em(cm);
-// 	int v;
-// 	v=m[k]; m[k]=v; m.set(k,v);
-// 	v=cm[k];
-    
-// 	m=cm;  
-// 	dm=cm; //Copy from another type  
-// 	em=cm; //Copy to more complex type
-// 	{
-// 	  //Check the typedef's
-// 	  typename Graph::template NodeMap<int>::Value val;
-// 	  val=1;
-// 	  typename Graph::template NodeMap<int>::Key key;
-// 	  key = typename Graph::NodeIt(G);
-// 	}
-//       }  
-//       { //bool NodeMap
-// 	Node k;
-// 	typename Graph::template NodeMap<bool> m(G);
-// 	typename Graph::template NodeMap<bool> const &cm = m;  //Const map
-// 	//Inicialize with default value
-// 	typename Graph::template NodeMap<bool> mdef(G,12);
-// 	typename Graph::template NodeMap<bool> mm(cm);   //Copy
-// 	typename Graph::template 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
-// 	m=dm; //Copy to another type
-
-// 	{
-// 	  //Check the typedef's
-// 	  typename Graph::template NodeMap<bool>::Value val;
-// 	  val=true;
-// 	  typename Graph::template NodeMap<bool>::Key key;
-// 	  key= typename Graph::NodeIt(G);
-// 	}
-//       }
-//       //EdgeMap tests
-//       {
-// 	Edge k;
-// 	typename Graph::template EdgeMap<int> m(G);
-// 	typename Graph::template EdgeMap<int> const &cm = m;  //Const map
-// 	//Inicialize with default value
-// 	typename Graph::template EdgeMap<int> mdef(G,12);
-// 	typename Graph::template EdgeMap<int> mm(cm);   //Copy
-// 	typename Graph::template 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
-// 	{
-// 	  //Check the typedef's
-// 	  typename Graph::template EdgeMap<int>::Value val;
-// 	  val=1;
-// 	  typename Graph::template EdgeMap<int>::Key key;
-// 	  key= typename Graph::EdgeIt(G);
-// 	}
-//       }  
-//       { //bool EdgeMap
-// 	Edge k;
-// 	typename Graph::template EdgeMap<bool> m(G);
-// 	typename Graph::template EdgeMap<bool> const &cm = m;  //Const map
-// 	//Inicialize with default value
-// 	typename Graph::template EdgeMap<bool> mdef(G,12);
-// 	typename Graph::template EdgeMap<bool> mm(cm);   //Copy
-// 	typename Graph::template 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
-// 	m=dm; //Copy to another type
-// 	{
-// 	  //Check the typedef's
-// 	  typename Graph::template EdgeMap<bool>::Value val;
-// 	  val=true;
-// 	  typename Graph::template EdgeMap<bool>::Key key;
-// 	  key= typename Graph::EdgeIt(G);
-// 	}
-//       }
-//     }
-    
 //     /// An empty non-static graph class.
     
@@ -666,8 +402,8 @@
 //       ///Add a new edge to the graph.
 
-//       ///Add a new edge to the graph with source node \c t
-//       ///and target node \c h.
+//       ///Add a new edge to the graph with source node \c s
+//       ///and target node \c t.
 //       ///\return the new edge.
-//       Edge addEdge(Node h, Node t) { return INVALID; }
+//       Edge addEdge(Node s, Node t) { return INVALID; }
     
 //       /// Resets the graph.
@@ -678,28 +414,4 @@
 //       void clear() { }
 //     };
-
-    
-//     ///\brief Checks whether \c G meets the
-//     ///\ref lemon::concept::ExtendableGraph "ExtendableGraph" concept
-//     template<class Graph> void checkCompileExtendableGraph(Graph &G) 
-//     {
-//       checkCompileStaticGraph(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 n,m;
-//       n=G.addNode();
-//       m=G.addNode();
-//       Edge e;
-//       e=G.addEdge(n,m); 
-  
-//       //  G.clear();
-//     }
-
 
 //     /// An empty erasable graph class.
@@ -726,41 +438,6 @@
 //       void erase(Edge e) { }
 //     };
-    
-//     template<class Graph> void checkCompileGraphEraseEdge(Graph &G) 
-//     {
-//       typename Graph::Edge e;
-//       G.erase(e);
-//     }
-
-//     template<class Graph> void checkCompileGraphEraseNode(Graph &G) 
-//     {
-//       typename Graph::Node n;
-//       G.erase(n);
-//     }
-
-//     ///\brief Checks whether \c G meets the
-//     ///\ref lemon::concept::EresableGraph "EresableGraph" concept
-//     template<class Graph> void checkCompileErasableGraph(Graph &G) 
-//     {
-//       checkCompileExtendableGraph(G);
-//       checkCompileGraphEraseNode(G);
-//       checkCompileGraphEraseEdge(G);
-//     }
-
-//     ///Checks whether a graph has findEdge() member function.
-    
-//     ///\todo findEdge() might be a global function.
-//     ///
-//     template<class Graph> void checkCompileGraphFindEdge(Graph &G) 
-//     {
-//       typedef typename Graph::NodeIt Node;
-//       typedef typename Graph::NodeIt NodeIt;
-
-//       G.findEdge(NodeIt(G),++NodeIt(G),G.findEdge(NodeIt(G),++NodeIt(G)));
-//       G.findEdge(Node(),Node(),G.findEdge(Node(),Node()));  
-//     }
-
-
-
+
+    
     /************* New GraphBase stuff **************/
 
@@ -816,8 +493,8 @@
 
       template<typename T>
-      class NodeMap : public GraphMap<Node, T, GraphBase> {};
+      class NodeMap : public GraphMap<GraphBase, Node, T> {};
 
       template<typename T>
-      class EdgeMap : public GraphMap<Edge, T, GraphBase> {};
+      class EdgeMap : public GraphMap<GraphBase, Node, T> {};
     };
 
@@ -834,12 +511,12 @@
       typedef BaseGraphComponent::Node Node;
       typedef BaseGraphComponent::Edge Edge;
-    };
-
-    template <typename Graph>
-    struct StaticGraphConcept {
-      void constraints() {
-	function_requires<IterableGraphComponentConcept<Graph> >();
-	function_requires<MappableGraphComponentConcept<Graph> >();
-      }
+
+      template <typename _Graph>
+      struct Constraints {
+	void constraints() {
+	  checkConcept<IterableGraphComponent, _Graph>();
+	  checkConcept<MappableGraphComponent, _Graph>();
+	}
+      };
     };
 
@@ -850,13 +527,13 @@
       typedef BaseGraphComponent::Node Node;
       typedef BaseGraphComponent::Edge Edge;
-    };
-
-    template <typename Graph>
-    struct ExtendableGraphConcept {
-      void constraints() {
-	function_requires<StaticGraphConcept<Graph> >();
-	function_requires<ExtendableGraphComponentConcept<Graph> >();
-	function_requires<ClearableGraphComponentConcept<Graph> >();
-      }
+
+      template <typename _Graph>
+      struct Constraints {
+	void constraints() {
+	  checkConcept<StaticGraph, _Graph >();
+	  checkConcept<ExtendableGraphComponent, _Graph >();
+	  checkConcept<ClearableGraphComponent, _Graph >();
+	}
+      };
     };
 
@@ -867,12 +544,12 @@
       typedef BaseGraphComponent::Node Node;
       typedef BaseGraphComponent::Edge Edge;
-    };
-
-    template <typename Graph>
-    struct ErasableGraphConcept {
-      void constraints() {
-	function_requires<ExtendableGraphConcept<Graph> >();
-	function_requires<ErasableGraphComponentConcept<Graph> >();
-      }
+
+      template <typename _Graph>
+      struct Constraints {
+	void constraints() {
+	  checkConcept<ExtendableGraph, _Graph >();
+	  checkConcept<ErasableGraphComponent, _Graph >();
+	}
+      };
     };
 
