[Lemon-commits] [lemon_svn] deba: r2550 - in hugo/branches/extendermerge: demo lemon lemon/bits lemon/concept test

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


Author: deba
Date: Fri Feb 17 13:24:31 2006
New Revision: 2550

Added:
   hugo/branches/extendermerge/demo/grid_ugraph_demo.cc
      - copied, changed from r2549, /hugo/branches/extendermerge/demo/grid_graph_demo.cc
   hugo/branches/extendermerge/demo/grid_ugraph_demo.in
      - copied unchanged from r2549, /hugo/branches/extendermerge/demo/grid_graph_demo.in
   hugo/branches/extendermerge/lemon/grid_ugraph.h
      - copied, changed from r2549, /hugo/branches/extendermerge/lemon/grid_graph.h
Removed:
   hugo/branches/extendermerge/demo/grid_graph_demo.cc
   hugo/branches/extendermerge/demo/grid_graph_demo.in
   hugo/branches/extendermerge/lemon/bits/clearable_graph_extender.h
   hugo/branches/extendermerge/lemon/bits/erasable_graph_extender.h
   hugo/branches/extendermerge/lemon/bits/extendable_graph_extender.h
   hugo/branches/extendermerge/lemon/bits/iterable_graph_extender.h
   hugo/branches/extendermerge/lemon/grid_graph.h
Modified:
   hugo/branches/extendermerge/demo/Makefile.am
   hugo/branches/extendermerge/lemon/Makefile.am
   hugo/branches/extendermerge/lemon/bits/alteration_notifier.h
   hugo/branches/extendermerge/lemon/bits/default_map.h
   hugo/branches/extendermerge/lemon/bits/graph_extender.h
   hugo/branches/extendermerge/lemon/bits/static_map.h
   hugo/branches/extendermerge/lemon/concept/bpugraph.h
   hugo/branches/extendermerge/lemon/concept/graph.h
   hugo/branches/extendermerge/lemon/concept/ugraph.h
   hugo/branches/extendermerge/lemon/edge_set.h
   hugo/branches/extendermerge/lemon/euler.h
   hugo/branches/extendermerge/lemon/fredman_tarjan.h
   hugo/branches/extendermerge/lemon/full_graph.h
   hugo/branches/extendermerge/lemon/graph_adaptor.h
   hugo/branches/extendermerge/lemon/hypercube_graph.h
   hugo/branches/extendermerge/lemon/kruskal.h
   hugo/branches/extendermerge/lemon/list_graph.h
   hugo/branches/extendermerge/lemon/prim.h
   hugo/branches/extendermerge/lemon/radix_sort.h
   hugo/branches/extendermerge/lemon/smart_graph.h
   hugo/branches/extendermerge/lemon/sub_graph.h
   hugo/branches/extendermerge/lemon/topology.h
   hugo/branches/extendermerge/lemon/traits.h
   hugo/branches/extendermerge/test/ugraph_test.cc

Log:
Merged extenders



Modified: hugo/branches/extendermerge/demo/Makefile.am
==============================================================================
--- hugo/branches/extendermerge/demo/Makefile.am	(original)
+++ hugo/branches/extendermerge/demo/Makefile.am	Fri Feb 17 13:24:31 2006
@@ -15,7 +15,7 @@
 	sub_graph_adaptor_demo \
 	descriptor_map_demo \
 	coloring \
-	grid_graph_demo \
+	grid_ugraph_demo \
 	topology_demo \
 	simann_maxcut_demo
 
@@ -40,7 +40,7 @@
 
 graph_to_eps_demo_SOURCES = graph_to_eps_demo.cc
 
-grid_graph_demo_SOURCES = grid_graph_demo.cc
+grid_ugraph_demo_SOURCES = grid_ugraph_demo.cc
 
 graph_orientation_SOURCES = graph_orientation.cc
 

Copied: hugo/branches/extendermerge/demo/grid_ugraph_demo.cc (from r2549, /hugo/branches/extendermerge/demo/grid_graph_demo.cc)
==============================================================================
--- /hugo/branches/extendermerge/demo/grid_graph_demo.cc	(original)
+++ hugo/branches/extendermerge/demo/grid_ugraph_demo.cc	Fri Feb 17 13:24:31 2006
@@ -16,7 +16,7 @@
  *
  */
 
-#include <lemon/grid_graph.h>
+#include <lemon/grid_ugraph.h>
 #include <lemon/graph_adaptor.h>
 #include <lemon/graph_to_eps.h>
 #include <lemon/bfs.h>
@@ -27,28 +27,28 @@
 
 ///\ingroup demos
 ///\file
-///\brief Labirinth example with grid graph.
+///\brief Labirinth example with grid ugraph.
 ///
-///  Labirinth example with grid graph.
+///  Labirinth example with grid ugraph.
 ///
 /// The input file is:
 ///
-/// \include grid_graph_demo.in
+/// \include grid_ugraph_demo.in
 ///
 /// The result:
 ///
-/// \image html grid_graph_demo.png
-/// \image latex grid_graph_demo.eps "The labirinth" width=\textwidth
+/// \image html grid_ugraph_demo.png
+/// \image latex grid_ugraph_demo.eps "The labirinth" width=\textwidth
 ///
 /// The source:
 ///
