[Lemon-commits] [lemon_svn] klao: r1322 - in hugo/trunk/src: benchmark lemon lemon/skeletons test work/klao

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:44:36 CET 2006


Author: klao
Date: Thu Oct 28 00:38:50 2004
New Revision: 1322

Added:
   hugo/trunk/src/lemon/alteration_observer_registry.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/alteration_observer_registry.h
   hugo/trunk/src/lemon/clearable_graph_extender.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/clearable_graph_extender.h
   hugo/trunk/src/lemon/concept_check.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/concept_check.h
   hugo/trunk/src/lemon/erasable_graph_extender.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/erasable_graph_extender.h
   hugo/trunk/src/lemon/extendable_graph_extender.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/extendable_graph_extender.h
   hugo/trunk/src/lemon/graph_utils.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/graph_utils.h
   hugo/trunk/src/lemon/idmappable_graph_extender.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/idmappable_graph_extender.h
   hugo/trunk/src/lemon/iterable_graph_extender.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/iterable_graph_extender.h
   hugo/trunk/src/lemon/list_graph.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/list_graph.h
   hugo/trunk/src/lemon/mappable_graph_extender.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/mappable_graph_extender.h
   hugo/trunk/src/lemon/skeletons/graph_component.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/lemon/skeletons/graph_component.h
   hugo/trunk/src/test/graph_factory_test.cc
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/test/graph_factory_test.cc
   hugo/trunk/src/test/graph_test.cc
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/test/graph_test.cc
   hugo/trunk/src/test/graph_utils_test.cc
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/test/graph_utils_test.cc
   hugo/trunk/src/test/graph_utils_test.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/test/graph_utils_test.h
   hugo/trunk/src/test/map_test.h
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/test/map_test.h
   hugo/trunk/src/test/new_graph_test.cc
      - copied unchanged from r1321, /hugo/branches/graph_factory/src/test/new_graph_test.cc
Removed:
   hugo/trunk/src/lemon/map_registry.h
Modified:
   hugo/trunk/src/benchmark/hcube.cc
   hugo/trunk/src/lemon/Makefile.am
   hugo/trunk/src/lemon/array_map.h
   hugo/trunk/src/lemon/bfs.h
   hugo/trunk/src/lemon/default_map.h
   hugo/trunk/src/lemon/dfs.h
   hugo/trunk/src/lemon/full_graph.h
   hugo/trunk/src/lemon/preflow.h
   hugo/trunk/src/lemon/skeletons/graph.h
   hugo/trunk/src/lemon/skeletons/maps.h
   hugo/trunk/src/lemon/smart_graph.h
   hugo/trunk/src/lemon/suurballe.h
   hugo/trunk/src/lemon/vector_map.h
   hugo/trunk/src/test/   (props changed)
   hugo/trunk/src/test/Makefile.am
   hugo/trunk/src/test/graph_test.h
   hugo/trunk/src/test/graph_wrapper_test.cc
   hugo/trunk/src/test/test_tools.h
   hugo/trunk/src/work/klao/TODO

Log:
The graph_factory branch (@ 1321) has been merged to trunk.


Modified: hugo/trunk/src/benchmark/hcube.cc
==============================================================================
--- hugo/trunk/src/benchmark/hcube.cc	(original)
+++ hugo/trunk/src/benchmark/hcube.cc	Thu Oct 28 00:38:50 2004
@@ -66,12 +66,15 @@
     for(int i=0;i<dim*(1<<dim);i++) P();
     
     //  for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
-    Edge te;
-    for(int i=0;i<dim*(1<<dim);i++) {
-      te.setToId(((long long int)(i)*93505)%(dim*(1<<dim)));
-      //    map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P();
-      map[te]=P();
-    }
+
+    ///\todo It must have been commented out because of
+    ///setToId
+//     Edge te;
+//     for(int i=0;i<dim*(1<<dim);i++) {
+//       te.setToId(((long long int)(i)*93505)%(dim*(1<<dim)));
+//       //    map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P();
+//       map[te]=P();
+//     }
     
 //     for(int i=0;i<(1<<dim);i++) {
 //       int mul= (1<<(numOfZeros(i,dim)/4));

Modified: hugo/trunk/src/lemon/Makefile.am
==============================================================================
--- hugo/trunk/src/lemon/Makefile.am	(original)
+++ hugo/trunk/src/lemon/Makefile.am	Thu Oct 28 00:38:50 2004
@@ -10,13 +10,12 @@
 	fib_heap.h							\
 	full_graph.h							\
 	graph_wrapper.h							\
+	graph_utils.h							\
 	invalid.h							\
 	kruskal.h							\
 	list_graph.h							\
-	map_defines.h                                                   \
 	map_iterator.h                                                  \
-	map_registry.h                                                  \
-	map_bits.h							\
+	alteration_observer_registry.h                                  \
 	maps.h								\
 	min_cost_flow.h                                                 \
 	suurballe.h                                                     \
@@ -26,10 +25,19 @@
 	time_measure.h							\
 	unionfind.h							\
 	vector_map.h                                                    \
-	xy.h
+	xy.h								\
+	concept_check.h							\
+	map_defines.h							\
+	map_bits.h							\
+	iterable_graph_extender.h					\
+	idmappable_graph_extender.h				   	\
+	extendable_graph_extender.h					\
+	clearable_graph_extender.h					\
+	erasable_graph_extender.h
 
 noinst_HEADERS =							\
 	skeletons/graph.h						\
+	skeletons/graph_component.h					\
 	skeletons/sym_graph.h                                           \
 	skeletons/maps.h                                                \
 	skeletons/path.h

Modified: hugo/trunk/src/lemon/array_map.h
==============================================================================
--- hugo/trunk/src/lemon/array_map.h	(original)
+++ hugo/trunk/src/lemon/array_map.h	Thu Oct 28 00:38:50 2004
@@ -20,7 +20,6 @@
 #include <memory>
 
 #include <lemon/map_iterator.h>
-#include <lemon/map_bits.h>
 
 ///\ingroup graphmaps
 ///\file
@@ -42,22 +41,32 @@
    *  will belong to and the ValueType.
    */
 
-  template <typename MapRegistry, typename Value> 
-  class ArrayMap : public MapRegistry::MapBase {
+  template <typename _Graph, 
+	    typename _Item,
+	    typename _ItemIt,
+	    typename _IdMap,
+	    typename _Value>
+  class ArrayMap : public AlterationObserverRegistry<_Item>::ObserverBase {
 
-    template <typename MR, typename V> friend class ArrayMap;
-		
   public:
 		
     /// The graph type of the maps. 
-    typedef typename MapRegistry::Graph Graph;
+    typedef _Graph Graph;
     /// The key type of the maps.
-    typedef typename MapRegistry::KeyType KeyType;
+    typedef _Item KeyType;
+
+    typedef AlterationObserverRegistry<_Item> Registry;
+
+  private:
     /// The iterator to iterate on the keys.
-    typedef typename MapRegistry::KeyIt KeyIt;
+    typedef _ItemIt KeyIt;
+
+    typedef _IdMap IdMap;
+
+    typedef _Value Value;
 
     /// The MapBase of the Map which imlements the core regisitry function.
-    typedef typename MapRegistry::MapBase MapBase;
+    typedef typename Registry::ObserverBase Parent;
 		
     
   public:
@@ -77,52 +86,47 @@
     typedef const Value* ConstPointerType;
 
 
+  private:
     typedef std::allocator<Value> Allocator;
 
-	
+
+  public:
+
     /** Graph and Registry initialized map constructor.
      */
-    ArrayMap(const Graph& g, MapRegistry& r) : MapBase(g, r) {
+    ArrayMap(const Graph& _g, Registry& _r) : graph(&_g) {
+      attach(_r);
       allocate_memory();
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
+      for (KeyIt it(*graph); it != INVALID; ++it) {
+	int id = IdMap(*graph)[it];
 	allocator.construct(&(values[id]), Value());
       }								
     }
 
-    /** Constructor to use default value to initialize the map. 
-     */
-    ArrayMap(const Graph& g, MapRegistry& r, const Value& v) 
-      : MapBase(g, r) {
+    /// Constructor to use default value to initialize the map. 
+
+    /// It constrates a map and initialize all of the the map. 
+
+    ArrayMap(const Graph& _g, Registry& _r, const Value& _v) : graph(&_g) {
+      attach(_r);
       allocate_memory();
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
-	allocator.construct(&(values[id]), v);
+      for (KeyIt it(*graph); it != INVALID; ++it) {
+	int id = IdMap(*graph)[it];
+	allocator.construct(&(values[id]), _v);
       }								
     }
 
     /** Constructor to copy a map of the same map type.
      */
-    ArrayMap(const ArrayMap& copy) : MapBase(copy) {
-      capacity = copy.capacity;
-      if (capacity == 0) return;
-      values = allocator.allocate(capacity);
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
-	allocator.construct(&(values[id]), copy.values[id]);
+    ArrayMap(const ArrayMap& copy) {
+      if (copy.attached()) {
+	attach(*copy.getRegistry());
       }
-    }
-
-    /** Constructor to copy a map of an other map type.
-     */
-    template <typename TT>
-    ArrayMap(const ArrayMap<MapRegistry, TT>& copy) 
-      : MapBase(copy) {
       capacity = copy.capacity;
       if (capacity == 0) return;
       values = allocator.allocate(capacity);
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
+      for (KeyIt it(*graph); it != INVALID; ++it) {
+	int id = IdMap(*graph)[it];
 	allocator.construct(&(values[id]), copy.values[id]);
       }
     }
@@ -132,58 +136,33 @@
     ArrayMap& operator=(const ArrayMap& copy) {
       if (&copy == this) return *this;
       
-      if (MapBase::getGraph() != copy.getGraph()) {
-	if (capacity != 0) {
-	  MapBase::destroy();
-	  allocator.deallocate(values, capacity);
+      if (graph != copy.graph) {
+	if (attached()) {
+	  clear();
+	  detach();
+	}
+	if (copy.attached()) {
+	  attach(*copy.getRegistry());
 	}
-
-	MapBase::operator=(copy);
 	capacity = copy.capacity;
 	if (capacity == 0) return *this;
 	values = allocator.allocate(capacity);      
       }
 
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
+      for (KeyIt it(*graph); it != INVALID; ++it) {
+	int id = IdMap(*graph)[it];
 	allocator.construct(&(values[id]), copy.values[id]);
       }
 
       return *this;
     }
 
-    /** Assign operator to copy a map of an other map type.
-     */
-    template <typename TT>
-    ArrayMap& operator=(const ArrayMap<MapRegistry, TT>& copy) {
-
-      if (MapBase::getGraph() != copy.getGraph()) {
-	if (capacity != 0) {
-	  MapBase::destroy();
-	  allocator.deallocate(values, capacity);
-	}
-
-	MapBase::operator=(copy);
-
-	capacity = copy.capacity;
-	if (capacity == 0) return *this;
-	values = allocator.allocate(capacity);
-      }
-
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
-	allocator.construct(&(values[id]), copy.values[id]);
-      }
-
-      return *this;
-    }
-				
     /** The destructor of the map.
      */
-    virtual ~ArrayMap() {
-      if (capacity != 0) {
-	MapBase::destroy();
-	allocator.deallocate(values, capacity);
+    virtual ~ArrayMap() {      
+      if (attached()) {
+	clear();
+	detach();
       }
     }
 	
@@ -193,7 +172,7 @@
      * actual keys of the graph. 
      */
     ReferenceType operator[](const KeyType& key) {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
+      int id = IdMap(*graph)[key];
       return values[id];
     } 
 		
@@ -202,7 +181,7 @@
      * actual keys of the graph. 
      */
     ConstReferenceType operator[](const KeyType& key) const {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
+      int id = IdMap(*graph)[key];
       return values[id];
     }
 	
@@ -210,22 +189,21 @@
      *  This is a compatibility feature with the not dereferable maps.
      */
     void set(const KeyType& key, const ValueType& val) {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
-      values[id] = val;
+      (*this)[key] = val;
     }
 		
     /** Add a new key to the map. It called by the map registry.
      */
     void add(const KeyType& key) {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
+      int id = IdMap(*graph)[key];
       if (id >= capacity) {
 	int new_capacity = (capacity == 0 ? 1 : capacity);
 	while (new_capacity <= id) {
 	  new_capacity <<= 1;
 	}
-	Value* new_values = allocator.allocate(new_capacity);;
-	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	  int jd = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
+	Value* new_values = allocator.allocate(new_capacity);
+	for (KeyIt it(*graph); it != INVALID; ++it) {
+	  int jd = IdMap(*graph)[it];
 	  if (id != jd) {
 	    allocator.construct(&(new_values[jd]), values[jd]);
 	    allocator.destroy(&(values[jd]));
@@ -241,77 +219,86 @@
     /** Erase a key from the map. It called by the map registry.
      */
     void erase(const KeyType& key) {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
+      int id = IdMap(*graph)[key];
       allocator.destroy(&(values[id]));
     }
 
-    /** Clear the data structure.
-     */
+    void build() {
+      allocate_memory();
+      for (KeyIt it(*graph); it != INVALID; ++it) {
+	int id = IdMap(*graph)[it];
+	allocator.construct(&(values[id]), Value());
+      }								
+    }
+
     void clear() {	
       if (capacity != 0) {
-	MapBase::destroy();
+	for (KeyIt it(*graph); it != INVALID; ++it) {
+	  int id = IdMap(*graph)[it];
+	  allocator.destroy(&(values[id]));
+	}								
 	allocator.deallocate(values, capacity);
 	capacity = 0;
       }
     }
 
-    /// The stl compatible pair iterator of the map.
-    typedef MapIterator<ArrayMap> Iterator;
-    /// The stl compatible const pair iterator of the map.
-    typedef MapConstIterator<ArrayMap> ConstIterator;
-
-    /** Returns the begin iterator of the map.
-     */
-    Iterator begin() {
-      return Iterator(*this, KeyIt(*MapBase::getGraph()));
-    }
-
-    /** Returns the end iterator of the map.
-     */
-    Iterator end() {
-      return Iterator(*this, INVALID);
-    }
-
-    /** Returns the begin ConstIterator of the map.
-     */
-    ConstIterator begin() const {
-      return ConstIterator(*this, KeyIt(*MapBase::getGraph()));
-    }
-
-    /** Returns the end const_iterator of the map.
-     */
-    ConstIterator end() const {
-      return ConstIterator(*this, INVALID);
-    }
-
-    /// The KeySet of the Map.
-    typedef MapConstKeySet<ArrayMap> ConstKeySet;
-
-    /// KeySet getter function.
-    ConstKeySet keySet() const {
-      return ConstKeySet(*this); 
-    }
-
-    /// The ConstValueSet of the Map.
-    typedef MapConstValueSet<ArrayMap> ConstValueSet;
-
-    /// ConstValueSet getter function.
-    ConstValueSet valueSet() const {
-      return ConstValueSet(*this);
-    }
-
-    /// The ValueSet of the Map.
-    typedef MapValueSet<ArrayMap> ValueSet;
-
-    /// ValueSet getter function.
-    ValueSet valueSet() {
-      return ValueSet(*this);
-    }
+//     /// The stl compatible pair iterator of the map.
+//     typedef MapIterator<ArrayMap> Iterator;
+//     /// The stl compatible const pair iterator of the map.
+//     typedef MapConstIterator<ArrayMap> ConstIterator;
+
+//     /** Returns the begin iterator of the map.
+//      */
+//     Iterator begin() {
+//       return Iterator(*this, KeyIt(*MapBase::getGraph()));
+//     }
+
+//     /** Returns the end iterator of the map.
+//      */
+//     Iterator end() {
+//       return Iterator(*this, INVALID);
+//     }
+
+//     /** Returns the begin ConstIterator of the map.
+//      */
+//     ConstIterator begin() const {
+//       return ConstIterator(*this, KeyIt(*MapBase::getGraph()));
+//     }
+
+//     /** Returns the end const_iterator of the map.
+//      */
+//     ConstIterator end() const {
+//       return ConstIterator(*this, INVALID);
+//     }
+
+//     /// The KeySet of the Map.
+//     typedef MapConstKeySet<ArrayMap> ConstKeySet;
+
+//     /// KeySet getter function.
+//     ConstKeySet keySet() const {
+//       return ConstKeySet(*this); 
+//     }
+
+//     /// The ConstValueSet of the Map.
+//     typedef MapConstValueSet<ArrayMap> ConstValueSet;
+
+//     /// ConstValueSet getter function.
+//     ConstValueSet valueSet() const {
+//       return ConstValueSet(*this);
+//     }
+
+//     /// The ValueSet of the Map.
+//     typedef MapValueSet<ArrayMap> ValueSet;
+
+//     /// ValueSet getter function.
+//     ValueSet valueSet() {
+//       return ValueSet(*this);
+//     }
 
   private:
       
     void allocate_memory() {
-      int max_id = KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph());
+      int max_id = IdMap(*graph).maxId();
       if (max_id == -1) {
 	capacity = 0;
 	values = 0;
@@ -324,24 +311,88 @@
       values = allocator.allocate(capacity);	
     }      
 
+    const Graph* graph;
     int capacity;
     Value* values;
     Allocator allocator;
 
   public:
-    // STL  compatibility typedefs.
-    typedef Iterator iterator;
-    typedef ConstIterator const_iterator;
-    typedef typename Iterator::PairValueType value_type;
-    typedef typename Iterator::KeyType key_type;
-    typedef typename Iterator::ValueType data_type;
-    typedef typename Iterator::PairReferenceType reference;
-    typedef typename Iterator::PairPointerType pointer;
-    typedef typename ConstIterator::PairReferenceType const_reference;
-    typedef typename ConstIterator::PairPointerType const_pointer;
-    typedef int difference_type;		
+//     // STL  compatibility typedefs.
+//     typedef Iterator iterator;
+//     typedef ConstIterator const_iterator;
+//     typedef typename Iterator::PairValueType value_type;
+//     typedef typename Iterator::KeyType key_type;
+//     typedef typename Iterator::ValueType data_type;
+//     typedef typename Iterator::PairReferenceType reference;
+//     typedef typename Iterator::PairPointerType pointer;
+//     typedef typename ConstIterator::PairReferenceType const_reference;
+//     typedef typename ConstIterator::PairPointerType const_pointer;
+//     typedef int difference_type;		
   };		
 
+  template <typename _Base> 
+  class ArrayMappableGraphExtender : public _Base {
+  public:
+
+    typedef ArrayMappableGraphExtender<_Base> Graph;
+    typedef _Base Parent;
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::NodeIt NodeIt;
+    typedef typename Parent::NodeIdMap NodeIdMap;
+    typedef typename Parent::NodeObserverRegistry NodeObserverRegistry;
+
+    typedef typename Parent::Edge Edge;
+    typedef typename Parent::EdgeIt EdgeIt;
+    typedef typename Parent::EdgeIdMap EdgeIdMap;
+    typedef typename Parent::EdgeObserverRegistry EdgeObserverRegistry;
+
+    
+
+    template <typename _Value>
+    class NodeMap : public ArrayMap<Graph, Node, NodeIt, NodeIdMap, _Value> {
+    public:
+      typedef ArrayMappableGraphExtender<_Base> Graph;
+
+      typedef typename Graph::Node Node;
+      typedef typename Graph::NodeIt NodeIt;
+      typedef typename Graph::NodeIdMap NodeIdMap;
+
+      typedef ArrayMap<Graph, Node, NodeIt, NodeIdMap, _Value> Parent;
+
+      typedef typename Parent::Graph Graph;
+      typedef typename Parent::Value Value;
+
+      NodeMap(const Graph& g) 
+	: Parent(g, g.getNodeObserverRegistry()) {}
+      NodeMap(const Graph& g, const Value& v) 
+	: Parent(g, g.getNodeObserverRegistry(), v) {}
+
+    };
+
+    template <typename _Value>
+    class EdgeMap : public ArrayMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> {
+    public:
+      typedef ArrayMappableGraphExtender<_Base> Graph;
+
+      typedef typename Graph::Edge Edge;
+      typedef typename Graph::EdgeIt EdgeIt;
+      typedef typename Graph::EdgeIdMap EdgeIdMap;
+
+      typedef ArrayMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> Parent;
+
+      typedef typename Parent::Graph Graph;
+      typedef typename Parent::Value Value;
+
+      EdgeMap(const Graph& g) 
+	: Parent(g, g.getEdgeObserverRegistry()) {}
+      EdgeMap(const Graph& g, const Value& v) 
+	: Parent(g, g.getEdgeObserverRegistry(), v) {}
+
+    };
+    
+  };
+
 /// @}
 
 }

Modified: hugo/trunk/src/lemon/bfs.h
==============================================================================
--- hugo/trunk/src/lemon/bfs.h	(original)
+++ hugo/trunk/src/lemon/bfs.h	Thu Oct 28 00:38:50 2004
@@ -195,7 +195,7 @@
 	pred_node->set(u,INVALID);
       }
       
-      int N=G->nodeNum();
+      int N = countNodes(*G);
       std::vector<typename Graph::Node> Q(N);
       int Qh=0;
       int Qt=0;

Modified: hugo/trunk/src/lemon/default_map.h
==============================================================================
--- hugo/trunk/src/lemon/default_map.h	(original)
+++ hugo/trunk/src/lemon/default_map.h	Thu Oct 28 00:38:50 2004
@@ -23,7 +23,7 @@
 
 ///\ingroup graphmaps
 ///\file
-///\brief Graph maps that construates and destruates
+///\brief Graph maps that construct and destruct
 ///their elements dynamically.
 
 namespace lemon {
@@ -41,100 +41,185 @@
    */
 
 
-  /** Macro to implement the DefaultMap.
-   */
-#define DEFAULT_MAP_BODY(DynMap, Value) \
-{ \
-\
-public: \
-\
-typedef DynMap<MapRegistry, Value> Parent; \
-\
-typedef typename MapRegistry::Graph Graph; \
-\
-DefaultMap(const Graph& g, MapRegistry& r) : Parent(g, r) {} \
-DefaultMap(const Graph& g, MapRegistry& r, const Value& v) \
-  : Parent(g, r, v) {} \
-DefaultMap(const DefaultMap& copy) \
-  : Parent(static_cast<const Parent&>(copy)) {} \
-template <typename TT> \
-DefaultMap(const DefaultMap<MapRegistry, TT>& copy) \
-  : Parent(*copy.getGraph()) { \
-  if (Parent::getGraph()) { \
-    for (typename Parent::KeyIt it(*Parent::getGraph()); it!=INVALID; ++it) {\
-      Parent::operator[](it) = copy[it]; \
-    } \
-  } \
-} \
-DefaultMap& operator=(const DefaultMap& copy) { \
-  Parent::operator=(static_cast<const Parent&>(copy)); \
-  return *this; \
-} \
-template <typename TT> \
-DefaultMap& operator=(const DefaultMap<MapRegistry, TT>& copy) { \
-  if (Parent::getGraph() != copy.getGraph()) { \
-    Parent::clear(); \
-    Parent::MapBase::operator=(copy); \
-    Parent::construct(); \
-  } \
-  if (Parent::getGraph()) { \
-    for (typename Parent::KeyIt it(*Parent::getGraph()); it!=INVALID; ++it) {\
-      Parent::operator[](it) = copy[it]; \
-    } \
-  } \
-  return *this; \
-} \
-};
-
-
-  template <typename MapRegistry, typename Type>
-  class DefaultMap : public ArrayMap<MapRegistry, Type> 
-  DEFAULT_MAP_BODY(ArrayMap, Type);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, bool> 
-    : public VectorMap<MapRegistry, bool> 
-  DEFAULT_MAP_BODY(VectorMap, bool);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, char> 
-    : public VectorMap<MapRegistry, char> 
-  DEFAULT_MAP_BODY(VectorMap, char);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, int> 
-    : public VectorMap<MapRegistry, int> 
-  DEFAULT_MAP_BODY(VectorMap, int);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, short> 
-    : public VectorMap<MapRegistry, short> 
-  DEFAULT_MAP_BODY(VectorMap, short);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, long> 
-    : public VectorMap<MapRegistry, long> 
-  DEFAULT_MAP_BODY(VectorMap, long);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, float> 
-    : public VectorMap<MapRegistry, float> 
-  DEFAULT_MAP_BODY(VectorMap, float);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, double> 
-    : public VectorMap<MapRegistry, double> 
-  DEFAULT_MAP_BODY(VectorMap, double);
-
-  template <typename MapRegistry>
-  class DefaultMap<MapRegistry, long double> 
-    : public VectorMap<MapRegistry, long double> 
-  DEFAULT_MAP_BODY(VectorMap, long double);
-
-  template <typename MapRegistry, typename Type>
-  class DefaultMap<MapRegistry, Type*>
-    : public VectorMap<MapRegistry, Type*> 
-  DEFAULT_MAP_BODY(VectorMap, Type*);
+
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap, typename _Value>
+  struct DefaultMapSelector {
+    typedef ArrayMap<_Graph, _Item, _ItemIt, _IdMap, _Value> Map;
+  };
+
+  // bool
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, bool> {
+    typedef VectorMap<_Graph, _Item, _IdMap, bool> Map;
+  };
+
+  // char
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, char> {
+    typedef VectorMap<_Graph, _Item, _IdMap, char> Map;
+  };
+
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed char> {
+    typedef VectorMap<_Graph, _Item, _IdMap, signed char> Map;
+  };
+
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned char> {
+    typedef VectorMap<_Graph, _Item, _IdMap, unsigned char> Map;
+  };
+
+
+  // int
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed int> {
+    typedef VectorMap<_Graph, _Item, _IdMap, signed int> Map;
+  };
+
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned int> {
+    typedef VectorMap<_Graph, _Item, _IdMap, unsigned int> Map;
+  };
+
+
+  // short
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed short> {
+    typedef VectorMap<_Graph, _Item, _IdMap, signed short> Map;
+  };
+
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned short> {
+    typedef VectorMap<_Graph, _Item, _IdMap, unsigned short> Map;
+  };
+
+
+  // long
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed long> {
+    typedef VectorMap<_Graph, _Item, _IdMap, signed long> Map;
+  };
+
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned long> {
+    typedef VectorMap<_Graph, _Item, _IdMap, unsigned long> Map;
+  };
+
+  // \todo handling long long type
+
+
+  // float
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, float> {
+    typedef VectorMap<_Graph, _Item, _IdMap, float> Map;
+  };
+
+
+  // double
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, double> {
+    typedef VectorMap<_Graph, _Item, _IdMap,  double> Map;
+  };
+
+
+  // long double
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, long double> {
+    typedef VectorMap<_Graph, _Item, _IdMap, long double> Map;
+  };
+
+
+  // pointer
+  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap, typename _Ptr>
+  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Ptr*> {
+    typedef VectorMap<_Graph, _Item, _IdMap, _Ptr*> Map;
+  };
+
+
+
+  template <typename _Graph, 
+	    typename _Item,
+	    typename _ItemIt,
+	    typename _IdMap,
+	    typename _Value>
+  class DefaultMap : public DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Value>::Map {
+  public:
+    typedef typename DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Value>::Map Parent;
+    typedef DefaultMap<_Graph, _Item, _ItemIt, _IdMap, bool> Map;
+    
+    typedef typename Parent::Graph Graph;
+    typedef typename Parent::Registry Registry;
+    typedef typename Parent::ValueType ValueType;
+
+    DefaultMap(const Graph& _g, Registry& _r) : Parent(_g, _r) {}
+    DefaultMap(const Graph& _g, Registry& _r, const ValueType& _v) : Parent(_g, _r, _v) {}
+  };
+
+
+
+  template <typename _Base> 
+  class DefaultMappableGraphExtender : public _Base {
+  public:
+
+    typedef DefaultMappableGraphExtender<_Base> Graph;
+    typedef _Base Parent;
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::NodeIt NodeIt;
+    typedef typename Parent::NodeIdMap NodeIdMap;
+    typedef typename Parent::NodeObserverRegistry NodeObserverRegistry;
+
+    typedef typename Parent::Edge Edge;
+    typedef typename Parent::EdgeIt EdgeIt;
+    typedef typename Parent::EdgeIdMap EdgeIdMap;
+    typedef typename Parent::EdgeObserverRegistry EdgeObserverRegistry;
+
+    
+
+    template <typename _Value>
+    class NodeMap : public DefaultMap<Graph, Node, NodeIt, NodeIdMap, _Value> {
+    public:
+      typedef DefaultMappableGraphExtender<_Base> Graph;
+
+      typedef typename Graph::Node Node;
+      typedef typename Graph::NodeIt NodeIt;
+      typedef typename Graph::NodeIdMap NodeIdMap;
+
+      typedef DefaultMap<Graph, Node, NodeIt, NodeIdMap, _Value> Parent;
+
+      typedef typename Parent::Graph Graph;
+      typedef typename Parent::ValueType ValueType;
+
+      NodeMap(const Graph& g) 
+	: Parent(g, g.getNodeObserverRegistry()) {}
+      NodeMap(const Graph& g, const ValueType& v) 
+	: Parent(g, g.getNodeObserverRegistry(), v) {}
+
+    };
+
+    template <typename _Value>
+    class EdgeMap : public DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> {
+    public:
+      typedef DefaultMappableGraphExtender<_Base> Graph;
+
+      typedef typename Graph::Edge Edge;
+      typedef typename Graph::EdgeIt EdgeIt;
+      typedef typename Graph::EdgeIdMap EdgeIdMap;
+
+      typedef DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> Parent;
+
+      typedef typename Parent::Graph Graph;
+      typedef typename Parent::ValueType ValueType;
+
+      EdgeMap(const Graph& g) 
+	: Parent(g, g.getEdgeObserverRegistry()) {}
+      EdgeMap(const Graph& g, const ValueType& v) 
+	: Parent(g, g.getEdgeObserverRegistry(), v) {}
+
+    };
+    
+  };
+
 
 }
 

Modified: hugo/trunk/src/lemon/dfs.h
==============================================================================
--- hugo/trunk/src/lemon/dfs.h	(original)
+++ hugo/trunk/src/lemon/dfs.h	Thu Oct 28 00:38:50 2004
@@ -23,7 +23,7 @@
 ///
 ///\todo Revise Manual.
 
-#include <lemon/bin_heap.h>
+#include <lemon/graph_utils.h>
 #include <lemon/invalid.h>
 
 namespace lemon {
@@ -193,12 +193,12 @@
 	pred_node->set(u,INVALID);
       }
       
-      int N=G->nodeNum();
+      int N = countNodes(*G);
       std::vector<typename Graph::OutEdgeIt> Q(N);
 
       int Qh=0;
       
-      G->first(Q[Qh],s);
+      Q[Qh] = OutEdgeIt(*G, s);
       distance->set(s, 0);
 
       Node n=s;
@@ -209,7 +209,7 @@
 	  if((m=G->head(e))!=s && (*predecessor)[m=G->head(e)]==INVALID) {
 	    predecessor->set(m,e);
 	    pred_node->set(m,n);
-	    G->first(Q[++Qh],m);
+	    Q[++Qh] = OutEdgeIt(*G, m);
 	    distance->set(m,Qh);
 	    n=m;
 	  }

Modified: hugo/trunk/src/lemon/full_graph.h
==============================================================================
--- hugo/trunk/src/lemon/full_graph.h	(original)
+++ hugo/trunk/src/lemon/full_graph.h	Thu Oct 28 00:38:50 2004
@@ -17,20 +17,21 @@
 #ifndef LEMON_FULL_GRAPH_H
 #define LEMON_FULL_GRAPH_H
 
+
+#include <lemon/idmappable_graph_extender.h>
+
+#include <lemon/iterable_graph_extender.h>
+
+#include <lemon/alteration_observer_registry.h>
+#include <lemon/default_map.h>
+
 ///\ingroup graphs
 ///\file
 ///\brief FullGraph and SymFullGraph classes.
 
-#include <vector>
-#include <climits>
 
 #include <lemon/invalid.h>
 
-#include <lemon/map_registry.h>
-#include <lemon/array_map.h>
-
-#include <lemon/map_defines.h>
-
 namespace lemon {
 
 /// \addtogroup graphs
@@ -48,34 +49,26 @@
   ///\todo Don't we need SymEdgeMap?
   ///
   ///\author Alpar Juttner
-  class FullGraph {
+  class FullGraphBase {
     int NodeNum;
     int EdgeNum;
   public:
 
-    typedef FullGraph Graph;
+    typedef FullGraphBase Graph;
 
     class Node;
     class Edge;
 
-    class NodeIt;
-    class EdgeIt;
-    class OutEdgeIt;
-    class InEdgeIt;
-    
-
-    // Create map registries.
-    CREATE_MAP_REGISTRIES;
-    // Create node and edge maps.
-    CREATE_MAPS(ArrayMap);
-    
   public:
 
+    FullGraphBase() {}
+
+
     ///Creates a full graph with \c n nodes.
-    FullGraph(int n) : NodeNum(n), EdgeNum(NodeNum*NodeNum) { }
+    void construct(int n) { NodeNum = n; EdgeNum = n * n; }
     ///
-    FullGraph(const FullGraph &_g)
-      : NodeNum(_g.nodeNum()), EdgeNum(NodeNum*NodeNum) { }
+    //    FullGraphBase(const FullGraphBase &_g)
+    //      : NodeNum(_g.nodeNum()), EdgeNum(NodeNum*NodeNum) { }
     
     ///Number of nodes.
     int nodeNum() const { return NodeNum; }
@@ -93,17 +86,9 @@
     ///\sa id(Edge)
     int maxEdgeId() const { return EdgeNum-1; }
 
-    Node tail(Edge e) const { return e.n%NodeNum; }
-    Node head(Edge e) const { return e.n/NodeNum; }
+    Node tail(Edge e) const { return e.id % NodeNum; }
+    Node head(Edge e) const { return e.id / NodeNum; }
 
-    NodeIt& first(NodeIt& v) const {
-      v=NodeIt(*this); return v; }
-    EdgeIt& first(EdgeIt& e) const { 
-      e=EdgeIt(*this); return e; }
-    OutEdgeIt& first(OutEdgeIt& e, const Node v) const { 
-      e=OutEdgeIt(*this,v); return e; }
-    InEdgeIt& first(InEdgeIt& e, const Node v) const { 
-      e=InEdgeIt(*this,v); return e; }
 
     /// Node ID.
     
@@ -113,7 +98,8 @@
     ///
     /// The ID of the \ref INVALID node is -1.
     ///\return The ID of the node \c v. 
-    static int id(Node v) { return v.n; }
+
+    static int id(Node v) { return v.id; }
     /// Edge ID.
     
     /// The ID of a valid Edge is a nonnegative integer not greater than
@@ -122,7 +108,7 @@
     ///
     /// The ID of the \ref INVALID edge is -1.
     ///\return The ID of the edge \c e. 
-    static int id(Edge e) { return e.n; }
+    static int id(Edge e) { return e.id; }
 
     /// Finds an edge between two nodes.
     
@@ -134,110 +120,102 @@
     /// \return The found edge or INVALID if there is no such an edge.
     Edge findEdge(Node u,Node v, Edge prev = INVALID) 
     {
-      return prev.n == -1 ? Edge(*this, u.n, v.n) : INVALID;
+      return prev.id == -1 ? Edge(*this, u.id, v.id) : INVALID;
     }
     
       
     class Node {
-      friend class FullGraph;
-      template <typename T> friend class NodeMap;
-
-      friend class Edge;
-      friend class OutEdgeIt;
-      friend class InEdgeIt;
-      friend class SymEdge;
+      friend class FullGraphBase;
 
     protected:
-      int n;
-      friend int FullGraph::id(Node v); 
-      Node(int nn) {n=nn;}
+      int id;
+      Node(int _id) { id = _id;}
     public:
       Node() {}
-      Node (Invalid) { n=-1; }
-      bool operator==(const Node i) const {return n==i.n;}
-      bool operator!=(const Node i) const {return n!=i.n;}
-      bool operator<(const Node i) const {return n<i.n;}
+      Node (Invalid) { id = -1; }
+      bool operator==(const Node node) const {return id == node.id;}
+      bool operator!=(const Node node) const {return id != node.id;}
+      bool operator<(const Node node) const {return id < node.id;}
     };
     
-    class NodeIt : public Node {
-      const FullGraph *G;
-      friend class FullGraph;
-    public:
-      NodeIt() : Node() { }
-      NodeIt(const FullGraph& _G,Node n) : Node(n), G(&_G) { }
-      NodeIt(Invalid i) : Node(i) { }
-      NodeIt(const FullGraph& _G) : Node(_G.NodeNum?0:-1), G(&_G) { }
-      ///\todo Undocumented conversion Node -\> NodeIt.
-      NodeIt& operator++() { n=(n+2)%(G->NodeNum+1)-1;return *this; }
-    };
+
 
     class Edge {
-      friend class FullGraph;
-      template <typename T> friend class EdgeMap;
+      friend class FullGraphBase;
       
-      friend class Node;
-      friend class NodeIt;
     protected:
-      int n; //NodeNum*head+tail;
-      friend int FullGraph::id(Edge e);
+      int id;  // NodeNum * head + tail;
+
+      Edge(int _id) : id(_id) {}
 
-      Edge(int nn) : n(nn) {}
-      Edge(const FullGraph &G, int tail, int head) : n(G.NodeNum*head+tail) {}
+      Edge(const FullGraphBase& _graph, int tail, int head) 
+	: id(_graph.NodeNum * head+tail) {}
     public:
       Edge() { }
-      Edge (Invalid) { n=-1; }
-      bool operator==(const Edge i) const {return n==i.n;}
-      bool operator!=(const Edge i) const {return n!=i.n;}
-      bool operator<(const Edge i) const {return n<i.n;}
-      ///\bug This is a workaround until somebody tells me how to
-      ///make class \c SymFullGraph::SymEdgeMap friend of Edge
-      int &idref() {return n;}
-      const int &idref() const {return n;}
+      Edge (Invalid) { id = -1; }
+      bool operator==(const Edge edge) const {return id == edge.id;}
+      bool operator!=(const Edge edge) const {return id != edge.id;}
+      bool operator<(const Edge edge) const {return id < edge.id;}
     };
-    
-    class EdgeIt : public Edge {
-      friend class FullGraph;
-    public:
-      EdgeIt(const FullGraph& _G) : Edge(_G.EdgeNum-1) { }
-      EdgeIt(const FullGraph&, Edge e) : Edge(e) { }
-      EdgeIt (Invalid i) : Edge(i) { }
-      EdgeIt() : Edge() { }
-      EdgeIt& operator++() { --n; return *this; }
-
-      ///\bug This is a workaround until somebody tells me how to
-      ///make class \c SymFullGraph::SymEdgeMap friend of Edge
-      int &idref() {return n;}
-    };
-    
-    class OutEdgeIt : public Edge {
-      const FullGraph *G;
-      friend class FullGraph;
-    public: 
-      OutEdgeIt() : Edge() { }
-      OutEdgeIt(const FullGraph& _G, Edge e) : Edge(e), G(&_G) { }
-      OutEdgeIt (Invalid i) : Edge(i) { }
 
-      OutEdgeIt(const FullGraph& _G,const Node v) : Edge(v.n), G(&_G) {}
-      
-      OutEdgeIt& operator++()
-      { n+=G->NodeNum; if(n>=G->EdgeNum) n=-1; return *this; }
+    void first(Node& node) const {
+      node.id = NodeNum-1;
+    }
 
-    };
+    static void next(Node& node) {
+      --node.id;
+    }
+
+    void first(Edge& edge) const {
+      edge.id = EdgeNum-1;
+    }
+
+    static void next(Edge& edge) {
+      --edge.id;
+    }
+
+    void firstOut(Edge& edge, const Node& node) const {
+      edge.id = EdgeNum + node.id - NodeNum;
+    }
+
+    void nextOut(Edge& edge) const {
+      edge.id -= NodeNum;
+      if (edge.id < 0) edge.id = -1;
+    }
+
+    void firstIn(Edge& edge, const Node& node) const {
+      edge.id = node.id * NodeNum;
+    }
     
-    class InEdgeIt : public Edge {
-      const FullGraph *G;
-      friend class FullGraph;
-    public: 
-      InEdgeIt() : Edge() { }
-      InEdgeIt(const FullGraph& _G, Edge e) : Edge(e), G(&_G) { }
-      InEdgeIt (Invalid i) : Edge(i) { }
-      InEdgeIt(const FullGraph& _G,Node v) : Edge(v.n*_G.NodeNum), G(&_G) {}
-      InEdgeIt& operator++()
-      { if(!((++n)%G->NodeNum)) n=-1; return *this; }
-    };
+    void nextIn(Edge& edge) const {
+      ++edge.id;
+      if (edge.id % NodeNum == 0) edge.id = -1;
+    }
 
   };
 
+
+  typedef AlterableGraphExtender<FullGraphBase> AlterableFullGraphBase;
+  typedef IterableGraphExtender<AlterableFullGraphBase> IterableFullGraphBase;
+  typedef IdMappableGraphExtender<IterableFullGraphBase> IdMappableFullGraphBase;
+  typedef DefaultMappableGraphExtender<IdMappableFullGraphBase> MappableFullGraphBase;
+
+  class FullGraph : public MappableFullGraphBase {
+  public:
+
+    FullGraph(int n) { construct(n); }
+  };
+
+  template <>
+  int countNodes<FullGraph>(const FullGraph& graph) {
+    return graph.nodeNum();
+  }
+
+  template <>
+  int countEdges<FullGraph>(const FullGraph& graph) {
+    return graph.edgeNum();
+  }
+
   /// @}  
 
 } //namespace lemon

Modified: hugo/trunk/src/lemon/preflow.h
==============================================================================
--- hugo/trunk/src/lemon/preflow.h	(original)
+++ hugo/trunk/src/lemon/preflow.h	Thu Oct 28 00:38:50 2004
@@ -140,7 +140,7 @@
       Preflow(const Graph& _G, Node _s, Node _t, 
 	      const CapMap& _capacity, FlowMap& _flow) :
 	g(&_G), s(_s), t(_t), capacity(&_capacity),
-	flow(&_flow), n(_G.nodeNum()), level(_G), excess(_G,0), 
+	flow(&_flow), n(countNodes(_G)), level(_G), excess(_G,0), 
 	flow_prop(NO_FLOW), status(AFTER_NOTHING) { }
 
 

Modified: hugo/trunk/src/lemon/skeletons/graph.h
==============================================================================
--- hugo/trunk/src/lemon/skeletons/graph.h	(original)
+++ hugo/trunk/src/lemon/skeletons/graph.h	Thu Oct 28 00:38:50 2004
@@ -23,6 +23,8 @@
 
 #include <lemon/invalid.h>
 #include <lemon/skeletons/maps.h>
+#include <lemon/concept_check.h>
+#include <lemon/skeletons/graph_component.h>
 
 namespace lemon {
   namespace skeleton {
@@ -30,734 +32,883 @@
     /// \addtogroup skeletons
     /// @{
 
-    /// An empty static graph class.
+//     /// An empty static graph class.
   
-    /// This class provides all the common features of a graph structure,
-    /// however completely without implementations and real data structures
-    /// behind the interface.
-    /// All graph algorithms should compile with this class, but it will not
-    /// run properly, of course.
-    ///
-    /// It can be used for checking the interface compatibility,
-    /// or it can serve as a skeleton of a new graph structure.
-    /// 
-    /// Also, you will find here the full documentation of a certain graph
-    /// feature, the documentation of a real graph imlementation
-    /// like @ref ListGraph or
-    /// @ref SmartGraph will just refer to this structure.
-    ///
-    /// \todo A pages describing the concept of concept description would
-    /// be nice.
-    class StaticGraph
-    {
-    public:
-      /// Defalult constructor.
-
-      /// Defalult constructor.
-      ///
-      StaticGraph() { }
-      ///Copy consructor.
-
-//       ///\todo It is not clear, what we expect from a copy constructor.
-//       ///E.g. How to assign the nodes/edges to each other? What about maps?
-//       StaticGraph(const StaticGraph& g) { }
-
-      /// The base type of node iterators, 
-      /// or in other words, the trivial node iterator.
-
-      /// This is the base type of each node iterator,
-      /// thus each kind of node iterator converts to this.
-      /// More precisely each kind of node iterator should be inherited 
-      /// from the trivial node iterator.
-      class Node {
-      public:
-	/// Default constructor
-
-	/// @warning The default constructor sets the iterator
-	/// to an undefined value.
-	Node() { }
-	/// Copy constructor.
-
-	/// Copy constructor.
-	///
-	Node(const Node&) { }
-
-	/// Invalid constructor \& conversion.
-
-	/// This constructor initializes the iterator to be invalid.
-	/// \sa Invalid for more details.
-	Node(Invalid) { }
-	/// Equality operator
-
-	/// Two iterators are equal if and only if they point to the
-	/// same object or both are invalid.
-	bool operator==(Node) const { return true; }
+//     /// This class provides all the common features of a graph structure,
+//     /// however completely without implementations and real data structures
+//     /// behind the interface.
+//     /// All graph algorithms should compile with this class, but it will not
+//     /// run properly, of course.
+//     ///
+//     /// It can be used for checking the interface compatibility,
+//     /// or it can serve as a skeleton of a new graph structure.
+//     /// 
+//     /// Also, you will find here the full documentation of a certain graph
+//     /// feature, the documentation of a real graph imlementation
+//     /// like @ref ListGraph or
+//     /// @ref SmartGraph will just refer to this structure.
+//     ///
+//     /// \todo A pages describing the concept of concept description would
+//     /// be nice.
+//     class StaticGraph
+//     {
+//     public:
+//       /// Defalult constructor.
+
+//       /// Defalult constructor.
+//       ///
+//       StaticGraph() { }
+//       ///Copy consructor.
+
+// //       ///\todo It is not clear, what we expect from a copy constructor.
+// //       ///E.g. How to assign the nodes/edges to each other? What about maps?
+// //       StaticGraph(const StaticGraph& g) { }
+
+//       /// The base type of node iterators, 
+//       /// or in other words, the trivial node iterator.
+
+//       /// This is the base type of each node iterator,
+//       /// thus each kind of node iterator converts to this.
+//       /// More precisely each kind of node iterator should be inherited 
+//       /// from the trivial node iterator.
+//       class Node {
+//       public:
+// 	/// Default constructor
+
+// 	/// @warning The default constructor sets the iterator
+// 	/// to an undefined value.
+// 	Node() { }
+// 	/// Copy constructor.
+
+// 	/// Copy constructor.
+// 	///
+// 	Node(const Node&) { }
+
+// 	/// Invalid constructor \& conversion.
+
+// 	/// This constructor initializes the iterator to be invalid.
+// 	/// \sa Invalid for more details.
+// 	Node(Invalid) { }
+// 	/// Equality operator
+
+// 	/// Two iterators are equal if and only if they point to the
+// 	/// same object or both are invalid.
+// 	bool operator==(Node) const { return true; }
 
-	/// Inequality operator
+// 	/// Inequality operator
 	
-	/// \sa operator==(Node n)
-	///
-	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; }
-      };
-    
-      /// This iterator goes through each node.
-
-      /// This iterator goes through each node.
-      /// Its usage is quite simple, for example you can count the number
-      /// of nodes in graph \c g of type \c Graph like this:
-      /// \code
-      /// int count=0;
-      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
-      /// \endcode
-      class NodeIt : public Node {
-      public:
-	/// Default constructor
-
-	/// @warning The default constructor sets the iterator
-	/// to an undefined value.
-	NodeIt() { }
-	/// Copy constructor.
+// 	/// \sa operator==(Node n)
+// 	///
+// 	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; }
+//       };
+    
+//       /// This iterator goes through each node.
+
+//       /// This iterator goes through each node.
+//       /// Its usage is quite simple, for example you can count the number
+//       /// of nodes in graph \c g of type \c Graph like this:
+//       /// \code
+//       /// int count=0;
+//       /// for (Graph::NodeIt n(g); n!=INVALID ++n) ++count;
+//       /// \endcode
+//       class NodeIt : public Node {
+//       public:
+// 	/// Default constructor
+
+// 	/// @warning The default constructor sets the iterator
+// 	/// to an undefined value.
+// 	NodeIt() { }
+// 	/// Copy constructor.
 	
-	/// Copy constructor.
-	///
-	NodeIt(const NodeIt&) { }
-	/// Invalid constructor \& conversion.
-
-	/// Initialize the iterator to be invalid.
-	/// \sa Invalid for more details.
-	NodeIt(Invalid) { }
-	/// Sets the iterator to the first node.
-
-	/// Sets the iterator to the first node of \c g.
-	///
-	NodeIt(const StaticGraph& g) { }
-	/// Node -> NodeIt conversion.
-
-	/// Sets the iterator to the node of \c g pointed by the trivial 
-	/// iterator n.
-	/// This feature necessitates that each time we 
-	/// iterate the edge-set, the iteration order is the same.
-	NodeIt(const StaticGraph& g, const Node& n) { }
-	/// Next node.
-
-	/// Assign the iterator to the next node.
-	///
-	NodeIt& operator++() { return *this; }
-      };
-    
-    
-      /// The base type of the edge iterators.
-
-      /// The base type of the edge iterators.
-      ///
-      class Edge {
-      public:
-	/// Default constructor
-
-	/// @warning The default constructor sets the iterator
-	/// to an undefined value.
-	Edge() { }
-	/// Copy constructor.
-
-	/// Copy constructor.
-	///
-	Edge(const Edge&) { }
-	/// Initialize the iterator to be invalid.
-
-	/// Initialize the iterator to be invalid.
-	///
-	Edge(Invalid) { }
-	/// Equality operator
-
-	/// Two iterators are equal if and only if they point to the
-	/// same object or both are invalid.
-	bool operator==(Edge) const { return true; }
-	/// Inequality operator
-
-	/// \sa operator==(Node n)
-	///
-	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; }
-      };
-    
-      /// This iterator goes trough the outgoing edges of a node.
-
-      /// This iterator goes trough the \e outgoing edges of a certain node
-      /// of a graph.
-      /// Its usage is quite simple, for example you can count the number
-      /// of outgoing edges of a node \c n
-      /// in graph \c g of type \c Graph as follows.
-      /// \code
-      /// int count=0;
-      /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
-      /// \endcode
-    
-      class OutEdgeIt : public Edge {
-      public:
-	/// Default constructor
-
-	/// @warning The default constructor sets the iterator
-	/// to an undefined value.
-	OutEdgeIt() { }
-	/// Copy constructor.
-
-	/// Copy constructor.
-	///
-	OutEdgeIt(const OutEdgeIt&) { }
-	/// Initialize the iterator to be invalid.
-
-	/// Initialize the iterator to be invalid.
-	///
-	OutEdgeIt(Invalid) { }
-	/// This constructor sets the iterator to first outgoing edge.
-    
-	/// This constructor set the iterator to the first outgoing edge of
-	/// node
-	///@param n the node
-	///@param g the graph
-	OutEdgeIt(const StaticGraph& g, const Node& n) { }
-	/// Edge -> OutEdgeIt conversion
-
-	/// Sets the iterator to the value of the trivial iterator \c e.
-	/// This feature necessitates that each time we 
-	/// iterate the edge-set, the iteration order is the same.
-	OutEdgeIt(const StaticGraph& g, const Edge& e) { }
-	///Next outgoing edge
+// 	/// Copy constructor.
+// 	///
+// 	NodeIt(const NodeIt&) { }
+// 	/// Invalid constructor \& conversion.
+
+// 	/// Initialize the iterator to be invalid.
+// 	/// \sa Invalid for more details.
+// 	NodeIt(Invalid) { }
+// 	/// Sets the iterator to the first node.
+
+// 	/// Sets the iterator to the first node of \c g.
+// 	///
+// 	NodeIt(const StaticGraph& g) { }
+// 	/// Node -> NodeIt conversion.
+
+// 	/// Sets the iterator to the node of \c g pointed by the trivial 
+// 	/// iterator n.
+// 	/// This feature necessitates that each time we 
+// 	/// iterate the edge-set, the iteration order is the same.
+// 	NodeIt(const StaticGraph& g, const Node& n) { }
+// 	/// Next node.
+
+// 	/// Assign the iterator to the next node.
+// 	///
+// 	NodeIt& operator++() { return *this; }
+//       };
+    
+    
+//       /// The base type of the edge iterators.
+
+//       /// The base type of the edge iterators.
+//       ///
+//       class Edge {
+//       public:
+// 	/// Default constructor
+
+// 	/// @warning The default constructor sets the iterator
+// 	/// to an undefined value.
+// 	Edge() { }
+// 	/// Copy constructor.
+
+// 	/// Copy constructor.
+// 	///
+// 	Edge(const Edge&) { }
+// 	/// Initialize the iterator to be invalid.
+
+// 	/// Initialize the iterator to be invalid.
+// 	///
+// 	Edge(Invalid) { }
+// 	/// Equality operator
+
+// 	/// Two iterators are equal if and only if they point to the
+// 	/// same object or both are invalid.
+// 	bool operator==(Edge) const { return true; }
+// 	/// Inequality operator
+
+// 	/// \sa operator==(Node n)
+// 	///
+// 	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; }
+//       };
+    
+//       /// This iterator goes trough the outgoing edges of a node.
+
+//       /// This iterator goes trough the \e outgoing edges of a certain node
+//       /// of a graph.
+//       /// Its usage is quite simple, for example you can count the number
+//       /// of outgoing edges of a node \c n
+//       /// in graph \c g of type \c Graph as follows.
+//       /// \code
+//       /// int count=0;
+//       /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+//       /// \endcode
+    
+//       class OutEdgeIt : public Edge {
+//       public:
+// 	/// Default constructor
+
+// 	/// @warning The default constructor sets the iterator
+// 	/// to an undefined value.
+// 	OutEdgeIt() { }
+// 	/// Copy constructor.
+
+// 	/// Copy constructor.
+// 	///
+// 	OutEdgeIt(const OutEdgeIt&) { }
+// 	/// Initialize the iterator to be invalid.
+
+// 	/// Initialize the iterator to be invalid.
+// 	///
+// 	OutEdgeIt(Invalid) { }
+// 	/// This constructor sets the iterator to first outgoing edge.
+    
+// 	/// This constructor set the iterator to the first outgoing edge of
+// 	/// node
+// 	///@param n the node
+// 	///@param g the graph
+// 	OutEdgeIt(const StaticGraph& g, const Node& n) { }
+// 	/// Edge -> OutEdgeIt conversion
+
+// 	/// Sets the iterator to the value of the trivial iterator \c e.
+// 	/// This feature necessitates that each time we 
+// 	/// iterate the edge-set, the iteration order is the same.
+// 	OutEdgeIt(const StaticGraph& g, const Edge& e) { }
+// 	///Next outgoing edge
 	
-	/// Assign the iterator to the next 
-	/// outgoing edge of the corresponding node.
-	OutEdgeIt& operator++() { return *this; }
-      };
-
-      /// This iterator goes trough the incoming edges of a node.
-
-      /// This iterator goes trough the \e incoming edges of a certain node
-      /// of a graph.
-      /// Its usage is quite simple, for example you can count the number
-      /// of outgoing edges of a node \c n
-      /// in graph \c g of type \c Graph as follows.
-      /// \code
-      /// int count=0;
-      /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
-      /// \endcode
-
-      class InEdgeIt : public Edge {
-      public:
-	/// Default constructor
-
-	/// @warning The default constructor sets the iterator
-	/// to an undefined value.
-	InEdgeIt() { }
-	/// Copy constructor.
-
-	/// Copy constructor.
-	///
-	InEdgeIt(const InEdgeIt&) { }
-	/// Initialize the iterator to be invalid.
-
-	/// Initialize the iterator to be invalid.
-	///
-	InEdgeIt(Invalid) { }
-	/// This constructor sets the iterator to first incoming edge.
-    
-	/// This constructor set the iterator to the first incoming edge of
-	/// node
-	///@param n the node
-	///@param g the graph
-	InEdgeIt(const StaticGraph& g, const Node& n) { }
-	/// Edge -> InEdgeIt conversion
-
-	/// Sets the iterator to the value of the trivial iterator \c e.
-	/// This feature necessitates that each time we 
-	/// iterate the edge-set, the iteration order is the same.
-	InEdgeIt(const StaticGraph& g, const Edge& n) { }
-	/// Next incoming edge
-
-	/// Assign the iterator to the next inedge of the corresponding node.
-	///
-	InEdgeIt& operator++() { return *this; }
-      };
-      /// This iterator goes through each edge.
-
-      /// This iterator goes through each edge of a graph.
-      /// Its usage is quite simple, for example you can count the number
-      /// of edges in a graph \c g of type \c Graph as follows:
-      /// \code
-      /// int count=0;
-      /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
-      /// \endcode
-      class EdgeIt : public Edge {
-      public:
-	/// Default constructor
-
-	/// @warning The default constructor sets the iterator
-	/// to an undefined value.
-	EdgeIt() { }
-	/// Copy constructor.
-
-	/// Copy constructor.
-	///
-	EdgeIt(const EdgeIt&) { }
-	/// Initialize the iterator to be invalid.
-
-	/// Initialize the iterator to be invalid.
-	///
-	EdgeIt(Invalid) { }
-	/// This constructor sets the iterator to first edge.
-    
-	/// This constructor set the iterator to the first edge of
-	/// node
-	///@param g the graph
-	EdgeIt(const StaticGraph& g) { }
-	/// Edge -> EdgeIt conversion
-
-	/// Sets the iterator to the value of the trivial iterator \c e.
-	/// This feature necessitates that each time we 
-	/// iterate the edge-set, the iteration order is the same.
-	EdgeIt(const StaticGraph&, const Edge&) { } 
-    	///Next edge
+// 	/// Assign the iterator to the next 
+// 	/// outgoing edge of the corresponding node.
+// 	OutEdgeIt& operator++() { return *this; }
+//       };
+
+//       /// This iterator goes trough the incoming edges of a node.
+
+//       /// This iterator goes trough the \e incoming edges of a certain node
+//       /// of a graph.
+//       /// Its usage is quite simple, for example you can count the number
+//       /// of outgoing edges of a node \c n
+//       /// in graph \c g of type \c Graph as follows.
+//       /// \code
+//       /// int count=0;
+//       /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+//       /// \endcode
+
+//       class InEdgeIt : public Edge {
+//       public:
+// 	/// Default constructor
+
+// 	/// @warning The default constructor sets the iterator
+// 	/// to an undefined value.
+// 	InEdgeIt() { }
+// 	/// Copy constructor.
+
+// 	/// Copy constructor.
+// 	///
+// 	InEdgeIt(const InEdgeIt&) { }
+// 	/// Initialize the iterator to be invalid.
+
+// 	/// Initialize the iterator to be invalid.
+// 	///
+// 	InEdgeIt(Invalid) { }
+// 	/// This constructor sets the iterator to first incoming edge.
+    
+// 	/// This constructor set the iterator to the first incoming edge of
+// 	/// node
+// 	///@param n the node
+// 	///@param g the graph
+// 	InEdgeIt(const StaticGraph& g, const Node& n) { }
+// 	/// Edge -> InEdgeIt conversion
+
+// 	/// Sets the iterator to the value of the trivial iterator \c e.
+// 	/// This feature necessitates that each time we 
+// 	/// iterate the edge-set, the iteration order is the same.
+// 	InEdgeIt(const StaticGraph& g, const Edge& n) { }
+// 	/// Next incoming edge
+
+// 	/// Assign the iterator to the next inedge of the corresponding node.
+// 	///
+// 	InEdgeIt& operator++() { return *this; }
+//       };
+//       /// This iterator goes through each edge.
+
+//       /// This iterator goes through each edge of a graph.
+//       /// Its usage is quite simple, for example you can count the number
+//       /// of edges in a graph \c g of type \c Graph as follows:
+//       /// \code
+//       /// int count=0;
+//       /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
+//       /// \endcode
+//       class EdgeIt : public Edge {
+//       public:
+// 	/// Default constructor
+
+// 	/// @warning The default constructor sets the iterator
+// 	/// to an undefined value.
+// 	EdgeIt() { }
+// 	/// Copy constructor.
+
+// 	/// Copy constructor.
+// 	///
+// 	EdgeIt(const EdgeIt&) { }
+// 	/// Initialize the iterator to be invalid.
+
+// 	/// Initialize the iterator to be invalid.
+// 	///
+// 	EdgeIt(Invalid) { }
+// 	/// This constructor sets the iterator to first edge.
+    
+// 	/// This constructor set the iterator to the first edge of
+// 	/// node
+// 	///@param g the graph
+// 	EdgeIt(const StaticGraph& g) { }
+// 	/// Edge -> EdgeIt conversion
+
+// 	/// Sets the iterator to the value of the trivial iterator \c e.
+// 	/// This feature necessitates that each time we 
+// 	/// iterate the edge-set, the iteration order is the same.
+// 	EdgeIt(const StaticGraph&, const Edge&) { } 
+//     	///Next edge
 	
-	/// Assign the iterator to the next 
-	/// edge of the corresponding node.
-	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 head node of an edge.
-
-      ///Gives back the head node of an edge.
-      ///
-      Node head(Edge) const { return INVALID; }
-      ///Gives back the tail node of an edge.
-
-      ///Gives back the tail node of an edge.
-      ///
-      Node tail(Edge) const { return INVALID; }
+// 	/// Assign the iterator to the next 
+// 	/// edge of the corresponding node.
+// 	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 head node of an edge.
+
+//       ///Gives back the head node of an edge.
+//       ///
+//       Node head(Edge) const { return INVALID; }
+//       ///Gives back the tail node of an edge.
+
+//       ///Gives back the tail node of an edge.
+//       ///
+//       Node tail(Edge) const { return INVALID; }
   
-      ///Gives back the \e id of a node.
+//       ///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; }
+//       ///\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
+//       ///\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.
-
-      /// \ingroup skeletons
-      ///Reference 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 >
-      {
-      public:
-
-	///\e
-	NodeMap(const StaticGraph&) { }
-	///\e
-	NodeMap(const StaticGraph&, T) { }
-
-	///Copy constructor
-	template<typename TT> NodeMap(const NodeMap<TT>&) { }
-	///Assignment operator
-	template<typename TT> NodeMap& operator=(const NodeMap<TT>&)
-	{ return *this; }
-      };
-
-      ///Reference map of the edges to type \c T.
-
-      /// \ingroup skeletons
-      ///Reference map of the edges to type \c T.
-      /// \sa Reference
-      /// \warning Making maps that can handle bool type (EdgeMap<bool>)
-      /// needs some extra attention!
-      template<class T> class EdgeMap
-	: public ReferenceMap<Edge,T>
-      {
-      public:
-
-	///\e
-	EdgeMap(const StaticGraph&) { }
-	///\e
-	EdgeMap(const StaticGraph&, T) { }
-    
-	///Copy constructor
-	template<typename TT> EdgeMap(const EdgeMap<TT>&) { }
-	///Assignment operator
-	template<typename TT> EdgeMap &operator=(const EdgeMap<TT>&)
-	{ return *this; }
-      };
+//       ///\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.
+
+//       /// \ingroup skeletons
+//       ///Reference 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 >
+//       {
+//       public:
+
+// 	///\e
+// 	NodeMap(const StaticGraph&) { }
+// 	///\e
+// 	NodeMap(const StaticGraph&, T) { }
+
+// 	///Copy constructor
+// 	template<typename TT> NodeMap(const NodeMap<TT>&) { }
+// 	///Assignment operator
+// 	template<typename TT> NodeMap& operator=(const NodeMap<TT>&)
+// 	{ return *this; }
+//       };
+
+//       ///Reference map of the edges to type \c T.
+
+//       /// \ingroup skeletons
+//       ///Reference map of the edges to type \c T.
+//       /// \sa Reference
+//       /// \warning Making maps that can handle bool type (EdgeMap<bool>)
+//       /// needs some extra attention!
+//       template<class T> class EdgeMap
+// 	: public ReferenceMap<Edge,T>
+//       {
+//       public:
+
+// 	///\e
+// 	EdgeMap(const StaticGraph&) { }
+// 	///\e
+// 	EdgeMap(const StaticGraph&, T) { }
+    
+// 	///Copy constructor
+// 	template<typename TT> EdgeMap(const EdgeMap<TT>&) { }
+// 	///Assignment operator
+// 	template<typename TT> EdgeMap &operator=(const EdgeMap<TT>&)
+// 	{ return *this; }
+//       };
+//     };
+
+//     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::skeleton::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.tail(e);
+// 	n=G.head(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>::ValueType val;
+// 	  val=1;
+// 	  typename Graph::template NodeMap<int>::KeyType 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>::ValueType val;
+// 	  val=true;
+// 	  typename Graph::template NodeMap<bool>::KeyType 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>::ValueType val;
+// 	  val=1;
+// 	  typename Graph::template EdgeMap<int>::KeyType 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>::ValueType val;
+// 	  val=true;
+// 	  typename Graph::template EdgeMap<bool>::KeyType key;
+// 	  key= typename Graph::EdgeIt(G);
+// 	}
+//       }
+//     }
+    
+//     /// An empty non-static graph class.
+    
+//     /// This class provides everything that \ref StaticGraph
+//     /// with additional functionality which enables to build a
+//     /// graph from scratch.
+//     class ExtendableGraph : public StaticGraph
+//     {
+//     public:
+//       /// Defalult constructor.
+
+//       /// Defalult constructor.
+//       ///
+//       ExtendableGraph() { }
+//       ///Add a new node to the graph.
+
+//       /// \return the new node.
+//       ///
+//       Node addNode() { return INVALID; }
+//       ///Add a new edge to the graph.
+
+//       ///Add a new edge to the graph with tail node \c t
+//       ///and head node \c h.
+//       ///\return the new edge.
+//       Edge addEdge(Node h, Node t) { return INVALID; }
+    
+//       /// Resets the graph.
+
+//       /// This function deletes all edges and nodes of the graph.
+//       /// It also frees the memory allocated to store them.
+//       /// \todo It might belong to \ref ErasableGraph.
+//       void clear() { }
+//     };
+
+    
+//     ///\brief Checks whether \c G meets the
+//     ///\ref lemon::skeleton::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.
+  
+//     /// This class is an extension of \ref ExtendableGraph. It also makes it
+//     /// possible to erase edges or nodes.
+//     class ErasableGraph : public ExtendableGraph
+//     {
+//     public:
+//       /// Defalult constructor.
+
+//       /// Defalult constructor.
+//       ///
+//       ErasableGraph() { }
+//       /// Deletes a node.
+
+//       /// Deletes node \c n node.
+//       ///
+//       void erase(Node n) { }
+//       /// Deletes an edge.
+
+//       /// Deletes edge \c e edge.
+//       ///
+//       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::skeleton::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 **************/
+
+
+    /// \bug The nodes and edges are not allowed to inherit from the
+    /// same baseclass.
+
+    class BaseGraphItem {
+    public:
+      BaseGraphItem() {}
+      BaseGraphItem(Invalid) {}
+
+      // We explicitely list these:
+      BaseGraphItem(BaseGraphItem const&) {}
+      BaseGraphItem& operator=(BaseGraphItem const&) { return *this; }
+
+      bool operator==(BaseGraphItem) const { return false; }
+      bool operator!=(BaseGraphItem) const { return false; }
+
+      // Technical requirement. Do we really need this?
+      bool operator<(BaseGraphItem) const { return false; }
     };
 
-    struct DummyType {
-      int value;
-      DummyType() {}
-      DummyType(int p) : value(p) {}
-      DummyType& operator=(int p) { value = p; return *this;}
+
+    /// A minimal GraphBase concept
+
+    /// This class describes a minimal concept which can be extended to a
+    /// full-featured graph with \ref GraphFactory.
+    class GraphBase {
+    public:
+
+      GraphBase() {}
+
+
+      /// \bug Nodes and Edges are comparable each other
+      
+      class Node : public BaseGraphItem {};
+      class Edge : public BaseGraphItem {};
+
+      // Graph operation
+      void firstNode(Node &n) const { }
+      void firstEdge(Edge &e) const { }
+
+      void firstOutEdge(Edge &e, Node) const { }
+      void firstInEdge(Edge &e, Node) const { }
+
+      void nextNode(Node &n) const { }
+      void nextEdge(Edge &e) const { }
+
+
+      // Question: isn't it reasonable if this methods have a Node
+      // parameter? Like this:
+      // Edge& nextOut(Edge &e, Node) const { return e; }
+      void nextOutEdge(Edge &e) const { }
+      void nextInEdge(Edge &e) const { }
+
+      Node head(Edge) const { return Node(); }
+      Node tail(Edge) const { return Node(); }
+      
+
+      // Do we need id, nodeNum, edgeNum and co. in this basic graphbase
+      // concept?
+
+
+      // Maps.
+      //
+      // We need a special slimer concept which does not provide maps (it
+      // wouldn't be strictly slimer, cause for map-factory id() & friends
+      // a required...)
+
+      template<typename T>
+      class NodeMap : public GraphMap<Node, T, GraphBase> {};
+
+      template<typename T>
+      class EdgeMap : public GraphMap<Edge, T, GraphBase> {};
     };
-    
-    ///\brief Checks whether \c G meets the
-    ///\ref lemon::skeleton::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.tail(e);
-	n=G.head(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>::ValueType val;
-	  val=1;
-	  typename Graph::template NodeMap<int>::KeyType 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>::ValueType val;
-	  val=true;
-	  typename Graph::template NodeMap<bool>::KeyType 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>::ValueType val;
-	  val=1;
-	  typename Graph::template EdgeMap<int>::KeyType 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>::ValueType val;
-	  val=true;
-	  typename Graph::template EdgeMap<bool>::KeyType key;
-	  key= typename Graph::EdgeIt(G);
+
+
+
+    /**************** Concept checking classes ****************/
+
+    template<typename BGI>
+    struct BaseGraphItemConcept {
+      void constraints() {
+	BGI i1;
+	BGI i2 = i1;
+	BGI i3 = INVALID;
+	
+	i1 = i3;
+	if( i1 == i3 ) {
+	  if ( i2 != i3 && i3 < i2 )
+	    return;
 	}
       }
-    }
+    };
+
     
-    /// An empty non-static graph class.
     
-    /// This class provides everything that \ref StaticGraph
-    /// with additional functionality which enables to build a
-    /// graph from scratch.
-    class ExtendableGraph : public StaticGraph
-    {
+    class StaticGraph 
+      :  virtual public BaseGraphComponent, public IterableGraphComponent, public MappableGraphComponent {
     public:
-      /// Defalult constructor.
+      typedef BaseGraphComponent::Node Node;
+      typedef BaseGraphComponent::Edge Edge;
+    };
 
-      /// Defalult constructor.
-      ///
-      ExtendableGraph() { }
-      ///Add a new node to the graph.
-
-      /// \return the new node.
-      ///
-      Node addNode() { return INVALID; }
-      ///Add a new edge to the graph.
-
-      ///Add a new edge to the graph with tail node \c t
-      ///and head node \c h.
-      ///\return the new edge.
-      Edge addEdge(Node h, Node t) { return INVALID; }
-    
-      /// Resets the graph.
-
-      /// This function deletes all edges and nodes of the graph.
-      /// It also frees the memory allocated to store them.
-      /// \todo It might belong to \ref ErasableGraph.
-      void clear() { }
+    template <typename Graph>
+    struct StaticGraphConcept {
+      void constraints() {
+	function_requires<BaseGraphComponentConcept<Graph> >();
+	function_requires<IterableGraphComponentConcept<Graph> >();
+	function_requires<MappableGraphComponentConcept<Graph> >();
+      }
+      Graph& graph;
     };
 
-    
-    ///\brief Checks whether \c G meets the
-    ///\ref lemon::skeleton::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();
-    }
+    class ExtendableGraph 
+      :  virtual public BaseGraphComponent, public StaticGraph, public ExtendableGraphComponent, public ClearableGraphComponent {
+    public:
+      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> >();
+      }
+      Graph& graph;
+    };
 
-    /// An empty erasable graph class.
-  
-    /// This class is an extension of \ref ExtendableGraph. It also makes it
-    /// possible to erase edges or nodes.
-    class ErasableGraph : public ExtendableGraph
-    {
+    class ErasableGraph 
+      :  virtual public BaseGraphComponent, public ExtendableGraph, public ErasableGraphComponent {
     public:
-      /// Defalult constructor.
+      typedef BaseGraphComponent::Node Node;
+      typedef BaseGraphComponent::Edge Edge;
+    };
 
-      /// Defalult constructor.
-      ///
-      ErasableGraph() { }
-      /// Deletes a node.
-
-      /// Deletes node \c n node.
-      ///
-      void erase(Node n) { }
-      /// Deletes an edge.
-
-      /// Deletes edge \c e edge.
-      ///
-      void erase(Edge e) { }
+    template <typename Graph>
+    struct ErasableGraphConcept {
+      void constraints() {
+	function_requires<ExtendableGraphConcept<Graph> >();
+	function_requires<ErasableGraphComponentConcept<Graph> >();
+      }
+      Graph& graph;
     };
-    
-    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::skeleton::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()));  
-    }
- 
+
     // @}
   } //namespace skeleton  
 } //namespace lemon

Modified: hugo/trunk/src/lemon/skeletons/maps.h
==============================================================================
--- hugo/trunk/src/lemon/skeletons/maps.h	(original)
+++ hugo/trunk/src/lemon/skeletons/maps.h	Thu Oct 28 00:38:50 2004
@@ -17,6 +17,8 @@
 #ifndef LEMON_MAPSKELETON_H
 #define LEMON_MAPSKELETON_H
 
+#include <lemon/concept_check.h>
+
 ///\ingroup skeletons
 ///\file
 ///\brief Map concepts checking classes for testing and documenting.
@@ -113,6 +115,130 @@
       ReferenceMap() {}
     };
 
+
+    template<typename Item, typename T, typename Graph>
+    class GraphMap : public ReadWriteMap<Item, T> {
+      // I really, really don't like the idea that every graph should have
+      // reference maps! --klao
+
+    private:
+      // We state explicitly that graph maps have no default constructor?
+      GraphMap();
+
+    public:
+      explicit GraphMap(Graph const&) {}
+      // value for initializing
+      GraphMap(Graph const&, T) {}
+
+      // this probably should be required:
+      GraphMap(GraphMap const&) {}
+      GraphMap& operator=(GraphMap const&) { return *this; }
+
+      // but this is a absolute no-op! We should provide a more generic
+      // graph-map-copy operation.
+      //
+      // template<typename TT>
+      // GraphMap(GraphMap<TT> const&);
+      //
+      // template<typename TT>
+      // GraphMap& operator=(const GraphMap<TT>&);
+    };
+
+
+    /****************  Concept-checking classes  ****************/
+
+    template<typename ReadMap>
+    struct ReadMapConcept {
+      typedef typename ReadMap::KeyType KeyType;
+      typedef typename ReadMap::ValueType ValueType;
+
+      void constraints() {
+	// No constraints for constructor.
+
+	// What are the requirement for the ValueType?
+	// CopyConstructible? Assignable? None of these?
+	ValueType v = m[k];
+	v = m[k];
+
+	// FIXME:
+	ignore_unused_variable_warning(v);
+      }
+
+      ReadMap m;
+      KeyType k;
+    };
+
+    template<typename WriteMap>
+    struct WriteMapConcept {
+      typedef typename WriteMap::KeyType KeyType;
+      typedef typename WriteMap::ValueType ValueType;
+
+      void constraints() {
+	// No constraints for constructor.
+
+	m.set(k, v);
+      }
+
+      WriteMap m;
+      KeyType k;
+      ValueType v;
+    };
+
+    template<typename ReadWriteMap>
+    struct ReadWriteMapConcept {
+      void constraints() {
+	function_requires< ReadMapConcept<ReadWriteMap> >();
+	function_requires< WriteMapConcept<ReadWriteMap> >();
+      }
+    };
+
+    template<typename ReferenceMap>
+    struct ReferenceMapConcept {
+      typedef typename ReferenceMap::KeyType KeyType;
+      typedef typename ReferenceMap::ValueType ValueType;
+      typedef typename ReferenceMap::ReferenceType ReferenceType;
+
+      // What for is this?
+      typedef typename ReferenceMap::ConstReferenceType ConstReferenceType;
+
+      void constraints() {
+	function_requires< ReadWriteMapConcept<ReferenceMap> >();
+
+	m[k] = v;
+	// Or should we require real reference?
+	// Like this:
+	// ValueType &vv = m[k];
+	// ignore_unused_variable_warning(vv);
+      }
+
+      ReferenceMap m;
+      KeyType k;
+      ValueType v;
+    };
+
+    /// \todo GraphMapConceptCheck
+
+    template<typename GraphMap, typename Graph>
+    struct GraphMapConcept {
+      void constraints() {
+	function_requires< ReadWriteMapConcept<GraphMap> >();
+	// Construction with a graph parameter
+	GraphMap a(g);
+	// Ctor with a graph and a default value parameter
+	GraphMap a2(g,t);
+	// Copy ctor. Do we need it?
+	GraphMap b=c;
+	// Copy operator. Do we need it?
+	a=b;
+
+	ignore_unused_variable_warning(a2);
+      }
+      const GraphMap &c;
+      const Graph &g;
+      const typename GraphMap::ValueType &t;
+    };
+    
+
     // @}
 
   } //namespace skeleton

Modified: hugo/trunk/src/lemon/smart_graph.h
==============================================================================
--- hugo/trunk/src/lemon/smart_graph.h	(original)
+++ hugo/trunk/src/lemon/smart_graph.h	Thu Oct 28 00:38:50 2004
@@ -22,22 +22,28 @@
 ///\brief SmartGraph and SymSmartGraph classes.
 
 #include <vector>
-#include <climits>
 
 #include <lemon/invalid.h>
 
+#include <lemon/erasable_graph_extender.h>
+#include <lemon/clearable_graph_extender.h>
+#include <lemon/extendable_graph_extender.h>
 
-#include <lemon/array_map.h>
+#include <lemon/idmappable_graph_extender.h>
 
-#include <lemon/map_registry.h>
+#include <lemon/iterable_graph_extender.h>
+
+#include <lemon/alteration_observer_registry.h>
+#include <lemon/default_map.h>
+
+
+#include <lemon/graph_utils.h>
 
-#include <lemon/map_defines.h>
 
 namespace lemon {
 
-/// \addtogroup graphs
-/// @{
-//  class SymSmartGraph;
+  /// \addtogroup graphs
+  /// @{
 
   ///A smart graph class.
 
@@ -56,7 +62,7 @@
   ///Of course it should be used as a stack. (Maybe X is not necessary.)
   ///
   ///\author Alpar Juttner
-  class SmartGraph {
+  class SmartGraphBase {
 
     struct NodeT 
     {
@@ -77,25 +83,16 @@
     
   public:
 
-    typedef SmartGraph Graph;
+    typedef SmartGraphBase Graph;
 
     class Node;
     class Edge;
 
-    class NodeIt;
-    class EdgeIt;
-    class OutEdgeIt;
-    class InEdgeIt;
-    
-    // Create map registries.
-    CREATE_MAP_REGISTRIES;
-    // Create node and edge maps.
-    CREATE_MAPS(ArrayMap);
     
   public:
 
-    SmartGraph() : nodes(), edges() { }
-    SmartGraph(const SmartGraph &_g) : nodes(_g.nodes), edges(_g.edges) { }
+    SmartGraphBase() : nodes(), edges() { }
+    SmartGraphBase(const SmartGraphBase &_g) : nodes(_g.nodes), edges(_g.edges) { }
     
     ///Number of nodes.
     int nodeNum() const { return nodes.size(); }
@@ -116,15 +113,6 @@
     Node tail(Edge e) const { return edges[e.n].tail; }
     Node head(Edge e) const { return edges[e.n].head; }
 
-    NodeIt& first(NodeIt& v) const { 
-      v=NodeIt(*this); return v; }
-    EdgeIt& first(EdgeIt& e) const { 
-      e=EdgeIt(*this); return e; }
-    OutEdgeIt& first(OutEdgeIt& e, const Node v) const { 
-      e=OutEdgeIt(*this,v); return e; }
-    InEdgeIt& first(InEdgeIt& e, const Node v) const { 
-      e=InEdgeIt(*this,v); return e; }
-
     /// Node ID.
     
     /// The ID of a valid Node is a nonnegative integer not greater than
@@ -147,9 +135,6 @@
     Node addNode() {
       Node n; n.n=nodes.size();
       nodes.push_back(NodeT()); //FIXME: Hmmm...
-
-      
-      node_maps.add(n);
       return n;
     }
     
@@ -160,8 +145,6 @@
       edges[e.n].next_in=nodes[v.n].first_in;
       nodes[u.n].first_out=nodes[v.n].first_in=e.n;
 
-      edge_maps.add(e);
-
       return e;
     }
 
@@ -182,24 +165,16 @@
     }
     
     void clear() {
-      edge_maps.clear();
       edges.clear();
-      node_maps.clear();
       nodes.clear();
     }
 
+
     class Node {
-      friend class SmartGraph;
-      template <typename T> friend class NodeMap;
-      
-      friend class Edge;
-      friend class OutEdgeIt;
-      friend class InEdgeIt;
-      friend class SymEdge;
+      friend class SmartGraphBase;
 
     protected:
       int n;
-      friend int SmartGraph::id(Node v); 
       Node(int nn) {n=nn;}
     public:
       Node() {}
@@ -207,529 +182,77 @@
       bool operator==(const Node i) const {return n==i.n;}
       bool operator!=(const Node i) const {return n!=i.n;}
       bool operator<(const Node i) const {return n<i.n;}
-      //      ///Validity check
-      //      operator bool() { return n!=-1; }
     };
     
-    class NodeIt : public Node {
-      const SmartGraph *G;
-      friend class SmartGraph;
-    public:
-      NodeIt() : Node() { }
-      NodeIt(const SmartGraph& _G,Node n) : Node(n), G(&_G) { }
-      NodeIt(Invalid i) : Node(i) { }
-      NodeIt(const SmartGraph& _G) : Node(_G.nodes.size()?0:-1), G(&_G) { }
-      NodeIt &operator++() {
-	n=(n+2)%(G->nodes.size()+1)-1; 
-	return *this; 
-      }
-//       ///Validity check
-//       operator bool() { return Node::operator bool(); }      
-    };
 
     class Edge {
-      friend class SmartGraph;
-      template <typename T> friend class EdgeMap;
+      friend class SmartGraphBase;
 
-      friend class SymSmartGraph;
-      
-      friend class Node;
-      friend class NodeIt;
     protected:
       int n;
-      friend int SmartGraph::id(Edge e);
       Edge(int nn) {n=nn;}
     public:
-      /// An Edge with id \c n.
-
       Edge() { }
       Edge (Invalid) { n=-1; }
       bool operator==(const Edge i) const {return n==i.n;}
       bool operator!=(const Edge i) const {return n!=i.n;}
       bool operator<(const Edge i) const {return n<i.n;}
-//       ///Validity check
-//       operator bool() { return n!=-1; }
-
-      ///Set the edge to that have ID \c ID.
-      void setToId(int id) { n=id; }
-   };
-    
-    class EdgeIt : public Edge {
-      const SmartGraph *G;
-      friend class SmartGraph;
-    public:
-      EdgeIt(const SmartGraph& _G) : Edge(_G.edges.size()-1), G(&_G) { }
-      EdgeIt(const SmartGraph& _G, Edge e) : Edge(e), G(&_G) { }
-      EdgeIt (Invalid i) : Edge(i) { }
-      EdgeIt() : Edge() { }
-      EdgeIt &operator++() { --n; return *this; }
-//       ///Validity check
-//       operator bool() { return Edge::operator bool(); }      
-    };
-    
-    class OutEdgeIt : public Edge {
-      const SmartGraph *G;
-      friend class SmartGraph;
-    public: 
-      OutEdgeIt() : Edge() { }
-      OutEdgeIt(const SmartGraph& _G, Edge e) : Edge(e), G(&_G) { }
-      OutEdgeIt (Invalid i) : Edge(i) { }
-
-      OutEdgeIt(const SmartGraph& _G,const Node v)
-	: Edge(_G.nodes[v.n].first_out), G(&_G) {}
-      OutEdgeIt &operator++() { n=G->edges[n].next_out; return *this; }
-//       ///Validity check
-//       operator bool() { return Edge::operator bool(); }      
-    };
-    
-    class InEdgeIt : public Edge {
-      const SmartGraph *G;
-      friend class SmartGraph;
-    public: 
-      InEdgeIt() : Edge() { }
-      InEdgeIt(const SmartGraph& _G, Edge e) : Edge(e), G(&_G) { }
-      InEdgeIt (Invalid i) : Edge(i) { }
-      InEdgeIt(const SmartGraph& _G,Node v)
-	: Edge(_G.nodes[v.n].first_in), G(&_G) { }
-      InEdgeIt &operator++() { n=G->edges[n].next_in; return *this; }
-//       ///Validity check
-//       operator bool() { return Edge::operator bool(); }      
-    };
-
-  };
-
-
-
-  class SymSmartGraph : public SmartGraph {
-    typedef SmartGraph Parent;
-  public:
-
-    typedef SymSmartGraph Graph;
-
-    typedef SmartGraph::Node Node;
-    typedef SmartGraph::NodeIt NodeIt;
-
-    class SymEdge;
-    class SymEdgeIt;
-
-    class Edge;
-    class EdgeIt;
-    class OutEdgeIt;
-    class InEdgeIt;
-
-    template <typename Value>
-    class NodeMap : public Parent::NodeMap<Value> {      
-    public:
-      NodeMap(const SymSmartGraph& g) 
-	: SymSmartGraph::Parent::NodeMap<Value>(g) {}
-      NodeMap(const SymSmartGraph& g, Value v) 
-	: SymSmartGraph::Parent::NodeMap<Value>(g, v) {}
-      template<typename TT> 
-      NodeMap(const NodeMap<TT>& copy) 
-	: SymSmartGraph::Parent::NodeMap<Value>(copy) { }            
-    };
-
-    template <typename Value>
-    class SymEdgeMap : public Parent::EdgeMap<Value> {
-    public:
-      typedef SymEdge KeyType;
-
-      SymEdgeMap(const SymSmartGraph& g) 
-	: SymSmartGraph::Parent::EdgeMap<Value>(g) {}
-      SymEdgeMap(const SymSmartGraph& g, Value v) 
-	: SymSmartGraph::Parent::EdgeMap<Value>(g, v) {}
-      template<typename TT> 
-      SymEdgeMap(const SymEdgeMap<TT>& copy) 
-	: SymSmartGraph::Parent::EdgeMap<Value>(copy) { }
-      
     };
 
-    // Create edge map registry.
-    CREATE_EDGE_MAP_REGISTRY;
-    // Create edge maps.
-    CREATE_EDGE_MAP(ArrayMap);
-
-    class Edge {
-      friend class SymSmartGraph;
-      friend class SymSmartGraph::EdgeIt;
-      friend class SymSmartGraph::OutEdgeIt;
-      friend class SymSmartGraph::InEdgeIt;
-      
-    protected:
-      int id;
-
-      Edge(int pid) { id = pid; }
-
-    public:
-      /// An Edge with id \c n.
-
-      Edge() { }
-      Edge (Invalid) { id = -1; }
-
-      operator SymEdge(){ return SymEdge(id >> 1);}
-      
-      bool operator==(const Edge i) const {return id == i.id;}
-      bool operator!=(const Edge i) const {return id != i.id;}
-      bool operator<(const Edge i) const {return id < i.id;}
-      //      ///Validity check
-      //      operator bool() { return n!=-1; }
-    };
-
-    class SymEdge : public SmartGraph::Edge {
-      friend class SymSmartGraph;
-      friend class SymSmartGraph::Edge;
-      typedef SmartGraph::Edge Parent;
-
-    protected:      
-      SymEdge(int pid) : Parent(pid) {}
-    public:
-
-      SymEdge() { }
-      SymEdge(const SmartGraph::Edge& i) : Parent(i) {} 
-      SymEdge (Invalid) : Parent(INVALID) {}
-
-    };
-
-    class OutEdgeIt {
-      Parent::OutEdgeIt out;
-      Parent::InEdgeIt in;      
-    public: 
-      OutEdgeIt() {}
-      OutEdgeIt(const SymSmartGraph& g, Edge e) { 
-	if ((e.id & 1) == 0) {	
-	  out = Parent::OutEdgeIt(g, SymEdge(e));
-	  in = Parent::InEdgeIt(g, g.tail(e));
-	} else {
-	  out = Parent::OutEdgeIt(INVALID);
-	  in = Parent::InEdgeIt(g, SymEdge(e));
-	}
-      }
-      OutEdgeIt (Invalid i) : out(INVALID), in(INVALID) { }
-
-      OutEdgeIt(const SymSmartGraph& g, const Node v)
-	: out(g, v), in(g, v) {}
-      OutEdgeIt &operator++() { 
-	if (out != INVALID) {
-	  ++out;
-	} else {
-	  ++in;
-	}
-	return *this; 
-      }
-
-      operator Edge() const {
-	if (out == INVALID && in == INVALID) return INVALID;
-	return out != INVALID ? forward(out) : backward(in);
-      }
-
-      bool operator==(const Edge i) const {return Edge(*this) == i;}
-      bool operator!=(const Edge i) const {return Edge(*this) != i;}
-      bool operator<(const Edge i) const {return Edge(*this) < i;}
-    };
-
-    class InEdgeIt {
-      Parent::OutEdgeIt out;
-      Parent::InEdgeIt in;      
-    public: 
-      InEdgeIt() {}
-      InEdgeIt(const SymSmartGraph& g, Edge e) { 
-	if ((e.id & 1) == 0) {	
-	  out = Parent::OutEdgeIt(g, SymEdge(e));
-	  in = Parent::InEdgeIt(g, g.tail(e));
-	} else {
-	  out = Parent::OutEdgeIt(INVALID);
-	  in = Parent::InEdgeIt(g, SymEdge(e));
-	}
-      }
-      InEdgeIt (Invalid i) : out(INVALID), in(INVALID) { }
-
-      InEdgeIt(const SymSmartGraph& g, const Node v)
-	: out(g, v), in(g, v) {}
-
-      InEdgeIt &operator++() { 
-	if (out != INVALID) {
-	  ++out;
-	} else {
-	  ++in;
-	}
-	return *this; 
-      }
-
-      operator Edge() const {
-	if (out == INVALID && in == INVALID) return INVALID;
-	return out != INVALID ? backward(out) : forward(in);
-      }
-
-      bool operator==(const Edge i) const {return Edge(*this) == i;}
-      bool operator!=(const Edge i) const {return Edge(*this) != i;}
-      bool operator<(const Edge i) const {return Edge(*this) < i;}
-    };
-
-    class SymEdgeIt : public Parent::EdgeIt {
-
-    public:
-      SymEdgeIt() {}
-
-      SymEdgeIt(const SymSmartGraph& g) 
-	: SymSmartGraph::Parent::EdgeIt(g) {}
-
-      SymEdgeIt(const SymSmartGraph& g, SymEdge e) 
-	: SymSmartGraph::Parent::EdgeIt(g, e) {}
-
-      SymEdgeIt(Invalid i) 
-	: SymSmartGraph::Parent::EdgeIt(INVALID) {}
-
-      SymEdgeIt& operator++() {
-	SymSmartGraph::Parent::EdgeIt::operator++();
-	return *this;
-      }
-
-      operator SymEdge() const {
-	return SymEdge
-	  (static_cast<const SymSmartGraph::Parent::EdgeIt&>(*this));
-      }
-      bool operator==(const SymEdge i) const {return SymEdge(*this) == i;}
-      bool operator!=(const SymEdge i) const {return SymEdge(*this) != i;}
-      bool operator<(const SymEdge i) const {return SymEdge(*this) < i;}
-    };
-
-    class EdgeIt {
-      SymEdgeIt it;
-      bool fw;
-    public:
-      EdgeIt(const SymSmartGraph& g) : it(g), fw(true) {}
-      EdgeIt (Invalid i) : it(i) { }
-      EdgeIt(const SymSmartGraph& g, Edge e) 
-	: it(g, SymEdge(e)), fw(id(e) & 1 == 0) { }
-      EdgeIt() { }
-      EdgeIt& operator++() {
-	fw = !fw;
-	if (fw) ++it;
-	return *this;
-      }
-      operator Edge() const {
-	if (it == INVALID) return INVALID;
-	return fw ? forward(it) : backward(it);
-      }
-      bool operator==(const Edge i) const {return Edge(*this) == i;}
-      bool operator!=(const Edge i) const {return Edge(*this) != i;}
-      bool operator<(const Edge i) const {return Edge(*this) < i;}
-
-    };
-
-    ///Number of nodes.
-    int nodeNum() const { return Parent::nodeNum(); }
-    ///Number of edges.
-    int edgeNum() const { return 2*Parent::edgeNum(); }
-    ///Number of symmetric edges.
-    int symEdgeNum() const { return Parent::edgeNum(); }
-
-    /// Maximum node ID.
-    
-    /// Maximum node ID.
-    ///\sa id(Node)
-    int maxNodeId() const { return Parent::maxNodeId(); } 
-    /// Maximum edge ID.
-    
-    /// Maximum edge ID.
-    ///\sa id(Edge)
-    int maxEdgeId() const { return 2*Parent::maxEdgeId(); }
-    /// Maximum symmetric edge ID.
-    
-    /// Maximum symmetric edge ID.
-    ///\sa id(SymEdge)
-    int maxSymEdgeId() const { return Parent::maxEdgeId(); }
-
-
-    Node tail(Edge e) const { 
-      return (e.id & 1) == 0 ? 
-	Parent::tail(SymEdge(e)) : Parent::head(SymEdge(e)); 
+    void first(Node& node) const {
+      node.n = nodes.size() - 1;
     }
 
-    Node head(Edge e) const { 
-      return (e.id & 1) == 0 ? 
-	Parent::head(SymEdge(e)) : Parent::tail(SymEdge(e)); 
+    static void next(Node& node) {
+      --node.n;
     }
 
-    Node tail(SymEdge e) const { 
-      return Parent::tail(e); 
+    void first(Edge& edge) const {
+      edge.n = edges.size() - 1;
     }
 
-    Node head(SymEdge e) const { 
-      return Parent::head(e); 
+    static void next(Edge& edge) {
+      --edge.n;
     }
 
-    NodeIt& first(NodeIt& v) const { 
-      v=NodeIt(*this); return v; }
-    EdgeIt& first(EdgeIt& e) const { 
-      e=EdgeIt(*this); return e; }
-    SymEdgeIt& first(SymEdgeIt& e) const {
-      e=SymEdgeIt(*this); return e; }
-    OutEdgeIt& first(OutEdgeIt& e, const Node v) const { 
-      e=OutEdgeIt(*this,v); return e; }
-    InEdgeIt& first(InEdgeIt& e, const Node v) const { 
-      e=InEdgeIt(*this,v); return e; }
-
-    /// Node ID.
-    
-    /// The ID of a valid Node is a nonnegative integer not greater than
-    /// \ref maxNodeId(). The range of the ID's is not surely continuous
-    /// and the greatest node ID can be actually less then \ref maxNodeId().
-    ///
-    /// The ID of the \ref INVALID node is -1.
-    ///\return The ID of the node \c v. 
-    static int id(Node v) { return Parent::id(v); }
-    /// Edge ID.
-    
-    /// The ID of a valid Edge is a nonnegative integer not greater than
-    /// \ref maxEdgeId(). The range of the ID's is not surely continuous
-    /// and the greatest edge ID can be actually less then \ref maxEdgeId().
-    ///
-    /// The ID of the \ref INVALID edge is -1.
-    ///\return The ID of the edge \c e. 
-    static int id(Edge e) { return e.id; }
-
-    /// The ID of a valid SymEdge is a nonnegative integer not greater than
-    /// \ref maxSymEdgeId(). The range of the ID's is not surely continuous
-    /// and the greatest edge ID can be actually less then \ref maxSymEdgeId().
-    ///
-    /// The ID of the \ref INVALID symmetric edge is -1.
-    ///\return The ID of the edge \c e. 
-    static int id(SymEdge e) { return Parent::id(e); }
-
-    /// Adds a new node to the graph.
-
-    /// \warning It adds the new node to the front of the list.
-    /// (i.e. the lastly added node becomes the first.)
-    Node addNode() {
-      return Parent::addNode();
-    }
-    
-    SymEdge addEdge(Node u, Node v) {
-      SymEdge se = Parent::addEdge(u, v);
-      edge_maps.add(forward(se));
-      edge_maps.add(backward(se));
-      return se;
-    }
-    
-    /// Finds an edge between two nodes.
-
-    /// Finds an edge from node \c u to node \c v.
-    ///
-    /// If \c prev is \ref INVALID (this is the default value), then
-    /// It finds the first edge from \c u to \c v. Otherwise it looks for
-    /// the next edge from \c u to \c v after \c prev.
-    /// \return The found edge or INVALID if there is no such an edge.
-    Edge findEdge(Node u, Node v, Edge prev = INVALID) 
-    {     
-      if (prev == INVALID || id(prev) & 1 == 0) {
-	SymEdge se = Parent::findEdge(u, v, SymEdge(prev));
-	if (se != INVALID) return forward(se);
-      } else {
-	SymEdge se = Parent::findEdge(v, u, SymEdge(prev));
-	if (se != INVALID) return backward(se);	
-      }
-      return INVALID;
-    }
-
-//     /// Finds an symmetric edge between two nodes.
-
-//     /// Finds an symmetric edge from node \c u to node \c v.
-//     ///
-//     /// If \c prev is \ref INVALID (this is the default value), then
-//     /// It finds the first edge from \c u to \c v. Otherwise it looks for
-//     /// the next edge from \c u to \c v after \c prev.
-//     /// \return The found edge or INVALID if there is no such an edge.
-
-//     SymEdge findEdge(Node u, Node v, SymEdge prev = INVALID) 
-//     {     
-//       if (prev == INVALID || id(prev) & 1 == 0) {
-// 	SymEdge se = Parent::findEdge(u, v, SymEdge(prev));
-// 	if (se != INVALID) return se;
-//       } else {
-// 	SymEdge se = Parent::findEdge(v, u, SymEdge(prev));
-// 	if (se != INVALID) return se;	
-//       }
-//       return INVALID;
-//     }
-    
-  public:
-
-    void clear() {
-      edge_maps.clear();
-      Parent::clear();
+    void firstOut(Edge& edge, const Node& node) const {
+      edge.n = nodes[node.n].first_out;
     }
 
-    static Edge opposite(Edge e) {
-      return Edge(id(e) ^ 1);
+    void nextOut(Edge& edge) const {
+      edge.n = edges[edge.n].next_out;
     }
 
-    static Edge forward(SymEdge e) {
-      return Edge(id(e) << 1);
+    void firstIn(Edge& edge, const Node& node) const {
+      edge.n = nodes[node.n].first_in;
     }
-
-    static Edge backward(SymEdge e) {
-      return Edge((id(e) << 1) | 1);
+    
+    void nextIn(Edge& edge) const {
+      edge.n = edges[edge.n].next_in;
     }
 
   };
-  ///Graph for bidirectional edges.
-
-  ///The purpose of this graph structure is to handle graphs
-  ///having bidirectional edges. Here the function \c addEdge(u,v) adds a pair
-  ///of oppositely directed edges.
-  ///There is a new edge map type called
-  ///\ref SymSmartGraph::SymEdgeMap "SymEdgeMap"
-  ///that complements this
-  ///feature by
-  ///storing shared values for the edge pairs. The usual
-  ///\ref Graph::EdgeMap "EdgeMap"
-  ///can be used
-  ///as well.
-  ///
-  ///The oppositely directed edge can also be obtained easily
-  ///using \ref opposite.
-  ///\warning It shares the similarity with \ref SmartGraph that
-  ///it is not possible to delete edges or nodes from the graph.
-  //\sa SmartGraph.
-
-  /*  class SymSmartGraph : public SmartGraph
-  {
-  public:
-    typedef SymSmartGraph Graph;
-
-    // Create symmetric map registry.
-    CREATE_SYM_EDGE_MAP_REGISTRY;
-    // Create symmetric edge map.
-    CREATE_SYM_EDGE_MAP(ArrayMap);
-
 
-    SymSmartGraph() : SmartGraph() { }
-    SymSmartGraph(const SmartGraph &_g) : SmartGraph(_g) { }
-    ///Adds a pair of oppositely directed edges to the graph.
-    Edge addEdge(Node u, Node v)
-    {
-      Edge e = SmartGraph::addEdge(u,v);
-      Edge f = SmartGraph::addEdge(v,u);
-      sym_edge_maps.add(e);
-      sym_edge_maps.add(f);
-      return e;
-    }
-
-    ///The oppositely directed edge.
-
-    ///Returns the oppositely directed
-    ///pair of the edge \c e.
-    static Edge opposite(Edge e)
-    {
-      Edge f;
-      f.n = e.n - 2*(e.n%2) + 1;
-      return f;
-    }
-    
+  typedef AlterableGraphExtender<SmartGraphBase> AlterableSmartGraphBase;
+  typedef IterableGraphExtender<AlterableSmartGraphBase> IterableSmartGraphBase;
+  typedef IdMappableGraphExtender<IterableSmartGraphBase> IdMappableSmartGraphBase;
+  typedef DefaultMappableGraphExtender<IdMappableSmartGraphBase> MappableSmartGraphBase;
+  typedef ExtendableGraphExtender<MappableSmartGraphBase> ExtendableSmartGraphBase;
+  typedef ClearableGraphExtender<ExtendableSmartGraphBase> ClearableSmartGraphBase;
+
+  typedef ClearableSmartGraphBase SmartGraph;
+
+
+  template <>
+  int countNodes<SmartGraph>(const SmartGraph& graph) {
+    return graph.nodeNum();
+  }
+
+  template <>
+  int countEdges<SmartGraph>(const SmartGraph& graph) {
+    return graph.edgeNum();
+  }
 
-    };*/
-  
   /// @}  
 } //namespace lemon
 

Modified: hugo/trunk/src/lemon/suurballe.h
==============================================================================
--- hugo/trunk/src/lemon/suurballe.h	(original)
+++ hugo/trunk/src/lemon/suurballe.h	Thu Oct 28 00:38:50 2004
@@ -125,12 +125,10 @@
       paths.resize(k);
       for (int j=0; j<i; ++j){
 	Node n=s;
-	OutEdgeIt e;
 
 	while (n!=t){
 
-
-	  G.first(e,n);
+	  OutEdgeIt e(G, n);
 	  
 	  while (!reversed[e]){
 	    ++e;

Modified: hugo/trunk/src/lemon/vector_map.h
==============================================================================
--- hugo/trunk/src/lemon/vector_map.h	(original)
+++ hugo/trunk/src/lemon/vector_map.h	Thu Oct 28 00:38:50 2004
@@ -18,9 +18,9 @@
 #define LEMON_VECTOR_MAP_H
 
 #include <vector>
+#include <algorithm>
 
-#include <lemon/map_iterator.h>
-#include <lemon/map_bits.h>
+#include <lemon/alteration_observer_registry.h>
 
 ///\ingroup graphmaps
 ///\file
@@ -31,34 +31,41 @@
   /// \addtogroup graphmaps
   /// @{
   
-  /** The VectorMap template class is graph map structure what
-   *  automatically updates the map when a key is added to or erased from
-   *  the map. This map factory uses the allocators to implement 
-   *  the container functionality. This map factory
-   *  uses the std::vector to implement the container function.
-   *
-   *  \param MapRegistry The MapRegistry that the maps will belong to.
-   *  \param Value The value type of the map.
-   * 
-   *  \author Balazs Dezso
-   */
-	
-  template <typename MapRegistry, typename Value>
-  class VectorMap : public MapRegistry::MapBase {
-    template <typename MR, typename T> friend class VectorMap;
+  /// The VectorMap template class is graph map structure what
+  /// automatically updates the map when a key is added to or erased from
+  /// the map. This map factory uses the allocators to implement 
+  /// the container functionality. This map factory
+  /// uses the std::vector to implement the container function.
+  ///
+  /// \param Registry The AlterationObserverRegistry that will notify this map.
+  /// \param IdMap The IdMap type of the graph items.
+  /// \param Value The value type of the map.
+  /// 
+  /// \author Balazs Dezso
+  	
+
+  template <typename _Graph, 
+	    typename _Item,
+	    typename _IdMap,
+	    typename _Value>
+  class VectorMap : public AlterationObserverRegistry<_Item>::ObserverBase {
   public:
 		
-    /// The graph type of the maps. 
-    typedef typename MapRegistry::Graph Graph;
-    /// The key type of the maps.
-    typedef typename MapRegistry::KeyType KeyType;
-    /// The iterator to iterate on the keys.
-    typedef typename MapRegistry::KeyIt KeyIt;
+    /// The graph type of the map. 
+    typedef _Graph Graph;
+    /// The key type of the map.
+    typedef _Item KeyType;
+    /// The id map type of the map.
+    typedef _IdMap IdMap;
+    /// The registry type of the map.
+    typedef AlterationObserverRegistry<_Item> Registry;
+    /// The value type of the map.
+    typedef _Value Value;
 
     /// The map type.
     typedef VectorMap Map;
-    /// The MapBase of the Map which implements the core regisitry function.
-    typedef typename MapRegistry::MapBase MapBase;
+    /// The base class of the map.
+    typedef typename Registry::ObserverBase Parent;
 
   private:
 		
@@ -67,7 +74,6 @@
 
   public:
 
-
     /// The value type of the map.
     typedef Value ValueType;
     /// The reference type of the map;
@@ -82,95 +88,98 @@
     /// The pointer type of the map;
     typedef typename Container::const_pointer ConstPointerType;
 
-    /// Constructor to attach the new map into a registry.
+    /// Constructor to attach the new map into the registry.
 
-    /** Constructor to attach the new map into a registry.
-     *  It adds all the nodes or edges of the graph to the map.
-     */
-    VectorMap(const Graph& g, MapRegistry& r) 
-      : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1) {}
+    /// It construates a map and attachs it into the registry.
+    /// It adds all the items of the graph to the map.
+     
+    VectorMap(const Graph& _g, Registry& _r) : graph(&_g) {
+      attach(_r);
+      build();
+    }
 
     /// Constructor uses given value to initialize the map. 
 
-    /** Constructor uses given value to initialize the map. 
-     *  It adds all the nodes or edges of the graph to the map.
-     */
-    VectorMap(const Graph& g, MapRegistry& r, const Value& v) 
-      : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1, v) {}
-
-    /// Assign operator to copy a map of an other map type.
+    /// It construates a map uses a given value to initialize the map. 
+    /// It adds all the items of the graph to the map.
+     
+    VectorMap(const Graph& g, Registry& r, const Value& v) : graph(&g) { 
+      attach(r);
+      container.resize(IdMap(*graph).maxId() + 1, v);
+    }
 
-    /** Assign operator to copy a map of an other map type.
-     *  This map's value type must be assignable by the other
-     *  map type's value type.
-     */
-    template <typename TT>
-    VectorMap(const VectorMap<MapRegistry, TT>& c) 
-      : MapBase(c), container(c.container.size()) {
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
-	container[id] = c.container[id];
+    VectorMap(const VectorMap& copy) : graph(copy.getGraph()) {
+      if (copy.attached()) {
+	attach(*copy.getRegistry());
+	container = copy.container;
       }
     }
 
-    /// Assign operator to copy a map of an other map type.
 
-    /** Assign operator to copy a map of an other map type.
-     *  This map's value type must be assignable by the other
-     *  map type's value type.
+    /** Assign operator to copy a map of the same map type.
      */
-    template <typename TT>
-    VectorMap& operator=(const VectorMap<MapRegistry, TT>& c) {
-      if (MapBase::getGraph() != c.getGraph()) {
-	MapBase::operator=(c);
-	container.resize(c.container.size());
-      }
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
-	container[id] = c.container[id];
+    VectorMap& operator=(const VectorMap& copy) {
+      if (&copy == this) return *this;
+      
+      if (graph != copy.graph) {
+	if (attached()) {
+	  detach();
+	}
+	if (copy.attached()) {
+	  attach(*copy.getRegistry());
+	}
       }
+      container = copy.container;
+
       return *this;
     }
 
+
+    virtual ~VectorMap() {
+      if (attached()) {
+	detach();
+      }
+    }
+
+    const Graph* getGraph() const {
+      return graph;
+    }
+
     /// The subcript operator.
 
-    /**
-     * The subscript operator. The map can be subscripted by the
-     * actual keys of the graph. 
-     */
+    /// The subscript operator. The map can be subscripted by the
+    /// actual items of the graph. 
+     
     ReferenceType operator[](const KeyType& key) {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
-      return container[id];
+      return container[IdMap(*graph)[key]];
     } 
 		
     /// The const subcript operator.
 
-    /**
-     * The const subscript operator. The map can be subscripted by the
-     * actual keys of the graph. 
-     */
+    /// The const subscript operator. The map can be subscripted by the
+    /// actual items of the graph. 
+     
     ConstReferenceType operator[](const KeyType& key) const {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
-      return container[id];
+      return container[IdMap(*graph)[key]];
     }
 
-    ///Setter function of the map.
 
-    /** Setter function of the map. Equivalent with map[key] = val.
-     *  This is a compatibility feature with the not dereferable maps.
-     */
-    void set(const KeyType& key, const ValueType& val) {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
-      container[id] = val;
+    /// The setter function of the map.
+
+    /// It the same as operator[](key) = value expression.
+    ///
+     
+    void set(const KeyType& key, const ValueType& value) {
+      (*this)[key] = value;
     }
+
     /// Adds a new key to the map.
 		
-    /** Adds a new key to the map. It called by the map registry
-     *  and it overrides the \ref MapRegistry::MapBase MapBase's
-     *  add() member function.
-     */
+    /// It adds a new key to the map. It called by the observer registry
+    /// and it overrides the add() member function of the observer base.
+     
     void add(const KeyType& key) {
-      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
+      int id = IdMap(*graph)[key];
       if (id >= (int)container.size()) {
 	container.resize(id + 1);
       }
@@ -178,93 +187,94 @@
 
     /// Erases a key from the map.
 		
-    /** Erase a key from the map. It called by the map registry 
-     *  and it overrides the \ref MapRegistry::MapBase MapBase's
-     *  erase() member function.
-     */
+    /// Erase a key from the map. It called by the observer registry
+    /// and it overrides the erase() member function of the observer base.     
     void erase(const KeyType& key) {}
 
-    /// Makes empty the map.
+    /// Buildes the map.
+		
+    /// It buildes the map. It called by the observer registry
+    /// and it overrides the build() member function of the observer base.
+
+    void build() { 
+      container.resize(IdMap(*graph).maxId() + 1);
+    }
 
-    /** Makes empty the map. It called by the map registry 
-     *  and it overrides the \ref MapRegistry::MapBase MapBase's
-     *  clear() member function.
-     */
+    /// Clear the map.
 
+    /// It erase all items from the map. It called by the observer registry
+    /// and it overrides the clear() member function of the observer base.     
     void clear() { 
       container.clear();
     }
 
-    /// The stl compatible pair iterator of the map.
-    typedef MapIterator<VectorMap> Iterator;
-    /// The stl compatible const pair iterator of the map.
-    typedef MapConstIterator<VectorMap> ConstIterator;
+  private:
+		
+    Container container;
+    const Graph *graph;
 
-    /** Returns the begin iterator of the map.
-     */
-    Iterator begin() {
-      return Iterator(*this, KeyIt(*MapBase::getGraph()));
-    }
+  };
 
-    /** Returns the end iterator of the map.
-     */
-    Iterator end() {
-      return Iterator(*this, INVALID);
-    }
 
-    /** Returns the begin ConstIterator of the map.
-     */
-    ConstIterator begin() const {
-      return ConstIterator(*this, KeyIt(*MapBase::getGraph()));
-    }
+  template <typename _Base> 
+  class VectorMappableGraphExtender : public _Base {
+  public:
 
-    /** Returns the end const_iterator of the map.
-     */
-    ConstIterator end() const {
-      return ConstIterator(*this, INVALID);
-    }
+    typedef VectorMappableGraphExtender<_Base> Graph;
+    typedef _Base Parent;
 
-    /// The KeySet of the Map.
-    typedef MapConstKeySet<VectorMap> ConstKeySet;
+    typedef typename Parent::Node Node;
+    typedef typename Parent::NodeIt NodeIt;
+    typedef typename Parent::NodeIdMap NodeIdMap;
+    typedef typename Parent::NodeObserverRegistry NodeObserverRegistry;
 
-    /// KeySet getter function.
-    ConstKeySet keySet() const {
-      return ConstKeySet(*this); 
-    }
+    typedef typename Parent::Edge Edge;
+    typedef typename Parent::EdgeIt EdgeIt;
+    typedef typename Parent::EdgeIdMap EdgeIdMap;
+    typedef typename Parent::EdgeObserverRegistry EdgeObserverRegistry;
 
-    /// The ConstValueSet of the Map.
-    typedef MapConstValueSet<VectorMap> ConstValueSet;
+    
 
-    /// ConstValueSet getter function.
-    ConstValueSet valueSet() const {
-      return ConstValueSet(*this);
-    }
+    template <typename _Value>
+    class NodeMap : public VectorMap<Graph, Node, NodeIdMap, _Value> {
+    public:
+      typedef VectorMappableGraphExtender<_Base> Graph;
 
-    /// The ValueSet of the Map.
-    typedef MapValueSet<VectorMap> ValueSet;
+      typedef typename Graph::Node Node;
+      typedef typename Graph::NodeIdMap NodeIdMap;
 
-    /// ValueSet getter function.
-    ValueSet valueSet() {
-      return ValueSet(*this);
-    }
+      typedef VectorMap<Graph, Node, NodeIdMap, _Value> Parent;
 
+      typedef typename Parent::Graph Graph;
+      typedef typename Parent::Value Value;
 
-  private:
-		
-    Container container;
+      NodeMap(const Graph& g) 
+	: Parent(g, g.getNodeObserverRegistry()) {}
+      NodeMap(const Graph& g, const Value& v) 
+	: Parent(g, g.getNodeObserverRegistry(), v) {}
 
-  public:
-    // STL  compatibility typedefs.
-    typedef Iterator iterator;
-    typedef ConstIterator const_iterator;
-    typedef typename Iterator::PairValueType value_type;
-    typedef typename Iterator::KeyType key_type;
-    typedef typename Iterator::ValueType data_type;
-    typedef typename Iterator::PairReferenceType reference;
-    typedef typename Iterator::PairPointerType pointer;
-    typedef typename ConstIterator::PairReferenceType const_reference;
-    typedef typename ConstIterator::PairPointerType const_pointer;
-    typedef int difference_type;		
+    };
+
+    template <typename _Value>
+    class EdgeMap : public VectorMap<Graph, Edge, EdgeIdMap, _Value> {
+    public:
+      typedef VectorMappableGraphExtender<_Base> Graph;
+
+      typedef typename Graph::Edge Edge;
+      typedef typename Graph::EdgeIdMap EdgeIdMap;
+
+      typedef VectorMap<Graph, Edge, EdgeIdMap, _Value> Parent;
+
+      typedef typename Parent::Graph Graph;
+      typedef typename Parent::Value Value;
+
+      EdgeMap(const Graph& g) 
+	: Parent(g, g.getEdgeObserverRegistry()) {}
+      EdgeMap(const Graph& g, const Value& v) 
+	: Parent(g, g.getEdgeObserverRegistry(), v) {}
+
+    };
+    
   };
   
   /// @}

Modified: hugo/trunk/src/test/Makefile.am
==============================================================================
--- hugo/trunk/src/test/Makefile.am	(original)
+++ hugo/trunk/src/test/Makefile.am	Thu Oct 28 00:38:50 2004
@@ -2,17 +2,22 @@
 
 EXTRA_DIST = preflow_graph.dim #input file for preflow_test.cc
 
-noinst_HEADERS = test_tools.h graph_test.h sym_graph_test.h
+noinst_HEADERS = \
+	test_tools.h \
+	graph_test.h \
+	sym_graph_test.h \
+	map_test.h \
+	graph_utils_test.h
 
 check_PROGRAMS = \
 	bfs_test \
 	dfs_test \
 	dijkstra_test \
 	graph_test \
-	sym_graph_test \
-	graph_wrapper_test \
+	graph_utils_test \
 	kruskal_test \
 	min_cost_flow_test \
+	new_graph_test \
 	suurballe_test \
 	path_test \
 	preflow_test \
@@ -20,6 +25,7 @@
 	test_tools_pass \
 	time_measure_test \
 	unionfind_test \
+	graph_wrapper_test \
 	xy_test
 
 TESTS = $(check_PROGRAMS)
@@ -29,10 +35,11 @@
 dfs_test_SOURCES = dfs_test.cc
 dijkstra_test_SOURCES = dijkstra_test.cc
 graph_test_SOURCES = graph_test.cc
-sym_graph_test_SOURCES = sym_graph_test.cc
+graph_utils_test_SOURCES = graph_utils_test.cc
 graph_wrapper_test_SOURCES = graph_wrapper_test.cc
 kruskal_test_SOURCES = kruskal_test.cc
 min_cost_flow_test_SOURCES = min_cost_flow_test.cc
+new_graph_test_SOURCES = new_graph_test.cc
 suurballe_test_SOURCES = suurballe_test.cc
 path_test_SOURCES = path_test.cc
 preflow_test_SOURCES = preflow_test.cc

Modified: hugo/trunk/src/test/graph_test.h
==============================================================================
--- hugo/trunk/src/test/graph_test.h	(original)
+++ hugo/trunk/src/test/graph_test.h	Thu Oct 28 00:38:50 2004
@@ -21,56 +21,64 @@
 
 //! \ingroup misc
 //! \file
-//! \brief Some utility to  test graph classes.
+//! \brief Some utility and test cases to test graph classes.
 namespace lemon {
 
   template<class Graph> void checkGraphNodeList(Graph &G, int nn)
-    {
-      typename Graph::NodeIt n(G);
-      for(int i=0;i<nn;i++) {
-	check(n!=INVALID,"Wrong Node list linking.");
-	++n;
-      }
-      check(n==INVALID,"Wrong Node list linking.");
+  {
+    typename Graph::NodeIt n(G);
+    for(int i=0;i<nn;i++) {
+      check(n!=INVALID,"Wrong Node list linking.");
+      ++n;
     }
+    check(n==INVALID,"Wrong Node list linking.");
+  }
 
-  template<class Graph> void checkGraphEdgeList(Graph &G, int nn)
-    {
-      typedef typename Graph::EdgeIt EdgeIt;
-
-      EdgeIt e(G);
-      for(int i=0;i<nn;i++) {
-	check(e!=INVALID,"Wrong Edge list linking.");
-	++e;
-      }
-      check(e==INVALID,"Wrong Edge list linking.");
+  template<class Graph>
+  void checkGraphEdgeList(Graph &G, int nn)
+  {
+    typedef typename Graph::EdgeIt EdgeIt;
+
+    EdgeIt e(G);
+    for(int i=0;i<nn;i++) {
+      check(e!=INVALID,"Wrong Edge list linking.");
+      ++e;
     }
+    check(e==INVALID,"Wrong Edge list linking.");
+  }
 
-  template<class Graph> void checkGraphOutEdgeList(Graph &G,
-						   typename Graph::Node n,
-						   int nn)
-    {
-      typename Graph::OutEdgeIt e(G,n);
-      for(int i=0;i<nn;i++) {
-	check(e!=INVALID,"Wrong OutEdge list linking.");
-	check(n==G.tail(e), "Wrong OutEdge list linking.");
-	++e;
-      }
-      check(e==INVALID,"Wrong OutEdge list linking.");
+  template<class Graph> 
+  void checkGraphOutEdgeList(Graph &G, typename Graph::Node n, int nn)
+  {
+    typename Graph::OutEdgeIt e(G,n);
+    for(int i=0;i<nn;i++) {
+      check(e!=INVALID,"Wrong OutEdge list linking.");
+      check(n==G.tail(e), "Wrong OutEdge list linking.");
+      ++e;
     }
+    check(e==INVALID,"Wrong OutEdge list linking.");
+  }
 
-  template<class Graph> void checkGraphInEdgeList(Graph &G,
-						  typename Graph::Node n,
-						  int nn)
-    {
-      typename Graph::InEdgeIt e(G,n);
-      for(int i=0;i<nn;i++) {
-	check(e!=INVALID,"Wrong InEdge list linking.");
-	check(n==G.head(e), "Wrong InEdge list linking.");
-	++e;
-      }
-      check(e==INVALID,"Wrong InEdge list linking.");
+  template<class Graph> void 
+  checkGraphInEdgeList(Graph &G, typename Graph::Node n, int nn)
+  {
+    typename Graph::InEdgeIt e(G,n);
+    for(int i=0;i<nn;i++) {
+      check(e!=INVALID,"Wrong InEdge list linking.");
+      check(n==G.head(e), "Wrong InEdge list linking.");
+      ++e;
     }
+    check(e==INVALID,"Wrong InEdge list linking.");
+  }
+
+  template <class Graph> 
+  void checkGraph() {
+    const int num = 5;
+    Graph G;
+    addPetersen(G, num);
+    bidirGraph(G);
+    checkBidirPetersen(G, num);
+  }
 
   ///\file
   ///\todo Check head(), tail() as well;

Modified: hugo/trunk/src/test/graph_wrapper_test.cc
==============================================================================
--- hugo/trunk/src/test/graph_wrapper_test.cc	(original)
+++ hugo/trunk/src/test/graph_wrapper_test.cc	Thu Oct 28 00:38:50 2004
@@ -15,8 +15,11 @@
  */
 
 #include<iostream>
+#include<lemon/concept_check.h>
+
 #include<lemon/smart_graph.h>
 #include<lemon/skeletons/graph.h>
+
 #include<lemon/list_graph.h>
 #include<lemon/full_graph.h>
 #include<lemon/graph_wrapper.h>
@@ -32,66 +35,31 @@
 */
 
 using namespace lemon;
+using namespace lemon::skeleton;
 
 
 typedef SmartGraph Graph;
 
-//Compile GraphWrapper
-typedef GraphWrapper<Graph> GW;
-template void lemon::skeleton::checkCompileStaticGraph<GW>(GW &);
-
-//Compile RevGraphWrapper
-typedef RevGraphWrapper<Graph> RevGW;
-template void lemon::skeleton::checkCompileStaticGraph<RevGW>(RevGW &);
-
-//Compile SubGraphWrapper
-typedef SubGraphWrapper<Graph, Graph::NodeMap<bool>, 
-			Graph::EdgeMap<bool> > SubGW;
-template void lemon::skeleton::checkCompileStaticGraph<SubGW>(SubGW &);
-
-//Compile NodeSubGraphWrapper
-typedef NodeSubGraphWrapper<Graph, Graph::NodeMap<bool> > NodeSubGW;
-template void lemon::skeleton::checkCompileStaticGraph<NodeSubGW>(NodeSubGW &);
-
-//Compile EdgeSubGraphWrapper
-typedef EdgeSubGraphWrapper<Graph, Graph::EdgeMap<bool> > EdgeSubGW;
-template void lemon::skeleton::checkCompileStaticGraph<EdgeSubGW>(EdgeSubGW &);
-
-//Compile UndirGraphWrapper
-/// \bug UndirGraphWrapper cannot pass the StaticGraph test
-//typedef UndirGraphWrapper<Graph> UndirGW;
-//template void checkCompileStaticGraph<UndirGW>(UndirGW &);
-
-//Compile UndirGraph
-//typedef UndirGraph<Graph> UndirG;
-//template void checkCompileStaticGraph<UndirG>(UndirG &);
-
-//Compile SubBidirGraphWrapper
-typedef SubBidirGraphWrapper<Graph, Graph::EdgeMap<bool>, 
-			     Graph::EdgeMap<bool> > SubBDGW;
-template void lemon::skeleton::checkCompileStaticGraph<SubBDGW>(SubBDGW &);
-
-//Compile BidirGraphWrapper
-typedef BidirGraphWrapper<Graph> BidirGW;
-template void lemon::skeleton::checkCompileStaticGraph<BidirGW>(BidirGW &);
-
-//Compile BidirGraph
-typedef BidirGraph<Graph> BidirG;
-template void lemon::skeleton::checkCompileStaticGraph<BidirG>(BidirG &);
-
-//Compile ResGraphWrapper
-typedef ResGraphWrapper<Graph, int, Graph::EdgeMap<int>, 
-			Graph::EdgeMap<int> > ResGW;
-template void lemon::skeleton::checkCompileStaticGraph<ResGW>(ResGW &);
-
-//Compile ErasingFirstGraphWrapper
-typedef ErasingFirstGraphWrapper<Graph, Graph::NodeMap<Graph::Edge> > ErasingFirstGW;
-template
-void lemon::skeleton::checkCompileStaticGraph<ErasingFirstGW>(ErasingFirstGW &);
-
 
 int main() 
 {
+  {
+    function_requires<StaticGraphConcept<GraphWrapper<Graph> > >();
+
+    function_requires<StaticGraphConcept<RevGraphWrapper<Graph> > >();
+
+    function_requires<StaticGraphConcept<SubGraphWrapper<Graph, Graph::NodeMap<bool> , Graph::EdgeMap<bool> > > >();
+    function_requires<StaticGraphConcept<NodeSubGraphWrapper<Graph, Graph::NodeMap<bool> > > >();
+    function_requires<StaticGraphConcept<EdgeSubGraphWrapper<Graph, Graph::EdgeMap<bool> > > >();
+
+    function_requires<StaticGraphConcept<SubBidirGraphWrapper<Graph, Graph::EdgeMap<bool>, Graph::EdgeMap<bool> > > > ();
+
+    function_requires<StaticGraphConcept<BidirGraph<Graph> > >();
+
+    function_requires<StaticGraphConcept<ResGraphWrapper<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > > >();
+
+    function_requires<StaticGraphConcept<ErasingFirstGraphWrapper<Graph, Graph::NodeMap<Graph::Edge> > > >();
+  }
   std::cout << __FILE__ ": All tests passed.\n";
 
   return 0;

Modified: hugo/trunk/src/test/test_tools.h
==============================================================================
--- hugo/trunk/src/test/test_tools.h	(original)
+++ hugo/trunk/src/test/test_tools.h	Thu Oct 28 00:38:50 2004
@@ -70,7 +70,7 @@
 ///\return The nodes and edges of the generated graph.
 
 template<typename Graph>
-PetStruct<Graph> addPetersen(Graph &G,int num=5)
+PetStruct<Graph> addPetersen(Graph &G,int num = 5)
 {
   PetStruct<Graph> n;
 
@@ -81,12 +81,50 @@
 
  for(int i=0;i<num;i++) {
    n.chords.push_back(G.addEdge(n.outer[i],n.inner[i]));
-   n.outcir.push_back(G.addEdge(n.outer[i],n.outer[(i+1)%5]));
-   n.incir.push_back(G.addEdge(n.inner[i],n.inner[(i+2)%5]));
+   n.outcir.push_back(G.addEdge(n.outer[i],n.outer[(i+1) % num]));
+   n.incir.push_back(G.addEdge(n.inner[i],n.inner[(i+2) % num]));
   }
  return n;
 }
 
+/// \brief Adds to the graph the reverse pair of all edge.
+///
+/// Adds to the graph the reverse pair of all edge.
+///
+template<class Graph> void bidirGraph(Graph &G)
+{
+  typedef typename Graph::Edge Edge;
+  typedef typename Graph::EdgeIt EdgeIt;
+  
+  std::vector<Edge> ee;
+  
+  for(EdgeIt e(G);e!=INVALID;++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));
+}
+
+
+/// \brief Checks the bidirectioned Petersen graph.
+///
+///  Checks the bidirectioned Petersen graph.
+///
+template<class Graph> void checkBidirPetersen(Graph &G, int num = 5)
+{
+  typedef typename Graph::Node Node;
+
+  typedef typename Graph::EdgeIt EdgeIt;
+  typedef typename Graph::NodeIt NodeIt;
+
+  checkGraphNodeList(G, 2 * num);
+  checkGraphEdgeList(G, 6 * num);
+
+  for(NodeIt n(G);n!=INVALID;++n) {
+    checkGraphInEdgeList(G, n, 3);
+    checkGraphOutEdgeList(G, n, 3);
+  }  
+}
+
 ///Structure returned by \ref addSymPetersen().
 
 ///Structure returned by \ref addSymPetersen().

Modified: hugo/trunk/src/work/klao/TODO
==============================================================================
--- hugo/trunk/src/work/klao/TODO	(original)
+++ hugo/trunk/src/work/klao/TODO	Thu Oct 28 00:38:50 2004
@@ -1 +1,3 @@
+full_graph.h -t atnez(et)ni!
+
 megcsinalni, hogy mukodjon a kereses a doksiban



More information about the Lemon-commits mailing list