-/// \include grid_graph_demo.cc
+/// \include grid_ugraph_demo.cc
 
 using namespace lemon;
 using namespace std;
 
 int main() {
-  ifstream in("grid_graph_demo.in");
+  ifstream in("grid_ugraph_demo.in");
   int width, height;
   in >> width >> height;
   int start_x, start_y;
@@ -56,23 +56,23 @@
   int stop_x, stop_y;
   in >> stop_x >> stop_y;
 
-  GridGraph graph(width, height);
-  GridGraph::Node start = graph(start_x - 1, start_y - 1);
-  GridGraph::Node stop = graph(stop_x - 1, stop_y - 1);
-  GridGraph::NodeMap<bool> filter(graph);
+  GridUGraph ugraph(width, height);
+  GridUGraph::Node start = ugraph(start_x - 1, start_y - 1);
+  GridUGraph::Node stop = ugraph(stop_x - 1, stop_y - 1);
+  GridUGraph::NodeMap<bool> filter(ugraph);
 
   for (int j = 0; j < height; ++j) {
     in >> ws;
     for (int i = 0; i < width; ++i) {
       char c; in >> c;
-      filter[graph(i, j)] = (c == '.');
+      filter[ugraph(i, j)] = (c == '.');
     }
   }
 
-  typedef NodeSubGraphAdaptor<GridGraph,
-    GridGraph::NodeMap<bool> > FilteredGraph;
+  typedef NodeSubGraphAdaptor<GridUGraph,
+    GridUGraph::NodeMap<bool> > FilteredGraph;
 
-  FilteredGraph filtered(graph, filter);
+  FilteredGraph filtered(ugraph, filter);
 
   Bfs<FilteredGraph> bfs(filtered);
   std::cout << "The length of shortest path: " << 
@@ -80,22 +80,22 @@
 
   FilteredGraph::EdgeMap<bool> path(filtered, false);
   
-  for (GridGraph::Node node = stop; 
+  for (GridUGraph::Node node = stop; 
        node != start; node = bfs.predNode(node)) {
     path[bfs.predEdge(node)] = true;
   }
   
-  graphToEps(filtered, "grid_graph_demo.eps").scaleToA4().
-    title("Grid graph").
+  graphToEps(filtered, "grid_ugraph_demo.eps").scaleToA4().
+    title("Grid ugraph").
     copyright("(C) 2006 LEMON Project").
-    coords(scaleMap(indexMap(graph), 10)).
+    coords(scaleMap(indexMap(ugraph), 10)).
     enableParallel().
     nodeScale(0.5).
     drawArrows().
     edgeColors(composeMap(ColorSet(), path)).
     run();
   
-  std::cout << "The shortest path is written to grid_graph_demo.eps" 
+  std::cout << "The shortest path is written to grid_ugraph_demo.eps" 
 	    << std::endl;
 
   return 0;

Modified: hugo/branches/extendermerge/lemon/Makefile.am
==============================================================================
--- hugo/branches/extendermerge/lemon/Makefile.am	(original)
+++ hugo/branches/extendermerge/lemon/Makefile.am	Fri Feb 17 13:24:31 2006
@@ -83,14 +83,12 @@
 	bits/alteration_notifier.h \
 	bits/array_map.h \
 	bits/default_map.h \
+	bits/static_map.h \
 	bits/vector_map.h \
-	bits/iterable_graph_extender.h \
-	bits/extendable_graph_extender.h \
-	bits/clearable_graph_extender.h \
-	bits/erasable_graph_extender.h \
-	bits/graph_extender.h \
 	bits/map_extender.h \
-	bits/static_map.h \
+	bits/graph_extender.h \
+	bits/graph_adaptor_extender.h \
+	bits/edge_set_extender.h \
 	bits/item_reader.h \
 	bits/item_writer.h \
 	concept/bpugraph.h \

Modified: hugo/branches/extendermerge/lemon/bits/alteration_notifier.h
==============================================================================
--- hugo/branches/extendermerge/lemon/bits/alteration_notifier.h	(original)
+++ hugo/branches/extendermerge/lemon/bits/alteration_notifier.h	Fri Feb 17 13:24:31 2006
@@ -265,8 +265,16 @@
     /// 
     void add(const Item& item) {
       typename Container::iterator it;
-      for (it = container.begin(); it != container.end(); ++it) {
-	(*it)->add(item);
+      try {
+        for (it = container.begin(); it != container.end(); ++it) {
+          (*it)->add(item);
+        }
+      } catch (...) {
+        typename Container::iterator jt;
+        for (jt = container.begin(); jt != it; ++it) {
+          (*it)->erase(item);
+        }
+        throw;
       }
     }	
 
@@ -278,8 +286,16 @@
     /// 
     void add(const std::vector<Item>& items) {
       typename Container::iterator it;
-      for (it = container.begin(); it != container.end(); ++it) {
-	(*it)->add(items);
+      try {
+        for (it = container.begin(); it != container.end(); ++it) {
+          (*it)->add(items);
+        }
+      } catch (...) {
+        typename Container::iterator jt;
+        for (jt = container.begin(); jt != it; ++it) {
+          (*it)->erase(items);
+        }
+        throw;
       }
     }	
 
@@ -316,8 +332,16 @@
     /// from an empty container.
     void build() {
       typename Container::iterator it;
-      for (it = container.begin(); it != container.end(); ++it) {
-	(*it)->build();
+      try {
+        for (it = container.begin(); it != container.end(); ++it) {
+          (*it)->build();
+        }
+      } catch (...) {
+        typename Container::iterator jt;
+        for (jt = container.begin(); jt != it; ++it) {
+          (*it)->clear();
+        }
+        throw;
       }
     }
 
@@ -335,232 +359,6 @@
     }
   };
 
-
-  /// \brief Class to extend a graph with the functionality of alteration
-  /// observing.
-  ///
-  /// AlterableGraphExtender extends the _Base graphs functionality with
-  /// the possibility of alteration observing. It defines two observer
-  /// registrys for the nodes and mapes.
-  /// 
-  /// \todo Document what "alteration observing" is. And probably find a
-  /// better (shorter) name.
-  ///
-  /// \param _Base is the base class to extend.
-  ///
-  /// \pre _Base is conform to the BaseGraphComponent concept.
-  ///
-  /// \post AlterableGraphExtender<_Base> is conform to the
-  /// AlterableGraphComponent concept.
-  ///
-  /// \author Balazs Dezso
-
-  template <typename _Base> 
-  class AlterableGraphExtender : public _Base {
-  public:
-
-    typedef AlterableGraphExtender Graph;
-    typedef _Base Parent;
-
-    typedef typename Parent::Node Node;
-    typedef typename Parent::Edge Edge;
-
-    /// The edge observer registry.
-    typedef AlterationNotifier<Edge> EdgeNotifier;
-    /// The node observer registry.
-    typedef AlterationNotifier<Node> NodeNotifier;
-
-
-  protected:
-
-    mutable EdgeNotifier edge_notifier;
-
-    mutable NodeNotifier node_notifier;
-
-  public:
-
-    /// \brief Gives back the edge alteration notifier.
-    ///
-    /// Gives back the edge alteration notifier.
-    EdgeNotifier& getNotifier(Edge) const {
-      return edge_notifier;
-    }
-
-    /// \brief Gives back the node alteration notifier.
-    ///
-    /// Gives back the node alteration notifier.
-    NodeNotifier& getNotifier(Node) const {
-      return node_notifier;
-    }
-
-    ~AlterableGraphExtender() {
-      node_notifier.clear();
-      edge_notifier.clear();
-    }
-    
-  };
-
-
-  template <typename _Base> 
-  class AlterableEdgeSetExtender : public _Base {
-  public:
-
-    typedef AlterableEdgeSetExtender Graph;
-    typedef _Base Parent;
-
-    typedef typename Parent::Edge Edge;
-
-    /// The edge observer registry.
-    typedef AlterationNotifier<Edge> EdgeNotifier;
-
-  protected:
-
-    mutable EdgeNotifier edge_notifier;
-
-  public:
-
-    /// \brief Gives back the edge alteration notifier.
-    ///
-    /// Gives back the edge alteration notifier.
-    EdgeNotifier& getNotifier(Edge) const {
-      return edge_notifier;
-    }
-
-    ~AlterableEdgeSetExtender() {
-      edge_notifier.clear();
-    }
-    
-  };
-
-  /// \brief Class to extend an undirected graph with the functionality of
-  /// alteration observing.
-  ///
-  /// \todo Document.
-  ///
-  /// \sa AlterableGraphExtender
-  ///
-  /// \bug This should be done some other way. Possibilities: template
-  /// specialization (not very easy, if at all possible); some kind of
-  /// enable_if boost technique?
-
-  template <typename _Base> 
-  class AlterableUGraphExtender
-    : public AlterableGraphExtender<_Base> {
-  public:
-
-    typedef AlterableUGraphExtender Graph;
-    typedef AlterableGraphExtender<_Base> Parent;
-
-    typedef typename Parent::UEdge UEdge;
-
-    /// The edge observer registry.
-    typedef AlterationNotifier<UEdge> UEdgeNotifier;
-
-  protected:
-
-    mutable UEdgeNotifier u_edge_notifier;
-
-  public:
-
-    using Parent::getNotifier;
-    UEdgeNotifier& getNotifier(UEdge) const {
-      return u_edge_notifier;
-    }
-
-    ~AlterableUGraphExtender() {
-      u_edge_notifier.clear();
-    }
-  };
-
-  template <typename _Base> 
-  class AlterableUEdgeSetExtender
-    : public AlterableEdgeSetExtender<_Base> {
-  public:
-
-    typedef AlterableUEdgeSetExtender Graph;
-    typedef AlterableEdgeSetExtender<_Base> Parent;
-
-    typedef typename Parent::UEdge UEdge;
-
-    typedef AlterationNotifier<UEdge> UEdgeNotifier;
-
-  protected:
-
-    mutable UEdgeNotifier u_edge_notifier;
-
-  public:
-
-    using Parent::getNotifier;
-    UEdgeNotifier& getNotifier(UEdge) const {
-      return u_edge_notifier;
-    }
-
-    ~AlterableUEdgeSetExtender() {
-      u_edge_notifier.clear();
-    }
-  };
-
-
-
-  template <typename _Base>
-  class AlterableBpUGraphExtender : public _Base {
-  public:
-
-    typedef _Base Parent;
-    typedef AlterableBpUGraphExtender Graph;
-  
-    typedef typename Parent::Node Node;
-    typedef typename Parent::BNode BNode;
-    typedef typename Parent::ANode ANode;
-    typedef typename Parent::Edge Edge;
-    typedef typename Parent::UEdge UEdge;
-  
-  
-    typedef AlterationNotifier<Node> NodeNotifier;
-    typedef AlterationNotifier<BNode> BNodeNotifier;
-    typedef AlterationNotifier<ANode> ANodeNotifier;
-    typedef AlterationNotifier<Edge> EdgeNotifier;
-    typedef AlterationNotifier<UEdge> UEdgeNotifier;
-
-  protected:
-
-    mutable NodeNotifier nodeNotifier;
-    mutable BNodeNotifier bNodeNotifier;
-    mutable ANodeNotifier aNodeNotifier;
-    mutable EdgeNotifier edgeNotifier;
-    mutable UEdgeNotifier uEdgeNotifier;
-
-  public:
-
-    NodeNotifier& getNotifier(Node) const {
-      return nodeNotifier;
-    }
-
-    BNodeNotifier& getNotifier(BNode) const {
-      return bNodeNotifier;
-    }
-
-    ANodeNotifier& getNotifier(ANode) const {
-      return aNodeNotifier;
-    }
-
-    EdgeNotifier& getNotifier(Edge) const {
-      return edgeNotifier;
-    }
-
-    UEdgeNotifier& getNotifier(UEdge) const {
-      return uEdgeNotifier;
-    }
-
-    ~AlterableBpUGraphExtender() {
-      nodeNotifier.clear();
-      bNodeNotifier.clear();
-      aNodeNotifier.clear();
-      edgeNotifier.clear();
-      uEdgeNotifier.clear();
-    }
-
-  };
   
 /// @}
   

Modified: hugo/branches/extendermerge/lemon/bits/default_map.h
==============================================================================
--- hugo/branches/extendermerge/lemon/bits/default_map.h	(original)
+++ hugo/branches/extendermerge/lemon/bits/default_map.h	Fri Feb 17 13:24:31 2006
@@ -22,6 +22,7 @@
 
 #include <lemon/bits/array_map.h>
 #include <lemon/bits/vector_map.h>
+#include <lemon/bits/static_map.h>
 
 ///\ingroup graphmapfactory
 ///\file
@@ -30,7 +31,7 @@
 
 namespace lemon {
   
-#ifndef GLIBCXX_DEBUG
+#ifndef _GLIBCXX_DEBUG
 
   template <typename _Graph, typename _Item, typename _Value>
   struct DefaultMapSelector {
@@ -167,483 +168,6 @@
 
   };
 
-
-  /// \e
-  template <typename _Base> 
-  class MappableGraphExtender : public _Base {
-  public:
-
-    typedef MappableGraphExtender<_Base> Graph;
-    typedef _Base Parent;
-
-    typedef typename Parent::Node Node;
-    typedef typename Parent::NodeIt NodeIt;
-
-    typedef typename Parent::Edge Edge;
-    typedef typename Parent::EdgeIt EdgeIt;
-
-    
-    template <typename _Value>
-    class NodeMap 
-      : public IterableMapExtender<DefaultMap<Graph, Node, _Value> > {
-    public:
-      typedef MappableGraphExtender Graph;
-      typedef IterableMapExtender<DefaultMap<Graph, Node, _Value> > Parent;
-
-      NodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      NodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      NodeMap& operator=(const NodeMap& cmap) {
-	return operator=<NodeMap>(cmap);
-      }
-
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concecpt and could be indiced by the current item set of
-      /// the NodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      NodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Node, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Node it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-
-    };
-
-    template <typename _Value>
-    class EdgeMap 
-      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
-    public:
-      typedef MappableGraphExtender Graph;
-      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
-
-      EdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      EdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      EdgeMap& operator=(const EdgeMap& cmap) {
-	return operator=<EdgeMap>(cmap);
-      }
-
-      template <typename CMap>
-      EdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Edge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-    
-  };
-
-  /// \e
-  template <typename _Base> 
-  class MappableEdgeSetExtender : public _Base {
-  public:
-
-    typedef MappableEdgeSetExtender<_Base> Graph;
-    typedef _Base Parent;
-
-    typedef typename Parent::Edge Edge;
-    typedef typename Parent::EdgeIt EdgeIt;
-
-    template <typename _Value>
-    class EdgeMap 
-      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
-    public:
-      typedef MappableEdgeSetExtender Graph;
-      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
-
-      EdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      EdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      EdgeMap& operator=(const EdgeMap& cmap) {
-	return operator=<EdgeMap>(cmap);
-      }
-
-      template <typename CMap>
-      EdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Edge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-    
-  };
-
-  /// \e
-  template <typename _Base> 
-  class MappableUGraphExtender : 
-    public MappableGraphExtender<_Base> {
-  public:
-
-    typedef MappableUGraphExtender Graph;
-    typedef MappableGraphExtender<_Base> Parent;
-
-    typedef typename Parent::UEdge UEdge;
-
-    template <typename _Value>
-    class UEdgeMap 
-      : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > {
-    public:
-      typedef MappableUGraphExtender Graph;
-      typedef IterableMapExtender<
-	DefaultMap<Graph, UEdge, _Value> > Parent;
-
-      UEdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      UEdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      UEdgeMap& operator=(const UEdgeMap& cmap) {
-	return operator=<UEdgeMap>(cmap);
-      }
-
-      template <typename CMap>
-      UEdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	UEdge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-
-
-  };
-
-  /// \e
-  template <typename _Base> 
-  class MappableUEdgeSetExtender : 
-    public MappableEdgeSetExtender<_Base> {
-  public:
-
-    typedef MappableUEdgeSetExtender Graph;
-    typedef MappableEdgeSetExtender<_Base> Parent;
-
-    typedef typename Parent::UEdge UEdge;
-
-    template <typename _Value>
-    class UEdgeMap 
-      : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > {
-    public:
-      typedef MappableUEdgeSetExtender Graph;
-      typedef IterableMapExtender<
-	DefaultMap<Graph, UEdge, _Value> > Parent;
-
-      UEdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      UEdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      UEdgeMap& operator=(const UEdgeMap& cmap) {
-	return operator=<UEdgeMap>(cmap);
-      }
-
-      template <typename CMap>
-      UEdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	UEdge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-
-
-  };
-
-
-  template <typename _Base>
-  class MappableBpUGraphExtender : public _Base {
-  public:
-
-    typedef _Base Parent;
-    typedef MappableBpUGraphExtender Graph;
-
-    typedef typename Parent::Node Node;
-    typedef typename Parent::ANode ANode;
-    typedef typename Parent::BNode BNode;
-    typedef typename Parent::Edge Edge;
-    typedef typename Parent::UEdge UEdge;
-    
-    template <typename _Value>
-    class ANodeMap 
-      : public IterableMapExtender<DefaultMap<Graph, ANode, _Value> > {
-    public:
-      typedef MappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<DefaultMap<Graph, ANode, _Value> > 
-      Parent;
-    
-      ANodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      ANodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      ANodeMap& operator=(const ANodeMap& cmap) {
-	return operator=<ANodeMap>(cmap);
-      }
-    
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concept and could be indiced by the current item set of
-      /// the ANodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      ANodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<ANode, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	ANode it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    
-    };
-
-    template <typename _Value>
-    class BNodeMap 
-      : public IterableMapExtender<DefaultMap<Graph, BNode, _Value> > {
-    public:
-      typedef MappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<DefaultMap<Graph, BNode, _Value> > 
-      Parent;
-    
-      BNodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      BNodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      BNodeMap& operator=(const BNodeMap& cmap) {
-	return operator=<BNodeMap>(cmap);
-      }
-    
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concept and could be indiced by the current item set of
-      /// the BNodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      BNodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<BNode, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	BNode it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    
-    };
-
-  protected:
-
-    template <typename _Value>
-    class NodeMapBase : public Parent::NodeNotifier::ObserverBase {
-    public:
-      typedef MappableBpUGraphExtender Graph;
-
-      typedef Node Key;
-      typedef _Value Value;
-
-      /// The reference type of the map;
-      typedef typename BNodeMap<_Value>::Reference Reference;
-      /// The pointer type of the map;
-      typedef typename BNodeMap<_Value>::Pointer Pointer;
-      
-      /// The const value type of the map.
-      typedef const Value ConstValue;
-      /// The const reference type of the map;
-      typedef typename BNodeMap<_Value>::ConstReference ConstReference;
-      /// The pointer type of the map;
-      typedef typename BNodeMap<_Value>::ConstPointer ConstPointer;
-
-      typedef True ReferenceMapTag;
-
-      NodeMapBase(const Graph& _g) 
-	: graph(&_g), bNodeMap(_g), aNodeMap(_g) {
-	Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
-      }
-      NodeMapBase(const Graph& _g, const _Value& _v) 
-	: graph(&_g), bNodeMap(_g, _v), 
-	  aNodeMap(_g, _v) {
-	Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
-      }
-
-      virtual ~NodeMapBase() {      
-	if (Parent::NodeNotifier::ObserverBase::attached()) {
-	  Parent::NodeNotifier::ObserverBase::detach();
-	}
-      }
-    
-      ConstReference operator[](const Key& node) const {
-	if (Parent::aNode(node)) {
-	  return aNodeMap[node];
-	} else {
-	  return bNodeMap[node];
-	}
-      } 
-
-      Reference operator[](const Key& node) {
-	if (Parent::aNode(node)) {
-	  return aNodeMap[node];
-	} else {
-	  return bNodeMap[node];
-	}
-      }
-
-      void set(const Key& node, const Value& value) {
-	if (Parent::aNode(node)) {
-	  aNodeMap.set(node, value);
-	} else {
-	  bNodeMap.set(node, value);
-	}
-      }
-
-    protected:
-      
-      virtual void add(const Node&) {}
-      virtual void add(const std::vector<Node>&) {}
-      virtual void erase(const Node&) {}
-      virtual void erase(const std::vector<Node>&) {}
-      virtual void clear() {}
-      virtual void build() {}
-
-      const Graph* getGraph() const { return graph; }
-      
-    private:
-      const Graph* graph;
-      BNodeMap<_Value> bNodeMap;
-      ANodeMap<_Value> aNodeMap;
-    };
-    
-  public:
-
-    template <typename _Value>
-    class NodeMap 
-      : public IterableMapExtender<NodeMapBase<_Value> > {
-    public:
-      typedef MappableBpUGraphExtender Graph;
-      typedef IterableMapExtender< NodeMapBase<_Value> > Parent;
-    
-      NodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      NodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      NodeMap& operator=(const NodeMap& cmap) {
-	return operator=<NodeMap>(cmap);
-      }
-    
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concept and could be indiced by the current item set of
-      /// the NodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      NodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Node, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Node it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    
-    };
-
-
-
-    template <typename _Value>
-    class EdgeMap 
-      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
-    public:
-      typedef MappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
-    
-      EdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      EdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      EdgeMap& operator=(const EdgeMap& cmap) {
-	return operator=<EdgeMap>(cmap);
-      }
-    
-      template <typename CMap>
-      EdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Edge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-
-    template <typename _Value>
-    class UEdgeMap 
-      : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > {
-    public:
-      typedef MappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > 
-      Parent;
-    
-      UEdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      UEdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      UEdgeMap& operator=(const UEdgeMap& cmap) {
-	return operator=<UEdgeMap>(cmap);
-      }
-    
-      template <typename CMap>
-      UEdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	UEdge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-  
-  };
-
 }
 
 #endif

Modified: hugo/branches/extendermerge/lemon/bits/graph_extender.h
==============================================================================
--- hugo/branches/extendermerge/lemon/bits/graph_extender.h	(original)
+++ hugo/branches/extendermerge/lemon/bits/graph_extender.h	Fri Feb 17 13:24:31 2006
@@ -22,15 +22,19 @@
 #include <lemon/invalid.h>
 #include <lemon/error.h>
 
+#include <lemon/bits/default_map.h>
+
 namespace lemon {
 
-  template <typename _Base>
-  class GraphExtender : public _Base {
+  template <typename Base>
+  class GraphExtender : public Base {
   public:
 
-    typedef _Base Parent;
+    typedef Base Parent;
     typedef GraphExtender Graph;
 
+    // Base extensions
+
     typedef typename Parent::Node Node;
     typedef typename Parent::Edge Edge;
 
@@ -59,24 +63,278 @@
 	return INVALID;
     }
 
+    // Alterable extension
+
+    typedef AlterationNotifier<Node> NodeNotifier;
+    typedef AlterationNotifier<Edge> EdgeNotifier;
+
+
+  protected:
+
+    mutable NodeNotifier node_notifier;
+    mutable EdgeNotifier edge_notifier;
+
+  public:
+
+    NodeNotifier& getNotifier(Node) const {
+      return node_notifier;
+    }
+    
+    EdgeNotifier& getNotifier(Edge) const {
+      return edge_notifier;
+    }
+
+    class NodeIt : public Node { 
+      const Graph* graph;
+    public:
+
+      NodeIt() {}
+
+      NodeIt(Invalid i) : Node(i) { }
+
+      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
+	_graph.first(*static_cast<Node*>(this));
+      }
+
+      NodeIt(const Graph& _graph, const Node& node) 
+	: Node(node), graph(&_graph) {}
+
+      NodeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class EdgeIt : public Edge { 
+      const Graph* graph;
+    public:
+
+      EdgeIt() { }
+
+      EdgeIt(Invalid i) : Edge(i) { }
+
+      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
+	_graph.first(*static_cast<Edge*>(this));
+      }
+
+      EdgeIt(const Graph& _graph, const Edge& e) : 
+	Edge(e), graph(&_graph) { }
+
+      EdgeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class OutEdgeIt : public Edge { 
+      const Graph* graph;
+    public:
+
+      OutEdgeIt() { }
+
+      OutEdgeIt(Invalid i) : Edge(i) { }
+
+      OutEdgeIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
+	_graph.firstOut(*this, node);
+      }
+
+      OutEdgeIt(const Graph& _graph, const Edge& edge) 
+	: Edge(edge), graph(&_graph) {}
+
+      OutEdgeIt& operator++() { 
+	graph->nextOut(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class InEdgeIt : public Edge { 
+      const Graph* graph;
+    public:
+
+      InEdgeIt() { }
+
+      InEdgeIt(Invalid i) : Edge(i) { }
+
+      InEdgeIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
+	_graph.firstIn(*this, node);
+      }
+
+      InEdgeIt(const Graph& _graph, const Edge& edge) : 
+	Edge(edge), graph(&_graph) {}
+
+      InEdgeIt& operator++() { 
+	graph->nextIn(*this);
+	return *this; 
+      }
+
+    };
+
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the source in this case) of the iterator
+    Node baseNode(const OutEdgeIt &e) const {
+      return Parent::source(e);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the target in this case) of the
+    /// iterator
+    Node runningNode(const OutEdgeIt &e) const {
+      return Parent::target(e);
+    }
+
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the target in this case) of the iterator
+    Node baseNode(const InEdgeIt &e) const {
+      return Parent::target(e);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the source in this case) of the
+    /// iterator
+    Node runningNode(const InEdgeIt &e) const {
+      return Parent::source(e);
+    }
+
+    
+    template <typename _Value>
+    class NodeMap 
+      : public IterableMapExtender<DefaultMap<Graph, Node, _Value> > {
+    public:
+      typedef GraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, Node, _Value> > Parent;
+
+      NodeMap(const Graph& _g) 
+	: Parent(_g) {}
+      NodeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+
+
+      /// \brief Template assign operator.
+      ///
+      /// The given parameter should be conform to the ReadMap
+      /// concecpt and could be indiced by the current item set of
+      /// the NodeMap. In this case the value for each item
+      /// is assigned by the value of the given ReadMap. 
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<Node, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	Node it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+
+    };
+
+    template <typename _Value>
+    class EdgeMap 
+      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
+    public:
+      typedef GraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
+
+      EdgeMap(const Graph& _g) 
+	: Parent(_g) {}
+      EdgeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+
+      EdgeMap& operator=(const EdgeMap& cmap) {
+	return operator=<EdgeMap>(cmap);
+      }
+
+      template <typename CMap>
+      EdgeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	Edge it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    };
+
+
+    Node addNode() {
+      Node node = Parent::addNode();
+      getNotifier(Node()).add(node);
+      return node;
+    }
+    
+    Edge addEdge(const Node& from, const Node& to) {
+      Edge edge = Parent::addEdge(from, to);
+      getNotifier(Edge()).add(edge);
+      return edge;
+    }
+
+    void clear() {
+      getNotifier(Edge()).clear();
+      getNotifier(Node()).clear();
+      Parent::clear();
+    }
+
+
+    void erase(const Node& node) {
+      Edge edge;
+      Parent::firstOut(edge, node);
+      while (edge != INVALID ) {
+	erase(edge);
+	Parent::firstOut(edge, node);
+      } 
+
+      Parent::firstIn(edge, node);
+      while (edge != INVALID ) {
+	erase(edge);
+	Parent::firstIn(edge, node);
+      }
+
+      getNotifier(Node()).erase(node);
+      Parent::erase(node);
+    }
+    
+    void erase(const Edge& edge) {
+      getNotifier(Edge()).erase(edge);
+      Parent::erase(edge);
+    }
+
+
+    ~GraphExtender() {
+      getNotifier(Edge()).clear();
+      getNotifier(Node()).clear();
+    }
   };
 
-  template <typename _Base>
-  class UGraphExtender : public _Base {
-    typedef _Base Parent;
-    typedef UGraphExtender Graph;
+  template <typename Base>
+  class UGraphBaseExtender : public Base {
 
   public:
 
+    typedef Base Parent;
     typedef typename Parent::Edge UEdge;
     typedef typename Parent::Node Node;
 
+    typedef True UndirectedTag;
+
     class Edge : public UEdge {
-      friend class UGraphExtender;
+      friend class UGraphBaseExtender;
 
     protected:
-      // FIXME: Marci use opposite logic in his graph adaptors. It would
-      // be reasonable to syncronize...
       bool forward;
 
       Edge(const UEdge &ue, bool _forward) :
@@ -101,16 +359,7 @@
     };
 
 
-    /// \brief Edge of opposite direction.
-    ///
-    /// Returns the Edge of opposite direction.
-    Edge oppositeEdge(const Edge &e) const {
-      return Edge(e,!e.forward);
-    }
 
-  public:
-    /// \todo Shouldn't the "source" of an undirected edge be called "aNode"
-    /// or something???
     using Parent::source;
 
     /// Source of the given Edge.
@@ -118,8 +367,6 @@
       return e.forward ? Parent::source(e) : Parent::target(e);
     }
 
-    /// \todo Shouldn't the "target" of an undirected edge be called "bNode"
-    /// or something???
     using Parent::target;
 
     /// Target of the given Edge.
@@ -127,24 +374,6 @@
       return e.forward ? Parent::target(e) : Parent::source(e);
     }
 
-    Node oppositeNode(const Node &n, const UEdge &e) const {
-      if( n == Parent::source(e))
-	return Parent::target(e);
-      else if( n == Parent::target(e))
-	return Parent::source(e);
-      else
-	return INVALID;
-    }
-
-    /// \brief Directed edge from an undirected edge and a source node.
-    ///
-    /// Returns a (directed) Edge corresponding to the specified UEdge
-    /// and source Node.
-    ///
-    Edge direct(const UEdge &ue, const Node &s) const {
-      return Edge(ue, s == source(ue));
-    }
-
     /// \brief Directed edge from an undirected edge.
     ///
     /// Returns a directed edge corresponding to the specified UEdge.
@@ -163,12 +392,13 @@
 
 
     using Parent::first;
+    using Parent::next;
+
     void first(Edge &e) const {
       Parent::first(e);
       e.forward=true;
     }
 
-    using Parent::next;
     void next(Edge &e) const {
       if( e.forward ) {
 	e.forward = false;
@@ -179,8 +409,6 @@
       }
     }
 
-  public:
-
     void firstOut(Edge &e, const Node &n) const {
       Parent::firstIn(e,n);
       if( UEdge(e) != INVALID ) {
@@ -229,21 +457,6 @@
       }
     }
 
-    void firstInc(UEdge &e, const Node &n) const {
-      Parent::firstOut(e, n);
-      if (e != INVALID) return;
-      Parent::firstIn(e, n);
-    }
-    void nextInc(UEdge &e, const Node &n) const {
-      if (Parent::source(e) == n) {
-	Parent::nextOut(e);
-	if (e != INVALID) return;
-	Parent::firstIn(e, n);
-      } else {
-	Parent::nextIn(e);
-      }
-    }
-
     void firstInc(UEdge &e, bool &d, const Node &n) const {
       d = true;
       Parent::firstOut(e, n);
@@ -251,6 +464,7 @@
       d = false;
       Parent::firstIn(e, n);
     }
+
     void nextInc(UEdge &e, bool &d) const {
       if (d) {
 	Node s = Parent::source(e);
@@ -263,14 +477,17 @@
       }
     }
 
-    // Miscellaneous stuff:
+    Node nodeFromId(int id) const {
+      return Parent::nodeFromId(id);
+    }
 
-    /// \todo these methods (id, maxEdgeId) should be moved into separate
-    /// Extender
+    Edge edgeFromId(int id) const {
+      return direct(Parent::edgeFromId(id >> 1), bool(id & 1));
+    }
 
-    // using Parent::id;
-    // Using "using" is not a good idea, cause it could be that there is
-    // no "id" in Parent...
+    UEdge uEdgeFromId(int id) const {
+      return Parent::edgeFromId(id >> 1);
+    }
 
     int id(const Node &n) const {
       return Parent::id(n);
@@ -296,16 +513,6 @@
       return Parent::maxEdgeId();
     }
 
-    int maxId(Node) const {
-      return maxNodeId();
-    }
-
-    int maxId(Edge) const {
-      return maxEdgeId();
-    }
-    int maxId(UEdge) const {
-      return maxUEdgeId();
-    }
 
     int edgeNum() const {
       return 2 * Parent::edgeNum();
@@ -315,31 +522,6 @@
       return Parent::edgeNum();
     }
 
-    Node nodeFromId(int id) const {
-      return Parent::nodeFromId(id);
-    }
-
-    Edge edgeFromId(int id) const {
-      return direct(Parent::edgeFromId(id >> 1), bool(id & 1));
-    }
-
-    UEdge uEdgeFromId(int id) const {
-      return Parent::edgeFromId(id >> 1);
-    }
-
-    Node fromId(int id, Node) const {
-      return nodeFromId(id);
-    }
-
-    Edge fromId(int id, Edge) const {
-      return edgeFromId(id);
-    }
-
-    UEdge fromId(int id, UEdge) const {
-      return uEdgeFromId(id);
-    }
-
-
     Edge findEdge(Node source, Node target, Edge prev) const {
       if (prev == INVALID) {
 	UEdge edge = Parent::findEdge(source, target);
@@ -375,168 +557,444 @@
       }
       return INVALID;
     }
-
   };
 
 
-  template <typename _Base>
-  class BpUGraphExtender : public _Base {
+  template <typename Base> 
+  class UGraphExtender : public Base {
   public:
-    typedef _Base Parent;
-    typedef BpUGraphExtender Graph;
+    
+    typedef Base Parent;
+    typedef UGraphExtender Graph;
 
     typedef typename Parent::Node Node;
-    typedef typename Parent::Edge UEdge;
-
-    using Parent::first;
-    using Parent::next;
+    typedef typename Parent::Edge Edge;
+    typedef typename Parent::UEdge UEdge;
 
-    using Parent::id;
+    // UGraph extension    
 
-    Node source(const UEdge& edge) const {
-      return aNode(edge);
-    }
-    Node target(const UEdge& edge) const {
-      return bNode(edge);
+    int maxId(Node) const {
+      return Parent::maxNodeId();
     }
 
-    void firstInc(UEdge& edge, bool& direction, const Node& node) const {
-      if (Parent::aNode(node)) {
-	Parent::firstOut(edge, node);
-	direction = true;
-      } else {
-	Parent::firstIn(edge, node);
-	direction = static_cast<UEdge&>(edge) == INVALID;
-      }
+    int maxId(Edge) const {
+      return Parent::maxEdgeId();
     }
-    void nextInc(UEdge& edge, bool& direction) const {
-      if (direction) {
-	Parent::nextOut(edge);
-      } else {
-	Parent::nextIn(edge);
-	if (edge == INVALID) direction = true;
-      }
+
+    int maxId(UEdge) const {
+      return Parent::maxUEdgeId();
     }
 
-    int maxUEdgeId() const {
-      return Parent::maxEdgeId();
+    Node fromId(int id, Node) const {
+      return Parent::nodeFromId(id);
     }
 
-    UEdge uEdgeFromId(int id) const {
+    Edge fromId(int id, Edge) const {
       return Parent::edgeFromId(id);
     }
 
-    class Edge : public UEdge {
-      friend class BpUGraphExtender;
-    protected:
-      bool forward;
-
-      Edge(const UEdge& edge, bool _forward)
-	: UEdge(edge), forward(_forward) {}
-
-    public:
-      Edge() {}
-      Edge (Invalid) : UEdge(INVALID), forward(true) {}
-      bool operator==(const Edge& i) const {
-	return UEdge::operator==(i) && forward == i.forward;
-      }
-      bool operator!=(const Edge& i) const {
-	return UEdge::operator!=(i) || forward != i.forward;
-      }
-      bool operator<(const Edge& i) const {
-	return UEdge::operator<(i) || 
-	  (!(i.forward<forward) && UEdge(*this)<UEdge(i));
-      }
-    };
+    UEdge fromId(int id, UEdge) const {
+      return Parent::uEdgeFromId(id);
+    }
 
-    void first(Edge& edge) const {
-      Parent::first(static_cast<UEdge&>(edge));
-      edge.forward = true;
+    Node oppositeNode(const Node &n, const UEdge &e) const {
+      if( n == Parent::source(e))
+	return Parent::target(e);
+      else if( n == Parent::target(e))
+	return Parent::source(e);
+      else
+	return INVALID;
     }
 
-    void next(Edge& edge) const {
-      if (!edge.forward) {
-	Parent::next(static_cast<UEdge&>(edge));
-      }
-      edge.forward = !edge.forward;
+    Edge oppositeEdge(const Edge &e) const {
+      return Parent::direct(e, !Parent::direction(e));
     }
 
-    void firstOut(Edge& edge, const Node& node) const {
-      if (Parent::aNode(node)) {
-	Parent::firstOut(edge, node);
-	edge.forward = true;
-      } else {
-	Parent::firstIn(edge, node);
-	edge.forward = static_cast<UEdge&>(edge) == INVALID;
-      }
+    using Parent::direct;
+    Edge direct(const UEdge &ue, const Node &s) const {
+      return Parent::direct(ue, Parent::source(ue) == s);
     }
-    void nextOut(Edge& edge) const {
-      if (edge.forward) {
-	Parent::nextOut(edge);
-      } else {
-	Parent::nextIn(edge);
-        edge.forward = static_cast<UEdge&>(edge) == INVALID;
-      }
+
+    // Alterable extension
+
+    typedef AlterationNotifier<Node> NodeNotifier;
+    typedef AlterationNotifier<Edge> EdgeNotifier;
+    typedef AlterationNotifier<UEdge> UEdgeNotifier;
+
+
+  protected:
+
+    mutable NodeNotifier node_notifier;
+    mutable EdgeNotifier edge_notifier;
+    mutable UEdgeNotifier uedge_notifier;
+
+  public:
+
+    NodeNotifier& getNotifier(Node) const {
+      return node_notifier;
+    }
+    
+    EdgeNotifier& getNotifier(Edge) const {
+      return edge_notifier;
     }
 
-    void firstIn(Edge& edge, const Node& node) const {
-      if (Parent::bNode(node)) {
-	Parent::firstIn(edge, node);
-	edge.forward = true;	
-      } else {
-	Parent::firstOut(edge, node);
-	edge.forward = static_cast<UEdge&>(edge) == INVALID;
-      }
+    UEdgeNotifier& getNotifier(UEdge) const {
+      return uedge_notifier;
     }
-    void nextIn(Edge& edge) const {
-      if (edge.forward) {
-	Parent::nextIn(edge);
-      } else {
-	Parent::nextOut(edge);
-	edge.forward = static_cast<UEdge&>(edge) == INVALID;
+
+
+
+    class NodeIt : public Node { 
+      const Graph* graph;
+    public:
+
+      NodeIt() {}
+
+      NodeIt(Invalid i) : Node(i) { }
+
+      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
+	_graph.first(*static_cast<Node*>(this));
       }
-    }
 
-    Node source(const Edge& edge) const {
-      return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
+      NodeIt(const Graph& _graph, const Node& node) 
+	: Node(node), graph(&_graph) {}
+
+      NodeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class EdgeIt : public Edge { 
+      const Graph* graph;
+    public:
+
+      EdgeIt() { }
+
+      EdgeIt(Invalid i) : Edge(i) { }
+
+      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
+	_graph.first(*static_cast<Edge*>(this));
+      }
+
+      EdgeIt(const Graph& _graph, const Edge& e) : 
+	Edge(e), graph(&_graph) { }
+
+      EdgeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class OutEdgeIt : public Edge { 
+      const Graph* graph;
+    public:
+
+      OutEdgeIt() { }
+
+      OutEdgeIt(Invalid i) : Edge(i) { }
+
+      OutEdgeIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
+	_graph.firstOut(*this, node);
+      }
+
+      OutEdgeIt(const Graph& _graph, const Edge& edge) 
+	: Edge(edge), graph(&_graph) {}
+
+      OutEdgeIt& operator++() { 
+	graph->nextOut(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class InEdgeIt : public Edge { 
+      const Graph* graph;
+    public:
+
+      InEdgeIt() { }
+
+      InEdgeIt(Invalid i) : Edge(i) { }
+
+      InEdgeIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
+	_graph.firstIn(*this, node);
+      }
+
+      InEdgeIt(const Graph& _graph, const Edge& edge) : 
+	Edge(edge), graph(&_graph) {}
+
+      InEdgeIt& operator++() { 
+	graph->nextIn(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class UEdgeIt : public Parent::UEdge { 
+      const Graph* graph;
+    public:
+
+      UEdgeIt() { }
+
+      UEdgeIt(Invalid i) : UEdge(i) { }
+
+      explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
+	_graph.first(*static_cast<UEdge*>(this));
+      }
+
+      UEdgeIt(const Graph& _graph, const UEdge& e) : 
+	UEdge(e), graph(&_graph) { }
+
+      UEdgeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+
+    };
+
+    class IncEdgeIt : public Parent::UEdge {
+      friend class UGraphExtender;
+      const Graph* graph;
+      bool direction;
+    public:
+
+      IncEdgeIt() { }
+
+      IncEdgeIt(Invalid i) : UEdge(i), direction(false) { }
+
+      IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
+	_graph.firstInc(*this, direction, n);
+      }
+
+      IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n)
+	: graph(&_graph), UEdge(ue) {
+	direction = (_graph.source(ue) == n);
+      }
+
+      IncEdgeIt& operator++() {
+	graph->nextInc(*this, direction);
+	return *this; 
+      }
+    };
+
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the source in this case) of the iterator
+    Node baseNode(const OutEdgeIt &e) const {
+      return Parent::source((Edge)e);
     }
-    Node target(const Edge& edge) const {
-      return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the target in this case) of the
+    /// iterator
+    Node runningNode(const OutEdgeIt &e) const {
+      return Parent::target((Edge)e);
     }
 
-    bool direction(const Edge& edge) const {
-      return edge.forward;
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the target in this case) of the iterator
+    Node baseNode(const InEdgeIt &e) const {
+      return Parent::target((Edge)e);
     }
-
-    Edge direct(const UEdge& edge, const Node& node) const {
-      return Edge(edge, node == Parent::source(edge));
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the source in this case) of the
+    /// iterator
+    Node runningNode(const InEdgeIt &e) const {
+      return Parent::source((Edge)e);
     }
 
-    Edge direct(const UEdge& edge, bool direction) const {
-      return Edge(edge, direction);
+    /// Base node of the iterator
+    ///
+    /// Returns the base node of the iterator
+    Node baseNode(const IncEdgeIt &e) const {
+      return e.direction ? source(e) : target(e);
     }
-
-    Node oppositeNode(const UEdge& edge, const Node& node) const {
-      return source(edge) == node ? 
-	target(edge) : source(edge);
+    /// Running node of the iterator
+    ///
+    /// Returns the running node of the iterator
+    Node runningNode(const IncEdgeIt &e) const {
+      return e.direction ? target(e) : source(e);
     }
 
-    Edge oppositeEdge(const Edge& edge) const {
-      return Edge(edge, !edge.forward);
-    }
+    // Mappable extension
 
-    int id(const Edge& edge) const {
-      return (Parent::id(edge) << 1) + (edge.forward ? 0 : 1);
+    template <typename _Value>
+    class NodeMap 
+      : public IterableMapExtender<DefaultMap<Graph, Node, _Value> > {
+    public:
+      typedef UGraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, Node, _Value> > Parent;
+
+      NodeMap(const Graph& _g) 
+	: Parent(_g) {}
+      NodeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+
+
+      /// \brief Template assign operator.
+      ///
+      /// The given parameter should be conform to the ReadMap
+      /// concecpt and could be indiced by the current item set of
+      /// the NodeMap. In this case the value for each item
+      /// is assigned by the value of the given ReadMap. 
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<Node, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	Node it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+
+    };
+
+    template <typename _Value>
+    class EdgeMap 
+      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
+    public:
+      typedef UGraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
+
+      EdgeMap(const Graph& _g) 
+	: Parent(_g) {}
+      EdgeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+
+      EdgeMap& operator=(const EdgeMap& cmap) {
+	return operator=<EdgeMap>(cmap);
+      }
+
+      template <typename CMap>
+      EdgeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	Edge it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    };
+
+
+    template <typename _Value>
+    class UEdgeMap 
+      : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > {
+    public:
+      typedef UGraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > Parent;
+
+      UEdgeMap(const Graph& _g) 
+	: Parent(_g) {}
+      UEdgeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+
+      UEdgeMap& operator=(const UEdgeMap& cmap) {
+	return operator=<UEdgeMap>(cmap);
+      }
+
+      template <typename CMap>
+      UEdgeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	UEdge it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    };
+
+    // Alteration extension
+
+    Node addNode() {
+      Node node = Parent::addNode();
+      getNotifier(Node()).add(node);
+      return node;
+    }
+
+    UEdge addEdge(const Node& from, const Node& to) {
+      UEdge uedge = Parent::addEdge(from, to);
+      getNotifier(UEdge()).add(uedge);
+      getNotifier(Edge()).add(Parent::direct(uedge, true));
+      getNotifier(Edge()).add(Parent::direct(uedge, false));
+      return uedge;
+    }
+    
+    void clear() {
+      getNotifier(Edge()).clear();
+      getNotifier(UEdge()).clear();
+      getNotifier(Node()).clear();
+      Parent::clear();
+    }
+
+    void erase(const Node& node) {
+      Edge edge;
+      Parent::firstOut(edge, node);
+      while (edge != INVALID ) {
+	erase(edge);
+	Parent::firstOut(edge, node);
+      } 
+
+      Parent::firstIn(edge, node);
+      while (edge != INVALID ) {
+	erase(edge);
+	Parent::firstIn(edge, node);
+      }
+
+      getNotifier(Node()).erase(node);
+      Parent::erase(node);
     }
-    Edge edgeFromId(int id) const {
-      return Edge(Parent::fromId(id >> 1, UEdge()), (id & 1) == 0);
+
+    void erase(const UEdge& uedge) {
+      getNotifier(Edge()).erase(Parent::direct(uedge, true));
+      getNotifier(Edge()).erase(Parent::direct(uedge, false));
+      getNotifier(UEdge()).erase(uedge);
+      Parent::erase(uedge);
     }
-    int maxEdgeId() const {
-      return (Parent::maxId(UEdge()) << 1) + 1;
+
+    ~UGraphExtender() {
+      getNotifier(Edge()).clear();
+      getNotifier(UEdge()).clear();
+      getNotifier(Node()).clear();
     }
 
+  };
+
+
+  template <typename Base>
+  class BpUGraphBaseExtender : public Base {
+  public:
+    typedef Base Parent;
+    typedef BpUGraphBaseExtender Graph;
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Edge UEdge;
+
+
+    using Parent::first;
+    using Parent::next;
+
+    using Parent::id;
+
     class ANode : public Node {
-      friend class BpUGraphExtender;
+      friend class BpUGraphBaseExtender;
     public:
       ANode() {}
       ANode(const Node& node) : Node(node) {
@@ -558,7 +1016,7 @@
     }
 
     class BNode : public Node {
-      friend class BpUGraphExtender;
+      friend class BpUGraphBaseExtender;
     public:
       BNode() {}
       BNode(const Node& node) : Node(node) {
@@ -579,6 +1037,161 @@
       return Parent::aNodeId(node);
     }
 
+    Node source(const UEdge& edge) const {
+      return aNode(edge);
+    }
+    Node target(const UEdge& edge) const {
+      return bNode(edge);
+    }
+
+    void firstInc(UEdge& edge, bool& direction, const Node& node) const {
+      if (Parent::aNode(node)) {
+	Parent::firstOut(edge, node);
+	direction = true;
+      } else {
+	Parent::firstIn(edge, node);
+	direction = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+    void nextInc(UEdge& edge, bool& direction) const {
+      if (direction) {
+	Parent::nextOut(edge);
+      } else {
+	Parent::nextIn(edge);
+	if (edge == INVALID) direction = true;
+      }
+    }
+
+    int maxUEdgeId() const {
+      return Parent::maxEdgeId();
+    }
+
+    UEdge uEdgeFromId(int id) const {
+      return Parent::edgeFromId(id);
+    }
+
+    class Edge : public UEdge {
+      friend class BpUGraphBaseExtender;
+    protected:
+      bool forward;
+
+      Edge(const UEdge& edge, bool _forward)
+	: UEdge(edge), forward(_forward) {}
+
+    public:
+      Edge() {}
+      Edge (Invalid) : UEdge(INVALID), forward(true) {}
+      bool operator==(const Edge& i) const {
+	return UEdge::operator==(i) && forward == i.forward;
+      }
+      bool operator!=(const Edge& i) const {
+	return UEdge::operator!=(i) || forward != i.forward;
+      }
+      bool operator<(const Edge& i) const {
+	return UEdge::operator<(i) || 
+	  (!(i.forward<forward) && UEdge(*this)<UEdge(i));
+      }
+    };
+
+    void first(Edge& edge) const {
+      Parent::first(static_cast<UEdge&>(edge));
+      edge.forward = true;
+    }
+
+    void next(Edge& edge) const {
+      if (!edge.forward) {
+	Parent::next(static_cast<UEdge&>(edge));
+      }
+      edge.forward = !edge.forward;
+    }
+
+    void firstOut(Edge& edge, const Node& node) const {
+      if (Parent::aNode(node)) {
+	Parent::firstOut(edge, node);
+	edge.forward = true;
+      } else {
+	Parent::firstIn(edge, node);
+	edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+    void nextOut(Edge& edge) const {
+      if (edge.forward) {
+	Parent::nextOut(edge);
+      } else {
+	Parent::nextIn(edge);
+        edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+
+    void firstIn(Edge& edge, const Node& node) const {
+      if (Parent::bNode(node)) {
+	Parent::firstIn(edge, node);
+	edge.forward = true;	
+      } else {
+	Parent::firstOut(edge, node);
+	edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+    void nextIn(Edge& edge) const {
+      if (edge.forward) {
+	Parent::nextIn(edge);
+      } else {
+	Parent::nextOut(edge);
+	edge.forward = static_cast<UEdge&>(edge) == INVALID;
+      }
+    }
+
+    Node source(const Edge& edge) const {
+      return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
+    }
+    Node target(const Edge& edge) const {
+      return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
+    }
+
+    int id(const Edge& edge) const {
+      return (Parent::id(edge) << 1) + (edge.forward ? 0 : 1);
+    }
+    Edge edgeFromId(int id) const {
+      return Edge(Parent::fromId(id >> 1, UEdge()), (id & 1) == 0);
+    }
+    int maxEdgeId() const {
+      return (Parent::maxId(UEdge()) << 1) + 1;
+    }
+
+    bool direction(const Edge& edge) const {
+      return edge.forward;
+    }
+
+    Edge direct(const UEdge& edge, bool direction) const {
+      return Edge(edge, direction);
+    }
+  };
+
+  template <typename Base>
+  class BpUGraphExtender : public Base {
+  public:
+    typedef Base Parent;
+    typedef BpUGraphExtender Graph;
+
+    typedef typename Parent::Node Node;
+    typedef typename Parent::BNode BNode;
+    typedef typename Parent::ANode ANode;
+    typedef typename Parent::Edge Edge;
+    typedef typename Parent::UEdge UEdge;
+
+    Node oppositeNode(const UEdge& edge, const Node& node) const {
+      return source(edge) == node ? 
+	target(edge) : source(edge);
+    }
+
+    using Parent::direct;
+    Edge direct(const UEdge& edge, const Node& node) const {
+      return Edge(edge, node == Parent::source(edge));
+    }
+
+    Edge oppositeEdge(const Edge& edge) const {
+      return Parent::direct(edge, !Parent::direction(edge));
+    }
 
 
     int maxId(Node) const {
@@ -591,10 +1204,10 @@
       return Parent::maxANodeId();
     }
     int maxId(Edge) const {
-      return maxEdgeId();
+      return Parent::maxEdgeId();
     }
     int maxId(UEdge) const {
-      return maxUEdgeId();
+      return Parent::maxUEdgeId();
     }
 
 
@@ -608,12 +1221,605 @@
       return Parent::fromBNodeId(id);
     }
     Edge fromId(int id, Edge) const {
-      return edgeFromId(id);
+      return Parent::edgeFromId(id);
     }
     UEdge fromId(int id, UEdge) const {
-      return uEdgeFromId(id);
+      return Parent::uEdgeFromId(id);
+    }  
+  
+    typedef AlterationNotifier<Node> NodeNotifier;
+    typedef AlterationNotifier<BNode> BNodeNotifier;
+    typedef AlterationNotifier<ANode> ANodeNotifier;
+    typedef AlterationNotifier<Edge> EdgeNotifier;
+    typedef AlterationNotifier<UEdge> UEdgeNotifier;
+
+  protected:
+
+    mutable NodeNotifier nodeNotifier;
+    mutable BNodeNotifier bNodeNotifier;
+    mutable ANodeNotifier aNodeNotifier;
+    mutable EdgeNotifier edgeNotifier;
+    mutable UEdgeNotifier uEdgeNotifier;
+
+  public:
+
+    NodeNotifier& getNotifier(Node) const {
+      return nodeNotifier;
+    }
+
+    BNodeNotifier& getNotifier(BNode) const {
+      return bNodeNotifier;
+    }
+
+    ANodeNotifier& getNotifier(ANode) const {
+      return aNodeNotifier;
     }
 
+    EdgeNotifier& getNotifier(Edge) const {
+      return edgeNotifier;
+    }
+
+    UEdgeNotifier& getNotifier(UEdge) const {
+      return uEdgeNotifier;
+    }
+
+    ~BpUGraphExtender() {
+      getNotifier(UEdge()).clear();
+      getNotifier(Edge()).clear();
+      getNotifier(ANode()).clear();
+      getNotifier(BNode()).clear();
+      getNotifier(Node()).clear();
+    }
+
+  
+    class NodeIt : public Node { 
+      const Graph* graph;
+    public:
+    
+      NodeIt() { }
+    
+      NodeIt(Invalid i) : Node(INVALID) { }
+    
+      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
+	graph->first(static_cast<Node&>(*this));
+      }
+
+      NodeIt(const Graph& _graph, const Node& node) 
+	: Node(node), graph(&_graph) { }
+    
+      NodeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+
+    };
+
+    class ANodeIt : public Node { 
+      friend class BpUGraphExtender;
+      const Graph* graph;
+    public:
+    
+      ANodeIt() { }
+    
+      ANodeIt(Invalid i) : Node(INVALID) { }
+    
+      explicit ANodeIt(const Graph& _graph) : graph(&_graph) {
+	graph->firstANode(static_cast<Node&>(*this));
+      }
+
+      ANodeIt(const Graph& _graph, const Node& node) 
+	: Node(node), graph(&_graph) {}
+    
+      ANodeIt& operator++() { 
+	graph->nextANode(*this);
+	return *this; 
+      }
+    };
+
+    class BNodeIt : public Node { 
+      friend class BpUGraphExtender;
+      const Graph* graph;
+    public:
+    
+      BNodeIt() { }
+    
+      BNodeIt(Invalid i) : Node(INVALID) { }
+    
+      explicit BNodeIt(const Graph& _graph) : graph(&_graph) {
+	graph->firstBNode(static_cast<Node&>(*this));
+      }
+
+      BNodeIt(const Graph& _graph, const Node& node) 
+	: Node(node), graph(&_graph) {}
+    
+      BNodeIt& operator++() { 
+	graph->nextBNode(*this);
+	return *this; 
+      }
+    };
+
+    class EdgeIt : public Edge { 
+      friend class BpUGraphExtender;
+      const Graph* graph;
+    public:
+    
+      EdgeIt() { }
+    
+      EdgeIt(Invalid i) : Edge(INVALID) { }
+    
+      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
+	graph->first(static_cast<Edge&>(*this));
+      }
+
+      EdgeIt(const Graph& _graph, const Edge& edge) 
+	: Edge(edge), graph(&_graph) { }
+    
+      EdgeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+
+    };
+
+    class UEdgeIt : public UEdge { 
+      friend class BpUGraphExtender;
+      const Graph* graph;
+    public:
+    
+      UEdgeIt() { }
+    
+      UEdgeIt(Invalid i) : UEdge(INVALID) { }
+    
+      explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
+	graph->first(static_cast<UEdge&>(*this));
+      }
+
+      UEdgeIt(const Graph& _graph, const UEdge& edge) 
+	: UEdge(edge), graph(&_graph) { }
+    
+      UEdgeIt& operator++() { 
+	graph->next(*this);
+	return *this; 
+      }
+    };
+
+    class OutEdgeIt : public Edge { 
+      friend class BpUGraphExtender;
+      const Graph* graph;
+    public:
+    
+      OutEdgeIt() { }
+    
+      OutEdgeIt(Invalid i) : Edge(i) { }
+    
+      OutEdgeIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
+	graph->firstOut(*this, node);
+      }
+    
+      OutEdgeIt(const Graph& _graph, const Edge& edge) 
+	: Edge(edge), graph(&_graph) {}
+    
+      OutEdgeIt& operator++() { 
+	graph->nextOut(*this);
+	return *this; 
+      }
+
+    };
+
+
+    class InEdgeIt : public Edge { 
+      friend class BpUGraphExtender;
+      const Graph* graph;
+    public:
+    
+      InEdgeIt() { }
+    
+      InEdgeIt(Invalid i) : Edge(i) { }
+    
+      InEdgeIt(const Graph& _graph, const Node& node) 
+	: graph(&_graph) {
+	graph->firstIn(*this, node);
+      }
+    
+      InEdgeIt(const Graph& _graph, const Edge& edge) : 
+	Edge(edge), graph(&_graph) {}
+    
+      InEdgeIt& operator++() { 
+	graph->nextIn(*this);
+	return *this; 
+      }
+
+    };
+  
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the source in this case) of the iterator
+    Node baseNode(const OutEdgeIt &e) const {
+      return Parent::source((Edge&)e);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the target in this case) of the
+    /// iterator
+    Node runningNode(const OutEdgeIt &e) const {
+      return Parent::target((Edge&)e);
+    }
+  
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the target in this case) of the iterator
+    Node baseNode(const InEdgeIt &e) const {
+      return Parent::target((Edge&)e);
+    }
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the source in this case) of the
+    /// iterator
+    Node runningNode(const InEdgeIt &e) const {
+      return Parent::source((Edge&)e);
+    }
+  
+    class IncEdgeIt : public Parent::UEdge { 
+      friend class BpUGraphExtender;
+      const Graph* graph;
+      bool direction;
+    public:
+    
+      IncEdgeIt() { }
+    
+      IncEdgeIt(Invalid i) : UEdge(i), direction(true) { }
+    
+      IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
+	graph->firstInc(*this, direction, n);
+      }
+
+      IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n)
+	: graph(&_graph), UEdge(ue) {
+	direction = (graph->source(ue) == n);
+      }
+
+      IncEdgeIt& operator++() {
+	graph->nextInc(*this, direction);
+	return *this; 
+      }
+    };
+  
+
+    /// Base node of the iterator
+    ///
+    /// Returns the base node of the iterator
+    Node baseNode(const IncEdgeIt &e) const {
+      return e.direction ? source(e) : target(e);
+    }
+
+    /// Running node of the iterator
+    ///
+    /// Returns the running node of the iterator
+    Node runningNode(const IncEdgeIt &e) const {
+      return e.direction ? target(e) : source(e);
+    }
+
+    template <typename _Value>
+    class ANodeMap 
+      : public IterableMapExtender<DefaultMap<Graph, ANode, _Value> > {
+    public:
+      typedef BpUGraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, ANode, _Value> > 
+      Parent;
+    
+      ANodeMap(const Graph& _g) 
+	: Parent(_g) {}
+      ANodeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+    
+      ANodeMap& operator=(const ANodeMap& cmap) {
+	return operator=<ANodeMap>(cmap);
+      }
+    
+
+      /// \brief Template assign operator.
+      ///
+      /// The given parameter should be conform to the ReadMap
+      /// concept and could be indiced by the current item set of
+      /// the ANodeMap. In this case the value for each item
+      /// is assigned by the value of the given ReadMap. 
+      template <typename CMap>
+      ANodeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<ANode, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	ANode it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    
+    };
+
+    template <typename _Value>
+    class BNodeMap 
+      : public IterableMapExtender<DefaultMap<Graph, BNode, _Value> > {
+    public:
+      typedef BpUGraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, BNode, _Value> > 
+      Parent;
+    
+      BNodeMap(const Graph& _g) 
+	: Parent(_g) {}
+      BNodeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+    
+      BNodeMap& operator=(const BNodeMap& cmap) {
+	return operator=<BNodeMap>(cmap);
+      }
+    
+
+      /// \brief Template assign operator.
+      ///
+      /// The given parameter should be conform to the ReadMap
+      /// concept and could be indiced by the current item set of
+      /// the BNodeMap. In this case the value for each item
+      /// is assigned by the value of the given ReadMap. 
+      template <typename CMap>
+      BNodeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<BNode, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	BNode it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    
+    };
+
+  protected:
+
+    template <typename _Value>
+    class NodeMapBase : public NodeNotifier::ObserverBase {
+    public:
+      typedef BpUGraphExtender Graph;
+
+      typedef Node Key;
+      typedef _Value Value;
+
+      /// The reference type of the map;
+      typedef typename BNodeMap<_Value>::Reference Reference;
+      /// The pointer type of the map;
+      typedef typename BNodeMap<_Value>::Pointer Pointer;
+      
+      /// The const value type of the map.
+      typedef const Value ConstValue;
+      /// The const reference type of the map;
+      typedef typename BNodeMap<_Value>::ConstReference ConstReference;
+      /// The pointer type of the map;
+      typedef typename BNodeMap<_Value>::ConstPointer ConstPointer;
+
+      typedef True ReferenceMapTag;
+
+      NodeMapBase(const Graph& _g) 
+	: graph(&_g), bNodeMap(_g), aNodeMap(_g) {
+	NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
+      }
+      NodeMapBase(const Graph& _g, const _Value& _v) 
+	: graph(&_g), bNodeMap(_g, _v), 
+	  aNodeMap(_g, _v) {
+	NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
+      }
+
+      virtual ~NodeMapBase() {      
+	if (NodeNotifier::ObserverBase::attached()) {
+          NodeNotifier::ObserverBase::detach();
+	}
+      }
+    
+      ConstReference operator[](const Key& node) const {
+	if (Parent::aNode(node)) {
+	  return aNodeMap[node];
+	} else {
+	  return bNodeMap[node];
+	}
+      } 
+
+      Reference operator[](const Key& node) {
+	if (Parent::aNode(node)) {
+	  return aNodeMap[node];
+	} else {
+	  return bNodeMap[node];
+	}
+      }
+
+      void set(const Key& node, const Value& value) {
+	if (Parent::aNode(node)) {
+	  aNodeMap.set(node, value);
+	} else {
+	  bNodeMap.set(node, value);
+	}
+      }
+
+    protected:
+      
+      virtual void add(const Node&) {}
+      virtual void add(const std::vector<Node>&) {}
+      virtual void erase(const Node&) {}
+      virtual void erase(const std::vector<Node>&) {}
+      virtual void clear() {}
+      virtual void build() {}
+
+      const Graph* getGraph() const { return graph; }
+      
+    private:
+      const Graph* graph;
+      BNodeMap<_Value> bNodeMap;
+      ANodeMap<_Value> aNodeMap;
+    };
+    
+  public:
+
+    template <typename _Value>
+    class NodeMap 
+      : public IterableMapExtender<NodeMapBase<_Value> > {
+    public:
+      typedef BpUGraphExtender Graph;
+      typedef IterableMapExtender< NodeMapBase<_Value> > Parent;
+    
+      NodeMap(const Graph& _g) 
+	: Parent(_g) {}
+      NodeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+    
+      NodeMap& operator=(const NodeMap& cmap) {
+	return operator=<NodeMap>(cmap);
+      }
+    
+
+      /// \brief Template assign operator.
+      ///
+      /// The given parameter should be conform to the ReadMap
+      /// concept and could be indiced by the current item set of
+      /// the NodeMap. In this case the value for each item
+      /// is assigned by the value of the given ReadMap. 
+      template <typename CMap>
+      NodeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<Node, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	Node it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    
+    };
+
+
+
+    template <typename _Value>
+    class EdgeMap 
+      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
+    public:
+      typedef BpUGraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
+    
+      EdgeMap(const Graph& _g) 
+	: Parent(_g) {}
+      EdgeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+    
+      EdgeMap& operator=(const EdgeMap& cmap) {
+	return operator=<EdgeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      EdgeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	Edge it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    };
+
+    template <typename _Value>
+    class UEdgeMap 
+      : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > {
+    public:
+      typedef BpUGraphExtender Graph;
+      typedef IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > 
+      Parent;
+    
+      UEdgeMap(const Graph& _g) 
+	: Parent(_g) {}
+      UEdgeMap(const Graph& _g, const _Value& _v) 
+	: Parent(_g, _v) {}
+    
+      UEdgeMap& operator=(const UEdgeMap& cmap) {
+	return operator=<UEdgeMap>(cmap);
+      }
+    
+      template <typename CMap>
+      UEdgeMap& operator=(const CMap& cmap) {
+	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
+	const typename Parent::Graph* graph = Parent::getGraph();
+	UEdge it;
+	for (graph->first(it); it != INVALID; graph->next(it)) {
+	  Parent::set(it, cmap[it]);
+	}
+	return *this;
+      }
+    };
+
+  
+    Node addANode() {
+      Node node = Parent::addANode();
+      getNotifier(ANode()).add(node);
+      getNotifier(Node()).add(node);
+      return node;
+    }
+
+    Node addBNode() {
+      Node node = Parent::addBNode();
+      getNotifier(BNode()).add(node);
+      getNotifier(Node()).add(node);
+      return node;
+    }
+  
+    UEdge addEdge(const Node& source, const Node& target) {
+      UEdge uedge = Parent::addEdge(source, target);
+      getNotifier(UEdge()).add(uedge);
+    
+      std::vector<Edge> edges;
+      edges.push_back(direct(uedge, true));
+      edges.push_back(direct(uedge, false));
+      getNotifier(Edge()).add(edges);
+    
+      return uedge;
+    }
+
+    void clear() {
+      getNotifier(Edge()).clear();
+      getNotifier(UEdge()).clear();
+      getNotifier(Node()).clear();
+      getNotifier(BNode()).clear();
+      getNotifier(ANode()).clear();
+      Parent::clear();
+    }
+
+    void erase(const Node& node) {
+      UEdge uedge;
+      bool dir;
+      Parent::firstInc(uedge, dir, node);
+      while (uedge != INVALID ) {
+	erase(uedge);
+	Parent::firstInc(uedge, dir, node);
+      } 
+
+      getNotifier(Node()).erase(node);
+      Parent::erase(node);
+    }
+    
+    void erase(const UEdge& uedge) {
+      std::vector<Edge> edges;
+      edges.push_back(direct(uedge, true));
+      edges.push_back(direct(uedge, false));
+      getNotifier(Edge()).erase(edges);
+      getNotifier(UEdge()).erase(uedge);
+      Parent::erase(uedge);
+    }
+
+
+    ~BpUGraphExtender() {
+      getNotifier(Edge()).clear();
+      getNotifier(UEdge()).clear();
+      getNotifier(Node()).clear();
+      getNotifier(BNode()).clear();
+      getNotifier(ANode()).clear();
+    }
+
+
   };
 
 }

Modified: hugo/branches/extendermerge/lemon/bits/static_map.h
==============================================================================
--- hugo/branches/extendermerge/lemon/bits/static_map.h	(original)
+++ hugo/branches/extendermerge/lemon/bits/static_map.h	Fri Feb 17 13:24:31 2006
@@ -56,11 +56,11 @@
   class StaticMap : public AlterationNotifier<_Item>::ObserverBase {
   public:
 
-    /// \brief Exception class for unsinported exceptions.
-    class UnsinportedOperation : public lemon::LogicError {
+    /// \brief Exception class for unsupported exceptions.
+    class UnsupportedOperation : public lemon::LogicError {
     public:
       virtual const char* exceptionName() const {
-	return "lemon::StaticMap::UnsinportedOperation";
+	return "lemon::StaticMap::UnsupportedOperation";
       }
     };
 
@@ -187,7 +187,7 @@
     /// and it overrides the add() member function of the observer base.
      
     void add(const Key&) {
-      throw UnsinportedOperation();
+      throw UnsupportedOperation();
     }
 
     /// \brief Erases a key from the map.
@@ -195,7 +195,7 @@
     /// 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 Key&) {
-      throw UnsinportedOperation();
+      throw UnsupportedOperation();
     }
 
     /// Buildes the map.
@@ -224,396 +224,6 @@
 
   };
 
-  /// \e
-  template <typename _Base> 
-  class StaticMappableGraphExtender : public _Base {
-  public:
-
-    typedef StaticMappableGraphExtender<_Base> Graph;
-    typedef _Base Parent;
-
-    typedef typename Parent::Node Node;
-    typedef typename Parent::NodeIt NodeIt;
-
-    typedef typename Parent::Edge Edge;
-    typedef typename Parent::EdgeIt EdgeIt;
-
-    
-    template <typename _Value>
-    class NodeMap 
-      : public IterableMapExtender<StaticMap<Graph, Node, _Value> > {
-    public:
-      typedef StaticMappableGraphExtender Graph;
-      typedef IterableMapExtender<StaticMap<Graph, Node, _Value> > Parent;
-
-      NodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      NodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      NodeMap& operator=(const NodeMap& cmap) {
-	return operator=<NodeMap>(cmap);
-      }
-
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concecpt and could be indiced by the current item set of
-      /// the NodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      NodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Node, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Node it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-
-    };
-
-    template <typename _Value>
-    class EdgeMap 
-      : public IterableMapExtender<StaticMap<Graph, Edge, _Value> > {
-    public:
-      typedef StaticMappableGraphExtender Graph;
-      typedef IterableMapExtender<StaticMap<Graph, Edge, _Value> > Parent;
-
-      EdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      EdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      EdgeMap& operator=(const EdgeMap& cmap) {
-	return operator=<EdgeMap>(cmap);
-      }
-
-      template <typename CMap>
-      EdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Edge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-    
-  };
-
-  /// \e
-  template <typename _Base> 
-  class StaticMappableUGraphExtender : 
-    public StaticMappableGraphExtender<_Base> {
-  public:
-
-    typedef StaticMappableUGraphExtender Graph;
-    typedef StaticMappableGraphExtender<_Base> Parent;
-
-    typedef typename Parent::UEdge UEdge;
-
-    template <typename _Value>
-    class UEdgeMap 
-      : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > {
-    public:
-      typedef StaticMappableUGraphExtender Graph;
-      typedef IterableMapExtender<
-	StaticMap<Graph, UEdge, _Value> > Parent;
-
-      UEdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      UEdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-
-      UEdgeMap& operator=(const UEdgeMap& cmap) {
-	return operator=<UEdgeMap>(cmap);
-      }
-
-      template <typename CMap>
-      UEdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	UEdge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-
-  };
-
-  template <typename _Base>
-  class StaticMappableBpUGraphExtender : public _Base {
-  public:
-
-    typedef _Base Parent;
-    typedef StaticMappableBpUGraphExtender Graph;
-
-    typedef typename Parent::Node Node;
-    typedef typename Parent::ANode ANode;
-    typedef typename Parent::BNode BNode;
-    typedef typename Parent::Edge Edge;
-    typedef typename Parent::UEdge UEdge;
-    
-    template <typename _Value>
-    class ANodeMap 
-      : public IterableMapExtender<StaticMap<Graph, ANode, _Value> > {
-    public:
-      typedef StaticMappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<StaticMap<Graph, ANode, _Value> > 
-      Parent;
-    
-      ANodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      ANodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      ANodeMap& operator=(const ANodeMap& cmap) {
-	return operator=<ANodeMap>(cmap);
-      }
-    
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concept and could be indiced by the current item set of
-      /// the ANodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      ANodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<ANode, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	ANode it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    
-    };
-
-    template <typename _Value>
-    class BNodeMap 
-      : public IterableMapExtender<StaticMap<Graph, BNode, _Value> > {
-    public:
-      typedef StaticMappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<StaticMap<Graph, BNode, _Value> > 
-      Parent;
-    
-      BNodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      BNodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      BNodeMap& operator=(const BNodeMap& cmap) {
-	return operator=<BNodeMap>(cmap);
-      }
-    
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concept and could be indiced by the current item set of
-      /// the BNodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      BNodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<BNode, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	BNode it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    
-    };
-
-  protected:
-
-    template <typename _Value>
-    class NodeMapBase : public Parent::NodeNotifier::ObserverBase {
-    public:
-      typedef StaticMappableBpUGraphExtender Graph;
-
-      typedef Node Key;
-      typedef _Value Value;
-
-      /// The reference type of the map;
-      typedef typename BNodeMap<_Value>::Reference Reference;
-      /// The pointer type of the map;
-      typedef typename BNodeMap<_Value>::Pointer Pointer;
-      
-      /// The const value type of the map.
-      typedef const Value ConstValue;
-      /// The const reference type of the map;
-      typedef typename BNodeMap<_Value>::ConstReference ConstReference;
-      /// The pointer type of the map;
-      typedef typename BNodeMap<_Value>::ConstPointer ConstPointer;
-
-      typedef True ReferenceMapTag;
-
-      NodeMapBase(const Graph& _g) 
-	: graph(&_g), bNodeMap(_g), aNodeMap(_g) {
-	Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
-      }
-      NodeMapBase(const Graph& _g, const _Value& _v) 
-	: graph(&_g), bNodeMap(_g, _v), 
-	  aNodeMap(_g, _v) {
-	Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
-      }
-
-      virtual ~NodeMapBase() {      
-	if (Parent::NodeNotifier::ObserverBase::attached()) {
-	  Parent::NodeNotifier::ObserverBase::detach();
-	}
-      }
-    
-      ConstReference operator[](const Key& node) const {
-	if (Parent::aNode(node)) {
-	  return aNodeMap[node];
-	} else {
-	  return bNodeMap[node];
-	}
-      } 
-
-      Reference operator[](const Key& node) {
-	if (Parent::aNode(node)) {
-	  return aNodeMap[node];
-	} else {
-	  return bNodeMap[node];
-	}
-      }
-
-      void set(const Key& node, const Value& value) {
-	if (Parent::aNode(node)) {
-	  aNodeMap.set(node, value);
-	} else {
-	  bNodeMap.set(node, value);
-	}
-      }
-
-    protected:
-      
-      virtual void add(const Node&) {}
-      virtual void add(const std::vector<Node>&) {}
-      virtual void erase(const Node&) {}
-      virtual void erase(const std::vector<Node>&) {}
-      virtual void clear() {}
-      virtual void build() {}
-
-      const Graph* getGraph() const { return graph; }
-      
-    private:
-      const Graph* graph;
-      BNodeMap<_Value> bNodeMap;
-      ANodeMap<_Value> aNodeMap;
-    };
-    
-  public:
-
-    template <typename _Value>
-    class NodeMap 
-      : public IterableMapExtender<NodeMapBase<_Value> > {
-    public:
-      typedef StaticMappableBpUGraphExtender Graph;
-      typedef IterableMapExtender< NodeMapBase<_Value> > Parent;
-    
-      NodeMap(const Graph& _g) 
-	: Parent(_g) {}
-      NodeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      NodeMap& operator=(const NodeMap& cmap) {
-	return operator=<NodeMap>(cmap);
-      }
-    
-
-      /// \brief Template assign operator.
-      ///
-      /// The given parameter should be conform to the ReadMap
-      /// concept and could be indiced by the current item set of
-      /// the NodeMap. In this case the value for each item
-      /// is assigned by the value of the given ReadMap. 
-      template <typename CMap>
-      NodeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Node, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Node it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    
-    };
-
-
-
-    template <typename _Value>
-    class EdgeMap 
-      : public IterableMapExtender<StaticMap<Graph, Edge, _Value> > {
-    public:
-      typedef StaticMappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<StaticMap<Graph, Edge, _Value> > Parent;
-    
-      EdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      EdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      EdgeMap& operator=(const EdgeMap& cmap) {
-	return operator=<EdgeMap>(cmap);
-      }
-    
-      template <typename CMap>
-      EdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	Edge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-
-    template <typename _Value>
-    class UEdgeMap 
-      : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > {
-    public:
-      typedef StaticMappableBpUGraphExtender Graph;
-      typedef IterableMapExtender<StaticMap<Graph, UEdge, _Value> > 
-      Parent;
-    
-      UEdgeMap(const Graph& _g) 
-	: Parent(_g) {}
-      UEdgeMap(const Graph& _g, const _Value& _v) 
-	: Parent(_g, _v) {}
-    
-      UEdgeMap& operator=(const UEdgeMap& cmap) {
-	return operator=<UEdgeMap>(cmap);
-      }
-    
-      template <typename CMap>
-      UEdgeMap& operator=(const CMap& cmap) {
-	checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
-	const typename Parent::Graph* graph = Parent::getGraph();
-	UEdge it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  Parent::set(it, cmap[it]);
-	}
-	return *this;
-      }
-    };
-  
-  };
-
 }
 
 #endif

Modified: hugo/branches/extendermerge/lemon/concept/bpugraph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/concept/bpugraph.h	(original)
+++ hugo/branches/extendermerge/lemon/concept/bpugraph.h	Fri Feb 17 13:24:31 2006
@@ -70,7 +70,7 @@
     public:
       /// \todo undocumented
       ///
-      typedef True UTag;
+      typedef True UndirectedTag;
 
       /// \brief The base type of node iterators, 
       /// or in other words, the trivial node iterator.

Modified: hugo/branches/extendermerge/lemon/concept/graph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/concept/graph.h	(original)
+++ hugo/branches/extendermerge/lemon/concept/graph.h	Fri Feb 17 13:24:31 2006
@@ -44,8 +44,6 @@
          public IterableGraphComponent, public MappableGraphComponent {
     public:
 
-      typedef False UTag;
-      
       typedef BaseGraphComponent::Node Node;
       typedef BaseGraphComponent::Edge Edge;
 
@@ -123,10 +121,6 @@
     public:
       ///\e
 
-      ///\todo undocumented
-      ///
-      typedef False UTag;
-
       /// Defalult constructor.
 
       /// Defalult constructor.

Modified: hugo/branches/extendermerge/lemon/concept/ugraph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/concept/ugraph.h	(original)
+++ hugo/branches/extendermerge/lemon/concept/ugraph.h	Fri Feb 17 13:24:31 2006
@@ -245,7 +245,7 @@
 
       ///\todo undocumented
       ///
-      typedef True UTag;
+      typedef True UndirectedTag;
 
       /// \brief The base type of node iterators, 
       /// or in other words, the trivial node iterator.

Modified: hugo/branches/extendermerge/lemon/edge_set.h
==============================================================================
--- hugo/branches/extendermerge/lemon/edge_set.h	(original)
+++ hugo/branches/extendermerge/lemon/edge_set.h	Fri Feb 17 13:24:31 2006
@@ -19,13 +19,8 @@
 #ifndef LEMON_EDGE_SET_H
 #define LEMON_EDGE_SET_H
 
-#include <lemon/bits/erasable_graph_extender.h>
-#include <lemon/bits/clearable_graph_extender.h>
-#include <lemon/bits/extendable_graph_extender.h>
-#include <lemon/bits/iterable_graph_extender.h>
-#include <lemon/bits/alteration_notifier.h>
-#include <lemon/bits/default_map.h>
-#include <lemon/bits/graph_extender.h>
+
+#include <lemon/bits/edge_set_extender.h>
 
 /// \ingroup graphs
 /// \file
@@ -229,26 +224,11 @@
   /// In the edge extension and removing it conforms to the 
   /// \ref concept::ErasableGraph "ErasableGraph" concept.
   template <typename _Graph>
-  class ListEdgeSet :
-    public ErasableEdgeSetExtender<
-    ClearableEdgeSetExtender<
-    ExtendableEdgeSetExtender<
-    MappableEdgeSetExtender<
-    IterableGraphExtender<
-    AlterableEdgeSetExtender<
-    GraphExtender<
-    ListEdgeSetBase<_Graph> > > > > > > > {
+  class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<_Graph> > {
 
   public:
 
-    typedef ErasableEdgeSetExtender<
-      ClearableEdgeSetExtender<
-      ExtendableEdgeSetExtender<
-      MappableEdgeSetExtender<
-      IterableGraphExtender<
-      AlterableEdgeSetExtender<
-      GraphExtender<
-      ListEdgeSetBase<_Graph> > > > > > > > Parent;
+    typedef EdgeSetExtender<ListEdgeSetBase<_Graph> > Parent;
     
     typedef typename Parent::Node Node;
     typedef typename Parent::Edge Edge;
@@ -336,26 +316,13 @@
   /// In the edge extension and removing it conforms to the 
   /// \ref concept::ErasableUGraph "ErasableUGraph" concept.
   template <typename _Graph>
-  class ListUEdgeSet :
-    public ErasableUEdgeSetExtender<
-    ClearableUEdgeSetExtender<
-    ExtendableUEdgeSetExtender<
-    MappableUEdgeSetExtender<
-    IterableUGraphExtender<
-    AlterableUEdgeSetExtender<
-    UGraphExtender<
-    ListEdgeSetBase<_Graph> > > > > > > > {
+  class ListUEdgeSet 
+    : public UEdgeSetExtender<UGraphBaseExtender<ListEdgeSetBase<_Graph> > > {
 
   public:
 
-    typedef ErasableUEdgeSetExtender<
-      ClearableUEdgeSetExtender<
-      ExtendableUEdgeSetExtender<
-      MappableUEdgeSetExtender<
-      IterableUGraphExtender<
-      AlterableUEdgeSetExtender<
-      UGraphExtender<
-      ListEdgeSetBase<_Graph> > > > > > > > Parent;
+    typedef UEdgeSetExtender<UGraphBaseExtender<
+      ListEdgeSetBase<_Graph> > > Parent;
     
     typedef typename Parent::Node Node;
     typedef typename Parent::Edge Edge;
@@ -567,24 +534,11 @@
   /// In the edge extension and removing it conforms to the 
   /// \ref concept::ExtendableGraph "ExtendableGraph" concept.
   template <typename _Graph>
-  class SmartEdgeSet :
-    public ClearableEdgeSetExtender<
-    ExtendableEdgeSetExtender<
-    MappableEdgeSetExtender<
-    IterableGraphExtender<
-    AlterableEdgeSetExtender<
-    GraphExtender<
-    SmartEdgeSetBase<_Graph> > > > > > > {
+  class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<_Graph> > {
 
   public:
 
-    typedef ClearableEdgeSetExtender<
-      ExtendableEdgeSetExtender<
-      MappableEdgeSetExtender<
-      IterableGraphExtender<
-      AlterableEdgeSetExtender<
-      GraphExtender<
-      SmartEdgeSetBase<_Graph> > > > > > > Parent;
+    typedef EdgeSetExtender<SmartEdgeSetBase<_Graph> > Parent;
     
     typedef typename Parent::Node Node;
     typedef typename Parent::Edge Edge;
@@ -671,24 +625,13 @@
   /// In the edge extension and removing it conforms to the 
   /// \ref concept::ExtendableUGraph "ExtendableUGraph" concept.
   template <typename _Graph>
-  class SmartUEdgeSet :
-    public ClearableUEdgeSetExtender<
-    ExtendableUEdgeSetExtender<
-    MappableUEdgeSetExtender<
-    IterableUGraphExtender<
-    AlterableUEdgeSetExtender<
-    UGraphExtender<
-    SmartEdgeSetBase<_Graph> > > > > > > {
+  class SmartUEdgeSet 
+    : public UEdgeSetExtender<UGraphBaseExtender<SmartEdgeSetBase<_Graph> > > {
 
   public:
 
-    typedef ClearableUEdgeSetExtender<
-      ExtendableUEdgeSetExtender<
-      MappableUEdgeSetExtender<
-      IterableUGraphExtender<
-      AlterableUEdgeSetExtender<
-      UGraphExtender<
-      SmartEdgeSetBase<_Graph> > > > > > > Parent;
+    typedef UEdgeSetExtender<UGraphBaseExtender<
+      SmartEdgeSetBase<_Graph> > > Parent;
     
     typedef typename Parent::Node Node;
     typedef typename Parent::Edge Edge;

Modified: hugo/branches/extendermerge/lemon/euler.h
==============================================================================
--- hugo/branches/extendermerge/lemon/euler.h	(original)
+++ hugo/branches/extendermerge/lemon/euler.h	Fri Feb 17 13:24:31 2006
@@ -227,7 +227,7 @@
 #ifdef DOXYGEN
   bool
 #else
-  typename enable_if<typename Graph::UTag,bool>::type
+  typename enable_if<UndirectedTagIndicator<Graph>,bool>::type
   euler(const Graph &g) 
   {
     for(typename Graph::NodeIt n(g);n!=INVALID;++n)
@@ -235,7 +235,7 @@
     return connected(g);
   }
   template<class Graph>
-  typename disable_if<typename Graph::UTag,bool>::type
+  typename disable_if<UndirectedTagIndicator<Graph>,bool>::type
 #endif
   euler(const Graph &g) 
   {

Modified: hugo/branches/extendermerge/lemon/fredman_tarjan.h
==============================================================================
--- hugo/branches/extendermerge/lemon/fredman_tarjan.h	(original)
+++ hugo/branches/extendermerge/lemon/fredman_tarjan.h	Fri Feb 17 13:24:31 2006
@@ -504,7 +504,7 @@
       Create ft(graph,cost);
     ft.treeMap(tree);
     ft.run();
-  };
+  }
 
 } //END OF NAMESPACE LEMON
 

Modified: hugo/branches/extendermerge/lemon/full_graph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/full_graph.h	(original)
+++ hugo/branches/extendermerge/lemon/full_graph.h	Fri Feb 17 13:24:31 2006
@@ -22,11 +22,9 @@
 #include <cmath>
 
 
-#include <lemon/bits/iterable_graph_extender.h>
-#include <lemon/bits/alteration_notifier.h>
-#include <lemon/bits/static_map.h>
 #include <lemon/bits/graph_extender.h>
 
+
 #include <lemon/invalid.h>
 #include <lemon/utility.h>
 
@@ -191,10 +189,7 @@
 
   };
 
-  typedef StaticMappableGraphExtender<
-    IterableGraphExtender<
-    AlterableGraphExtender<
-    GraphExtender<FullGraphBase> > > > ExtendedFullGraphBase;
+  typedef GraphExtender<FullGraphBase> ExtendedFullGraphBase;
 
   /// \ingroup graphs
   ///
@@ -379,10 +374,8 @@
 
   };
 
-  typedef StaticMappableUGraphExtender<
-    IterableUGraphExtender<
-    AlterableUGraphExtender<
-    UGraphExtender<FullUGraphBase> > > > ExtendedFullUGraphBase;
+  typedef UGraphExtender<UGraphBaseExtender<FullUGraphBase> > 
+  ExtendedFullUGraphBase;
 
   /// \ingroup graphs
   ///
@@ -577,12 +570,8 @@
   };
 
 
-  typedef StaticMappableBpUGraphExtender<
-    IterableBpUGraphExtender<
-    AlterableBpUGraphExtender<
-    BpUGraphExtender <
-    FullBpUGraphBase> > > >
-  ExtendedFullBpUGraphBase;
+  typedef BpUGraphExtender< BpUGraphBaseExtender<
+    FullBpUGraphBase> > ExtendedFullBpUGraphBase;
 
 
   /// \ingroup graphs

Modified: hugo/branches/extendermerge/lemon/graph_adaptor.h
==============================================================================
--- hugo/branches/extendermerge/lemon/graph_adaptor.h	(original)
+++ hugo/branches/extendermerge/lemon/graph_adaptor.h	Fri Feb 17 13:24:31 2006
@@ -29,13 +29,10 @@
 
 #include <lemon/invalid.h>
 #include <lemon/maps.h>
-#include <lemon/bits/erasable_graph_extender.h>
-#include <lemon/bits/clearable_graph_extender.h>
-#include <lemon/bits/extendable_graph_extender.h>
-#include <lemon/bits/iterable_graph_extender.h>
-#include <lemon/bits/alteration_notifier.h>
-#include <lemon/bits/default_map.h>
+
+#include <lemon/bits/graph_adaptor_extender.h>
 #include <lemon/bits/graph_extender.h>
+
 #include <iostream>
 
 namespace lemon {
@@ -145,10 +142,10 @@
 
   template <typename _Graph>
   class GraphAdaptor :
-    public IterableGraphExtender<GraphAdaptorBase<_Graph> > { 
+    public GraphAdaptorExtender<GraphAdaptorBase<_Graph> > { 
   public:
     typedef _Graph Graph;
-    typedef IterableGraphExtender<GraphAdaptorBase<_Graph> > Parent;
+    typedef GraphAdaptorExtender<GraphAdaptorBase<_Graph> > Parent;
   protected:
     GraphAdaptor() : Parent() { }
 
@@ -198,10 +195,10 @@
 
   template<typename _Graph>
   class RevGraphAdaptor : 
-    public IterableGraphExtender<RevGraphAdaptorBase<_Graph> > {
+    public GraphAdaptorExtender<RevGraphAdaptorBase<_Graph> > {
   public:
     typedef _Graph Graph;
-    typedef IterableGraphExtender<
+    typedef GraphAdaptorExtender<
       RevGraphAdaptorBase<_Graph> > Parent;
   protected:
     RevGraphAdaptor() { }
@@ -496,11 +493,11 @@
   template<typename _Graph, typename NodeFilterMap, 
 	   typename EdgeFilterMap, bool checked = true>
   class SubGraphAdaptor : 
-    public IterableGraphExtender<
+    public GraphAdaptorExtender<
     SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap, checked> > {
   public:
     typedef _Graph Graph;
-    typedef IterableGraphExtender<
+    typedef GraphAdaptorExtender<
       SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap> > Parent;
   protected:
     SubGraphAdaptor() { }
@@ -703,13 +700,13 @@
   };
 
   template <typename _Graph>
-  class UGraphAdaptorBase : 
-    public UGraphExtender<GraphAdaptorBase<_Graph> > {
+  class UndirectGraphAdaptorBase : 
+    public UGraphBaseExtender<GraphAdaptorBase<_Graph> > {
   public:
     typedef _Graph Graph;
-    typedef UGraphExtender<GraphAdaptorBase<_Graph> > Parent;
+    typedef UGraphBaseExtender<GraphAdaptorBase<_Graph> > Parent;
   protected:
-    UGraphAdaptorBase() : Parent() { }
+    UndirectGraphAdaptorBase() : Parent() { }
   public:
     typedef typename Parent::UEdge UEdge;
     typedef typename Parent::Edge Edge;
@@ -717,17 +714,17 @@
     template <typename T>
     class EdgeMap {
     protected:
-      const UGraphAdaptorBase<_Graph>* g;
+      const UndirectGraphAdaptorBase<_Graph>* g;
       template <typename TT> friend class EdgeMap;
       typename _Graph::template EdgeMap<T> forward_map, backward_map; 
     public:
       typedef T Value;
       typedef Edge Key;
       
-      EdgeMap(const UGraphAdaptorBase<_Graph>& _g) : g(&_g), 
+      EdgeMap(const UndirectGraphAdaptorBase<_Graph>& _g) : g(&_g), 
 	forward_map(*(g->graph)), backward_map(*(g->graph)) { }
 
-      EdgeMap(const UGraphAdaptorBase<_Graph>& _g, T a) : g(&_g), 
+      EdgeMap(const UndirectGraphAdaptorBase<_Graph>& _g, T a) : g(&_g), 
 	forward_map(*(g->graph), a), backward_map(*(g->graph), a) { }
       
       void set(Edge e, T a) { 
@@ -753,10 +750,10 @@
       typedef T Value;
       typedef UEdge Key;
       
-      UEdgeMap(const UGraphAdaptorBase<_Graph>& g) : 
+      UEdgeMap(const UndirectGraphAdaptorBase<_Graph>& g) : 
 	map(*(g.graph)) { }
 
-      UEdgeMap(const UGraphAdaptorBase<_Graph>& g, T a) : 
+      UEdgeMap(const UndirectGraphAdaptorBase<_Graph>& g, T a) : 
 	map(*(g.graph), a) { }
       
       void set(UEdge e, T a) { 
@@ -778,17 +775,17 @@
   /// 
   /// \author Marton Makai
   template<typename _Graph>
-  class UGraphAdaptor : 
-    public IterableUGraphExtender<
-    UGraphAdaptorBase<_Graph> > {
+  class UndirectGraphAdaptor : 
+    public UGraphAdaptorExtender<
+    UndirectGraphAdaptorBase<_Graph> > {
   public:
     typedef _Graph Graph;
-    typedef IterableUGraphExtender<
-      UGraphAdaptorBase<_Graph> > Parent;
+    typedef UGraphAdaptorExtender<
+      UndirectGraphAdaptorBase<_Graph> > Parent;
   protected:
-    UGraphAdaptor() { }
+    UndirectGraphAdaptor() { }
   public:
-    UGraphAdaptor(_Graph& _graph) { 
+    UndirectGraphAdaptor(_Graph& _graph) { 
       setGraph(_graph);
     }
   };
@@ -1083,11 +1080,11 @@
   template<typename _Graph, 
 	   typename ForwardFilterMap, typename BackwardFilterMap>
   class SubBidirGraphAdaptor : 
-    public IterableGraphExtender<
+    public GraphAdaptorExtender<
     SubBidirGraphAdaptorBase<_Graph, ForwardFilterMap, BackwardFilterMap> > {
   public:
     typedef _Graph Graph;
-    typedef IterableGraphExtender<
+    typedef GraphAdaptorExtender<
       SubBidirGraphAdaptorBase<
       _Graph, ForwardFilterMap, BackwardFilterMap> > Parent;
   protected:
@@ -1341,11 +1338,11 @@
   ///
   template <typename _Graph, typename FirstOutEdgesMap>
   class ErasingFirstGraphAdaptor : 
-    public IterableGraphExtender<
+    public GraphAdaptorExtender<
     ErasingFirstGraphAdaptorBase<_Graph, FirstOutEdgesMap> > {
   public:
     typedef _Graph Graph;
-    typedef IterableGraphExtender<
+    typedef GraphAdaptorExtender<
       ErasingFirstGraphAdaptorBase<_Graph, FirstOutEdgesMap> > Parent;
     ErasingFirstGraphAdaptor(Graph& _graph, 
 			     FirstOutEdgesMap& _first_out_edges) { 
@@ -1711,9 +1708,9 @@
 
   template <typename _Graph>
   class SplitGraphAdaptor 
-    : public IterableGraphExtender<SplitGraphAdaptorBase<_Graph> > {
+    : public GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > {
   public:
-    typedef IterableGraphExtender<SplitGraphAdaptorBase<_Graph> > Parent;
+    typedef GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > Parent;
 
     SplitGraphAdaptor(_Graph& graph) {
       Parent::setGraph(graph);

Copied: hugo/branches/extendermerge/lemon/grid_ugraph.h (from r2549, /hugo/branches/extendermerge/lemon/grid_graph.h)
==============================================================================
--- /hugo/branches/extendermerge/lemon/grid_graph.h	(original)
+++ hugo/branches/extendermerge/lemon/grid_ugraph.h	Fri Feb 17 13:24:31 2006
@@ -16,45 +16,42 @@
  *
  */
 
-#ifndef GRID_GRAPH_H
-#define GRID_GRAPH_H
+#ifndef GRID_UGRAPH_H
+#define GRID_UGRAPH_H
 
 #include <iostream>
 #include <lemon/invalid.h>
 #include <lemon/utility.h>
 
-#include <lemon/bits/iterable_graph_extender.h>
-#include <lemon/bits/alteration_notifier.h>
-#include <lemon/bits/static_map.h>
 #include <lemon/bits/graph_extender.h>
 
 #include <lemon/xy.h>
 
 ///\ingroup graphs
 ///\file
-///\brief GridGraph class.
+///\brief GridUGraph class.
 
 namespace lemon {
 
-  /// \brief Base graph for GridGraph.
+  /// \brief Base graph for GridUGraph.
   ///
   /// Base graph for grid graph. It describes some member functions
-  /// which can be used in the GridGraph.
+  /// which can be used in the GridUGraph.
   ///
-  /// \warning Always use the GridGraph instead of this.
-  /// \see GridGraph
-  class GridGraphBase {
+  /// \warning Always use the GridUGraph instead of this.
+  /// \see GridUGraph
+  class GridUGraphBase {
 
   public:
 
-    typedef GridGraphBase Graph;
+    typedef GridUGraphBase UGraph;
 
     class Node;
     class Edge;
 
   public:
 
-    GridGraphBase() {}
+    GridUGraphBase() {}
 
   protected:
 
@@ -242,7 +239,7 @@
     
       
     class Node {
-      friend class GridGraphBase;
+      friend class GridUGraphBase;
 
     protected:
       int id;
@@ -258,7 +255,7 @@
 
 
     class Edge {
-      friend class GridGraphBase;
+      friend class GridUGraphBase;
       
     protected:
       int id; 
@@ -340,10 +337,8 @@
   };
 
 
-  typedef StaticMappableUGraphExtender<
-    IterableUGraphExtender<
-    AlterableUGraphExtender<
-    UGraphExtender<GridGraphBase> > > > ExtendedGridGraphBase;
+  typedef UGraphExtender<UGraphBaseExtender<
+    GridUGraphBase> > ExtendedGridUGraphBase;
 
   /// \ingroup graphs
   ///
@@ -357,8 +352,8 @@
   ///
   /// The graph can be indiced in the following way:
   ///\code
-  /// GridGraph graph(w, h);
-  /// GridGraph::NodeMap<int> val(graph); 
+  /// GridUGraph graph(w, h);
+  /// GridUGraph::NodeMap<int> val(graph); 
   /// for (int i = 0; i < graph.width(); ++i) {
   ///   for (int j = 0; j < graph.height(); ++j) {
   ///     val[graph(i, j)] = i + j;
@@ -366,12 +361,12 @@
   /// }
   ///\endcode
   ///
-  /// The graph type is fully conform to the \ref concept::UGraph
-  /// "Undirected Graph" concept.
+  /// The graph type is fully conform to the \ref concept::UUGraph
+  /// "Undirected UGraph" concept.
   ///
   /// \author Balazs Dezso
-  /// \see GridGraphBase
-  class GridGraph : public ExtendedGridGraphBase {
+  /// \see GridUGraphBase
+  class GridUGraph : public ExtendedGridUGraphBase {
   public:
 
     /// \brief Map to get the indices of the nodes as xy<int>.
@@ -379,16 +374,15 @@
     /// Map to get the indices of the nodes as xy<int>.
     class IndexMap {
     public:
-      typedef True NeedCopy;
       /// \brief The key type of the map
-      typedef GridGraph::Node Key;
+      typedef GridUGraph::Node Key;
       /// \brief The value type of the map
       typedef xy<int> Value;
 
       /// \brief Constructor
       ///
       /// Constructor
-      IndexMap(const GridGraph& _graph) : graph(_graph) {}
+      IndexMap(const GridUGraph& _graph) : graph(_graph) {}
 
       /// \brief The subscript operator
       ///
@@ -398,7 +392,7 @@
       }
 
     private:
-      const GridGraph& graph;
+      const GridUGraph& graph;
     };
 
     /// \brief Map to get the row of the nodes.
@@ -406,16 +400,15 @@
     /// Map to get the row of the nodes.
     class RowMap {
     public:
-      typedef True NeedCopy;
       /// \brief The key type of the map
-      typedef GridGraph::Node Key;
+      typedef GridUGraph::Node Key;
       /// \brief The value type of the map
       typedef int Value;
 
       /// \brief Constructor
       ///
       /// Constructor
-      RowMap(const GridGraph& _graph) : graph(_graph) {}
+      RowMap(const GridUGraph& _graph) : graph(_graph) {}
 
       /// \brief The subscript operator
       ///
@@ -425,7 +418,7 @@
       }
 
     private:
-      const GridGraph& graph;
+      const GridUGraph& graph;
     };
 
     /// \brief Map to get the column of the nodes.
@@ -433,16 +426,15 @@
     /// Map to get the column of the nodes.
     class ColMap {
     public:
-      typedef True NeedCopy;
       /// \brief The key type of the map
-      typedef GridGraph::Node Key;
+      typedef GridUGraph::Node Key;
       /// \brief The value type of the map
       typedef int Value;
 
       /// \brief Constructor
       ///
       /// Constructor
-      ColMap(const GridGraph& _graph) : graph(_graph) {}
+      ColMap(const GridUGraph& _graph) : graph(_graph) {}
 
       /// \brief The subscript operator
       ///
@@ -452,13 +444,13 @@
       }
 
     private:
-      const GridGraph& graph;
+      const GridUGraph& graph;
     };
 
     /// \brief Constructor
     ///
     /// 
-    GridGraph(int n, int m) { construct(n, m); }
+    GridUGraph(int n, int m) { construct(n, m); }
     
     /// \brief Gives back the edge goes down from the node.
     ///
@@ -501,22 +493,22 @@
   /// \brief Index map of the grid graph
   ///
   /// Just returns an IndexMap for the grid graph.
-  GridGraph::IndexMap indexMap(const GridGraph& graph) {
-    return GridGraph::IndexMap(graph);
+  GridUGraph::IndexMap indexMap(const GridUGraph& graph) {
+    return GridUGraph::IndexMap(graph);
   }
 
   /// \brief Row map of the grid graph
   ///
   /// Just returns a RowMap for the grid graph.
-  GridGraph::RowMap rowMap(const GridGraph& graph) {
-    return GridGraph::RowMap(graph);
+  GridUGraph::RowMap rowMap(const GridUGraph& graph) {
+    return GridUGraph::RowMap(graph);
   }
 
   /// \brief Column map of the grid graph
   ///
   /// Just returns a ColMap for the grid graph.
-  GridGraph::ColMap colMap(const GridGraph& graph) {
-    return GridGraph::ColMap(graph);
+  GridUGraph::ColMap colMap(const GridUGraph& graph) {
+    return GridUGraph::ColMap(graph);
   }
 }
 #endif

Modified: hugo/branches/extendermerge/lemon/hypercube_graph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/hypercube_graph.h	(original)
+++ hugo/branches/extendermerge/lemon/hypercube_graph.h	Fri Feb 17 13:24:31 2006
@@ -25,9 +25,6 @@
 #include <lemon/utility.h>
 #include <lemon/error.h>
 
-#include <lemon/bits/iterable_graph_extender.h>
-#include <lemon/bits/alteration_notifier.h>
-#include <lemon/bits/static_map.h>
 #include <lemon/bits/graph_extender.h>
 
 ///\ingroup graphs
@@ -236,11 +233,7 @@
   };
 
 
-  typedef StaticMappableGraphExtender<
-    IterableGraphExtender<
-    AlterableGraphExtender<
-    GraphExtender<
-    HyperCubeGraphBase> > > > ExtendedHyperCubeGraphBase;
+  typedef GraphExtender<HyperCubeGraphBase> ExtendedHyperCubeGraphBase;
 
   /// \ingroup graphs
   ///

Modified: hugo/branches/extendermerge/lemon/kruskal.h
==============================================================================
--- hugo/branches/extendermerge/lemon/kruskal.h	(original)
+++ hugo/branches/extendermerge/lemon/kruskal.h	Fri Feb 17 13:24:31 2006
@@ -23,6 +23,7 @@
 #include <vector>
 #include <lemon/unionfind.h>
 #include <lemon/utility.h>
+#include <lemon/traits.h>
 
 /**
 @defgroup spantree Minimum Cost Spanning Tree Algorithms
@@ -228,7 +229,7 @@
     };
 
     template<class _GR>
-    typename enable_if<typename _GR::UTag,void>::type
+    typename enable_if<UndirectedTagIndicator<_GR>,void>::type
     fillWithEdges(const _GR& g, const Map& m,dummy<0> = 0) 
     {
       for(typename GR::UEdgeIt e(g);e!=INVALID;++e) 
@@ -236,7 +237,7 @@
     }
 
     template<class _GR>
-    typename disable_if<typename _GR::UTag,void>::type
+    typename disable_if<UndirectedTagIndicator<_GR>,void>::type
     fillWithEdges(const _GR& g, const Map& m,dummy<1> = 1) 
     {
       for(typename GR::EdgeIt e(g);e!=INVALID;++e) 

Modified: hugo/branches/extendermerge/lemon/list_graph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/list_graph.h	(original)
+++ hugo/branches/extendermerge/lemon/list_graph.h	Fri Feb 17 13:24:31 2006
@@ -23,16 +23,11 @@
 ///\file
 ///\brief ListGraph, ListUGraph classes.
 
-#include <lemon/bits/erasable_graph_extender.h>
-#include <lemon/bits/clearable_graph_extender.h>
-#include <lemon/bits/extendable_graph_extender.h>
-#include <lemon/bits/iterable_graph_extender.h>
-#include <lemon/bits/alteration_notifier.h>
-#include <lemon/bits/default_map.h>
 #include <lemon/bits/graph_extender.h>
 
 #include <lemon/error.h>
 
+#include <vector>
 #include <list>
 
 namespace lemon {
@@ -311,13 +306,7 @@
 
   };
 
-  typedef ErasableGraphExtender<
-    ClearableGraphExtender<
-    ExtendableGraphExtender<
-    MappableGraphExtender<
-    IterableGraphExtender<
-    AlterableGraphExtender<
-    GraphExtender<ListGraphBase> > > > > > > ExtendedListGraphBase;
+  typedef GraphExtender<ListGraphBase> ExtendedListGraphBase;
 
   /// \addtogroup graphs
   /// @{
@@ -578,13 +567,8 @@
 
   /**************** Undirected List Graph ****************/
 
-  typedef ErasableUGraphExtender<
-    ClearableUGraphExtender<
-    ExtendableUGraphExtender<
-    MappableUGraphExtender<
-    IterableUGraphExtender<
-    AlterableUGraphExtender<
-    UGraphExtender<ListGraphBase> > > > > > > ExtendedListUGraphBase;
+  typedef UGraphExtender<UGraphBaseExtender<
+    ListGraphBase> > ExtendedListUGraphBase;
 
   /// \addtogroup graphs
   /// @{

Modified: hugo/branches/extendermerge/lemon/prim.h
==============================================================================
--- hugo/branches/extendermerge/lemon/prim.h	(original)
+++ hugo/branches/extendermerge/lemon/prim.h	Fri Feb 17 13:24:31 2006
@@ -788,7 +788,7 @@
       Create prm(graph,cost);
     prm.treeMap(tree);
     prm.run();
-  };
+  }
 
 } //END OF NAMESPACE LEMON
 

Modified: hugo/branches/extendermerge/lemon/radix_sort.h
==============================================================================
--- hugo/branches/extendermerge/lemon/radix_sort.h	(original)
+++ hugo/branches/extendermerge/lemon/radix_sort.h	Fri Feb 17 13:24:31 2006
@@ -264,7 +264,7 @@
 		       int byte, Functor functor) {
     const int size = 
       (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
-    int counter[size];
+    std::vector<int> counter(size);
     for (int i = 0; i < size; ++i) {
       counter[i] = 0;
     }
@@ -290,7 +290,7 @@
 			     int byte, Functor functor) {
     const int size = 
       (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
-    int counter[size];
+    std::vector<int> counter(size);
     for (int i = 0; i < size; ++i) {
       counter[i] = 0;
     }

Modified: hugo/branches/extendermerge/lemon/smart_graph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/smart_graph.h	(original)
+++ hugo/branches/extendermerge/lemon/smart_graph.h	Fri Feb 17 13:24:31 2006
@@ -27,16 +27,13 @@
 
 #include <lemon/invalid.h>
 
-#include <lemon/bits/clearable_graph_extender.h>
-#include <lemon/bits/extendable_graph_extender.h>
-#include <lemon/bits/iterable_graph_extender.h>
-#include <lemon/bits/alteration_notifier.h>
-#include <lemon/bits/default_map.h>
 #include <lemon/bits/graph_extender.h>
 
 #include <lemon/utility.h>
 #include <lemon/error.h>
 
+#include <lemon/bits/graph_extender.h>
+
 namespace lemon {
 
   class SmartGraph;
@@ -222,12 +219,7 @@
 
   };
 
-  typedef ClearableGraphExtender<
-    ExtendableGraphExtender<
-    MappableGraphExtender<
-    IterableGraphExtender<
-    AlterableGraphExtender<
-    GraphExtender<SmartGraphBase> > > > > > ExtendedSmartGraphBase;
+  typedef GraphExtender<SmartGraphBase> ExtendedSmartGraphBase;
 
   /// \ingroup graphs
 
@@ -244,7 +236,9 @@
   ///\author Alpar Juttner
   class SmartGraph : public ExtendedSmartGraphBase {
   public:
-    
+
+    typedef ExtendedSmartGraphBase Parent;
+
     class Snapshot;
     friend class Snapshot;
 
@@ -355,12 +349,8 @@
 
   /**************** Undirected List Graph ****************/
 
-  typedef ClearableUGraphExtender<
-    ExtendableUGraphExtender<
-    MappableUGraphExtender<
-    IterableUGraphExtender<
-    AlterableUGraphExtender<
-    UGraphExtender<SmartGraphBase> > > > > > ExtendedSmartUGraphBase;
+  typedef UGraphExtender<UGraphBaseExtender<SmartGraphBase> >
+  ExtendedSmartUGraphBase;
 
   /// \ingroup graphs
   ///
@@ -587,14 +577,8 @@
   };
 
 
-  typedef ClearableBpUGraphExtender<
-    ExtendableBpUGraphExtender<
-    MappableBpUGraphExtender<
-    IterableBpUGraphExtender<
-    AlterableBpUGraphExtender<
-    BpUGraphExtender <
-    SmartBpUGraphBase> > > > > >
-  ExtendedSmartBpUGraphBase;
+  typedef BpUGraphExtender< BpUGraphBaseExtender<
+    SmartBpUGraphBase> > ExtendedSmartBpUGraphBase;
 
   /// \ingroup graphs
   ///

Modified: hugo/branches/extendermerge/lemon/sub_graph.h
==============================================================================
--- hugo/branches/extendermerge/lemon/sub_graph.h	(original)
+++ hugo/branches/extendermerge/lemon/sub_graph.h	Fri Feb 17 13:24:31 2006
@@ -386,9 +386,9 @@
   /// \see EdgeSubGraphBase
   template <typename Graph>
   class SubGraph 
-    : public IterableGraphExtender< SubGraphBase<Graph> > {
+    : public GraphAdaptorExtender< SubGraphBase<Graph> > {
   public:
-    typedef IterableGraphExtender< SubGraphBase<Graph> > Parent;
+    typedef GraphAdaptorExtender< SubGraphBase<Graph> > Parent;
   public:
     /// \brief Constructor for sub-graph.
     ///
@@ -683,9 +683,9 @@
   /// \see EdgeSubGraphBase
   template <typename Graph>
   class EdgeSubGraph 
-    : public IterableGraphExtender< EdgeSubGraphBase<Graph> > {
+    : public GraphAdaptorExtender< EdgeSubGraphBase<Graph> > {
   public:
-    typedef IterableGraphExtender< EdgeSubGraphBase<Graph> > Parent;
+    typedef GraphAdaptorExtender< EdgeSubGraphBase<Graph> > Parent;
   public:
     /// \brief Constructor for sub-graph.
     ///

Modified: hugo/branches/extendermerge/lemon/topology.h
==============================================================================
--- hugo/branches/extendermerge/lemon/topology.h	(original)
+++ hugo/branches/extendermerge/lemon/topology.h	Fri Feb 17 13:24:31 2006
@@ -1417,7 +1417,7 @@
       if(bfs.dist(graph.source(i))==bfs.dist(graph.target(i)))return false;
     }
     return true;
-  };
+  }
   
   /// \ingroup topology
   ///
@@ -1459,7 +1459,7 @@
       if(bfs.dist(graph.source(i)) == bfs.dist(graph.target(i)))return false;
     }
     return true;
-  };
+  }
    
 } //namespace lemon
 

Modified: hugo/branches/extendermerge/lemon/traits.h
==============================================================================
--- hugo/branches/extendermerge/lemon/traits.h	(original)
+++ hugo/branches/extendermerge/lemon/traits.h	Fri Feb 17 13:24:31 2006
@@ -209,6 +209,19 @@
     static const bool value = true;
   };
 
+  template <typename Graph, typename Enable = void>
+  struct UndirectedTagIndicator {
+    static const bool value = false;
+  };
+
+  template <typename Graph>
+  struct UndirectedTagIndicator<
+    Graph, 
+    typename enable_if<typename Graph::UndirectedTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
 
 
 }

Modified: hugo/branches/extendermerge/test/ugraph_test.cc
==============================================================================
--- hugo/branches/extendermerge/test/ugraph_test.cc	(original)
+++ hugo/branches/extendermerge/test/ugraph_test.cc	Fri Feb 17 13:24:31 2006
@@ -32,25 +32,6 @@
 using namespace lemon::concept;
 
 void check_concepts() {
-  typedef UGraphExtender<ListGraphBase> ListUGraphBase;
-
-  typedef IterableUGraphExtender<
-    AlterableUGraphExtender<ListUGraphBase> > IterableListUGraph;
-
-  typedef MappableUGraphExtender<IterableListUGraph>
-    MappableListUGraph;
-
-  typedef ErasableUGraphExtender<
-    ClearableUGraphExtender<
-    ExtendableUGraphExtender<MappableListUGraph> > > Graph;
-
-  checkConcept<BaseIterableUGraphConcept, Graph>();
-  checkConcept<IterableUGraphConcept, Graph>();
-  checkConcept<MappableUGraphConcept, Graph>();
-
-  checkConcept<UGraph, Graph>();
-  checkConcept<ErasableUGraph, Graph>();
-
   checkConcept<UGraph, ListUGraph>();
   checkConcept<ErasableUGraph, ListUGraph>();
 
@@ -61,7 +42,7 @@
 
   checkConcept<UGraph, UGraph>();
 
-  checkConcept<UGraph, GridGraph>();
+  checkConcept<UGraph, GridUGraph>();
 }
 
 template <typename Graph>
@@ -150,7 +131,7 @@
   check_item_counts(g,3,2);
 }
 
-void checkGridGraph(const GridGraph& g, int w, int h) {
+void checkGridUGraph(const GridUGraph& g, int w, int h) {
   check(g.width() == w, "Wrong width");
   check(g.height() == h, "Wrong height");
 
@@ -206,9 +187,9 @@
   }
 
   {
-    GridGraph g(5, 6);
+    GridUGraph g(5, 6);
     check_item_counts(g, 30, 49);
-    checkGridGraph(g, 5, 6);
+    checkGridUGraph(g, 5, 6);
   }
 
   std::cout << __FILE__ ": All tests passed.\n";



More information about the Lemon-commits mailing list