Index: lemon/Makefile.am
===================================================================
--- lemon/Makefile.am	(revision 326)
+++ lemon/Makefile.am	(revision 334)
@@ -13,6 +13,7 @@
         lemon/random.cc
 
-#lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS)
-#lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS)
+
+lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS)
+lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS)
 
 lemon_HEADERS += \
@@ -30,4 +31,5 @@
 	lemon/error.h \
         lemon/graph_to_eps.h \
+        lemon/grid_graph.h \
 	lemon/kruskal.h \
 	lemon/lgf_reader.h \
@@ -36,5 +38,4 @@
 	lemon/maps.h \
 	lemon/math.h \
-	lemon/max_matching.h \
 	lemon/path.h \
         lemon/random.h \
Index: lemon/arg_parser.cc
===================================================================
--- lemon/arg_parser.cc	(revision 311)
+++ lemon/arg_parser.cc	(revision 214)
@@ -27,9 +27,10 @@
   }
 
-  ArgParser::ArgParser(int argc, const char * const *argv)
-    :_argc(argc), _argv(argv), _command_name(argv[0]) {
+  ArgParser::ArgParser(int argc, const char **argv) :_argc(argc), _argv(argv),
+                                                     _command_name(argv[0]) {
     funcOption("-help","Print a short help message",_showHelp,this);
     synonym("help","-help");
     synonym("h","-help");
+
   }
 
Index: lemon/arg_parser.h
===================================================================
--- lemon/arg_parser.h	(revision 311)
+++ lemon/arg_parser.h	(revision 214)
@@ -17,6 +17,6 @@
  */
 
-#ifndef LEMON_ARG_PARSER_H
-#define LEMON_ARG_PARSER_H
+#ifndef LEMON_ARG_PARSER
+#define LEMON_ARG_PARSER
 
 #include <vector>
@@ -47,5 +47,5 @@
 
     int _argc;
-    const char * const *_argv;
+    const char **_argv;
 
     enum OptType { UNKNOWN=0, BOOL=1, STRING=2, DOUBLE=3, INTEGER=4, FUNC=5 };
@@ -120,5 +120,5 @@
 
     ///Constructor
-    ArgParser(int argc, const char * const *argv);
+    ArgParser(int argc, const char **argv);
 
     ~ArgParser();
@@ -311,7 +311,6 @@
     ///This is the type of the return value of ArgParser::operator[]().
     ///It automatically converts to \c int, \c double, \c bool or
-    ///\c std::string if the type of the option matches, which is checked
-    ///with an \ref LEMON_ASSERT "assertion" (i.e. it performs runtime
-    ///type checking).
+    ///\c std::string if the type of the option matches, otherwise it
+    ///throws an exception (i.e. it performs runtime type checking).
     class RefType
     {
@@ -384,3 +383,3 @@
 }
 
-#endif // LEMON_ARG_PARSER_H
+#endif // LEMON_ARG_PARSER
Index: lemon/assert.h
===================================================================
--- lemon/assert.h	(revision 290)
+++ lemon/assert.h	(revision 218)
@@ -28,7 +28,6 @@
 namespace lemon {
 
-  inline void assert_fail_abort(const char *file, int line,
-                                const char *function, const char* message,
-                                const char *assertion)
+  inline void assert_fail_log(const char *file, int line, const char *function,
+                              const char *message, const char *assertion)
   {
     std::cerr << file << ":" << line << ": ";
@@ -39,4 +38,11 @@
       std::cerr << " (assertion '" << assertion << "' failed)";
     std::cerr << std::endl;
+  }
+
+  inline void assert_fail_abort(const char *file, int line,
+                                const char *function, const char* message,
+                                const char *assertion)
+  {
+    assert_fail_log(file, line, function, message, assertion);
     std::abort();
   }
@@ -58,12 +64,15 @@
 
 #undef LEMON_ASSERT
+#undef LEMON_FIXME
 #undef LEMON_DEBUG
 
-#if (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +               \
+#if (defined(LEMON_ASSERT_LOG) ? 1 : 0) +               \
+  (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +               \
   (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) > 1
 #error "LEMON assertion system is not set properly"
 #endif
 
-#if ((defined(LEMON_ASSERT_ABORT) ? 1 : 0) +            \
+#if ((defined(LEMON_ASSERT_LOG) ? 1 : 0) +              \
+     (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +            \
      (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) == 1 ||     \
      defined(LEMON_ENABLE_ASSERTS)) &&                  \
@@ -74,5 +83,8 @@
 
 
-#if defined LEMON_ASSERT_ABORT
+#if defined LEMON_ASSERT_LOG
+#  undef LEMON_ASSERT_HANDLER
+#  define LEMON_ASSERT_HANDLER ::lemon::assert_fail_log
+#elif defined LEMON_ASSERT_ABORT
 #  undef LEMON_ASSERT_HANDLER
 #  define LEMON_ASSERT_HANDLER ::lemon::assert_fail_abort
@@ -96,8 +108,6 @@
 #  elif defined _MSC_VER
 #    define LEMON_FUNCTION_NAME (__FUNCSIG__)
-#  elif __STDC_VERSION__ >= 199901L
+#  else
 #    define LEMON_FUNCTION_NAME (__func__)
-#  else
-#    define LEMON_FUNCTION_NAME ("<unknown>")
 #  endif
 #endif
@@ -109,10 +119,10 @@
 /// \brief Macro for assertion with customizable message
 ///
-/// Macro for assertion with customizable message.
-/// \param exp An expression that must be convertible to \c bool.  If it is \c
-/// false, then an assertion is raised. The concrete behaviour depends on the
-/// settings of the assertion system.
-/// \param msg A <tt>const char*</tt> parameter, which can be used to provide
-/// information about the circumstances of the failed assertion.
+/// Macro for assertion with customizable message.  \param exp An
+/// expression that must be convertible to \c bool.  If it is \c
+/// false, then an assertion is raised. The concrete behaviour depends
+/// on the settings of the assertion system.  \param msg A <tt>const
+/// char*</tt> parameter, which can be used to provide information
+/// about the circumstances of the failed assertion.
 ///
 /// The assertions are enabled in the default behaviour.
@@ -128,10 +138,15 @@
 /// The checking is also disabled when the standard macro \c NDEBUG is defined.
 ///
-/// As a default behaviour the failed assertion prints a short log message to
-/// the standard error and aborts the execution.
-///
-/// However, the following modes can be used in the assertion system:
-/// - \c LEMON_ASSERT_ABORT The failed assertion prints a short log message to
-///   the standard error and aborts the program. It is the default behaviour.
+/// The LEMON assertion system has a wide range of customization
+/// properties. As a default behaviour the failed assertion prints a
+/// short log message to the standard error and aborts the execution.
+///
+/// The following modes can be used in the assertion system:
+///
+/// - \c LEMON_ASSERT_LOG The failed assertion prints a short log
+///   message to the standard error and continues the execution.
+/// - \c LEMON_ASSERT_ABORT This mode is similar to the \c
+///   LEMON_ASSERT_LOG, but it aborts the program. It is the default
+///   behaviour.
 /// - \c LEMON_ASSERT_CUSTOM The user can define own assertion handler
 ///   function.
@@ -161,4 +176,20 @@
 /// \ingroup exceptions
 ///
+/// \brief Macro for mark not yet implemented features.
+///
+/// Macro for mark not yet implemented features and outstanding bugs.
+/// It is close to be the shortcut of the following code:
+/// \code
+///   LEMON_ASSERT(false, msg);
+/// \endcode
+///
+/// \see LEMON_ASSERT
+#  define LEMON_FIXME(msg)                                              \
+  (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,        \
+                        ::lemon::_assert_bits::cstringify(msg),         \
+                        static_cast<const char*>(0)))
+
+/// \ingroup exceptions
+///
 /// \brief Macro for internal assertions
 ///
@@ -192,4 +223,5 @@
 #  ifndef LEMON_ASSERT_HANDLER
 #    define LEMON_ASSERT(exp, msg)  (static_cast<void>(0))
+#    define LEMON_FIXME(msg) (static_cast<void>(0))
 #    define LEMON_DEBUG(exp, msg) (static_cast<void>(0))
 #  else
@@ -200,4 +232,9 @@
                              ::lemon::_assert_bits::cstringify(msg),    \
                              #exp), 0)))
+#    define LEMON_FIXME(msg)                                            \
+       (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,   \
+                             ::lemon::_assert_bits::cstringify(msg),    \
+                             static_cast<const char*>(0)))
+
 #    if LEMON_ENABLE_DEBUG
 #      define LEMON_DEBUG(exp, msg)                                     \
Index: lemon/bfs.h
===================================================================
--- lemon/bfs.h	(revision 301)
+++ lemon/bfs.h	(revision 252)
@@ -29,5 +29,4 @@
 #include <lemon/error.h>
 #include <lemon/maps.h>
-#include <lemon/path.h>
 
 namespace lemon {
@@ -50,9 +49,10 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
-    ///Instantiates a PredMap.
-
-    ///This function instantiates a PredMap.
+    ///Instantiates a \ref PredMap.
+
+    ///This function instantiates a \ref PredMap.
     ///\param g is the digraph, to which we would like to define the
-    ///PredMap.
+    ///\ref PredMap.
+    ///\todo The digraph alone may be insufficient to initialize
     static PredMap *createPredMap(const Digraph &g)
     {
@@ -64,10 +64,11 @@
     ///The type of the map that indicates which nodes are processed.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+    ///By default it is a NullMap.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
-    ///Instantiates a ProcessedMap.
-
-    ///This function instantiates a ProcessedMap.
+    ///Instantiates a \ref ProcessedMap.
+
+    ///This function instantiates a \ref ProcessedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ProcessedMap
+    ///we would like to define the \ref ProcessedMap
 #ifdef DOXYGEN
     static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -84,9 +85,9 @@
     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
-    ///Instantiates a ReachedMap.
-
-    ///This function instantiates a ReachedMap.
+    ///Instantiates a \ref ReachedMap.
+
+    ///This function instantiates a \ref ReachedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ReachedMap.
+    ///we would like to define the \ref ReachedMap.
     static ReachedMap *createReachedMap(const Digraph &g)
     {
@@ -99,9 +100,9 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<int> DistMap;
-    ///Instantiates a DistMap.
-
-    ///This function instantiates a DistMap.
+    ///Instantiates a \ref DistMap.
+
+    ///This function instantiates a \ref DistMap.
     ///\param g is the digraph, to which we would like to define the
-    ///DistMap.
+    ///\ref DistMap.
     static DistMap *createDistMap(const Digraph &g)
     {
@@ -115,5 +116,5 @@
   ///This class provides an efficient implementation of the %BFS algorithm.
   ///
-  ///There is also a \ref bfs() "function-type interface" for the BFS
+  ///There is also a \ref bfs() "function type interface" for the BFS
   ///algorithm, which is convenient in the simplier cases and it can be
   ///used easier.
@@ -136,4 +137,14 @@
   class Bfs {
   public:
+    ///\ref Exception for uninitialized parameters.
+
+    ///This error represents problems in the initialization of the
+    ///parameters of the algorithm.
+    class UninitializedParameter : public lemon::UninitializedParameter {
+    public:
+      virtual const char* what() const throw() {
+        return "lemon::Bfs::UninitializedParameter";
+      }
+    };
 
     ///The type of the digraph the algorithm runs on.
@@ -185,5 +196,6 @@
     int _curr_dist;
 
-    //Creates the maps if necessary.
+    ///Creates the maps if necessary.
+    ///\todo Better memory allocation (instead of new).
     void create_maps()
     {
@@ -219,96 +231,92 @@
 
     template <class T>
-    struct SetPredMapTraits : public Traits {
+    struct DefPredMapTraits : public Traits {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "PredMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///PredMap type.
+    ///\ref PredMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///PredMap type.
+    ///\ref PredMap type.
     template <class T>
-    struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > {
-      typedef Bfs< Digraph, SetPredMapTraits<T> > Create;
+    struct DefPredMap : public Bfs< Digraph, DefPredMapTraits<T> > {
+      typedef Bfs< Digraph, DefPredMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetDistMapTraits : public Traits {
+    struct DefDistMapTraits : public Traits {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "DistMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///DistMap type.
+    ///\ref DistMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///DistMap type.
+    ///\ref DistMap type.
     template <class T>
-    struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > {
-      typedef Bfs< Digraph, SetDistMapTraits<T> > Create;
+    struct DefDistMap : public Bfs< Digraph, DefDistMapTraits<T> > {
+      typedef Bfs< Digraph, DefDistMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetReachedMapTraits : public Traits {
+    struct DefReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "ReachedMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ReachedMap type.
+    ///\ref ReachedMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ReachedMap type.
+    ///\ref ReachedMap type.
     template <class T>
-    struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > {
-      typedef Bfs< Digraph, SetReachedMapTraits<T> > Create;
+    struct DefReachedMap : public Bfs< Digraph, DefReachedMapTraits<T> > {
+      typedef Bfs< Digraph, DefReachedMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetProcessedMapTraits : public Traits {
+    struct DefProcessedMapTraits : public Traits {
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "ProcessedMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type.
+    ///\ref ProcessedMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type.
+    ///\ref ProcessedMap type.
     template <class T>
-    struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > {
-      typedef Bfs< Digraph, SetProcessedMapTraits<T> > Create;
-    };
-
-    struct SetStandardProcessedMapTraits : public Traits {
+    struct DefProcessedMap : public Bfs< Digraph, DefProcessedMapTraits<T> > {
+      typedef Bfs< Digraph, DefProcessedMapTraits<T> > Create;
+    };
+
+    struct DefDigraphProcessedMapTraits : public Traits {
       typedef typename Digraph::template NodeMap<bool> ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &g)
       {
         return new ProcessedMap(g);
-        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///If you don't set it explicitly, it will be automatically allocated.
-    struct SetStandardProcessedMap :
-      public Bfs< Digraph, SetStandardProcessedMapTraits > {
-      typedef Bfs< Digraph, SetStandardProcessedMapTraits > Create;
+    template <class T>
+    struct DefProcessedMapToBeDefaultMap :
+      public Bfs< Digraph, DefDigraphProcessedMapTraits> {
+      typedef Bfs< Digraph, DefDigraphProcessedMapTraits> Create;
     };
 
@@ -600,9 +608,9 @@
     ///
     ///This method runs the %BFS algorithm from the root node(s)
-    ///in order to compute the shortest path to \c t.
+    ///in order to compute the shortest path to \c dest.
     ///
     ///The algorithm computes
-    ///- the shortest path to \c t,
-    ///- the distance of \c t from the root(s).
+    ///- the shortest path to \c dest,
+    ///- the distance of \c dest from the root(s).
     ///
     ///\pre init() must be called and at least one root node should be
@@ -616,8 +624,8 @@
     ///  }
     ///\endcode
-    void start(Node t)
+    void start(Node dest)
     {
       bool reach = false;
-      while ( !emptyQueue() && !reach ) processNextNode(t, reach);
+      while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
     }
 
@@ -657,5 +665,5 @@
     }
 
-    ///Runs the algorithm from the given source node.
+    ///Runs the algorithm from the given node.
 
     ///This method runs the %BFS algorithm from node \c s
@@ -681,8 +689,8 @@
 
     ///This method runs the %BFS algorithm from node \c s
-    ///in order to compute the shortest path to node \c t
-    ///(it stops searching when \c t is processed).
-    ///
-    ///\return \c true if \c t is reachable form \c s.
+    ///in order to compute the shortest path to \c t.
+    ///
+    ///\return The length of the shortest <tt>s</tt>--<tt>t</tt> path,
+    ///if \c t is reachable form \c s, \c 0 otherwise.
     ///
     ///\note Apart from the return value, <tt>b.run(s,t)</tt> is just a
@@ -693,9 +701,9 @@
     ///  b.start(t);
     ///\endcode
-    bool run(Node s,Node t) {
+    int run(Node s,Node t) {
       init();
       addSource(s);
       start(t);
-      return reached(t);
+      return reached(t) ? _curr_dist : 0;
     }
 
@@ -835,13 +843,18 @@
     ///arcs of the shortest paths.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
-    ///Instantiates a PredMap.
-
-    ///This function instantiates a PredMap.
+    typedef NullMap<typename Digraph::Node,typename Digraph::Arc> PredMap;
+    ///Instantiates a \ref PredMap.
+
+    ///This function instantiates a \ref PredMap.
     ///\param g is the digraph, to which we would like to define the
-    ///PredMap.
+    ///\ref PredMap.
+    ///\todo The digraph alone may be insufficient to initialize
+#ifdef DOXYGEN
     static PredMap *createPredMap(const Digraph &g)
-    {
-      return new PredMap(g);
+#else
+    static PredMap *createPredMap(const Digraph &)
+#endif
+    {
+      return new PredMap();
     }
 
@@ -850,11 +863,10 @@
     ///The type of the map that indicates which nodes are processed.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    ///By default it is a NullMap.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
-    ///Instantiates a ProcessedMap.
-
-    ///This function instantiates a ProcessedMap.
+    ///Instantiates a \ref ProcessedMap.
+
+    ///This function instantiates a \ref ProcessedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ProcessedMap.
+    ///we would like to define the \ref ProcessedMap.
 #ifdef DOXYGEN
     static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -871,9 +883,9 @@
     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
-    ///Instantiates a ReachedMap.
-
-    ///This function instantiates a ReachedMap.
+    ///Instantiates a \ref ReachedMap.
+
+    ///This function instantiates a \ref ReachedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ReachedMap.
+    ///we would like to define the \ref ReachedMap.
     static ReachedMap *createReachedMap(const Digraph &g)
     {
@@ -885,23 +897,22 @@
     ///The type of the map that stores the distances of the nodes.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    typedef typename Digraph::template NodeMap<int> DistMap;
-    ///Instantiates a DistMap.
-
-    ///This function instantiates a DistMap.
+    ///
+    typedef NullMap<typename Digraph::Node,int> DistMap;
+    ///Instantiates a \ref DistMap.
+
+    ///This function instantiates a \ref DistMap.
     ///\param g is the digraph, to which we would like to define
-    ///the DistMap
+    ///the \ref DistMap
+#ifdef DOXYGEN
     static DistMap *createDistMap(const Digraph &g)
-    {
-      return new DistMap(g);
-    }
-
-    ///The type of the shortest paths.
-
-    ///The type of the shortest paths.
-    ///It must meet the \ref concepts::Path "Path" concept.
-    typedef lemon::Path<Digraph> Path;
+#else
+    static DistMap *createDistMap(const Digraph &)
+#endif
+    {
+      return new DistMap();
+    }
   };
 
-  /// Default traits class used by BfsWizard
+  /// Default traits class used by \ref BfsWizard
 
   /// To make it easier to use Bfs algorithm
@@ -930,8 +941,6 @@
     //Pointer to the map of distances.
     void *_dist;
-    //Pointer to the shortest path to the target node.
-    void *_path;
-    //Pointer to the distance of the target node.
-    int *_di;
+    //Pointer to the source node.
+    Node _source;
 
     public:
@@ -939,28 +948,42 @@
 
     /// This constructor does not require parameters, therefore it initiates
-    /// all of the attributes to \c 0.
+    /// all of the attributes to default values (0, INVALID).
     BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
-                      _dist(0), _path(0), _di(0) {}
+                      _dist(0), _source(INVALID) {}
 
     /// Constructor.
 
-    /// This constructor requires one parameter,
-    /// others are initiated to \c 0.
+    /// This constructor requires some parameters,
+    /// listed in the parameters list.
+    /// Others are initiated to 0.
     /// \param g The digraph the algorithm runs on.
-    BfsWizardBase(const GR &g) :
+    /// \param s The source node.
+    BfsWizardBase(const GR &g, Node s=INVALID) :
       _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
-      _reached(0), _processed(0), _pred(0), _dist(0),  _path(0), _di(0) {}
+      _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
 
   };
 
-  /// Auxiliary class for the function-type interface of BFS algorithm.
-
-  /// This auxiliary class is created to implement the
-  /// \ref bfs() "function-type interface" of \ref Bfs algorithm.
-  /// It does not have own \ref run() method, it uses the functions
-  /// and features of the plain \ref Bfs.
+  /// Auxiliary class for the function type interface of BFS algorithm.
+
+  /// This auxiliary class is created to implement the function type
+  /// interface of \ref Bfs algorithm. It uses the functions and features
+  /// of the plain \ref Bfs, but it is much simpler to use it.
+  /// It should only be used through the \ref bfs() function, which makes
+  /// it easier to use the algorithm.
   ///
-  /// This class should only be used through the \ref bfs() function,
-  /// which makes it easier to use the algorithm.
+  /// Simplicity means that the way to change the types defined
+  /// in the traits class is based on functions that returns the new class
+  /// and not on templatable built-in classes.
+  /// When using the plain \ref Bfs
+  /// the new class with the modified type comes from
+  /// the original class by using the ::
+  /// operator. In the case of \ref BfsWizard only
+  /// a function have to be called, and it will
+  /// return the needed class.
+  ///
+  /// It does not have own \ref run() method. When its \ref run() method
+  /// is called, it initiates a plain \ref Bfs object, and calls the
+  /// \ref Bfs::run() method of it.
   template<class TR>
   class BfsWizard : public TR
@@ -985,6 +1008,4 @@
     ///\brief The type of the map that indicates which nodes are processed.
     typedef typename TR::ProcessedMap ProcessedMap;
-    ///The type of the shortest paths
-    typedef typename TR::Path Path;
 
   public:
@@ -997,7 +1018,6 @@
     /// Constructor that requires parameters.
     /// These parameters will be the default values for the traits class.
-    /// \param g The digraph the algorithm runs on.
-    BfsWizard(const Digraph &g) :
-      TR(g) {}
+    BfsWizard(const Digraph &g, Node s=INVALID) :
+      TR(g,s) {}
 
     ///Copy constructor
@@ -1006,176 +1026,129 @@
     ~BfsWizard() {}
 
-    ///Runs BFS algorithm from the given source node.
-
-    ///This method runs BFS algorithm from node \c s
-    ///in order to compute the shortest path to each node.
+    ///Runs BFS algorithm from a source node.
+
+    ///Runs BFS algorithm from a source node.
+    ///The node can be given with the \ref source() function.
+    void run()
+    {
+      if(Base::_source==INVALID) throw UninitializedParameter();
+      Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
+      if(Base::_reached)
+        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
+      if(Base::_processed)
+        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
+      if(Base::_pred)
+        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+      if(Base::_dist)
+        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
+      alg.run(Base::_source);
+    }
+
+    ///Runs BFS algorithm from the given node.
+
+    ///Runs BFS algorithm from the given node.
+    ///\param s is the given source.
     void run(Node s)
     {
-      Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
-      if (Base::_pred)
-        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
-      if (Base::_dist)
-        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
-      if (Base::_reached)
-        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
-      if (Base::_processed)
-        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
-      if (s!=INVALID)
-        alg.run(s);
-      else
-        alg.run();
-    }
-
-    ///Finds the shortest path between \c s and \c t.
-
-    ///This method runs BFS algorithm from node \c s
-    ///in order to compute the shortest path to node \c t
-    ///(it stops searching when \c t is processed).
-    ///
-    ///\return \c true if \c t is reachable form \c s.
-    bool run(Node s, Node t)
-    {
-      Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
-      if (Base::_pred)
-        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
-      if (Base::_dist)
-        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
-      if (Base::_reached)
-        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
-      if (Base::_processed)
-        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
-      alg.run(s,t);
-      if (Base::_path)
-        *reinterpret_cast<Path*>(Base::_path) = alg.path(t);
-      if (Base::_di)
-        *Base::_di = alg.dist(t);
-      return alg.reached(t);
-    }
-
-    ///Runs BFS algorithm to visit all nodes in the digraph.
-
-    ///This method runs BFS algorithm in order to compute
-    ///the shortest path to each node.
-    void run()
-    {
-      run(INVALID);
+      Base::_source=s;
+      run();
+    }
+
+    /// Sets the source node, from which the Bfs algorithm runs.
+
+    /// Sets the source node, from which the Bfs algorithm runs.
+    /// \param s is the source node.
+    BfsWizard<TR> &source(Node s)
+    {
+      Base::_source=s;
+      return *this;
     }
 
     template<class T>
-    struct SetPredMapBase : public Base {
+    struct DefPredMapBase : public Base {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &) { return 0; };
-      SetPredMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting PredMap object.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for setting PredMap object.
+      DefPredMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref PredMap object.
+    ///
+    /// \ref named-templ-param "Named parameter"
+    ///for setting \ref PredMap object.
     template<class T>
-    BfsWizard<SetPredMapBase<T> > predMap(const T &t)
+    BfsWizard<DefPredMapBase<T> > predMap(const T &t)
     {
       Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<SetPredMapBase<T> >(*this);
+      return BfsWizard<DefPredMapBase<T> >(*this);
     }
 
     template<class T>
-    struct SetReachedMapBase : public Base {
+    struct DefReachedMapBase : public Base {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &) { return 0; };
-      SetReachedMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting ReachedMap object.
-    ///
-    /// \ref named-func-param "Named parameter"
-    ///for setting ReachedMap object.
+      DefReachedMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref ReachedMap object.
+    ///
+    /// \ref named-templ-param "Named parameter"
+    ///for setting \ref ReachedMap object.
     template<class T>
-    BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
+    BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
     {
       Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<SetReachedMapBase<T> >(*this);
+      return BfsWizard<DefReachedMapBase<T> >(*this);
     }
 
     template<class T>
-    struct SetDistMapBase : public Base {
+    struct DefProcessedMapBase : public Base {
+      typedef T ProcessedMap;
+      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
+      DefProcessedMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref ProcessedMap object.
+    ///
+    /// \ref named-templ-param "Named parameter"
+    ///for setting \ref ProcessedMap object.
+    template<class T>
+    BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
+    {
+      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
+      return BfsWizard<DefProcessedMapBase<T> >(*this);
+    }
+
+    template<class T>
+    struct DefDistMapBase : public Base {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &) { return 0; };
-      SetDistMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting DistMap object.
-    ///
-    /// \ref named-func-param "Named parameter"
-    ///for setting DistMap object.
+      DefDistMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref DistMap object.
+    ///
+    /// \ref named-templ-param "Named parameter"
+    ///for setting \ref DistMap object.
     template<class T>
-    BfsWizard<SetDistMapBase<T> > distMap(const T &t)
+    BfsWizard<DefDistMapBase<T> > distMap(const T &t)
     {
       Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<SetDistMapBase<T> >(*this);
-    }
-
-    template<class T>
-    struct SetProcessedMapBase : public Base {
-      typedef T ProcessedMap;
-      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
-      SetProcessedMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting ProcessedMap object.
-    ///
-    /// \ref named-func-param "Named parameter"
-    ///for setting ProcessedMap object.
-    template<class T>
-    BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
-    {
-      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<SetProcessedMapBase<T> >(*this);
-    }
-
-    template<class T>
-    struct SetPathBase : public Base {
-      typedef T Path;
-      SetPathBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for getting the shortest path to the target node.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for getting the shortest path to the target node.
-    template<class T>
-    BfsWizard<SetPathBase<T> > path(const T &t)
-    {
-      Base::_path=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return BfsWizard<SetPathBase<T> >(*this);
-    }
-
-    ///\brief \ref named-func-param "Named parameter"
-    ///for getting the distance of the target node.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for getting the distance of the target node.
-    BfsWizard dist(const int &d)
-    {
-      Base::_di=const_cast<int*>(&d);
-      return *this;
+      return BfsWizard<DefDistMapBase<T> >(*this);
     }
 
   };
 
-  ///Function-type interface for BFS algorithm.
+  ///Function type interface for Bfs algorithm.
 
   /// \ingroup search
-  ///Function-type interface for BFS algorithm.
+  ///Function type interface for Bfs algorithm.
   ///
-  ///This function also has several \ref named-func-param "named parameters",
+  ///This function also has several
+  ///\ref named-templ-func-param "named parameters",
   ///they are declared as the members of class \ref BfsWizard.
-  ///The following examples show how to use these parameters.
+  ///The following
+  ///example shows how to use these parameters.
   ///\code
-  ///  // Compute shortest path from node s to each node
-  ///  bfs(g).predMap(preds).distMap(dists).run(s);
-  ///
-  ///  // Compute shortest path from s to t
-  ///  bool reached = bfs(g).path(p).dist(d).run(s,t);
+  ///  bfs(g,source).predMap(preds).run();
   ///\endcode
   ///\warning Don't forget to put the \ref BfsWizard::run() "run()"
@@ -1185,7 +1158,7 @@
   template<class GR>
   BfsWizard<BfsWizardBase<GR> >
-  bfs(const GR &digraph)
+  bfs(const GR &g,typename GR::Node s=INVALID)
   {
-    return BfsWizard<BfsWizardBase<GR> >(digraph);
+    return BfsWizard<BfsWizardBase<GR> >(g,s);
   }
 
@@ -1268,9 +1241,9 @@
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
 
-    /// \brief Instantiates a ReachedMap.
-    ///
-    /// This function instantiates a ReachedMap.
+    /// \brief Instantiates a \ref ReachedMap.
+    ///
+    /// This function instantiates a \ref ReachedMap.
     /// \param digraph is the digraph, to which
-    /// we would like to define the ReachedMap.
+    /// we would like to define the \ref ReachedMap.
     static ReachedMap *createReachedMap(const Digraph &digraph) {
       return new ReachedMap(digraph);
@@ -1313,8 +1286,20 @@
   template <typename _Digraph = ListDigraph,
             typename _Visitor = BfsVisitor<_Digraph>,
-            typename _Traits = BfsVisitDefaultTraits<_Digraph> >
+            typename _Traits = BfsDefaultTraits<_Digraph> >
 #endif
   class BfsVisit {
   public:
+
+    /// \brief \ref Exception for uninitialized parameters.
+    ///
+    /// This error represents problems in the initialization
+    /// of the parameters of the algorithm.
+    class UninitializedParameter : public lemon::UninitializedParameter {
+    public:
+      virtual const char* what() const throw()
+      {
+        return "lemon::BfsVisit::UninitializedParameter";
+      }
+    };
 
     ///The traits class.
@@ -1349,5 +1334,6 @@
     int _list_front, _list_back;
 
-    //Creates the maps if necessary.
+    ///Creates the maps if necessary.
+    ///\todo Better memory allocation (instead of new).
     void create_maps() {
       if(!_reached) {
@@ -1369,9 +1355,8 @@
     ///@{
     template <class T>
-    struct SetReachedMapTraits : public Traits {
+    struct DefReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &digraph) {
-        LEMON_ASSERT(false, "ReachedMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
@@ -1381,7 +1366,7 @@
     /// \ref named-templ-param "Named parameter" for setting ReachedMap type.
     template <class T>
-    struct SetReachedMap : public BfsVisit< Digraph, Visitor,
-                                            SetReachedMapTraits<T> > {
-      typedef BfsVisit< Digraph, Visitor, SetReachedMapTraits<T> > Create;
+    struct DefReachedMap : public BfsVisit< Digraph, Visitor,
+                                            DefReachedMapTraits<T> > {
+      typedef BfsVisit< Digraph, Visitor, DefReachedMapTraits<T> > Create;
     };
     ///@}
@@ -1600,9 +1585,9 @@
     ///
     /// This method runs the %BFS algorithm from the root node(s)
-    /// in order to compute the shortest path to \c t.
+    /// in order to compute the shortest path to \c dest.
     ///
     /// The algorithm computes
-    /// - the shortest path to \c t,
-    /// - the distance of \c t from the root(s).
+    /// - the shortest path to \c dest,
+    /// - the distance of \c dest from the root(s).
     ///
     /// \pre init() must be called and at least one root node should be
@@ -1616,7 +1601,7 @@
     ///   }
     /// \endcode
-    void start(Node t) {
+    void start(Node dest) {
       bool reach = false;
-      while ( !emptyQueue() && !reach ) processNextNode(t, reach);
+      while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
     }
 
@@ -1656,5 +1641,5 @@
     }
 
-    /// \brief Runs the algorithm from the given source node.
+    /// \brief Runs the algorithm from the given node.
     ///
     /// This method runs the %BFS algorithm from node \c s
@@ -1675,26 +1660,4 @@
       addSource(s);
       start();
-    }
-
-    /// \brief Finds the shortest path between \c s and \c t.
-    ///
-    /// This method runs the %BFS algorithm from node \c s
-    /// in order to compute the shortest path to node \c t
-    /// (it stops searching when \c t is processed).
-    ///
-    /// \return \c true if \c t is reachable form \c s.
-    ///
-    /// \note Apart from the return value, <tt>b.run(s,t)</tt> is just a
-    /// shortcut of the following code.
-    ///\code
-    ///   b.init();
-    ///   b.addSource(s);
-    ///   b.start(t);
-    ///\endcode
-    bool run(Node s,Node t) {
-      init();
-      addSource(s);
-      start(t);
-      return reached(t);
     }
 
Index: lemon/bits/alteration_notifier.h
===================================================================
--- lemon/bits/alteration_notifier.h	(revision 314)
+++ lemon/bits/alteration_notifier.h	(revision 236)
@@ -25,73 +25,74 @@
 #include <lemon/core.h>
 
-//\ingroup graphbits
-//\file
-//\brief Observer notifier for graph alteration observers.
+///\ingroup graphbits
+///\file
+///\brief Observer notifier for graph alteration observers.
 
 namespace lemon {
 
-  // \ingroup graphbits
-  //
-  // \brief Notifier class to notify observes about alterations in
-  // a container.
-  //
-  // The simple graph's can be refered as two containers, one node container
-  // and one edge container. But they are not standard containers they
-  // does not store values directly they are just key continars for more
-  // value containers which are the node and edge maps.
-  //
-  // The graph's node and edge sets can be changed as we add or erase
-  // nodes and edges in the graph. LEMON would like to handle easily
-  // that the node and edge maps should contain values for all nodes or
-  // edges. If we want to check on every indicing if the map contains
-  // the current indicing key that cause a drawback in the performance
-  // in the library. We use another solution we notify all maps about
-  // an alteration in the graph, which cause only drawback on the
-  // alteration of the graph.
-  //
-  // This class provides an interface to the container. The \e first() and \e
-  // next() member functions make possible to iterate on the keys of the
-  // container. The \e id() function returns an integer id for each key.
-  // The \e maxId() function gives back an upper bound of the ids.
-  //
-  // For the proper functonality of this class, we should notify it
-  // about each alteration in the container. The alterations have four type
-  // as \e add(), \e erase(), \e build() and \e clear(). The \e add() and
-  // \e erase() signals that only one or few items added or erased to or
-  // from the graph. If all items are erased from the graph or from an empty
-  // graph a new graph is builded then it can be signaled with the
-  // clear() and build() members. Important rule that if we erase items
-  // from graph we should first signal the alteration and after that erase
-  // them from the container, on the other way on item addition we should
-  // first extend the container and just after that signal the alteration.
-  //
-  // The alteration can be observed with a class inherited from the
-  // \e ObserverBase nested class. The signals can be handled with
-  // overriding the virtual functions defined in the base class.  The
-  // observer base can be attached to the notifier with the
-  // \e attach() member and can be detached with detach() function. The
-  // alteration handlers should not call any function which signals
-  // an other alteration in the same notifier and should not
-  // detach any observer from the notifier.
-  //
-  // Alteration observers try to be exception safe. If an \e add() or
-  // a \e clear() function throws an exception then the remaining
-  // observeres will not be notified and the fulfilled additions will
-  // be rolled back by calling the \e erase() or \e clear()
-  // functions. Thence the \e erase() and \e clear() should not throw
-  // exception. Actullay, it can be throw only \ref ImmediateDetach
-  // exception which detach the observer from the notifier.
-  //
-  // There are some place when the alteration observing is not completly
-  // reliable. If we want to carry out the node degree in the graph
-  // as in the \ref InDegMap and we use the reverseEdge that cause
-  // unreliable functionality. Because the alteration observing signals
-  // only erasing and adding but not the reversing it will stores bad
-  // degrees. The sub graph adaptors cannot signal the alterations because
-  // just a setting in the filter map can modify the graph and this cannot
-  // be watched in any way.
-  //
-  // \param _Container The container which is observed.
-  // \param _Item The item type which is obserbved.
+  /// \ingroup graphbits
+  ///
+  /// \brief Notifier class to notify observes about alterations in
+  /// a container.
+  ///
+  /// The simple graph's can be refered as two containers, one node container
+  /// and one edge container. But they are not standard containers they
+  /// does not store values directly they are just key continars for more
+  /// value containers which are the node and edge maps.
+  ///
+  /// The graph's node and edge sets can be changed as we add or erase
+  /// nodes and edges in the graph. LEMON would like to handle easily
+  /// that the node and edge maps should contain values for all nodes or
+  /// edges. If we want to check on every indicing if the map contains
+  /// the current indicing key that cause a drawback in the performance
+  /// in the library. We use another solution we notify all maps about
+  /// an alteration in the graph, which cause only drawback on the
+  /// alteration of the graph.
+  ///
+  /// This class provides an interface to the container. The \e first() and \e
+  /// next() member functions make possible to iterate on the keys of the
+  /// container. The \e id() function returns an integer id for each key.
+  /// The \e maxId() function gives back an upper bound of the ids.
+  ///
+  /// For the proper functonality of this class, we should notify it
+  /// about each alteration in the container. The alterations have four type
+  /// as \e add(), \e erase(), \e build() and \e clear(). The \e add() and
+  /// \e erase() signals that only one or few items added or erased to or
+  /// from the graph. If all items are erased from the graph or from an empty
+  /// graph a new graph is builded then it can be signaled with the
+  /// clear() and build() members. Important rule that if we erase items
+  /// from graph we should first signal the alteration and after that erase
+  /// them from the container, on the other way on item addition we should
+  /// first extend the container and just after that signal the alteration.
+  ///
+  /// The alteration can be observed with a class inherited from the
+  /// \e ObserverBase nested class. The signals can be handled with
+  /// overriding the virtual functions defined in the base class.  The
+  /// observer base can be attached to the notifier with the
+  /// \e attach() member and can be detached with detach() function. The
+  /// alteration handlers should not call any function which signals
+  /// an other alteration in the same notifier and should not
+  /// detach any observer from the notifier.
+  ///
+  /// Alteration observers try to be exception safe. If an \e add() or
+  /// a \e clear() function throws an exception then the remaining
+  /// observeres will not be notified and the fulfilled additions will
+  /// be rolled back by calling the \e erase() or \e clear()
+  /// functions. Thence the \e erase() and \e clear() should not throw
+  /// exception. Actullay, it can be throw only
+  /// \ref AlterationObserver::ImmediateDetach ImmediateDetach
+  /// exception which detach the observer from the notifier.
+  ///
+  /// There are some place when the alteration observing is not completly
+  /// reliable. If we want to carry out the node degree in the graph
+  /// as in the \ref InDegMap and we use the reverseEdge that cause
+  /// unreliable functionality. Because the alteration observing signals
+  /// only erasing and adding but not the reversing it will stores bad
+  /// degrees. The sub graph adaptors cannot signal the alterations because
+  /// just a setting in the filter map can modify the graph and this cannot
+  /// be watched in any way.
+  ///
+  /// \param _Container The container which is observed.
+  /// \param _Item The item type which is obserbved.
 
   template <typename _Container, typename _Item>
@@ -104,28 +105,29 @@
     typedef _Item Item;
 
-    // \brief Exception which can be called from \e clear() and
-    // \e erase().
-    //
-    // From the \e clear() and \e erase() function only this
-    // exception is allowed to throw. The exception immediatly
-    // detaches the current observer from the notifier. Because the
-    // \e clear() and \e erase() should not throw other exceptions
-    // it can be used to invalidate the observer.
+    /// \brief Exception which can be called from \e clear() and
+    /// \e erase().
+    ///
+    /// From the \e clear() and \e erase() function only this
+    /// exception is allowed to throw. The exception immediatly
+    /// detaches the current observer from the notifier. Because the
+    /// \e clear() and \e erase() should not throw other exceptions
+    /// it can be used to invalidate the observer.
     struct ImmediateDetach {};
 
-    // \brief ObserverBase is the base class for the observers.
-    //
-    // ObserverBase is the abstract base class for the observers.
-    // It will be notified about an item was inserted into or
-    // erased from the graph.
-    //
-    // The observer interface contains some pure virtual functions
-    // to override. The add() and erase() functions are
-    // to notify the oberver when one item is added or
-    // erased.
-    //
-    // The build() and clear() members are to notify the observer
-    // about the container is built from an empty container or
-    // is cleared to an empty container.
+    /// \brief ObserverBase is the base class for the observers.
+    ///
+    /// ObserverBase is the abstract base class for the observers.
+    /// It will be notified about an item was inserted into or
+    /// erased from the graph.
+    ///
+    /// The observer interface contains some pure virtual functions
+    /// to override. The add() and erase() functions are
+    /// to notify the oberver when one item is added or
+    /// erased.
+    ///
+    /// The build() and clear() members are to notify the observer
+    /// about the container is built from an empty container or
+    /// is cleared to an empty container.
+
     class ObserverBase {
     protected:
@@ -134,20 +136,21 @@
       friend class AlterationNotifier;
 
-      // \brief Default constructor.
-      //
-      // Default constructor for ObserverBase.
+      /// \brief Default constructor.
+      ///
+      /// Default constructor for ObserverBase.
+      ///
       ObserverBase() : _notifier(0) {}
 
-      // \brief Constructor which attach the observer into notifier.
-      //
-      // Constructor which attach the observer into notifier.
+      /// \brief Constructor which attach the observer into notifier.
+      ///
+      /// Constructor which attach the observer into notifier.
       ObserverBase(AlterationNotifier& nf) {
         attach(nf);
       }
 
-      // \brief Constructor which attach the obserever to the same notifier.
-      //
-      // Constructor which attach the obserever to the same notifier as
-      // the other observer is attached to.
+      /// \brief Constructor which attach the obserever to the same notifier.
+      ///
+      /// Constructor which attach the obserever to the same notifier as
+      /// the other observer is attached to.
       ObserverBase(const ObserverBase& copy) {
         if (copy.attached()) {
@@ -156,5 +159,5 @@
       }
 
-      // \brief Destructor
+      /// \brief Destructor
       virtual ~ObserverBase() {
         if (attached()) {
@@ -163,26 +166,29 @@
       }
 
-      // \brief Attaches the observer into an AlterationNotifier.
-      //
-      // This member attaches the observer into an AlterationNotifier.
+      /// \brief Attaches the observer into an AlterationNotifier.
+      ///
+      /// This member attaches the observer into an AlterationNotifier.
+      ///
       void attach(AlterationNotifier& nf) {
         nf.attach(*this);
       }
 
-      // \brief Detaches the observer into an AlterationNotifier.
-      //
-      // This member detaches the observer from an AlterationNotifier.
+      /// \brief Detaches the observer into an AlterationNotifier.
+      ///
+      /// This member detaches the observer from an AlterationNotifier.
+      ///
       void detach() {
         _notifier->detach(*this);
       }
 
-      // \brief Gives back a pointer to the notifier which the map
-      // attached into.
-      //
-      // This function gives back a pointer to the notifier which the map
-      // attached into.
+      /// \brief Gives back a pointer to the notifier which the map
+      /// attached into.
+      ///
+      /// This function gives back a pointer to the notifier which the map
+      /// attached into.
+      ///
       Notifier* notifier() const { return const_cast<Notifier*>(_notifier); }
 
-      // Gives back true when the observer is attached into a notifier.
+      /// Gives back true when the observer is attached into a notifier.
       bool attached() const { return _notifier != 0; }
 
@@ -196,50 +202,51 @@
       typename std::list<ObserverBase*>::iterator _index;
 
-      // \brief The member function to notificate the observer about an
-      // item is added to the container.
-      //
-      // The add() member function notificates the observer about an item
-      // is added to the container. It have to be overrided in the
-      // subclasses.
+      /// \brief The member function to notificate the observer about an
+      /// item is added to the container.
+      ///
+      /// The add() member function notificates the observer about an item
+      /// is added to the container. It have to be overrided in the
+      /// subclasses.
       virtual void add(const Item&) = 0;
 
-      // \brief The member function to notificate the observer about
-      // more item is added to the container.
-      //
-      // The add() member function notificates the observer about more item
-      // is added to the container. It have to be overrided in the
-      // subclasses.
+      /// \brief The member function to notificate the observer about
+      /// more item is added to the container.
+      ///
+      /// The add() member function notificates the observer about more item
+      /// is added to the container. It have to be overrided in the
+      /// subclasses.
       virtual void add(const std::vector<Item>& items) = 0;
 
-      // \brief The member function to notificate the observer about an
-      // item is erased from the container.
-      //
-      // The erase() member function notificates the observer about an
-      // item is erased from the container. It have to be overrided in
-      // the subclasses.
+      /// \brief The member function to notificate the observer about an
+      /// item is erased from the container.
+      ///
+      /// The erase() member function notificates the observer about an
+      /// item is erased from the container. It have to be overrided in
+      /// the subclasses.
       virtual void erase(const Item&) = 0;
 
-      // \brief The member function to notificate the observer about
-      // more item is erased from the container.
-      //
-      // The erase() member function notificates the observer about more item
-      // is erased from the container. It have to be overrided in the
-      // subclasses.
+      /// \brief The member function to notificate the observer about
+      /// more item is erased from the container.
+      ///
+      /// The erase() member function notificates the observer about more item
+      /// is erased from the container. It have to be overrided in the
+      /// subclasses.
       virtual void erase(const std::vector<Item>& items) = 0;
 
-      // \brief The member function to notificate the observer about the
-      // container is built.
-      //
-      // The build() member function notificates the observer about the
-      // container is built from an empty container. It have to be
-      // overrided in the subclasses.
+      /// \brief The member function to notificate the observer about the
+      /// container is built.
+      ///
+      /// The build() member function notificates the observer about the
+      /// container is built from an empty container. It have to be
+      /// overrided in the subclasses.
+
       virtual void build() = 0;
 
-      // \brief The member function to notificate the observer about all
-      // items are erased from the container.
-      //
-      // The clear() member function notificates the observer about all
-      // items are erased from the container. It have to be overrided in
-      // the subclasses.
+      /// \brief The member function to notificate the observer about all
+      /// items are erased from the container.
+      ///
+      /// The clear() member function notificates the observer about all
+      /// items are erased from the container. It have to be overrided in
+      /// the subclasses.
       virtual void clear() = 0;
 
@@ -256,28 +263,29 @@
   public:
 
-    // \brief Default constructor.
-    //
-    // The default constructor of the AlterationNotifier.
-    // It creates an empty notifier.
+    /// \brief Default constructor.
+    ///
+    /// The default constructor of the AlterationNotifier.
+    /// It creates an empty notifier.
     AlterationNotifier()
       : container(0) {}
 
-    // \brief Constructor.
-    //
-    // Constructor with the observed container parameter.
+    /// \brief Constructor.
+    ///
+    /// Constructor with the observed container parameter.
     AlterationNotifier(const Container& _container)
       : container(&_container) {}
 
-    // \brief Copy Constructor of the AlterationNotifier.
-    //
-    // Copy constructor of the AlterationNotifier.
-    // It creates only an empty notifier because the copiable
-    // notifier's observers have to be registered still into that notifier.
+    /// \brief Copy Constructor of the AlterationNotifier.
+    ///
+    /// Copy constructor of the AlterationNotifier.
+    /// It creates only an empty notifier because the copiable
+    /// notifier's observers have to be registered still into that notifier.
     AlterationNotifier(const AlterationNotifier& _notifier)
       : container(_notifier.container) {}
 
-    // \brief Destructor.
-    //
-    // Destructor of the AlterationNotifier.
+    /// \brief Destructor.
+    ///
+    /// Destructor of the AlterationNotifier.
+    ///
     ~AlterationNotifier() {
       typename Observers::iterator it;
@@ -287,7 +295,7 @@
     }
 
-    // \brief Sets the container.
-    //
-    // Sets the container.
+    /// \brief Sets the container.
+    ///
+    /// Sets the container.
     void setContainer(const Container& _container) {
       container = &_container;
@@ -300,30 +308,32 @@
   public:
 
-    // \brief First item in the container.
-    //
-    // Returns the first item in the container. It is
-    // for start the iteration on the container.
+
+
+    /// \brief First item in the container.
+    ///
+    /// Returns the first item in the container. It is
+    /// for start the iteration on the container.
     void first(Item& item) const {
       container->first(item);
     }
 
-    // \brief Next item in the container.
-    //
-    // Returns the next item in the container. It is
-    // for iterate on the container.
+    /// \brief Next item in the container.
+    ///
+    /// Returns the next item in the container. It is
+    /// for iterate on the container.
     void next(Item& item) const {
       container->next(item);
     }
 
-    // \brief Returns the id of the item.
-    //
-    // Returns the id of the item provided by the container.
+    /// \brief Returns the id of the item.
+    ///
+    /// Returns the id of the item provided by the container.
     int id(const Item& item) const {
       return container->id(item);
     }
 
-    // \brief Returns the maximum id of the container.
-    //
-    // Returns the maximum id of the container.
+    /// \brief Returns the maximum id of the container.
+    ///
+    /// Returns the maximum id of the container.
     int maxId() const {
       return container->maxId(Item());
@@ -345,9 +355,10 @@
   public:
 
-    // \brief Notifies all the registed observers about an item added to
-    // the container.
-    //
-    // It notifies all the registed observers about an item added to
-    // the container.
+    /// \brief Notifies all the registed observers about an item added to
+    /// the container.
+    ///
+    /// It notifies all the registed observers about an item added to
+    /// the container.
+    ///
     void add(const Item& item) {
       typename Observers::reverse_iterator it;
@@ -365,9 +376,10 @@
     }
 
-    // \brief Notifies all the registed observers about more item added to
-    // the container.
-    //
-    // It notifies all the registed observers about more item added to
-    // the container.
+    /// \brief Notifies all the registed observers about more item added to
+    /// the container.
+    ///
+    /// It notifies all the registed observers about more item added to
+    /// the container.
+    ///
     void add(const std::vector<Item>& items) {
       typename Observers::reverse_iterator it;
@@ -385,9 +397,10 @@
     }
 
-    // \brief Notifies all the registed observers about an item erased from
-    // the container.
-    //
-    // It notifies all the registed observers about an item erased from
-    // the container.
+    /// \brief Notifies all the registed observers about an item erased from
+    /// the container.
+    ///
+    /// It notifies all the registed observers about an item erased from
+    /// the container.
+    ///
     void erase(const Item& item) throw() {
       typename Observers::iterator it = _observers.begin();
@@ -404,9 +417,10 @@
     }
 
-    // \brief Notifies all the registed observers about more item erased
-    // from the container.
-    //
-    // It notifies all the registed observers about more item erased from
-    // the container.
+    /// \brief Notifies all the registed observers about more item erased
+    /// from the container.
+    ///
+    /// It notifies all the registed observers about more item erased from
+    /// the container.
+    ///
     void erase(const std::vector<Item>& items) {
       typename Observers::iterator it = _observers.begin();
@@ -423,9 +437,9 @@
     }
 
-    // \brief Notifies all the registed observers about the container is
-    // built.
-    //
-    // Notifies all the registed observers about the container is built
-    // from an empty container.
+    /// \brief Notifies all the registed observers about the container is
+    /// built.
+    ///
+    /// Notifies all the registed observers about the container is built
+    /// from an empty container.
     void build() {
       typename Observers::reverse_iterator it;
@@ -443,9 +457,9 @@
     }
 
-    // \brief Notifies all the registed observers about all items are
-    // erased.
-    //
-    // Notifies all the registed observers about all items are erased
-    // from the container.
+    /// \brief Notifies all the registed observers about all items are
+    /// erased.
+    ///
+    /// Notifies all the registed observers about all items are erased
+    /// from the container.
     void clear() {
       typename Observers::iterator it = _observers.begin();
Index: lemon/bits/array_map.h
===================================================================
--- lemon/bits/array_map.h	(revision 314)
+++ lemon/bits/array_map.h	(revision 209)
@@ -27,46 +27,46 @@
 #include <lemon/concepts/maps.h>
 
-// \ingroup graphbits
-// \file
-// \brief Graph map based on the array storage.
+/// \ingroup graphbits
+/// \file
+/// \brief Graph map based on the array storage.
 
 namespace lemon {
 
-  // \ingroup graphbits
-  //
-  // \brief Graph map based on the array storage.
-  //
-  // The ArrayMap template class is graph map structure what
-  // automatically updates the map when a key is added to or erased from
-  // the map. This map uses the allocators to implement
-  // the container functionality.
-  //
-  // The template parameters are the Graph the current Item type and
-  // the Value type of the map.
+  /// \ingroup graphbits
+  ///
+  /// \brief Graph map based on the array storage.
+  ///
+  /// The ArrayMap template class is graph map structure what
+  /// automatically updates the map when a key is added to or erased from
+  /// the map. This map uses the allocators to implement
+  /// the container functionality.
+  ///
+  /// The template parameters are the Graph the current Item type and
+  /// the Value type of the map.
   template <typename _Graph, typename _Item, typename _Value>
   class ArrayMap
     : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
   public:
-    // The graph type of the maps.
+    /// The graph type of the maps.
     typedef _Graph Graph;
-    // The item type of the map.
+    /// The item type of the map.
     typedef _Item Item;
-    // The reference map tag.
+    /// The reference map tag.
     typedef True ReferenceMapTag;
 
-    // The key type of the maps.
+    /// The key type of the maps.
     typedef _Item Key;
-    // The value type of the map.
+    /// The value type of the map.
     typedef _Value Value;
 
-    // The const reference type of the map.
+    /// The const reference type of the map.
     typedef const _Value& ConstReference;
-    // The reference type of the map.
+    /// The reference type of the map.
     typedef _Value& Reference;
 
-    // The notifier type.
+    /// The notifier type.
     typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
 
-    // The MapBase of the Map which imlements the core regisitry function.
+    /// The MapBase of the Map which imlements the core regisitry function.
     typedef typename Notifier::ObserverBase Parent;
 
@@ -76,7 +76,7 @@
   public:
 
-    // \brief Graph initialized map constructor.
-    //
-    // Graph initialized map constructor.
+    /// \brief Graph initialized map constructor.
+    ///
+    /// Graph initialized map constructor.
     explicit ArrayMap(const Graph& graph) {
       Parent::attach(graph.notifier(Item()));
@@ -90,7 +90,7 @@
     }
 
-    // \brief Constructor to use default value to initialize the map.
-    //
-    // It constructs a map and initialize all of the the map.
+    /// \brief Constructor to use default value to initialize the map.
+    ///
+    /// It constructs a map and initialize all of the the map.
     ArrayMap(const Graph& graph, const Value& value) {
       Parent::attach(graph.notifier(Item()));
@@ -104,8 +104,7 @@
     }
 
-  private:
-    // \brief Constructor to copy a map of the same map type.
-    //
-    // Constructor to copy a map of the same map type.
+    /// \brief Constructor to copy a map of the same map type.
+    ///
+    /// Constructor to copy a map of the same map type.
     ArrayMap(const ArrayMap& copy) : Parent() {
       if (copy.attached()) {
@@ -123,11 +122,11 @@
     }
 
-    // \brief Assign operator.
-    //
-    // This operator assigns for each item in the map the
-    // value mapped to the same item in the copied map.
-    // The parameter map should be indiced with the same
-    // itemset because this assign operator does not change
-    // the container of the map.
+    /// \brief Assign operator.
+    ///
+    /// This operator assigns for each item in the map the
+    /// value mapped to the same item in the copied map.
+    /// The parameter map should be indiced with the same
+    /// itemset because this assign operator does not change
+    /// the container of the map.
     ArrayMap& operator=(const ArrayMap& cmap) {
       return operator=<ArrayMap>(cmap);
@@ -135,10 +134,10 @@
 
 
-    // \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.
+    /// \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>
     ArrayMap& operator=(const CMap& cmap) {
@@ -152,8 +151,7 @@
     }
 
-  public:
-    // \brief The destructor of the map.
-    //
-    // The destructor of the map.
+    /// \brief The destructor of the map.
+    ///
+    /// The destructor of the map.
     virtual ~ArrayMap() {
       if (attached()) {
@@ -171,8 +169,8 @@
   public:
 
-    // \brief The subscript operator.
-    //
-    // The subscript operator. The map can be subscripted by the
-    // actual keys of the graph.
+    /// \brief The subscript operator.
+    ///
+    /// The subscript operator. The map can be subscripted by the
+    /// actual keys of the graph.
     Value& operator[](const Key& key) {
       int id = Parent::notifier()->id(key);
@@ -180,8 +178,8 @@
     }
 
-    // \brief The const subscript operator.
-    //
-    // The const subscript operator. The map can be subscripted by the
-    // actual keys of the graph.
+    /// \brief The const subscript operator.
+    ///
+    /// The const subscript operator. The map can be subscripted by the
+    /// actual keys of the graph.
     const Value& operator[](const Key& key) const {
       int id = Parent::notifier()->id(key);
@@ -189,8 +187,8 @@
     }
 
-    // \brief Setter function of the map.
-    //
-    // Setter function of the map. Equivalent with map[key] = val.
-    // This is a compatibility feature with the not dereferable maps.
+    /// \brief Setter function of the map.
+    ///
+    /// Setter function of the map. Equivalent with map[key] = val.
+    /// This is a compatibility feature with the not dereferable maps.
     void set(const Key& key, const Value& val) {
       (*this)[key] = val;
@@ -199,8 +197,8 @@
   protected:
 
-    // \brief Adds a new key to the map.
-    //
-    // It adds a new key to the map. It called by the observer notifier
-    // and it overrides the add() member function of the observer base.
+    /// \brief Adds a new key to the map.
+    ///
+    /// It adds a new key to the map. It called by the observer notifier
+    /// and it overrides the add() member function of the observer base.
     virtual void add(const Key& key) {
       Notifier* nf = Parent::notifier();
@@ -227,8 +225,8 @@
     }
 
-    // \brief Adds more new keys to the map.
-    //
-    // It adds more new keys to the map. It called by the observer notifier
-    // and it overrides the add() member function of the observer base.
+    /// \brief Adds more new keys to the map.
+    ///
+    /// It adds more new keys to the map. It called by the observer notifier
+    /// and it overrides the add() member function of the observer base.
     virtual void add(const std::vector<Key>& keys) {
       Notifier* nf = Parent::notifier();
@@ -271,8 +269,8 @@
     }
 
-    // \brief Erase a key from the map.
-    //
-    // Erase a key from the map. It called by the observer notifier
-    // and it overrides the erase() member function of the observer base.
+    /// \brief Erase a key from the map.
+    ///
+    /// Erase a key from the map. It called by the observer notifier
+    /// and it overrides the erase() member function of the observer base.
     virtual void erase(const Key& key) {
       int id = Parent::notifier()->id(key);
@@ -280,8 +278,8 @@
     }
 
-    // \brief Erase more keys from the map.
-    //
-    // Erase more keys from the map. It called by the observer notifier
-    // and it overrides the erase() member function of the observer base.
+    /// \brief Erase more keys from the map.
+    ///
+    /// Erase more keys from the map. It called by the observer notifier
+    /// and it overrides the erase() member function of the observer base.
     virtual void erase(const std::vector<Key>& keys) {
       for (int i = 0; i < int(keys.size()); ++i) {
@@ -291,8 +289,8 @@
     }
 
-    // \brief Buildes the map.
-    //
-    // It buildes the map. It called by the observer notifier
-    // and it overrides the build() member function of the observer base.
+    /// \brief Buildes the map.
+    ///
+    /// It buildes the map. It called by the observer notifier
+    /// and it overrides the build() member function of the observer base.
     virtual void build() {
       Notifier* nf = Parent::notifier();
@@ -305,8 +303,8 @@
     }
 
-    // \brief Clear the map.
-    //
-    // It erase all items from the map. It called by the observer notifier
-    // and it overrides the clear() member function of the observer base.
+    /// \brief Clear the map.
+    ///
+    /// It erase all items from the map. It called by the observer notifier
+    /// and it overrides the clear() member function of the observer base.
     virtual void clear() {
       Notifier* nf = Parent::notifier();
Index: lemon/bits/base_extender.h
===================================================================
--- lemon/bits/base_extender.h	(revision 314)
+++ lemon/bits/base_extender.h	(revision 256)
@@ -29,12 +29,12 @@
 #include <lemon/concepts/maps.h>
 
-//\ingroup digraphbits
-//\file
-//\brief Extenders for the digraph types
+///\ingroup digraphbits
+///\file
+///\brief Extenders for the digraph types
 namespace lemon {
 
-  // \ingroup digraphbits
-  //
-  // \brief BaseDigraph to BaseGraph extender
+  /// \ingroup digraphbits
+  ///
+  /// \brief BaseDigraph to BaseGraph extender
   template <typename Base>
   class UndirDigraphExtender : public Base {
@@ -75,35 +75,38 @@
     };
 
-    // First node of the edge
+    /// First node of the edge
     Node u(const Edge &e) const {
       return Parent::source(e);
     }
 
-    // Source of the given arc
+    /// Source of the given arc
     Node source(const Arc &e) const {
       return e.forward ? Parent::source(e) : Parent::target(e);
     }
 
-    // Second node of the edge
+    /// Second node of the edge
     Node v(const Edge &e) const {
       return Parent::target(e);
     }
 
-    // Target of the given arc
+    /// Target of the given arc
     Node target(const Arc &e) const {
       return e.forward ? Parent::target(e) : Parent::source(e);
     }
 
-    // \brief Directed arc from an edge.
-    //
-    // Returns a directed arc corresponding to the specified edge.
-    // If the given bool is true, the first node of the given edge and
-    // the source node of the returned arc are the same.
+    /// \brief Directed arc from an edge.
+    ///
+    /// Returns a directed arc corresponding to the specified edge.
+    /// If the given bool is true, the first node of the given edge and
+    /// the source node of the returned arc are the same.
     static Arc direct(const Edge &e, bool d) {
       return Arc(e, d);
     }
 
-    // Returns whether the given directed arc has the same orientation
-    // as the corresponding edge.
+    /// Returns whether the given directed arc has the same orientation
+    /// as the corresponding edge.
+    ///
+    /// \todo reference to the corresponding point of the undirected digraph
+    /// concept. "What does the direction of an edge mean?"
     static bool direction(const Arc &a) { return a.forward; }
 
@@ -299,10 +302,10 @@
       Red() {}
       Red(const Node& node) : Node(node) {
-        LEMON_DEBUG(Parent::red(node) || node == INVALID,
-                    typename Parent::NodeSetError());
+        LEMON_ASSERT(Parent::red(node) || node == INVALID,
+                     typename Parent::NodeSetError());
       }
       Red& operator=(const Node& node) {
-        LEMON_DEBUG(Parent::red(node) || node == INVALID,
-                    typename Parent::NodeSetError());
+        LEMON_ASSERT(Parent::red(node) || node == INVALID,
+                     typename Parent::NodeSetError());
         Node::operator=(node);
         return *this;
@@ -331,10 +334,10 @@
       Blue() {}
       Blue(const Node& node) : Node(node) {
-        LEMON_DEBUG(Parent::blue(node) || node == INVALID,
-                    typename Parent::NodeSetError());
+        LEMON_ASSERT(Parent::blue(node) || node == INVALID,
+                     typename Parent::NodeSetError());
       }
       Blue& operator=(const Node& node) {
-        LEMON_DEBUG(Parent::blue(node) || node == INVALID,
-                    typename Parent::NodeSetError());
+        LEMON_ASSERT(Parent::blue(node) || node == INVALID,
+                     typename Parent::NodeSetError());
         Node::operator=(node);
         return *this;
Index: lemon/bits/bezier.h
===================================================================
--- lemon/bits/bezier.h	(revision 314)
+++ lemon/bits/bezier.h	(revision 209)
@@ -20,9 +20,9 @@
 #define LEMON_BEZIER_H
 
-//\ingroup misc
-//\file
-//\brief Classes to compute with Bezier curves.
-//
-//Up to now this file is used internally by \ref graph_to_eps.h
+///\ingroup misc
+///\file
+///\brief Classes to compute with Bezier curves.
+///
+///Up to now this file is used internally by \ref graph_to_eps.h
 
 #include<lemon/dim2.h>
Index: lemon/bits/default_map.h
===================================================================
--- lemon/bits/default_map.h	(revision 314)
+++ lemon/bits/default_map.h	(revision 209)
@@ -20,11 +20,12 @@
 #define LEMON_BITS_DEFAULT_MAP_H
 
+
 #include <lemon/bits/array_map.h>
 #include <lemon/bits/vector_map.h>
 //#include <lemon/bits/debug_map.h>
 
-//\ingroup graphbits
-//\file
-//\brief Graph maps that construct and destruct their elements dynamically.
+///\ingroup graphbits
+///\file
+///\brief Graph maps that construct and destruct their elements dynamically.
 
 namespace lemon {
@@ -149,5 +150,5 @@
 // #endif
 
-  // DefaultMap class
+  /// \e
   template <typename _Graph, typename _Item, typename _Value>
   class DefaultMap
Index: lemon/bits/enable_if.h
===================================================================
--- lemon/bits/enable_if.h	(revision 314)
+++ lemon/bits/enable_if.h	(revision 220)
@@ -36,27 +36,27 @@
 #define LEMON_BITS_ENABLE_IF_H
 
-//\file
-//\brief Miscellaneous basic utilities
+///\file
+///\brief Miscellaneous basic utilities
 
 namespace lemon
 {
 
-  // Basic type for defining "tags". A "YES" condition for \c enable_if.
+  /// Basic type for defining "tags". A "YES" condition for \c enable_if.
 
-  // Basic type for defining "tags". A "YES" condition for \c enable_if.
-  //
-  //\sa False
+  /// Basic type for defining "tags". A "YES" condition for \c enable_if.
+  ///
+  ///\sa False
   struct True {
-    //\e
+    ///\e
     static const bool value = true;
   };
 
-  // Basic type for defining "tags". A "NO" condition for \c enable_if.
+  /// Basic type for defining "tags". A "NO" condition for \c enable_if.
 
-  // Basic type for defining "tags". A "NO" condition for \c enable_if.
-  //
-  //\sa True
+  /// Basic type for defining "tags". A "NO" condition for \c enable_if.
+  ///
+  ///\sa True
   struct False {
-    //\e
+    ///\e
     static const bool value = false;
   };
Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h	(revision 314)
+++ lemon/bits/graph_extender.h	(revision 220)
@@ -28,12 +28,12 @@
 #include <lemon/concepts/maps.h>
 
-//\ingroup graphbits
-//\file
-//\brief Extenders for the digraph types
+///\ingroup graphbits
+///\file
+///\brief Extenders for the digraph types
 namespace lemon {
 
-  // \ingroup graphbits
-  //
-  // \brief Extender for the Digraphs
+  /// \ingroup graphbits
+  ///
+  /// \brief Extender for the Digraphs
   template <typename Base>
   class DigraphExtender : public Base {
@@ -187,28 +187,28 @@
     };
 
-    // \brief Base node of the iterator
-    //
-    // Returns the base node (i.e. the source in this case) of the iterator
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (i.e. the source in this case) of the iterator
     Node baseNode(const OutArcIt &arc) const {
       return Parent::source(arc);
     }
-    // \brief Running node of the iterator
-    //
-    // Returns the running node (i.e. the target in this case) of the
-    // iterator
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (i.e. the target in this case) of the
+    /// iterator
     Node runningNode(const OutArcIt &arc) const {
       return Parent::target(arc);
     }
 
-    // \brief Base node of the iterator
-    //
-    // Returns the base node (i.e. the target in this case) of the iterator
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (i.e. the target in this case) of the iterator
     Node baseNode(const InArcIt &arc) const {
       return Parent::target(arc);
     }
-    // \brief Running node of the iterator
-    //
-    // Returns the running node (i.e. the source in this case) of the
-    // iterator
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (i.e. the source in this case) of the
+    /// iterator
     Node runningNode(const InArcIt &arc) const {
       return Parent::source(arc);
@@ -228,5 +228,4 @@
         : Parent(digraph, value) {}
 
-    private:
       NodeMap& operator=(const NodeMap& cmap) {
         return operator=<NodeMap>(cmap);
@@ -253,5 +252,4 @@
         : Parent(digraph, value) {}
 
-    private:
       ArcMap& operator=(const ArcMap& cmap) {
         return operator=<ArcMap>(cmap);
@@ -326,7 +324,7 @@
   };
 
-  // \ingroup _graphbits
-  //
-  // \brief Extender for the Graphs
+  /// \ingroup _graphbits
+  ///
+  /// \brief Extender for the Graphs
   template <typename Base>
   class GraphExtender : public Base {
@@ -556,41 +554,41 @@
     };
 
-    // \brief Base node of the iterator
-    //
-    // Returns the base node (ie. the source in this case) of the iterator
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the source in this case) of the iterator
     Node baseNode(const OutArcIt &arc) const {
       return Parent::source(static_cast<const Arc&>(arc));
     }
-    // \brief Running node of the iterator
-    //
-    // Returns the running node (ie. the target in this case) of the
-    // iterator
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the target in this case) of the
+    /// iterator
     Node runningNode(const OutArcIt &arc) const {
       return Parent::target(static_cast<const Arc&>(arc));
     }
 
-    // \brief Base node of the iterator
-    //
-    // Returns the base node (ie. the target in this case) of the iterator
+    /// \brief Base node of the iterator
+    ///
+    /// Returns the base node (ie. the target in this case) of the iterator
     Node baseNode(const InArcIt &arc) const {
       return Parent::target(static_cast<const Arc&>(arc));
     }
-    // \brief Running node of the iterator
-    //
-    // Returns the running node (ie. the source in this case) of the
-    // iterator
+    /// \brief Running node of the iterator
+    ///
+    /// Returns the running node (ie. the source in this case) of the
+    /// iterator
     Node runningNode(const InArcIt &arc) const {
       return Parent::source(static_cast<const Arc&>(arc));
     }
 
-    // Base node of the iterator
-    //
-    // Returns the base node of the iterator
+    /// Base node of the iterator
+    ///
+    /// Returns the base node of the iterator
     Node baseNode(const IncEdgeIt &edge) const {
       return edge._direction ? u(edge) : v(edge);
     }
-    // Running node of the iterator
-    //
-    // Returns the running node of the iterator
+    /// Running node of the iterator
+    ///
+    /// Returns the running node of the iterator
     Node runningNode(const IncEdgeIt &edge) const {
       return edge._direction ? v(edge) : u(edge);
@@ -611,5 +609,4 @@
         : Parent(graph, value) {}
 
-    private:
       NodeMap& operator=(const NodeMap& cmap) {
         return operator=<NodeMap>(cmap);
@@ -636,5 +633,4 @@
         : Parent(graph, value) {}
 
-    private:
       ArcMap& operator=(const ArcMap& cmap) {
         return operator=<ArcMap>(cmap);
@@ -662,5 +658,4 @@
         : Parent(graph, value) {}
 
-    private:
       EdgeMap& operator=(const EdgeMap& cmap) {
         return operator=<EdgeMap>(cmap);
Index: lemon/bits/map_extender.h
===================================================================
--- lemon/bits/map_extender.h	(revision 314)
+++ lemon/bits/map_extender.h	(revision 209)
@@ -27,12 +27,12 @@
 #include <lemon/concepts/maps.h>
 
-//\file
-//\brief Extenders for iterable maps.
+///\file
+///\brief Extenders for iterable maps.
 
 namespace lemon {
 
-  // \ingroup graphbits
-  //
-  // \brief Extender for maps
+  /// \ingroup graphbits
+  ///
+  /// \brief Extender for maps
   template <typename _Map>
   class MapExtender : public _Map {
@@ -63,5 +63,4 @@
       : Parent(graph, value) {}
 
-  private:
     MapExtender& operator=(const MapExtender& cmap) {
       return operator=<MapExtender>(cmap);
@@ -74,5 +73,4 @@
     }
 
-  public:
     class MapIt : public Item {
     public:
@@ -172,7 +170,7 @@
   };
 
-  // \ingroup graphbits
-  //
-  // \brief Extender for maps which use a subset of the items.
+  /// \ingroup graphbits
+  ///
+  /// \brief Extender for maps which use a subset of the items.
   template <typename _Graph, typename _Map>
   class SubMapExtender : public _Map {
@@ -203,5 +201,4 @@
       : Parent(_graph, _value), graph(_graph) {}
 
-  private:
     SubMapExtender& operator=(const SubMapExtender& cmap) {
       return operator=<MapExtender>(cmap);
@@ -218,5 +215,4 @@
     }
 
-  public:
     class MapIt : public Item {
     public:
Index: lemon/bits/traits.h
===================================================================
--- lemon/bits/traits.h	(revision 314)
+++ lemon/bits/traits.h	(revision 220)
@@ -20,7 +20,7 @@
 #define LEMON_BITS_TRAITS_H
 
-//\file
-//\brief Traits for graphs and maps
-//
+///\file
+///\brief Traits for graphs and maps
+///
 
 #include <lemon/bits/enable_if.h>
Index: lemon/bits/vector_map.h
===================================================================
--- lemon/bits/vector_map.h	(revision 314)
+++ lemon/bits/vector_map.h	(revision 220)
@@ -29,21 +29,22 @@
 #include <lemon/concepts/maps.h>
 
-//\ingroup graphbits
-//
-//\file
-//\brief Vector based graph maps.
+///\ingroup graphbits
+///
+///\file
+///\brief Vector based graph maps.
 namespace lemon {
 
-  // \ingroup graphbits
-  //
-  // \brief Graph map based on the std::vector storage.
-  //
-  // The VectorMap template class is graph map structure what
-  // automatically updates the map when a key is added to or erased from
-  // the map. This map type uses the std::vector to store the values.
-  //
-  // \tparam _Graph The graph this map is attached to.
-  // \tparam _Item The item type of the graph items.
-  // \tparam _Value The value type of the map.
+  /// \ingroup graphbits
+  ///
+  /// \brief Graph map based on the std::vector storage.
+  ///
+  /// The VectorMap template class is graph map structure what
+  /// automatically updates the map when a key is added to or erased from
+  /// the map. This map type uses the std::vector to store the values.
+  ///
+  /// \tparam _Notifier The AlterationNotifier that will notify this map.
+  /// \tparam _Item The item type of the graph items.
+  /// \tparam _Value The value type of the map.
+  /// \todo Fix the doc: there is _Graph parameter instead of _Notifier.
   template <typename _Graph, typename _Item, typename _Value>
   class VectorMap
@@ -51,39 +52,39 @@
   private:
 
-    // The container type of the map.
+    /// The container type of the map.
     typedef std::vector<_Value> Container;
 
   public:
 
-    // The graph type of the map.
+    /// The graph type of the map.
     typedef _Graph Graph;
-    // The item type of the map.
+    /// The item type of the map.
     typedef _Item Item;
-    // The reference map tag.
+    /// The reference map tag.
     typedef True ReferenceMapTag;
 
-    // The key type of the map.
+    /// The key type of the map.
     typedef _Item Key;
-    // The value type of the map.
+    /// The value type of the map.
     typedef _Value Value;
 
-    // The notifier type.
+    /// The notifier type.
     typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
 
-    // The map type.
+    /// The map type.
     typedef VectorMap Map;
-    // The base class of the map.
+    /// The base class of the map.
     typedef typename Notifier::ObserverBase Parent;
 
-    // The reference type of the map;
+    /// The reference type of the map;
     typedef typename Container::reference Reference;
-    // The const reference type of the map;
+    /// The const reference type of the map;
     typedef typename Container::const_reference ConstReference;
 
 
-    // \brief Constructor to attach the new map into the notifier.
-    //
-    // It constructs a map and attachs it into the notifier.
-    // It adds all the items of the graph to the map.
+    /// \brief Constructor to attach the new map into the notifier.
+    ///
+    /// It constructs a map and attachs it into the notifier.
+    /// It adds all the items of the graph to the map.
     VectorMap(const Graph& graph) {
       Parent::attach(graph.notifier(Item()));
@@ -91,8 +92,8 @@
     }
 
-    // \brief Constructor uses given value to initialize the map.
-    //
-    // It constructs a map uses a given value to initialize the map.
-    // It adds all the items of the graph to the map.
+    /// \brief Constructor uses given value to initialize the map.
+    ///
+    /// It constructs a map uses a given value to initialize the map.
+    /// It adds all the items of the graph to the map.
     VectorMap(const Graph& graph, const Value& value) {
       Parent::attach(graph.notifier(Item()));
@@ -100,8 +101,7 @@
     }
 
-  private:
-    // \brief Copy constructor
-    //
-    // Copy constructor.
+    /// \brief Copy constructor
+    ///
+    /// Copy constructor.
     VectorMap(const VectorMap& _copy) : Parent() {
       if (_copy.attached()) {
@@ -111,11 +111,11 @@
     }
 
-    // \brief Assign operator.
-    //
-    // This operator assigns for each item in the map the
-    // value mapped to the same item in the copied map.
-    // The parameter map should be indiced with the same
-    // itemset because this assign operator does not change
-    // the container of the map.
+    /// \brief Assign operator.
+    ///
+    /// This operator assigns for each item in the map the
+    /// value mapped to the same item in the copied map.
+    /// The parameter map should be indiced with the same
+    /// itemset because this assign operator does not change
+    /// the container of the map.
     VectorMap& operator=(const VectorMap& cmap) {
       return operator=<VectorMap>(cmap);
@@ -123,10 +123,10 @@
 
 
-    // \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.
+    /// \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>
     VectorMap& operator=(const CMap& cmap) {
@@ -142,16 +142,16 @@
   public:
 
-    // \brief The subcript operator.
-    //
-    // The subscript operator. The map can be subscripted by the
-    // actual items of the graph.
+    /// \brief The subcript operator.
+    ///
+    /// The subscript operator. The map can be subscripted by the
+    /// actual items of the graph.
     Reference operator[](const Key& key) {
       return container[Parent::notifier()->id(key)];
     }
 
-    // \brief The const subcript operator.
-    //
-    // The const subscript operator. The map can be subscripted by the
-    // actual items of the graph.
+    /// \brief The const subcript operator.
+    ///
+    /// The const subscript operator. The map can be subscripted by the
+    /// actual items of the graph.
     ConstReference operator[](const Key& key) const {
       return container[Parent::notifier()->id(key)];
@@ -159,7 +159,7 @@
 
 
-    // \brief The setter function of the map.
-    //
-    // It the same as operator[](key) = value expression.
+    /// \brief The setter function of the map.
+    ///
+    /// It the same as operator[](key) = value expression.
     void set(const Key& key, const Value& value) {
       (*this)[key] = value;
@@ -168,8 +168,8 @@
   protected:
 
-    // \brief Adds a new key to the map.
-    //
-    // It adds a new key to the map. It called by the observer notifier
-    // and it overrides the add() member function of the observer base.
+    /// \brief Adds a new key to the map.
+    ///
+    /// It adds a new key to the map. It called by the observer notifier
+    /// and it overrides the add() member function of the observer base.
     virtual void add(const Key& key) {
       int id = Parent::notifier()->id(key);
@@ -179,8 +179,8 @@
     }
 
-    // \brief Adds more new keys to the map.
-    //
-    // It adds more new keys to the map. It called by the observer notifier
-    // and it overrides the add() member function of the observer base.
+    /// \brief Adds more new keys to the map.
+    ///
+    /// It adds more new keys to the map. It called by the observer notifier
+    /// and it overrides the add() member function of the observer base.
     virtual void add(const std::vector<Key>& keys) {
       int max = container.size() - 1;
@@ -194,16 +194,16 @@
     }
 
-    // \brief Erase a key from the map.
-    //
-    // Erase a key from the map. It called by the observer notifier
-    // and it overrides the erase() member function of the observer base.
+    /// \brief Erase a key from the map.
+    ///
+    /// Erase a key from the map. It called by the observer notifier
+    /// and it overrides the erase() member function of the observer base.
     virtual void erase(const Key& key) {
       container[Parent::notifier()->id(key)] = Value();
     }
 
-    // \brief Erase more keys from the map.
-    //
-    // Erase more keys from the map. It called by the observer notifier
-    // and it overrides the erase() member function of the observer base.
+    /// \brief Erase more keys from the map.
+    ///
+    /// Erase more keys from the map. It called by the observer notifier
+    /// and it overrides the erase() member function of the observer base.
     virtual void erase(const std::vector<Key>& keys) {
       for (int i = 0; i < int(keys.size()); ++i) {
@@ -212,8 +212,8 @@
     }
 
-    // \brief Buildes the map.
-    //
-    // It buildes the map. It called by the observer notifier
-    // and it overrides the build() member function of the observer base.
+    /// \brief Buildes the map.
+    ///
+    /// It buildes the map. It called by the observer notifier
+    /// and it overrides the build() member function of the observer base.
     virtual void build() {
       int size = Parent::notifier()->maxId() + 1;
@@ -222,8 +222,8 @@
     }
 
-    // \brief Clear the map.
-    //
-    // It erase all items from the map. It called by the observer notifier
-    // and it overrides the clear() member function of the observer base.
+    /// \brief Clear the map.
+    ///
+    /// It erase all items from the map. It called by the observer notifier
+    /// and it overrides the clear() member function of the observer base.
     virtual void clear() {
       container.clear();
Index: lemon/color.h
===================================================================
--- lemon/color.h	(revision 313)
+++ lemon/color.h	(revision 209)
@@ -93,5 +93,5 @@
   extern const Color DARK_CYAN;
 
-  ///Map <tt>int</tt>s to different <tt>Color</tt>s
+  ///Map <tt>int</tt>s to different \ref Color "Color"s
 
   ///This map assigns one of the predefined \ref Color "Color"s to
Index: lemon/concept_check.h
===================================================================
--- lemon/concept_check.h	(revision 285)
+++ lemon/concept_check.h	(revision 209)
@@ -17,10 +17,26 @@
  */
 
-// The contents of this file was inspired by the concept checking
-// utility of the BOOST library (http://www.boost.org).
+// This file contains a modified version of the concept checking
+// utility from BOOST.
+// See the appropriate copyright notice below.
+
+// (C) Copyright Jeremy Siek 2000.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// Revision History:
+//   05 May   2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
+//   02 April 2001: Removed limits header altogether. (Jeremy Siek)
+//   01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
+//
+
+// See http://www.boost.org/libs/concept_check for documentation.
 
 ///\file
 ///\brief Basic utilities for concept checking.
 ///
+///\todo Are we still using BOOST concept checking utility?
+///Is the BOOST copyright notice necessary?
 
 #ifndef LEMON_CONCEPT_CHECK_H
Index: lemon/concepts/digraph.h
===================================================================
--- lemon/concepts/digraph.h	(revision 263)
+++ lemon/concepts/digraph.h	(revision 220)
@@ -435,5 +435,4 @@
         NodeMap(const Digraph&, T) { }
 
-      private:
         ///Copy constructor
         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
@@ -458,5 +457,4 @@
         ///\e
         ArcMap(const Digraph&, T) { }
-      private:
         ///Copy constructor
         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
Index: lemon/concepts/graph.h
===================================================================
--- lemon/concepts/graph.h	(revision 263)
+++ lemon/concepts/graph.h	(revision 220)
@@ -513,5 +513,4 @@
         NodeMap(const Graph&, T) { }
 
-      private:
         ///Copy constructor
         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
@@ -537,5 +536,4 @@
         ///\e
         ArcMap(const Graph&, T) { }
-      private:
         ///Copy constructor
         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
@@ -561,5 +559,4 @@
         ///\e
         EdgeMap(const Graph&, T) { }
-      private:
         ///Copy constructor
         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {}
Index: lemon/concepts/graph_components.h
===================================================================
--- lemon/concepts/graph_components.h	(revision 313)
+++ lemon/concepts/graph_components.h	(revision 220)
@@ -983,5 +983,5 @@
     ///
     /// This class describes the common interface of the graph maps
-    /// (NodeMap, ArcMap), that is maps that can be used to
+    /// (NodeMap, ArcMap), that is \ref maps-page "maps" which can be used to
     /// associate data to graph descriptors (nodes or arcs).
     template <typename _Graph, typename _Item, typename _Value>
@@ -1006,6 +1006,4 @@
       /// Construct a new map for the graph and initalise the values.
       GraphMap(const Graph&, const Value&) {}
-
-    private:
       /// \brief Copy constructor.
       ///
@@ -1024,5 +1022,4 @@
       }
 
-    public:
       template<typename _Map>
       struct Constraints {
@@ -1034,12 +1031,11 @@
           _Map a2(g,t);
           // Copy constructor.
-          // _Map b(c);
-
-          // ReadMap<Key, Value> cmap;
-          // b = cmap;
-
-          ignore_unused_variable_warning(a);
+          _Map b(c);
+
+          ReadMap<Key, Value> cmap;
+          b = cmap;
+
           ignore_unused_variable_warning(a2);
-          // ignore_unused_variable_warning(b);
+          ignore_unused_variable_warning(b);
         }
 
@@ -1087,5 +1083,4 @@
           : Parent(digraph, value) {}
 
-      private:
         /// \brief Copy constructor.
         ///
@@ -1125,5 +1120,4 @@
           : Parent(digraph, value) {}
 
-      private:
         /// \brief Copy constructor.
         ///
@@ -1222,5 +1216,4 @@
           : Parent(graph, value) {}
 
-      private:
         /// \brief Copy constructor.
         ///
Index: lemon/concepts/heap.h
===================================================================
--- lemon/concepts/heap.h	(revision 290)
+++ lemon/concepts/heap.h	(revision 220)
@@ -130,4 +130,5 @@
       /// Otherwise it inserts the given item with the given priority.
       ///
+      /// It may throw an \ref UnderflowPriorityException.
       /// \param i The item.
       /// \param p The priority.
Index: lemon/concepts/maps.h
===================================================================
--- lemon/concepts/maps.h	(revision 314)
+++ lemon/concepts/maps.h	(revision 220)
@@ -23,5 +23,5 @@
 #include <lemon/concept_check.h>
 
-///\ingroup map_concepts
+///\ingroup concept
 ///\file
 ///\brief The concept of maps.
@@ -31,5 +31,5 @@
   namespace concepts {
 
-    /// \addtogroup map_concepts
+    /// \addtogroup concept
     /// @{
 
Index: lemon/concepts/path.h
===================================================================
--- lemon/concepts/path.h	(revision 281)
+++ lemon/concepts/path.h	(revision 236)
@@ -21,4 +21,5 @@
 ///\brief Classes for representing paths in digraphs.
 ///
+///\todo Iterators have obsolete style
 
 #ifndef LEMON_CONCEPT_PATH_H
@@ -66,8 +67,5 @@
       /// \brief Template assigment
       template <typename CPath>
-      Path& operator=(const CPath& cpath) {
-        ignore_unused_variable_warning(cpath);
-        return *this;
-      }
+      Path& operator=(const CPath& cpath) {}
 
       /// Length of the path ie. the number of arcs in the path.
Index: lemon/core.h
===================================================================
--- lemon/core.h	(revision 319)
+++ lemon/core.h	(revision 233)
@@ -25,5 +25,4 @@
 #include <lemon/bits/enable_if.h>
 #include <lemon/bits/traits.h>
-#include <lemon/assert.h>
 
 ///\file
@@ -60,8 +59,8 @@
   /// @{
 
-  ///Create convenience typedefs for the digraph types and iterators
-
-  ///This \c \#define creates convenient type definitions for the following
-  ///types of \c Digraph: \c Node,  \c NodeIt, \c Arc, \c ArcIt, \c InArcIt,
+  ///Creates convenience typedefs for the digraph types and iterators
+
+  ///This \c \#define creates convenience typedefs for the following types
+  ///of \c Digraph: \c Node,  \c NodeIt, \c Arc, \c ArcIt, \c InArcIt,
   ///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap,
   ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap.
@@ -84,5 +83,5 @@
   typedef Digraph::ArcMap<double> DoubleArcMap
 
-  ///Create convenience typedefs for the digraph types and iterators
+  ///Creates convenience typedefs for the digraph types and iterators
 
   ///\see DIGRAPH_TYPEDEFS
@@ -104,7 +103,7 @@
   typedef typename Digraph::template ArcMap<double> DoubleArcMap
 
-  ///Create convenience typedefs for the graph types and iterators
-
-  ///This \c \#define creates the same convenient type definitions as defined
+  ///Creates convenience typedefs for the graph types and iterators
+
+  ///This \c \#define creates the same convenience typedefs as defined
   ///by \ref DIGRAPH_TYPEDEFS(Graph) and six more, namely it creates
   ///\c Edge, \c EdgeIt, \c IncEdgeIt, \c BoolEdgeMap, \c IntEdgeMap,
@@ -112,5 +111,5 @@
   ///
   ///\note If the graph type is a dependent type, ie. the graph type depend
-  ///on a template parameter, then use \c TEMPLATE_GRAPH_TYPEDEFS()
+  ///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS()
   ///macro.
 #define GRAPH_TYPEDEFS(Graph)                                           \
@@ -123,5 +122,5 @@
   typedef Graph::EdgeMap<double> DoubleEdgeMap
 
-  ///Create convenience typedefs for the graph types and iterators
+  ///Creates convenience typedefs for the graph types and iterators
 
   ///\see GRAPH_TYPEDEFS
@@ -138,8 +137,8 @@
   typedef typename Graph::template EdgeMap<double> DoubleEdgeMap
 
-  /// \brief Function to count the items in a graph.
-  ///
-  /// This function counts the items (nodes, arcs etc.) in a graph.
-  /// The complexity of the function is linear because
+  /// \brief Function to count the items in the graph.
+  ///
+  /// This function counts the items (nodes, arcs etc) in the graph.
+  /// The complexity of the function is O(n) because
   /// it iterates on all of the items.
   template <typename Graph, typename Item>
@@ -178,9 +177,9 @@
   ///
   /// This function counts the nodes in the graph.
-  /// The complexity of the function is <em>O</em>(<em>n</em>), but for some
-  /// graph structures it is specialized to run in <em>O</em>(1).
-  ///
-  /// \note If the graph contains a \c nodeNum() member function and a
-  /// \c NodeNumTag tag then this function calls directly the member
+  /// The complexity of the function is O(n) but for some
+  /// graph structures it is specialized to run in O(1).
+  ///
+  /// If the graph contains a \e nodeNum() member function and a
+  /// \e NodeNumTag tag then this function calls directly the member
   /// function to query the cardinality of the node set.
   template <typename Graph>
@@ -214,9 +213,9 @@
   ///
   /// This function counts the arcs in the graph.
-  /// The complexity of the function is <em>O</em>(<em>m</em>), but for some
-  /// graph structures it is specialized to run in <em>O</em>(1).
-  ///
-  /// \note If the graph contains a \c arcNum() member function and a
-  /// \c ArcNumTag tag then this function calls directly the member
+  /// The complexity of the function is O(e) but for some
+  /// graph structures it is specialized to run in O(1).
+  ///
+  /// If the graph contains a \e arcNum() member function and a
+  /// \e EdgeNumTag tag then this function calls directly the member
   /// function to query the cardinality of the arc set.
   template <typename Graph>
@@ -226,5 +225,4 @@
 
   // Edge counting:
-
   namespace _core_bits {
 
@@ -250,9 +248,9 @@
   ///
   /// This function counts the edges in the graph.
-  /// The complexity of the function is <em>O</em>(<em>m</em>), but for some
-  /// graph structures it is specialized to run in <em>O</em>(1).
-  ///
-  /// \note If the graph contains a \c edgeNum() member function and a
-  /// \c EdgeNumTag tag then this function calls directly the member
+  /// The complexity of the function is O(m) but for some
+  /// graph structures it is specialized to run in O(1).
+  ///
+  /// If the graph contains a \e edgeNum() member function and a
+  /// \e EdgeNumTag tag then this function calls directly the member
   /// function to query the cardinality of the edge set.
   template <typename Graph>
@@ -275,8 +273,8 @@
   ///
   /// This function counts the number of the out-arcs from node \c n
-  /// in the graph \c g.
+  /// in the graph.
   template <typename Graph>
-  inline int countOutArcs(const Graph& g,  const typename Graph::Node& n) {
-    return countNodeDegree<Graph, typename Graph::OutArcIt>(g, n);
+  inline int countOutArcs(const Graph& _g,  const typename Graph::Node& _n) {
+    return countNodeDegree<Graph, typename Graph::OutArcIt>(_g, _n);
   }
 
@@ -284,8 +282,8 @@
   ///
   /// This function counts the number of the in-arcs to node \c n
-  /// in the graph \c g.
+  /// in the graph.
   template <typename Graph>
-  inline int countInArcs(const Graph& g,  const typename Graph::Node& n) {
-    return countNodeDegree<Graph, typename Graph::InArcIt>(g, n);
+  inline int countInArcs(const Graph& _g,  const typename Graph::Node& _n) {
+    return countNodeDegree<Graph, typename Graph::InArcIt>(_g, _n);
   }
 
@@ -293,8 +291,8 @@
   ///
   /// This function counts the number of the inc-edges to node \c n
-  /// in the undirected graph \c g.
+  /// in the graph.
   template <typename Graph>
-  inline int countIncEdges(const Graph& g,  const typename Graph::Node& n) {
-    return countNodeDegree<Graph, typename Graph::IncEdgeIt>(g, n);
+  inline int countIncEdges(const Graph& _g,  const typename Graph::Node& _n) {
+    return countNodeDegree<Graph, typename Graph::IncEdgeIt>(_g, _n);
   }
 
@@ -310,10 +308,10 @@
 
     template <typename Digraph, typename Item, typename RefMap,
-              typename FromMap, typename ToMap>
+              typename ToMap, typename FromMap>
     class MapCopy : public MapCopyBase<Digraph, Item, RefMap> {
     public:
 
-      MapCopy(const FromMap& map, ToMap& tmap)
-        : _map(map), _tmap(tmap) {}
+      MapCopy(ToMap& tmap, const FromMap& map)
+        : _tmap(tmap), _map(map) {}
 
       virtual void copy(const Digraph& digraph, const RefMap& refMap) {
@@ -325,6 +323,6 @@
 
     private:
+      ToMap& _tmap;
       const FromMap& _map;
-      ToMap& _tmap;
     };
 
@@ -333,5 +331,5 @@
     public:
 
-      ItemCopy(const Item& item, It& it) : _item(item), _it(it) {}
+      ItemCopy(It& it, const Item& item) : _it(it), _item(item) {}
 
       virtual void copy(const Digraph&, const RefMap& refMap) {
@@ -340,6 +338,6 @@
 
     private:
+      It& _it;
       Item _item;
-      It& _it;
     };
 
@@ -382,5 +380,5 @@
     struct DigraphCopySelector {
       template <typename From, typename NodeRefMap, typename ArcRefMap>
-      static void copy(const From& from, Digraph &to,
+      static void copy(Digraph &to, const From& from,
                        NodeRefMap& nodeRefMap, ArcRefMap& arcRefMap) {
         for (typename From::NodeIt it(from); it != INVALID; ++it) {
@@ -400,5 +398,5 @@
     {
       template <typename From, typename NodeRefMap, typename ArcRefMap>
-      static void copy(const From& from, Digraph &to,
+      static void copy(Digraph &to, const From& from,
                        NodeRefMap& nodeRefMap, ArcRefMap& arcRefMap) {
         to.build(from, nodeRefMap, arcRefMap);
@@ -409,5 +407,5 @@
     struct GraphCopySelector {
       template <typename From, typename NodeRefMap, typename EdgeRefMap>
-      static void copy(const From& from, Graph &to,
+      static void copy(Graph &to, const From& from,
                        NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
         for (typename From::NodeIt it(from); it != INVALID; ++it) {
@@ -427,5 +425,5 @@
     {
       template <typename From, typename NodeRefMap, typename EdgeRefMap>
-      static void copy(const From& from, Graph &to,
+      static void copy(Graph &to, const From& from,
                        NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
         to.build(from, nodeRefMap, edgeRefMap);
@@ -438,37 +436,37 @@
   ///
   /// Class to copy a digraph to another digraph (duplicate a digraph). The
-  /// simplest way of using it is through the \c digraphCopy() function.
-  ///
-  /// This class not only make a copy of a digraph, but it can create
+  /// simplest way of using it is through the \c copyDigraph() function.
+  ///
+  /// This class not just make a copy of a graph, but it can create
   /// references and cross references between the nodes and arcs of
-  /// the two digraphs, and it can copy maps to use with the newly created
-  /// digraph.
-  ///
-  /// To make a copy from a digraph, first an instance of DigraphCopy
-  /// should be created, then the data belongs to the digraph should
+  /// the two graphs, it can copy maps for use with the newly created
+  /// graph and copy nodes and arcs.
+  ///
+  /// To make a copy from a graph, first an instance of DigraphCopy
+  /// should be created, then the data belongs to the graph should
   /// assigned to copy. In the end, the \c run() member should be
   /// called.
   ///
-  /// The next code copies a digraph with several data:
+  /// The next code copies a graph with several data:
   ///\code
-  ///  DigraphCopy<OrigGraph, NewGraph> cg(orig_graph, new_graph);
-  ///  // Create references for the nodes
+  ///  DigraphCopy<NewGraph, OrigGraph> dc(new_graph, orig_graph);
+  ///  // create a reference for the nodes
   ///  OrigGraph::NodeMap<NewGraph::Node> nr(orig_graph);
-  ///  cg.nodeRef(nr);
-  ///  // Create cross references (inverse) for the arcs
+  ///  dc.nodeRef(nr);
+  ///  // create a cross reference (inverse) for the arcs
   ///  NewGraph::ArcMap<OrigGraph::Arc> acr(new_graph);
-  ///  cg.arcCrossRef(acr);
-  ///  // Copy an arc map
+  ///  dc.arcCrossRef(acr);
+  ///  // copy an arc map
   ///  OrigGraph::ArcMap<double> oamap(orig_graph);
   ///  NewGraph::ArcMap<double> namap(new_graph);
-  ///  cg.arcMap(oamap, namap);
-  ///  // Copy a node
+  ///  dc.arcMap(namap, oamap);
+  ///  // copy a node
   ///  OrigGraph::Node on;
   ///  NewGraph::Node nn;
-  ///  cg.node(on, nn);
-  ///  // Execute copying
-  ///  cg.run();
+  ///  dc.node(nn, on);
+  ///  // Executions of copy
+  ///  dc.run();
   ///\endcode
-  template <typename From, typename To>
+  template <typename To, typename From>
   class DigraphCopy {
   private:
@@ -485,16 +483,18 @@
     typedef typename From::template ArcMap<TArc> ArcRefMap;
 
+
   public:
 
-    /// \brief Constructor of DigraphCopy.
-    ///
-    /// Constructor of DigraphCopy for copying the content of the
-    /// \c from digraph into the \c to digraph.
-    DigraphCopy(const From& from, To& to)
+
+    /// \brief Constructor for the DigraphCopy.
+    ///
+    /// It copies the content of the \c _from digraph into the
+    /// \c _to digraph.
+    DigraphCopy(To& to, const From& from)
       : _from(from), _to(to) {}
 
-    /// \brief Destructor of DigraphCopy
-    ///
-    /// Destructor of DigraphCopy.
+    /// \brief Destructor of the DigraphCopy
+    ///
+    /// Destructor of the DigraphCopy
     ~DigraphCopy() {
       for (int i = 0; i < int(_node_maps.size()); ++i) {
@@ -507,10 +507,10 @@
     }
 
-    /// \brief Copy the node references into the given map.
-    ///
-    /// This function copies the node references into the given map.
-    /// The parameter should be a map, whose key type is the Node type of
-    /// the source digraph, while the value type is the Node type of the
-    /// destination digraph.
+    /// \brief Copies the node references into the given map.
+    ///
+    /// Copies the node references into the given map. The parameter
+    /// should be a map, which key type is the Node type of the source
+    /// graph, while the value type is the Node type of the
+    /// destination graph.
     template <typename NodeRef>
     DigraphCopy& nodeRef(NodeRef& map) {
@@ -520,10 +520,10 @@
     }
 
-    /// \brief Copy the node cross references into the given map.
-    ///
-    /// This function copies the node cross references (reverse references)
-    /// into the given map. The parameter should be a map, whose key type
-    /// is the Node type of the destination digraph, while the value type is
-    /// the Node type of the source digraph.
+    /// \brief Copies the node cross references into the given map.
+    ///
+    ///  Copies the node cross references (reverse references) into
+    ///  the given map. The parameter should be a map, which key type
+    ///  is the Node type of the destination graph, while the value type is
+    ///  the Node type of the source graph.
     template <typename NodeCrossRef>
     DigraphCopy& nodeCrossRef(NodeCrossRef& map) {
@@ -533,15 +533,13 @@
     }
 
-    /// \brief Make a copy of the given node map.
-    ///
-    /// This function makes a copy of the given node map for the newly
-    /// created digraph.
-    /// The key type of the new map \c tmap should be the Node type of the
-    /// destination digraph, and the key type of the original map \c map
-    /// should be the Node type of the source digraph.
-    template <typename FromMap, typename ToMap>
-    DigraphCopy& nodeMap(const FromMap& map, ToMap& tmap) {
+    /// \brief Make copy of the given map.
+    ///
+    /// Makes copy of the given map for the newly created digraph.
+    /// The new map's key type is the destination graph's node type,
+    /// and the copied map's key type is the source graph's node type.
+    template <typename ToMap, typename FromMap>
+    DigraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
       _node_maps.push_back(new _core_bits::MapCopy<From, Node,
-                           NodeRefMap, FromMap, ToMap>(map, tmap));
+                           NodeRefMap, ToMap, FromMap>(tmap, map));
       return *this;
     }
@@ -549,17 +547,14 @@
     /// \brief Make a copy of the given node.
     ///
-    /// This function makes a copy of the given node.
-    DigraphCopy& node(const Node& node, TNode& tnode) {
+    /// Make a copy of the given node.
+    DigraphCopy& node(TNode& tnode, const Node& snode) {
       _node_maps.push_back(new _core_bits::ItemCopy<From, Node,
-                           NodeRefMap, TNode>(node, tnode));
-      return *this;
-    }
-
-    /// \brief Copy the arc references into the given map.
-    ///
-    /// This function copies the arc references into the given map.
-    /// The parameter should be a map, whose key type is the Arc type of
-    /// the source digraph, while the value type is the Arc type of the
-    /// destination digraph.
+                           NodeRefMap, TNode>(tnode, snode));
+      return *this;
+    }
+
+    /// \brief Copies the arc references into the given map.
+    ///
+    /// Copies the arc references into the given map.
     template <typename ArcRef>
     DigraphCopy& arcRef(ArcRef& map) {
@@ -569,10 +564,8 @@
     }
 
-    /// \brief Copy the arc cross references into the given map.
-    ///
-    /// This function copies the arc cross references (reverse references)
-    /// into the given map. The parameter should be a map, whose key type
-    /// is the Arc type of the destination digraph, while the value type is
-    /// the Arc type of the source digraph.
+    /// \brief Copies the arc cross references into the given map.
+    ///
+    ///  Copies the arc cross references (reverse references) into
+    ///  the given map.
     template <typename ArcCrossRef>
     DigraphCopy& arcCrossRef(ArcCrossRef& map) {
@@ -582,15 +575,14 @@
     }
 
-    /// \brief Make a copy of the given arc map.
-    ///
-    /// This function makes a copy of the given arc map for the newly
-    /// created digraph.
-    /// The key type of the new map \c tmap should be the Arc type of the
-    /// destination digraph, and the key type of the original map \c map
-    /// should be the Arc type of the source digraph.
-    template <typename FromMap, typename ToMap>
-    DigraphCopy& arcMap(const FromMap& map, ToMap& tmap) {
+    /// \brief Make copy of the given map.
+    ///
+    /// Makes copy of the given map for the newly created digraph.
+    /// The new map's key type is the to digraph's arc type,
+    /// and the copied map's key type is the from digraph's arc
+    /// type.
+    template <typename ToMap, typename FromMap>
+    DigraphCopy& arcMap(ToMap& tmap, const FromMap& map) {
       _arc_maps.push_back(new _core_bits::MapCopy<From, Arc,
-                          ArcRefMap, FromMap, ToMap>(map, tmap));
+                          ArcRefMap, ToMap, FromMap>(tmap, map));
       return *this;
     }
@@ -598,20 +590,19 @@
     /// \brief Make a copy of the given arc.
     ///
-    /// This function makes a copy of the given arc.
-    DigraphCopy& arc(const Arc& arc, TArc& tarc) {
+    /// Make a copy of the given arc.
+    DigraphCopy& arc(TArc& tarc, const Arc& sarc) {
       _arc_maps.push_back(new _core_bits::ItemCopy<From, Arc,
-                          ArcRefMap, TArc>(arc, tarc));
-      return *this;
-    }
-
-    /// \brief Execute copying.
-    ///
-    /// This function executes the copying of the digraph along with the
-    /// copying of the assigned data.
+                          ArcRefMap, TArc>(tarc, sarc));
+      return *this;
+    }
+
+    /// \brief Executes the copies.
+    ///
+    /// Executes the copies.
     void run() {
       NodeRefMap nodeRefMap(_from);
       ArcRefMap arcRefMap(_from);
       _core_bits::DigraphCopySelector<To>::
-        copy(_from, _to, nodeRefMap, arcRefMap);
+        copy(_to, _from, nodeRefMap, arcRefMap);
       for (int i = 0; i < int(_node_maps.size()); ++i) {
         _node_maps[i]->copy(_from, nodeRefMap);
@@ -624,12 +615,13 @@
   protected:
 
+
     const From& _from;
     To& _to;
 
     std::vector<_core_bits::MapCopyBase<From, Node, NodeRefMap>* >
-      _node_maps;
+    _node_maps;
 
     std::vector<_core_bits::MapCopyBase<From, Arc, ArcRefMap>* >
-      _arc_maps;
+    _arc_maps;
 
   };
@@ -637,20 +629,20 @@
   /// \brief Copy a digraph to another digraph.
   ///
-  /// This function copies a digraph to another digraph.
-  /// The complete usage of it is detailed in the DigraphCopy class, but
-  /// a short example shows a basic work:
+  /// Copy a digraph to another digraph. The complete usage of the
+  /// function is detailed in the DigraphCopy class, but a short
+  /// example shows a basic work:
   ///\code
-  /// digraphCopy(src, trg).nodeRef(nr).arcCrossRef(acr).run();
+  /// copyDigraph(trg, src).nodeRef(nr).arcCrossRef(ecr).run();
   ///\endcode
   ///
   /// After the copy the \c nr map will contain the mapping from the
   /// nodes of the \c from digraph to the nodes of the \c to digraph and
-  /// \c acr will contain the mapping from the arcs of the \c to digraph
+  /// \c ecr will contain the mapping from the arcs of the \c to digraph
   /// to the arcs of the \c from digraph.
   ///
   /// \see DigraphCopy
-  template <typename From, typename To>
-  DigraphCopy<From, To> digraphCopy(const From& from, To& to) {
-    return DigraphCopy<From, To>(from, to);
+  template <typename To, typename From>
+  DigraphCopy<To, From> copyDigraph(To& to, const From& from) {
+    return DigraphCopy<To, From>(to, from);
   }
 
@@ -658,10 +650,10 @@
   ///
   /// Class to copy a graph to another graph (duplicate a graph). The
-  /// simplest way of using it is through the \c graphCopy() function.
-  ///
-  /// This class not only make a copy of a graph, but it can create
+  /// simplest way of using it is through the \c copyGraph() function.
+  ///
+  /// This class not just make a copy of a graph, but it can create
   /// references and cross references between the nodes, edges and arcs of
-  /// the two graphs, and it can copy maps for using with the newly created
-  /// graph.
+  /// the two graphs, it can copy maps for use with the newly created
+  /// graph and copy nodes, edges and arcs.
   ///
   /// To make a copy from a graph, first an instance of GraphCopy
@@ -672,23 +664,23 @@
   /// The next code copies a graph with several data:
   ///\code
-  ///  GraphCopy<OrigGraph, NewGraph> cg(orig_graph, new_graph);
-  ///  // Create references for the nodes
+  ///  GraphCopy<NewGraph, OrigGraph> dc(new_graph, orig_graph);
+  ///  // create a reference for the nodes
   ///  OrigGraph::NodeMap<NewGraph::Node> nr(orig_graph);
-  ///  cg.nodeRef(nr);
-  ///  // Create cross references (inverse) for the edges
-  ///  NewGraph::EdgeMap<OrigGraph::Edge> ecr(new_graph);
-  ///  cg.edgeCrossRef(ecr);
-  ///  // Copy an edge map
-  ///  OrigGraph::EdgeMap<double> oemap(orig_graph);
-  ///  NewGraph::EdgeMap<double> nemap(new_graph);
-  ///  cg.edgeMap(oemap, nemap);
-  ///  // Copy a node
+  ///  dc.nodeRef(nr);
+  ///  // create a cross reference (inverse) for the edges
+  ///  NewGraph::EdgeMap<OrigGraph::Arc> ecr(new_graph);
+  ///  dc.edgeCrossRef(ecr);
+  ///  // copy an arc map
+  ///  OrigGraph::ArcMap<double> oamap(orig_graph);
+  ///  NewGraph::ArcMap<double> namap(new_graph);
+  ///  dc.arcMap(namap, oamap);
+  ///  // copy a node
   ///  OrigGraph::Node on;
   ///  NewGraph::Node nn;
-  ///  cg.node(on, nn);
-  ///  // Execute copying
-  ///  cg.run();
+  ///  dc.node(nn, on);
+  ///  // Executions of copy
+  ///  dc.run();
   ///\endcode
-  template <typename From, typename To>
+  template <typename To, typename From>
   class GraphCopy {
   private:
@@ -709,7 +701,7 @@
 
     struct ArcRefMap {
-      ArcRefMap(const From& from, const To& to,
+      ArcRefMap(const To& to, const From& from,
                 const EdgeRefMap& edge_ref, const NodeRefMap& node_ref)
-        : _from(from), _to(to),
+        : _to(to), _from(from),
           _edge_ref(edge_ref), _node_ref(node_ref) {}
 
@@ -725,22 +717,24 @@
       }
 
+      const To& _to;
       const From& _from;
-      const To& _to;
       const EdgeRefMap& _edge_ref;
       const NodeRefMap& _node_ref;
     };
 
+
   public:
 
-    /// \brief Constructor of GraphCopy.
-    ///
-    /// Constructor of GraphCopy for copying the content of the
-    /// \c from graph into the \c to graph.
-    GraphCopy(const From& from, To& to)
+
+    /// \brief Constructor for the GraphCopy.
+    ///
+    /// It copies the content of the \c _from graph into the
+    /// \c _to graph.
+    GraphCopy(To& to, const From& from)
       : _from(from), _to(to) {}
 
-    /// \brief Destructor of GraphCopy
-    ///
-    /// Destructor of GraphCopy.
+    /// \brief Destructor of the GraphCopy
+    ///
+    /// Destructor of the GraphCopy
     ~GraphCopy() {
       for (int i = 0; i < int(_node_maps.size()); ++i) {
@@ -753,12 +747,10 @@
         delete _edge_maps[i];
       }
-    }
-
-    /// \brief Copy the node references into the given map.
-    ///
-    /// This function copies the node references into the given map.
-    /// The parameter should be a map, whose key type is the Node type of
-    /// the source graph, while the value type is the Node type of the
-    /// destination graph.
+
+    }
+
+    /// \brief Copies the node references into the given map.
+    ///
+    /// Copies the node references into the given map.
     template <typename NodeRef>
     GraphCopy& nodeRef(NodeRef& map) {
@@ -768,10 +760,8 @@
     }
 
-    /// \brief Copy the node cross references into the given map.
-    ///
-    /// This function copies the node cross references (reverse references)
-    /// into the given map. The parameter should be a map, whose key type
-    /// is the Node type of the destination graph, while the value type is
-    /// the Node type of the source graph.
+    /// \brief Copies the node cross references into the given map.
+    ///
+    ///  Copies the node cross references (reverse references) into
+    ///  the given map.
     template <typename NodeCrossRef>
     GraphCopy& nodeCrossRef(NodeCrossRef& map) {
@@ -781,15 +771,14 @@
     }
 
-    /// \brief Make a copy of the given node map.
-    ///
-    /// This function makes a copy of the given node map for the newly
-    /// created graph.
-    /// The key type of the new map \c tmap should be the Node type of the
-    /// destination graph, and the key type of the original map \c map
-    /// should be the Node type of the source graph.
-    template <typename FromMap, typename ToMap>
-    GraphCopy& nodeMap(const FromMap& map, ToMap& tmap) {
+    /// \brief Make copy of the given map.
+    ///
+    /// Makes copy of the given map for the newly created graph.
+    /// The new map's key type is the to graph's node type,
+    /// and the copied map's key type is the from graph's node
+    /// type.
+    template <typename ToMap, typename FromMap>
+    GraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
       _node_maps.push_back(new _core_bits::MapCopy<From, Node,
-                           NodeRefMap, FromMap, ToMap>(map, tmap));
+                           NodeRefMap, ToMap, FromMap>(tmap, map));
       return *this;
     }
@@ -797,17 +786,14 @@
     /// \brief Make a copy of the given node.
     ///
-    /// This function makes a copy of the given node.
-    GraphCopy& node(const Node& node, TNode& tnode) {
+    /// Make a copy of the given node.
+    GraphCopy& node(TNode& tnode, const Node& snode) {
       _node_maps.push_back(new _core_bits::ItemCopy<From, Node,
-                           NodeRefMap, TNode>(node, tnode));
-      return *this;
-    }
-
-    /// \brief Copy the arc references into the given map.
-    ///
-    /// This function copies the arc references into the given map.
-    /// The parameter should be a map, whose key type is the Arc type of
-    /// the source graph, while the value type is the Arc type of the
-    /// destination graph.
+                           NodeRefMap, TNode>(tnode, snode));
+      return *this;
+    }
+
+    /// \brief Copies the arc references into the given map.
+    ///
+    /// Copies the arc references into the given map.
     template <typename ArcRef>
     GraphCopy& arcRef(ArcRef& map) {
@@ -817,10 +803,8 @@
     }
 
-    /// \brief Copy the arc cross references into the given map.
-    ///
-    /// This function copies the arc cross references (reverse references)
-    /// into the given map. The parameter should be a map, whose key type
-    /// is the Arc type of the destination graph, while the value type is
-    /// the Arc type of the source graph.
+    /// \brief Copies the arc cross references into the given map.
+    ///
+    ///  Copies the arc cross references (reverse references) into
+    ///  the given map.
     template <typename ArcCrossRef>
     GraphCopy& arcCrossRef(ArcCrossRef& map) {
@@ -830,15 +814,14 @@
     }
 
-    /// \brief Make a copy of the given arc map.
-    ///
-    /// This function makes a copy of the given arc map for the newly
-    /// created graph.
-    /// The key type of the new map \c tmap should be the Arc type of the
-    /// destination graph, and the key type of the original map \c map
-    /// should be the Arc type of the source graph.
-    template <typename FromMap, typename ToMap>
-    GraphCopy& arcMap(const FromMap& map, ToMap& tmap) {
+    /// \brief Make copy of the given map.
+    ///
+    /// Makes copy of the given map for the newly created graph.
+    /// The new map's key type is the to graph's arc type,
+    /// and the copied map's key type is the from graph's arc
+    /// type.
+    template <typename ToMap, typename FromMap>
+    GraphCopy& arcMap(ToMap& tmap, const FromMap& map) {
       _arc_maps.push_back(new _core_bits::MapCopy<From, Arc,
-                          ArcRefMap, FromMap, ToMap>(map, tmap));
+                          ArcRefMap, ToMap, FromMap>(tmap, map));
       return *this;
     }
@@ -846,17 +829,14 @@
     /// \brief Make a copy of the given arc.
     ///
-    /// This function makes a copy of the given arc.
-    GraphCopy& arc(const Arc& arc, TArc& tarc) {
+    /// Make a copy of the given arc.
+    GraphCopy& arc(TArc& tarc, const Arc& sarc) {
       _arc_maps.push_back(new _core_bits::ItemCopy<From, Arc,
-                          ArcRefMap, TArc>(arc, tarc));
-      return *this;
-    }
-
-    /// \brief Copy the edge references into the given map.
-    ///
-    /// This function copies the edge references into the given map.
-    /// The parameter should be a map, whose key type is the Edge type of
-    /// the source graph, while the value type is the Edge type of the
-    /// destination graph.
+                          ArcRefMap, TArc>(tarc, sarc));
+      return *this;
+    }
+
+    /// \brief Copies the edge references into the given map.
+    ///
+    /// Copies the edge references into the given map.
     template <typename EdgeRef>
     GraphCopy& edgeRef(EdgeRef& map) {
@@ -866,10 +846,8 @@
     }
 
-    /// \brief Copy the edge cross references into the given map.
-    ///
-    /// This function copies the edge cross references (reverse references)
-    /// into the given map. The parameter should be a map, whose key type
-    /// is the Edge type of the destination graph, while the value type is
-    /// the Edge type of the source graph.
+    /// \brief Copies the edge cross references into the given map.
+    ///
+    /// Copies the edge cross references (reverse
+    /// references) into the given map.
     template <typename EdgeCrossRef>
     GraphCopy& edgeCrossRef(EdgeCrossRef& map) {
@@ -879,15 +857,14 @@
     }
 
-    /// \brief Make a copy of the given edge map.
-    ///
-    /// This function makes a copy of the given edge map for the newly
-    /// created graph.
-    /// The key type of the new map \c tmap should be the Edge type of the
-    /// destination graph, and the key type of the original map \c map
-    /// should be the Edge type of the source graph.
-    template <typename FromMap, typename ToMap>
-    GraphCopy& edgeMap(const FromMap& map, ToMap& tmap) {
+    /// \brief Make copy of the given map.
+    ///
+    /// Makes copy of the given map for the newly created graph.
+    /// The new map's key type is the to graph's edge type,
+    /// and the copied map's key type is the from graph's edge
+    /// type.
+    template <typename ToMap, typename FromMap>
+    GraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
       _edge_maps.push_back(new _core_bits::MapCopy<From, Edge,
-                           EdgeRefMap, FromMap, ToMap>(map, tmap));
+                           EdgeRefMap, ToMap, FromMap>(tmap, map));
       return *this;
     }
@@ -895,21 +872,20 @@
     /// \brief Make a copy of the given edge.
     ///
-    /// This function makes a copy of the given edge.
-    GraphCopy& edge(const Edge& edge, TEdge& tedge) {
+    /// Make a copy of the given edge.
+    GraphCopy& edge(TEdge& tedge, const Edge& sedge) {
       _edge_maps.push_back(new _core_bits::ItemCopy<From, Edge,
-                           EdgeRefMap, TEdge>(edge, tedge));
-      return *this;
-    }
-
-    /// \brief Execute copying.
-    ///
-    /// This function executes the copying of the graph along with the
-    /// copying of the assigned data.
+                           EdgeRefMap, TEdge>(tedge, sedge));
+      return *this;
+    }
+
+    /// \brief Executes the copies.
+    ///
+    /// Executes the copies.
     void run() {
       NodeRefMap nodeRefMap(_from);
       EdgeRefMap edgeRefMap(_from);
-      ArcRefMap arcRefMap(_from, _to, edgeRefMap, nodeRefMap);
+      ArcRefMap arcRefMap(_to, _from, edgeRefMap, nodeRefMap);
       _core_bits::GraphCopySelector<To>::
-        copy(_from, _to, nodeRefMap, edgeRefMap);
+        copy(_to, _from, nodeRefMap, edgeRefMap);
       for (int i = 0; i < int(_node_maps.size()); ++i) {
         _node_maps[i]->copy(_from, nodeRefMap);
@@ -929,11 +905,11 @@
 
     std::vector<_core_bits::MapCopyBase<From, Node, NodeRefMap>* >
-      _node_maps;
+    _node_maps;
 
     std::vector<_core_bits::MapCopyBase<From, Arc, ArcRefMap>* >
-      _arc_maps;
+    _arc_maps;
 
     std::vector<_core_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
-      _edge_maps;
+    _edge_maps;
 
   };
@@ -941,21 +917,21 @@
   /// \brief Copy a graph to another graph.
   ///
-  /// This function copies a graph to another graph.
-  /// The complete usage of it is detailed in the GraphCopy class,
-  /// but a short example shows a basic work:
+  /// Copy a graph to another graph. The complete usage of the
+  /// function is detailed in the GraphCopy class, but a short
+  /// example shows a basic work:
   ///\code
-  /// graphCopy(src, trg).nodeRef(nr).edgeCrossRef(ecr).run();
+  /// copyGraph(trg, src).nodeRef(nr).arcCrossRef(ecr).run();
   ///\endcode
   ///
   /// After the copy the \c nr map will contain the mapping from the
   /// nodes of the \c from graph to the nodes of the \c to graph and
-  /// \c ecr will contain the mapping from the edges of the \c to graph
-  /// to the edges of the \c from graph.
+  /// \c ecr will contain the mapping from the arcs of the \c to graph
+  /// to the arcs of the \c from graph.
   ///
   /// \see GraphCopy
-  template <typename From, typename To>
-  GraphCopy<From, To>
-  graphCopy(const From& from, To& to) {
-    return GraphCopy<From, To>(from, to);
+  template <typename To, typename From>
+  GraphCopy<To, From>
+  copyGraph(To& to, const From& from) {
+    return GraphCopy<To, From>(to, from);
   }
 
@@ -982,5 +958,5 @@
     struct FindArcSelector<
       Graph,
-      typename enable_if<typename Graph::FindArcTag, void>::type>
+      typename enable_if<typename Graph::FindEdgeTag, void>::type>
     {
       typedef typename Graph::Node Node;
@@ -992,8 +968,7 @@
   }
 
-  /// \brief Find an arc between two nodes of a digraph.
-  ///
-  /// This function finds an arc from node \c u to node \c v in the
-  /// digraph \c g.
+  /// \brief Finds an arc between two nodes of a graph.
+  ///
+  /// Finds an arc from node \c u to node \c v in graph \c g.
   ///
   /// If \c prev is \ref INVALID (this is the default value), then
@@ -1004,14 +979,13 @@
   /// Thus you can iterate through each arc from \c u to \c v as it follows.
   ///\code
-  /// for(Arc e = findArc(g,u,v); e != INVALID; e = findArc(g,u,v,e)) {
+  /// for(Arc e=findArc(g,u,v);e!=INVALID;e=findArc(g,u,v,e)) {
   ///   ...
   /// }
   ///\endcode
   ///
-  /// \note \ref ConArcIt provides iterator interface for the same
-  /// functionality.
-  ///
+  ///\sa ArcLookUp
+  ///\sa AllArcLookUp
+  ///\sa DynArcLookUp
   ///\sa ConArcIt
-  ///\sa ArcLookUp, AllArcLookUp, DynArcLookUp
   template <typename Graph>
   inline typename Graph::Arc
@@ -1021,8 +995,8 @@
   }
 
-  /// \brief Iterator for iterating on parallel arcs connecting the same nodes.
-  ///
-  /// Iterator for iterating on parallel arcs connecting the same nodes. It is
-  /// a higher level interface for the \ref findArc() function. You can
+  /// \brief Iterator for iterating on arcs connected the same nodes.
+  ///
+  /// Iterator for iterating on arcs connected the same nodes. It is
+  /// higher level interface for the findArc() function. You can
   /// use it the following way:
   ///\code
@@ -1033,5 +1007,7 @@
   ///
   ///\sa findArc()
-  ///\sa ArcLookUp, AllArcLookUp, DynArcLookUp
+  ///\sa ArcLookUp
+  ///\sa AllArcLookUp
+  ///\sa DynArcLookUp
   template <typename _Graph>
   class ConArcIt : public _Graph::Arc {
@@ -1046,6 +1022,6 @@
     /// \brief Constructor.
     ///
-    /// Construct a new ConArcIt iterating on the arcs that
-    /// connects nodes \c u and \c v.
+    /// Construct a new ConArcIt iterating on the arcs which
+    /// connects the \c u and \c v node.
     ConArcIt(const Graph& g, Node u, Node v) : _graph(g) {
       Parent::operator=(findArc(_graph, u, v));
@@ -1054,5 +1030,6 @@
     /// \brief Constructor.
     ///
-    /// Construct a new ConArcIt that continues the iterating from arc \c a.
+    /// Construct a new ConArcIt which continues the iterating from
+    /// the \c e arc.
     ConArcIt(const Graph& g, Arc a) : Parent(a), _graph(g) {}
 
@@ -1115,27 +1092,25 @@
   }
 
-  /// \brief Find an edge between two nodes of a graph.
-  ///
-  /// This function finds an edge from node \c u to node \c v in graph \c g.
-  /// If node \c u and node \c v is equal then each loop edge
+  /// \brief Finds an edge between two nodes of a graph.
+  ///
+  /// Finds an edge from node \c u to node \c v in graph \c g.
+  /// If the node \c u and node \c v is equal then each loop edge
   /// will be enumerated once.
   ///
   /// If \c prev is \ref INVALID (this is the default value), then
-  /// it finds the first edge from \c u to \c v. Otherwise it looks for
-  /// the next edge from \c u to \c v after \c prev.
-  /// \return The found edge or \ref INVALID if there is no such an edge.
-  ///
-  /// Thus you can iterate through each edge between \c u and \c v
-  /// as it follows.
+  /// it finds the first arc from \c u to \c v. Otherwise it looks for
+  /// the next arc from \c u to \c v after \c prev.
+  /// \return The found arc or \ref INVALID if there is no such an arc.
+  ///
+  /// Thus you can iterate through each arc from \c u to \c v as it follows.
   ///\code
-  /// for(Edge e = findEdge(g,u,v); e != INVALID; e = findEdge(g,u,v,e)) {
+  /// for(Edge e = findEdge(g,u,v); e != INVALID;
+  ///     e = findEdge(g,u,v,e)) {
   ///   ...
   /// }
   ///\endcode
   ///
-  /// \note \ref ConEdgeIt provides iterator interface for the same
-  /// functionality.
-  ///
   ///\sa ConEdgeIt
+
   template <typename Graph>
   inline typename Graph::Edge
@@ -1145,11 +1120,11 @@
   }
 
-  /// \brief Iterator for iterating on parallel edges connecting the same nodes.
-  ///
-  /// Iterator for iterating on parallel edges connecting the same nodes.
-  /// It is a higher level interface for the findEdge() function. You can
+  /// \brief Iterator for iterating on edges connected the same nodes.
+  ///
+  /// Iterator for iterating on edges connected the same nodes. It is
+  /// higher level interface for the findEdge() function. You can
   /// use it the following way:
   ///\code
-  /// for (ConEdgeIt<Graph> it(g, u, v); it != INVALID; ++it) {
+  /// for (ConEdgeIt<Graph> it(g, src, trg); it != INVALID; ++it) {
   ///   ...
   /// }
@@ -1169,6 +1144,6 @@
     /// \brief Constructor.
     ///
-    /// Construct a new ConEdgeIt iterating on the edges that
-    /// connects nodes \c u and \c v.
+    /// Construct a new ConEdgeIt iterating on the edges which
+    /// connects the \c u and \c v node.
     ConEdgeIt(const Graph& g, Node u, Node v) : _graph(g) {
       Parent::operator=(findEdge(_graph, u, v));
@@ -1177,5 +1152,6 @@
     /// \brief Constructor.
     ///
-    /// Construct a new ConEdgeIt that continues iterating from edge \c e.
+    /// Construct a new ConEdgeIt which continues the iterating from
+    /// the \c e edge.
     ConEdgeIt(const Graph& g, Edge e) : Parent(e), _graph(g) {}
 
@@ -1193,8 +1169,8 @@
 
 
-  ///Dynamic arc look-up between given endpoints.
+  ///Dynamic arc look up between given endpoints.
 
   ///Using this class, you can find an arc in a digraph from a given
-  ///source to a given target in amortized time <em>O</em>(log<em>d</em>),
+  ///source to a given target in amortized time <em>O(log</em>d<em>)</em>,
   ///where <em>d</em> is the out-degree of the source node.
   ///
@@ -1202,10 +1178,10 @@
   ///the \c operator() member.
   ///
-  ///This is a dynamic data structure. Consider to use \ref ArcLookUp or
-  ///\ref AllArcLookUp if your digraph is not changed so frequently.
-  ///
-  ///This class uses a self-adjusting binary search tree, the Splay tree
-  ///of Sleator and Tarjan to guarantee the logarithmic amortized
-  ///time bound for arc look-ups. This class also guarantees the
+  ///See the \ref ArcLookUp and \ref AllArcLookUp classes if your
+  ///digraph is not changed so frequently.
+  ///
+  ///This class uses a self-adjusting binary search tree, Sleator's
+  ///and Tarjan's Splay tree for guarantee the logarithmic amortized
+  ///time bound for arc lookups. This class also guarantees the
   ///optimal time bound in a constant factor for any distribution of
   ///queries.
@@ -1532,6 +1508,6 @@
 
     ///Find an arc between two nodes.
-    ///\param s The source node.
-    ///\param t The target node.
+    ///\param s The source node
+    ///\param t The target node
     ///\param p The previous arc between \c s and \c t. It it is INVALID or
     ///not given, the operator finds the first appropriate arc.
@@ -1544,9 +1520,9 @@
     ///DynArcLookUp<ListDigraph> ae(g);
     ///...
-    ///int n = 0;
-    ///for(Arc a = ae(u,v); a != INVALID; a = ae(u,v,a)) n++;
+    ///int n=0;
+    ///for(Arc e=ae(u,v);e!=INVALID;e=ae(u,v,e)) n++;
     ///\endcode
     ///
-    ///Finding the arcs take at most <em>O</em>(log<em>d</em>)
+    ///Finding the arcs take at most <em>O(</em>log<em>d)</em>
     ///amortized time, specifically, the time complexity of the lookups
     ///is equal to the optimal search tree implementation for the
@@ -1554,8 +1530,9 @@
     ///
     ///\note This is a dynamic data structure, therefore the data
-    ///structure is updated after each graph alteration. Thus although
-    ///this data structure is theoretically faster than \ref ArcLookUp
-    ///and \ref AllArcLookUp, it often provides worse performance than
+    ///structure is updated after each graph alteration. However,
+    ///theoretically this data structure is faster than \c ArcLookUp
+    ///or AllEdgeLookup, but it often provides worse performance than
     ///them.
+    ///
     Arc operator()(Node s, Node t, Arc p = INVALID) const  {
       if (p == INVALID) {
@@ -1609,8 +1586,8 @@
   };
 
-  ///Fast arc look-up between given endpoints.
+  ///Fast arc look up between given endpoints.
 
   ///Using this class, you can find an arc in a digraph from a given
-  ///source to a given target in time <em>O</em>(log<em>d</em>),
+  ///source to a given target in time <em>O(log d)</em>,
   ///where <em>d</em> is the out-degree of the source node.
   ///
@@ -1618,8 +1595,8 @@
   ///Use \ref AllArcLookUp for this purpose.
   ///
-  ///\warning This class is static, so you should call refresh() (or at
-  ///least refresh(Node)) to refresh this data structure whenever the
-  ///digraph changes. This is a time consuming (superlinearly proportional
-  ///(<em>O</em>(<em>m</em> log<em>m</em>)) to the number of arcs).
+  ///\warning This class is static, so you should refresh() (or at least
+  ///refresh(Node)) this data structure
+  ///whenever the digraph changes. This is a time consuming (superlinearly
+  ///proportional (<em>O(m</em>log<em>m)</em>) to the number of arcs).
   ///
   ///\tparam G The type of the underlying digraph.
@@ -1670,10 +1647,10 @@
     }
   public:
-    ///Refresh the search data structure at a node.
+    ///Refresh the data structure at a node.
 
     ///Build up the search database of node \c n.
     ///
-    ///It runs in time <em>O</em>(<em>d</em> log<em>d</em>), where <em>d</em>
-    ///is the number of the outgoing arcs of \c n.
+    ///It runs in time <em>O(d</em>log<em>d)</em>, where <em>d</em> is
+    ///the number of the outgoing arcs of \c n.
     void refresh(Node n)
     {
@@ -1691,7 +1668,8 @@
     ///\ref refresh(Node) "refresh(n)" for each node \c n.
     ///
-    ///It runs in time <em>O</em>(<em>m</em> log<em>D</em>), where <em>m</em> is
-    ///the number of the arcs in the digraph and <em>D</em> is the maximum
+    ///It runs in time <em>O(m</em>log<em>D)</em>, where <em>m</em> is
+    ///the number of the arcs of \c n and <em>D</em> is the maximum
     ///out-degree of the digraph.
+
     void refresh()
     {
@@ -1701,8 +1679,8 @@
     ///Find an arc between two nodes.
 
-    ///Find an arc between two nodes in time <em>O</em>(log<em>d</em>),
-    ///where <em>d</em> is the number of outgoing arcs of \c s.
-    ///\param s The source node.
-    ///\param t The target node.
+    ///Find an arc between two nodes in time <em>O(</em>log<em>d)</em>, where
+    /// <em>d</em> is the number of outgoing arcs of \c s.
+    ///\param s The source node
+    ///\param t The target node
     ///\return An arc from \c s to \c t if there exists,
     ///\ref INVALID otherwise.
@@ -1710,5 +1688,7 @@
     ///\warning If you change the digraph, refresh() must be called before using
     ///this operator. If you change the outgoing arcs of
-    ///a single node \c n, then \ref refresh(Node) "refresh(n)" is enough.
+    ///a single node \c n, then
+    ///\ref refresh(Node) "refresh(n)" is enough.
+    ///
     Arc operator()(Node s, Node t) const
     {
@@ -1722,14 +1702,13 @@
   };
 
-  ///Fast look-up of all arcs between given endpoints.
+  ///Fast look up of all arcs between given endpoints.
 
   ///This class is the same as \ref ArcLookUp, with the addition
-  ///that it makes it possible to find all parallel arcs between given
-  ///endpoints.
-  ///
-  ///\warning This class is static, so you should call refresh() (or at
-  ///least refresh(Node)) to refresh this data structure whenever the
-  ///digraph changes. This is a time consuming (superlinearly proportional
-  ///(<em>O</em>(<em>m</em> log<em>m</em>)) to the number of arcs).
+  ///that it makes it possible to find all arcs between given endpoints.
+  ///
+  ///\warning This class is static, so you should refresh() (or at least
+  ///refresh(Node)) this data structure
+  ///whenever the digraph changes. This is a time consuming (superlinearly
+  ///proportional (<em>O(m</em>log<em>m)</em>) to the number of arcs).
   ///
   ///\tparam G The type of the underlying digraph.
@@ -1755,4 +1734,5 @@
       else {
         next=refreshNext(_right[head],next);
+//         _next[head]=next;
         _next[head]=( next!=INVALID && _g.target(next)==_g.target(head))
           ? next : INVALID;
@@ -1779,6 +1759,7 @@
     ///Build up the search database of node \c n.
     ///
-    ///It runs in time <em>O</em>(<em>d</em> log<em>d</em>), where <em>d</em> is
+    ///It runs in time <em>O(d</em>log<em>d)</em>, where <em>d</em> is
     ///the number of the outgoing arcs of \c n.
+
     void refresh(Node n)
     {
@@ -1792,7 +1773,8 @@
     ///\ref refresh(Node) "refresh(n)" for each node \c n.
     ///
-    ///It runs in time <em>O</em>(<em>m</em> log<em>D</em>), where <em>m</em> is
-    ///the number of the arcs in the digraph and <em>D</em> is the maximum
+    ///It runs in time <em>O(m</em>log<em>D)</em>, where <em>m</em> is
+    ///the number of the arcs of \c n and <em>D</em> is the maximum
     ///out-degree of the digraph.
+
     void refresh()
     {
@@ -1803,6 +1785,6 @@
 
     ///Find an arc between two nodes.
-    ///\param s The source node.
-    ///\param t The target node.
+    ///\param s The source node
+    ///\param t The target node
     ///\param prev The previous arc between \c s and \c t. It it is INVALID or
     ///not given, the operator finds the first appropriate arc.
@@ -1815,15 +1797,16 @@
     ///AllArcLookUp<ListDigraph> ae(g);
     ///...
-    ///int n = 0;
-    ///for(Arc a = ae(u,v); a != INVALID; a=ae(u,v,a)) n++;
+    ///int n=0;
+    ///for(Arc e=ae(u,v);e!=INVALID;e=ae(u,v,e)) n++;
     ///\endcode
     ///
-    ///Finding the first arc take <em>O</em>(log<em>d</em>) time,
-    ///where <em>d</em> is the number of outgoing arcs of \c s. Then the
+    ///Finding the first arc take <em>O(</em>log<em>d)</em> time, where
+    /// <em>d</em> is the number of outgoing arcs of \c s. Then, the
     ///consecutive arcs are found in constant time.
     ///
     ///\warning If you change the digraph, refresh() must be called before using
     ///this operator. If you change the outgoing arcs of
-    ///a single node \c n, then \ref refresh(Node) "refresh(n)" is enough.
+    ///a single node \c n, then
+    ///\ref refresh(Node) "refresh(n)" is enough.
     ///
 #ifdef DOXYGEN
Index: lemon/dfs.h
===================================================================
--- lemon/dfs.h	(revision 319)
+++ lemon/dfs.h	(revision 252)
@@ -28,6 +28,6 @@
 #include <lemon/core.h>
 #include <lemon/error.h>
+#include <lemon/assert.h>
 #include <lemon/maps.h>
-#include <lemon/path.h>
 
 namespace lemon {
@@ -50,9 +50,10 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
-    ///Instantiates a PredMap.
-
-    ///This function instantiates a PredMap.
+    ///Instantiates a \ref PredMap.
+
+    ///This function instantiates a \ref PredMap.
     ///\param g is the digraph, to which we would like to define the
-    ///PredMap.
+    ///\ref PredMap.
+    ///\todo The digraph alone may be insufficient to initialize
     static PredMap *createPredMap(const Digraph &g)
     {
@@ -64,10 +65,11 @@
     ///The type of the map that indicates which nodes are processed.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+    ///By default it is a NullMap.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
-    ///Instantiates a ProcessedMap.
-
-    ///This function instantiates a ProcessedMap.
+    ///Instantiates a \ref ProcessedMap.
+
+    ///This function instantiates a \ref ProcessedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ProcessedMap
+    ///we would like to define the \ref ProcessedMap
 #ifdef DOXYGEN
     static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -84,9 +86,9 @@
     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
-    ///Instantiates a ReachedMap.
-
-    ///This function instantiates a ReachedMap.
+    ///Instantiates a \ref ReachedMap.
+
+    ///This function instantiates a \ref ReachedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ReachedMap.
+    ///we would like to define the \ref ReachedMap.
     static ReachedMap *createReachedMap(const Digraph &g)
     {
@@ -99,9 +101,9 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<int> DistMap;
-    ///Instantiates a DistMap.
-
-    ///This function instantiates a DistMap.
+    ///Instantiates a \ref DistMap.
+
+    ///This function instantiates a \ref DistMap.
     ///\param g is the digraph, to which we would like to define the
-    ///DistMap.
+    ///\ref DistMap.
     static DistMap *createDistMap(const Digraph &g)
     {
@@ -115,5 +117,5 @@
   ///This class provides an efficient implementation of the %DFS algorithm.
   ///
-  ///There is also a \ref dfs() "function-type interface" for the DFS
+  ///There is also a \ref dfs() "function type interface" for the DFS
   ///algorithm, which is convenient in the simplier cases and it can be
   ///used easier.
@@ -136,4 +138,14 @@
   class Dfs {
   public:
+    ///\ref Exception for uninitialized parameters.
+
+    ///This error represents problems in the initialization of the
+    ///parameters of the algorithm.
+    class UninitializedParameter : public lemon::UninitializedParameter {
+    public:
+      virtual const char* what() const throw() {
+        return "lemon::Dfs::UninitializedParameter";
+      }
+    };
 
     ///The type of the digraph the algorithm runs on.
@@ -184,5 +196,6 @@
     int _stack_head;
 
-    //Creates the maps if necessary.
+    ///Creates the maps if necessary.
+    ///\todo Better memory allocation (instead of new).
     void create_maps()
     {
@@ -218,80 +231,76 @@
 
     template <class T>
-    struct SetPredMapTraits : public Traits {
+    struct DefPredMapTraits : public Traits {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "PredMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///PredMap type.
+    ///\ref PredMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///PredMap type.
+    ///\ref PredMap type.
     template <class T>
-    struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > {
-      typedef Dfs<Digraph, SetPredMapTraits<T> > Create;
+    struct DefPredMap : public Dfs<Digraph, DefPredMapTraits<T> > {
+      typedef Dfs<Digraph, DefPredMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetDistMapTraits : public Traits {
+    struct DefDistMapTraits : public Traits {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "DistMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///DistMap type.
+    ///\ref DistMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///DistMap type.
+    ///\ref DistMap type.
     template <class T>
-    struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > {
-      typedef Dfs<Digraph, SetDistMapTraits<T> > Create;
+    struct DefDistMap : public Dfs< Digraph, DefDistMapTraits<T> > {
+      typedef Dfs<Digraph, DefDistMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetReachedMapTraits : public Traits {
+    struct DefReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "ReachedMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ReachedMap type.
+    ///\ref ReachedMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ReachedMap type.
+    ///\ref ReachedMap type.
     template <class T>
-    struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > {
-      typedef Dfs< Digraph, SetReachedMapTraits<T> > Create;
+    struct DefReachedMap : public Dfs< Digraph, DefReachedMapTraits<T> > {
+      typedef Dfs< Digraph, DefReachedMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetProcessedMapTraits : public Traits {
+    struct DefProcessedMapTraits : public Traits {
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "ProcessedMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type.
+    ///\ref ProcessedMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type.
+    ///\ref ProcessedMap type.
     template <class T>
-    struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > {
-      typedef Dfs< Digraph, SetProcessedMapTraits<T> > Create;
-    };
-
-    struct SetStandardProcessedMapTraits : public Traits {
+    struct DefProcessedMap : public Dfs< Digraph, DefProcessedMapTraits<T> > {
+      typedef Dfs< Digraph, DefProcessedMapTraits<T> > Create;
+    };
+
+    struct DefDigraphProcessedMapTraits : public Traits {
       typedef typename Digraph::template NodeMap<bool> ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -301,12 +310,13 @@
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///If you don't set it explicitly, it will be automatically allocated.
-    struct SetStandardProcessedMap :
-      public Dfs< Digraph, SetStandardProcessedMapTraits > {
-      typedef Dfs< Digraph, SetStandardProcessedMapTraits > Create;
+    template <class T>
+    struct DefProcessedMapToBeDefaultMap :
+      public Dfs< Digraph, DefDigraphProcessedMapTraits> {
+      typedef Dfs< Digraph, DefDigraphProcessedMapTraits> Create;
     };
 
@@ -549,15 +559,15 @@
     ///
     ///This method runs the %DFS algorithm from the root node
-    ///in order to compute the DFS path to \c t.
+    ///in order to compute the DFS path to \c dest.
     ///
     ///The algorithm computes
-    ///- the %DFS path to \c t,
-    ///- the distance of \c t from the root in the %DFS tree.
+    ///- the %DFS path to \c dest,
+    ///- the distance of \c dest from the root in the %DFS tree.
     ///
     ///\pre init() must be called and a root node should be
     ///added with addSource() before using this function.
-    void start(Node t)
-    {
-      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
+    void start(Node dest)
+    {
+      while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest )
         processNextArc();
     }
@@ -589,5 +599,5 @@
     }
 
-    ///Runs the algorithm from the given source node.
+    ///Runs the algorithm from the given node.
 
     ///This method runs the %DFS algorithm from node \c s
@@ -613,8 +623,8 @@
 
     ///This method runs the %DFS algorithm from node \c s
-    ///in order to compute the DFS path to node \c t
-    ///(it stops searching when \c t is processed)
-    ///
-    ///\return \c true if \c t is reachable form \c s.
+    ///in order to compute the DFS path to \c t.
+    ///
+    ///\return The length of the <tt>s</tt>--<tt>t</tt> DFS path,
+    ///if \c t is reachable form \c s, \c 0 otherwise.
     ///
     ///\note Apart from the return value, <tt>d.run(s,t)</tt> is
@@ -625,9 +635,9 @@
     ///  d.start(t);
     ///\endcode
-    bool run(Node s,Node t) {
+    int run(Node s,Node t) {
       init();
       addSource(s);
       start(t);
-      return reached(t);
+      return reached(t)?_stack_head+1:0;
     }
 
@@ -767,13 +777,19 @@
     ///arcs of the %DFS paths.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
-    ///Instantiates a PredMap.
-
-    ///This function instantiates a PredMap.
+    ///
+    typedef NullMap<typename Digraph::Node,typename Digraph::Arc> PredMap;
+    ///Instantiates a \ref PredMap.
+
+    ///This function instantiates a \ref PredMap.
     ///\param g is the digraph, to which we would like to define the
-    ///PredMap.
+    ///\ref PredMap.
+    ///\todo The digraph alone may be insufficient to initialize
+#ifdef DOXYGEN
     static PredMap *createPredMap(const Digraph &g)
-    {
-      return new PredMap(g);
+#else
+    static PredMap *createPredMap(const Digraph &)
+#endif
+    {
+      return new PredMap();
     }
 
@@ -782,11 +798,10 @@
     ///The type of the map that indicates which nodes are processed.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    ///By default it is a NullMap.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
-    ///Instantiates a ProcessedMap.
-
-    ///This function instantiates a ProcessedMap.
+    ///Instantiates a \ref ProcessedMap.
+
+    ///This function instantiates a \ref ProcessedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ProcessedMap.
+    ///we would like to define the \ref ProcessedMap.
 #ifdef DOXYGEN
     static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -803,9 +818,9 @@
     ///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept.
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
-    ///Instantiates a ReachedMap.
-
-    ///This function instantiates a ReachedMap.
+    ///Instantiates a \ref ReachedMap.
+
+    ///This function instantiates a \ref ReachedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ReachedMap.
+    ///we would like to define the \ref ReachedMap.
     static ReachedMap *createReachedMap(const Digraph &g)
     {
@@ -817,23 +832,22 @@
     ///The type of the map that stores the distances of the nodes.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    typedef typename Digraph::template NodeMap<int> DistMap;
-    ///Instantiates a DistMap.
-
-    ///This function instantiates a DistMap.
+    ///
+    typedef NullMap<typename Digraph::Node,int> DistMap;
+    ///Instantiates a \ref DistMap.
+
+    ///This function instantiates a \ref DistMap.
     ///\param g is the digraph, to which we would like to define
-    ///the DistMap
+    ///the \ref DistMap
+#ifdef DOXYGEN
     static DistMap *createDistMap(const Digraph &g)
-    {
-      return new DistMap(g);
-    }
-
-    ///The type of the DFS paths.
-
-    ///The type of the DFS paths.
-    ///It must meet the \ref concepts::Path "Path" concept.
-    typedef lemon::Path<Digraph> Path;
+#else
+    static DistMap *createDistMap(const Digraph &)
+#endif
+    {
+      return new DistMap();
+    }
   };
 
-  /// Default traits class used by DfsWizard
+  /// Default traits class used by \ref DfsWizard
 
   /// To make it easier to use Dfs algorithm
@@ -862,8 +876,6 @@
     //Pointer to the map of distances.
     void *_dist;
-    //Pointer to the DFS path to the target node.
-    void *_path;
-    //Pointer to the distance of the target node.
-    int *_di;
+    //Pointer to the source node.
+    Node _source;
 
     public:
@@ -871,28 +883,42 @@
 
     /// This constructor does not require parameters, therefore it initiates
-    /// all of the attributes to \c 0.
+    /// all of the attributes to default values (0, INVALID).
     DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
-                      _dist(0), _path(0), _di(0) {}
+                      _dist(0), _source(INVALID) {}
 
     /// Constructor.
 
-    /// This constructor requires one parameter,
-    /// others are initiated to \c 0.
+    /// This constructor requires some parameters,
+    /// listed in the parameters list.
+    /// Others are initiated to 0.
     /// \param g The digraph the algorithm runs on.
-    DfsWizardBase(const GR &g) :
+    /// \param s The source node.
+    DfsWizardBase(const GR &g, Node s=INVALID) :
       _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
-      _reached(0), _processed(0), _pred(0), _dist(0),  _path(0), _di(0) {}
+      _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
 
   };
 
-  /// Auxiliary class for the function-type interface of DFS algorithm.
-
-  /// This auxiliary class is created to implement the
-  /// \ref dfs() "function-type interface" of \ref Dfs algorithm.
-  /// It does not have own \ref run() method, it uses the functions
-  /// and features of the plain \ref Dfs.
+  /// Auxiliary class for the function type interface of DFS algorithm.
+
+  /// This auxiliary class is created to implement the function type
+  /// interface of \ref Dfs algorithm. It uses the functions and features
+  /// of the plain \ref Dfs, but it is much simpler to use it.
+  /// It should only be used through the \ref dfs() function, which makes
+  /// it easier to use the algorithm.
   ///
-  /// This class should only be used through the \ref dfs() function,
-  /// which makes it easier to use the algorithm.
+  /// Simplicity means that the way to change the types defined
+  /// in the traits class is based on functions that returns the new class
+  /// and not on templatable built-in classes.
+  /// When using the plain \ref Dfs
+  /// the new class with the modified type comes from
+  /// the original class by using the ::
+  /// operator. In the case of \ref DfsWizard only
+  /// a function have to be called, and it will
+  /// return the needed class.
+  ///
+  /// It does not have own \ref run() method. When its \ref run() method
+  /// is called, it initiates a plain \ref Dfs object, and calls the
+  /// \ref Dfs::run() method of it.
   template<class TR>
   class DfsWizard : public TR
@@ -909,5 +935,5 @@
 
     ///\brief The type of the map that stores the predecessor
-    ///arcs of the DFS paths.
+    ///arcs of the shortest paths.
     typedef typename TR::PredMap PredMap;
     ///\brief The type of the map that stores the distances of the nodes.
@@ -917,6 +943,4 @@
     ///\brief The type of the map that indicates which nodes are processed.
     typedef typename TR::ProcessedMap ProcessedMap;
-    ///The type of the DFS paths
-    typedef typename TR::Path Path;
 
   public:
@@ -929,7 +953,6 @@
     /// Constructor that requires parameters.
     /// These parameters will be the default values for the traits class.
-    /// \param g The digraph the algorithm runs on.
-    DfsWizard(const Digraph &g) :
-      TR(g) {}
+    DfsWizard(const Digraph &g, Node s=INVALID) :
+      TR(g,s) {}
 
     ///Copy constructor
@@ -938,178 +961,130 @@
     ~DfsWizard() {}
 
-    ///Runs DFS algorithm from the given source node.
-
-    ///This method runs DFS algorithm from node \c s
-    ///in order to compute the DFS path to each node.
+    ///Runs DFS algorithm from a source node.
+
+    ///Runs DFS algorithm from a source node.
+    ///The node can be given with the \ref source() function.
+    void run()
+    {
+      if(Base::_source==INVALID) throw UninitializedParameter();
+      Dfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
+      if(Base::_reached)
+        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
+      if(Base::_processed)
+        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
+      if(Base::_pred)
+        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+      if(Base::_dist)
+        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
+      alg.run(Base::_source);
+    }
+
+    ///Runs DFS algorithm from the given node.
+
+    ///Runs DFS algorithm from the given node.
+    ///\param s is the given source.
     void run(Node s)
     {
-      Dfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
-      if (Base::_pred)
-        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
-      if (Base::_dist)
-        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
-      if (Base::_reached)
-        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
-      if (Base::_processed)
-        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
-      if (s!=INVALID)
-        alg.run(s);
-      else
-        alg.run();
-    }
-
-    ///Finds the DFS path between \c s and \c t.
-
-    ///This method runs DFS algorithm from node \c s
-    ///in order to compute the DFS path to node \c t
-    ///(it stops searching when \c t is processed).
-    ///
-    ///\return \c true if \c t is reachable form \c s.
-    bool run(Node s, Node t)
-    {
-      Dfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
-      if (Base::_pred)
-        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
-      if (Base::_dist)
-        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
-      if (Base::_reached)
-        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
-      if (Base::_processed)
-        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
-      alg.run(s,t);
-      if (Base::_path)
-        *reinterpret_cast<Path*>(Base::_path) = alg.path(t);
-      if (Base::_di)
-        *Base::_di = alg.dist(t);
-      return alg.reached(t);
-      }
-
-    ///Runs DFS algorithm to visit all nodes in the digraph.
-
-    ///This method runs DFS algorithm in order to compute
-    ///the DFS path to each node.
-    void run()
-    {
-      run(INVALID);
+      Base::_source=s;
+      run();
+    }
+
+    /// Sets the source node, from which the Dfs algorithm runs.
+
+    /// Sets the source node, from which the Dfs algorithm runs.
+    /// \param s is the source node.
+    DfsWizard<TR> &source(Node s)
+    {
+      Base::_source=s;
+      return *this;
     }
 
     template<class T>
-    struct SetPredMapBase : public Base {
+    struct DefPredMapBase : public Base {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &) { return 0; };
-      SetPredMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting PredMap object.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for setting PredMap object.
+      DefPredMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref PredMap object.
+    ///
+    ///\ref named-templ-param "Named parameter"
+    ///for setting \ref PredMap object.
     template<class T>
-    DfsWizard<SetPredMapBase<T> > predMap(const T &t)
+    DfsWizard<DefPredMapBase<T> > predMap(const T &t)
     {
       Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DfsWizard<SetPredMapBase<T> >(*this);
+      return DfsWizard<DefPredMapBase<T> >(*this);
     }
 
     template<class T>
-    struct SetReachedMapBase : public Base {
+    struct DefReachedMapBase : public Base {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &) { return 0; };
-      SetReachedMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting ReachedMap object.
-    ///
-    /// \ref named-func-param "Named parameter"
-    ///for setting ReachedMap object.
+      DefReachedMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref ReachedMap object.
+    ///
+    /// \ref named-templ-param "Named parameter"
+    ///for setting \ref ReachedMap object.
     template<class T>
-    DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t)
+    DfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
     {
       Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DfsWizard<SetReachedMapBase<T> >(*this);
+      return DfsWizard<DefReachedMapBase<T> >(*this);
     }
 
     template<class T>
-    struct SetDistMapBase : public Base {
+    struct DefProcessedMapBase : public Base {
+      typedef T ProcessedMap;
+      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
+      DefProcessedMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref ProcessedMap object.
+    ///
+    /// \ref named-templ-param "Named parameter"
+    ///for setting \ref ProcessedMap object.
+    template<class T>
+    DfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
+    {
+      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
+      return DfsWizard<DefProcessedMapBase<T> >(*this);
+    }
+
+    template<class T>
+    struct DefDistMapBase : public Base {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &) { return 0; };
-      SetDistMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting DistMap object.
-    ///
-    /// \ref named-func-param "Named parameter"
-    ///for setting DistMap object.
+      DefDistMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref DistMap object.
+    ///
+    ///\ref named-templ-param "Named parameter"
+    ///for setting \ref DistMap object.
     template<class T>
-    DfsWizard<SetDistMapBase<T> > distMap(const T &t)
+    DfsWizard<DefDistMapBase<T> > distMap(const T &t)
     {
       Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DfsWizard<SetDistMapBase<T> >(*this);
-    }
-
-    template<class T>
-    struct SetProcessedMapBase : public Base {
-      typedef T ProcessedMap;
-      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
-      SetProcessedMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting ProcessedMap object.
-    ///
-    /// \ref named-func-param "Named parameter"
-    ///for setting ProcessedMap object.
-    template<class T>
-    DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t)
-    {
-      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DfsWizard<SetProcessedMapBase<T> >(*this);
-    }
-
-    template<class T>
-    struct SetPathBase : public Base {
-      typedef T Path;
-      SetPathBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for getting the DFS path to the target node.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for getting the DFS path to the target node.
-    template<class T>
-    DfsWizard<SetPathBase<T> > path(const T &t)
-    {
-      Base::_path=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DfsWizard<SetPathBase<T> >(*this);
-    }
-
-    ///\brief \ref named-func-param "Named parameter"
-    ///for getting the distance of the target node.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for getting the distance of the target node.
-    DfsWizard dist(const int &d)
-    {
-      Base::_di=const_cast<int*>(&d);
-      return *this;
+      return DfsWizard<DefDistMapBase<T> >(*this);
     }
 
   };
 
-  ///Function-type interface for DFS algorithm.
+  ///Function type interface for Dfs algorithm.
 
   ///\ingroup search
-  ///Function-type interface for DFS algorithm.
+  ///Function type interface for Dfs algorithm.
   ///
-  ///This function also has several \ref named-func-param "named parameters",
+  ///This function also has several
+  ///\ref named-templ-func-param "named parameters",
   ///they are declared as the members of class \ref DfsWizard.
-  ///The following examples show how to use these parameters.
+  ///The following
+  ///example shows how to use these parameters.
   ///\code
-  ///  // Compute the DFS tree
-  ///  dfs(g).predMap(preds).distMap(dists).run(s);
-  ///
-  ///  // Compute the DFS path from s to t
-  ///  bool reached = dfs(g).path(p).dist(d).run(s,t);
+  ///  dfs(g,source).predMap(preds).run();
   ///\endcode
-
   ///\warning Don't forget to put the \ref DfsWizard::run() "run()"
   ///to the end of the parameter list.
@@ -1118,7 +1093,7 @@
   template<class GR>
   DfsWizard<DfsWizardBase<GR> >
-  dfs(const GR &digraph)
+  dfs(const GR &g,typename GR::Node s=INVALID)
   {
-    return DfsWizard<DfsWizardBase<GR> >(digraph);
+    return DfsWizard<DfsWizardBase<GR> >(g,s);
   }
 
@@ -1213,9 +1188,9 @@
     typedef typename Digraph::template NodeMap<bool> ReachedMap;
 
-    /// \brief Instantiates a ReachedMap.
-    ///
-    /// This function instantiates a ReachedMap.
+    /// \brief Instantiates a \ref ReachedMap.
+    ///
+    /// This function instantiates a \ref ReachedMap.
     /// \param digraph is the digraph, to which
-    /// we would like to define the ReachedMap.
+    /// we would like to define the \ref ReachedMap.
     static ReachedMap *createReachedMap(const Digraph &digraph) {
       return new ReachedMap(digraph);
@@ -1258,8 +1233,20 @@
   template <typename _Digraph = ListDigraph,
             typename _Visitor = DfsVisitor<_Digraph>,
-            typename _Traits = DfsVisitDefaultTraits<_Digraph> >
+            typename _Traits = DfsDefaultTraits<_Digraph> >
 #endif
   class DfsVisit {
   public:
+
+    /// \brief \ref Exception for uninitialized parameters.
+    ///
+    /// This error represents problems in the initialization
+    /// of the parameters of the algorithm.
+    class UninitializedParameter : public lemon::UninitializedParameter {
+    public:
+      virtual const char* what() const throw()
+      {
+        return "lemon::DfsVisit::UninitializedParameter";
+      }
+    };
 
     ///The traits class.
@@ -1294,5 +1281,6 @@
     int _stack_head;
 
-    //Creates the maps if necessary.
+    ///Creates the maps if necessary.
+    ///\todo Better memory allocation (instead of new).
     void create_maps() {
       if(!_reached) {
@@ -1314,9 +1302,8 @@
     ///@{
     template <class T>
-    struct SetReachedMapTraits : public Traits {
+    struct DefReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &digraph) {
-        LEMON_ASSERT(false, "ReachedMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
@@ -1326,7 +1313,7 @@
     /// \ref named-templ-param "Named parameter" for setting ReachedMap type.
     template <class T>
-    struct SetReachedMap : public DfsVisit< Digraph, Visitor,
-                                            SetReachedMapTraits<T> > {
-      typedef DfsVisit< Digraph, Visitor, SetReachedMapTraits<T> > Create;
+    struct DefReachedMap : public DfsVisit< Digraph, Visitor,
+                                            DefReachedMapTraits<T> > {
+      typedef DfsVisit< Digraph, Visitor, DefReachedMapTraits<T> > Create;
     };
     ///@}
@@ -1503,14 +1490,14 @@
     ///
     /// This method runs the %DFS algorithm from the root node
-    /// in order to compute the DFS path to \c t.
+    /// in order to compute the DFS path to \c dest.
     ///
     /// The algorithm computes
-    /// - the %DFS path to \c t,
-    /// - the distance of \c t from the root in the %DFS tree.
+    /// - the %DFS path to \c dest,
+    /// - the distance of \c dest from the root in the %DFS tree.
     ///
     /// \pre init() must be called and a root node should be added
     /// with addSource() before using this function.
-    void start(Node t) {
-      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
+    void start(Node dest) {
+      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != dest )
         processNextArc();
     }
@@ -1541,5 +1528,5 @@
     }
 
-    /// \brief Runs the algorithm from the given source node.
+    /// \brief Runs the algorithm from the given node.
     ///
     /// This method runs the %DFS algorithm from node \c s.
@@ -1565,8 +1552,8 @@
 
     /// This method runs the %DFS algorithm from node \c s
-    /// in order to compute the DFS path to node \c t
-    /// (it stops searching when \c t is processed).
-    ///
-    /// \return \c true if \c t is reachable form \c s.
+    /// in order to compute the DFS path to \c t.
+    ///
+    /// \return The length of the <tt>s</tt>--<tt>t</tt> DFS path,
+    /// if \c t is reachable form \c s, \c 0 otherwise.
     ///
     /// \note Apart from the return value, <tt>d.run(s,t)</tt> is
@@ -1577,9 +1564,9 @@
     ///   d.start(t);
     ///\endcode
-    bool run(Node s,Node t) {
+    int run(Node s,Node t) {
       init();
       addSource(s);
       start(t);
-      return reached(t);
+      return reached(t)?_stack_head+1:0;
     }
 
Index: lemon/dijkstra.h
===================================================================
--- lemon/dijkstra.h	(revision 313)
+++ lemon/dijkstra.h	(revision 251)
@@ -31,5 +31,4 @@
 #include <lemon/error.h>
 #include <lemon/maps.h>
-#include <lemon/path.h>
 
 namespace lemon {
@@ -140,9 +139,10 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
-    ///Instantiates a PredMap.
-
-    ///This function instantiates a PredMap.
+    ///Instantiates a \ref PredMap.
+
+    ///This function instantiates a \ref PredMap.
     ///\param g is the digraph, to which we would like to define the
-    ///PredMap.
+    ///\ref PredMap.
+    ///\todo The digraph alone may be insufficient for the initialization
     static PredMap *createPredMap(const Digraph &g)
     {
@@ -155,10 +155,12 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     ///By default it is a NullMap.
+    ///\todo If it is set to a real map,
+    ///Dijkstra::processed() should read this.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
-    ///Instantiates a ProcessedMap.
-
-    ///This function instantiates a ProcessedMap.
+    ///Instantiates a \ref ProcessedMap.
+
+    ///This function instantiates a \ref ProcessedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ProcessedMap
+    ///we would like to define the \ref ProcessedMap
 #ifdef DOXYGEN
     static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -175,9 +177,9 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     typedef typename Digraph::template NodeMap<typename LM::Value> DistMap;
-    ///Instantiates a DistMap.
-
-    ///This function instantiates a DistMap.
+    ///Instantiates a \ref DistMap.
+
+    ///This function instantiates a \ref DistMap.
     ///\param g is the digraph, to which we would like to define
-    ///the DistMap
+    ///the \ref DistMap
     static DistMap *createDistMap(const Digraph &g)
     {
@@ -198,5 +200,5 @@
   ///It is also possible to change the underlying priority heap.
   ///
-  ///There is also a \ref dijkstra() "function-type interface" for the
+  ///There is also a \ref dijkstra() "function type interface" for the
   ///%Dijkstra algorithm, which is convenient in the simplier cases and
   ///it can be used easier.
@@ -226,4 +228,14 @@
   class Dijkstra {
   public:
+    ///\ref Exception for uninitialized parameters.
+
+    ///This error represents problems in the initialization of the
+    ///parameters of the algorithm.
+    class UninitializedParameter : public lemon::UninitializedParameter {
+    public:
+      virtual const char* what() const throw() {
+        return "lemon::Dijkstra::UninitializedParameter";
+      }
+    };
 
     ///The type of the digraph the algorithm runs on.
@@ -285,5 +297,6 @@
     bool local_heap;
 
-    //Creates the maps if necessary.
+    ///Creates the maps if necessary.
+    ///\todo Better memory allocation (instead of new).
     void create_maps()
     {
@@ -319,64 +332,61 @@
 
     template <class T>
-    struct SetPredMapTraits : public Traits {
+    struct DefPredMapTraits : public Traits {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "PredMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///PredMap type.
+    ///\ref PredMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///PredMap type.
+    ///\ref PredMap type.
     template <class T>
-    struct SetPredMap
-      : public Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > {
-      typedef Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > Create;
+    struct DefPredMap
+      : public Dijkstra< Digraph, LengthMap, DefPredMapTraits<T> > {
+      typedef Dijkstra< Digraph, LengthMap, DefPredMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetDistMapTraits : public Traits {
+    struct DefDistMapTraits : public Traits {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "DistMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///DistMap type.
+    ///\ref DistMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///DistMap type.
+    ///\ref DistMap type.
     template <class T>
-    struct SetDistMap
-      : public Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > {
-      typedef Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > Create;
+    struct DefDistMap
+      : public Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > {
+      typedef Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > Create;
     };
 
     template <class T>
-    struct SetProcessedMapTraits : public Traits {
+    struct DefProcessedMapTraits : public Traits {
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &)
       {
-        LEMON_ASSERT(false, "ProcessedMap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type.
+    ///\ref ProcessedMap type.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type.
+    ///\ref ProcessedMap type.
     template <class T>
-    struct SetProcessedMap
-      : public Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > {
-      typedef Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > Create;
-    };
-
-    struct SetStandardProcessedMapTraits : public Traits {
+    struct DefProcessedMap
+      : public Dijkstra< Digraph, LengthMap, DefProcessedMapTraits<T> > {
+      typedef Dijkstra< Digraph, LengthMap, DefProcessedMapTraits<T> > Create;
+    };
+
+    struct DefDigraphProcessedMapTraits : public Traits {
       typedef typename Digraph::template NodeMap<bool> ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -386,27 +396,26 @@
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///
     ///\ref named-templ-param "Named parameter" for setting
-    ///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
+    ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
     ///If you don't set it explicitly, it will be automatically allocated.
-    struct SetStandardProcessedMap
-      : public Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits > {
-      typedef Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits >
+    template <class T>
+    struct DefProcessedMapToBeDefaultMap
+      : public Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> {
+      typedef Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits>
       Create;
     };
 
     template <class H, class CR>
-    struct SetHeapTraits : public Traits {
+    struct DefHeapTraits : public Traits {
       typedef CR HeapCrossRef;
       typedef H Heap;
       static HeapCrossRef *createHeapCrossRef(const Digraph &) {
-        LEMON_ASSERT(false, "HeapCrossRef is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
       static Heap *createHeap(HeapCrossRef &)
       {
-        LEMON_ASSERT(false, "Heap is not initialized");
-        return 0; // ignore warnings
+        throw UninitializedParameter();
       }
     };
@@ -417,11 +426,11 @@
     ///reference type.
     template <class H, class CR = typename Digraph::template NodeMap<int> >
-    struct SetHeap
-      : public Dijkstra< Digraph, LengthMap, SetHeapTraits<H, CR> > {
-      typedef Dijkstra< Digraph, LengthMap, SetHeapTraits<H, CR> > Create;
+    struct DefHeap
+      : public Dijkstra< Digraph, LengthMap, DefHeapTraits<H, CR> > {
+      typedef Dijkstra< Digraph, LengthMap, DefHeapTraits<H, CR> > Create;
     };
 
     template <class H, class CR>
-    struct SetStandardHeapTraits : public Traits {
+    struct DefStandardHeapTraits : public Traits {
       typedef CR HeapCrossRef;
       typedef H Heap;
@@ -442,24 +451,24 @@
     ///parameter and the heap's constructor waits for the cross reference.
     template <class H, class CR = typename Digraph::template NodeMap<int> >
-    struct SetStandardHeap
-      : public Dijkstra< Digraph, LengthMap, SetStandardHeapTraits<H, CR> > {
-      typedef Dijkstra< Digraph, LengthMap, SetStandardHeapTraits<H, CR> >
+    struct DefStandardHeap
+      : public Dijkstra< Digraph, LengthMap, DefStandardHeapTraits<H, CR> > {
+      typedef Dijkstra< Digraph, LengthMap, DefStandardHeapTraits<H, CR> >
       Create;
     };
 
     template <class T>
-    struct SetOperationTraitsTraits : public Traits {
+    struct DefOperationTraitsTraits : public Traits {
       typedef T OperationTraits;
     };
 
     /// \brief \ref named-templ-param "Named parameter" for setting
-    ///\c OperationTraits type
+    ///\ref OperationTraits type
     ///
     ///\ref named-templ-param "Named parameter" for setting
     ///\ref OperationTraits type.
     template <class T>
-    struct SetOperationTraits
-      : public Dijkstra<Digraph, LengthMap, SetOperationTraitsTraits<T> > {
-      typedef Dijkstra<Digraph, LengthMap, SetOperationTraitsTraits<T> >
+    struct DefOperationTraits
+      : public Dijkstra<Digraph, LengthMap, DefOperationTraitsTraits<T> > {
+      typedef Dijkstra<Digraph, LengthMap, DefOperationTraitsTraits<T> >
       Create;
     };
@@ -720,24 +729,21 @@
     }
 
-    ///Executes the algorithm until the given target node is processed.
-
-    ///Executes the algorithm until the given target node is processed.
+    ///Executes the algorithm until the given target node is reached.
+
+    ///Executes the algorithm until the given target node is reached.
     ///
     ///This method runs the %Dijkstra algorithm from the root node(s)
-    ///in order to compute the shortest path to \c t.
+    ///in order to compute the shortest path to \c dest.
     ///
     ///The algorithm computes
-    ///- the shortest path to \c t,
-    ///- the distance of \c t from the root(s).
+    ///- the shortest path to \c dest,
+    ///- the distance of \c dest from the root(s).
     ///
     ///\pre init() must be called and at least one root node should be
     ///added with addSource() before using this function.
-    void start(Node t)
-    {
-      while ( !_heap->empty() && _heap->top()!=t ) processNextNode();
-      if ( !_heap->empty() ) {
-        finalizeNodeData(_heap->top(),_heap->prio());
-        _heap->pop();
-      }
+    void start(Node dest)
+    {
+      while ( !_heap->empty() && _heap->top()!=dest ) processNextNode();
+      if ( !_heap->empty() ) finalizeNodeData(_heap->top(),_heap->prio());
     }
 
@@ -767,5 +773,5 @@
     }
 
-    ///Runs the algorithm from the given source node.
+    ///Runs the algorithm from the given node.
 
     ///This method runs the %Dijkstra algorithm from node \c s
@@ -791,8 +797,8 @@
 
     ///This method runs the %Dijkstra algorithm from node \c s
-    ///in order to compute the shortest path to node \c t
-    ///(it stops searching when \c t is processed).
-    ///
-    ///\return \c true if \c t is reachable form \c s.
+    ///in order to compute the shortest path to \c t.
+    ///
+    ///\return The length of the shortest <tt>s</tt>--<tt>t</tt> path,
+    ///if \c t is reachable form \c s, \c 0 otherwise.
     ///
     ///\note Apart from the return value, <tt>d.run(s,t)</tt> is just a
@@ -803,9 +809,9 @@
     ///  d.start(t);
     ///\endcode
-    bool run(Node s,Node t) {
+    Value run(Node s,Node t) {
       init();
       addSource(s);
       start(t);
-      return (*_heap_cross_ref)[t] == Heap::POST_HEAP;
+      return (*_pred)[t]==INVALID?OperationTraits::zero():(*_dist)[t];
     }
 
@@ -903,5 +909,5 @@
     ///Returns \c true if \c v is processed, i.e. the shortest
     ///path to \c v has already found.
-    ///\pre Either \ref run() or \ref init()
+    ///\pre Either \ref run() or \ref start()
     ///must be called before using this function.
     bool processed(Node v) const { return (*_heap_cross_ref)[v] ==
@@ -912,10 +918,6 @@
     ///Returns the current distance of a node from the root(s).
     ///It may be decreased in the following processes.
-    ///\pre Either \ref run() or \ref init()
-    ///must be called before using this function and
-    ///node \c v must be reached but not necessarily processed.
-    Value currentDist(Node v) const {
-      return processed(v) ? (*_dist)[v] : (*_heap)[v];
-    }
+    ///\pre \c v should be reached but not processed.
+    Value currentDist(Node v) const { return (*_heap)[v]; }
 
     ///@}
@@ -957,4 +959,5 @@
     /// \param g is the digraph, to which we would like to define the
     /// HeapCrossRef.
+    /// \todo The digraph alone may be insufficient for the initialization
     static HeapCrossRef *createHeapCrossRef(const Digraph &g)
     {
@@ -986,13 +989,18 @@
     ///arcs of the shortest paths.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
-    ///Instantiates a PredMap.
-
-    ///This function instantiates a PredMap.
+    typedef NullMap <typename Digraph::Node,typename Digraph::Arc> PredMap;
+    ///Instantiates a \ref PredMap.
+
+    ///This function instantiates a \ref PredMap.
     ///\param g is the digraph, to which we would like to define the
-    ///PredMap.
+    ///\ref PredMap.
+    ///\todo The digraph alone may be insufficient to initialize
+#ifdef DOXYGEN
     static PredMap *createPredMap(const Digraph &g)
-    {
-      return new PredMap(g);
+#else
+    static PredMap *createPredMap(const Digraph &)
+#endif
+    {
+      return new PredMap();
     }
 
@@ -1002,10 +1010,13 @@
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
     ///By default it is a NullMap.
+    ///\todo If it is set to a real map,
+    ///Dijkstra::processed() should read this.
+    ///\todo named parameter to set this type, function to read and write.
     typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
-    ///Instantiates a ProcessedMap.
-
-    ///This function instantiates a ProcessedMap.
+    ///Instantiates a \ref ProcessedMap.
+
+    ///This function instantiates a \ref ProcessedMap.
     ///\param g is the digraph, to which
-    ///we would like to define the ProcessedMap.
+    ///we would like to define the \ref ProcessedMap.
 #ifdef DOXYGEN
     static ProcessedMap *createProcessedMap(const Digraph &g)
@@ -1021,23 +1032,21 @@
     ///The type of the map that stores the distances of the nodes.
     ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
-    typedef typename Digraph::template NodeMap<typename LM::Value> DistMap;
-    ///Instantiates a DistMap.
-
-    ///This function instantiates a DistMap.
+    typedef NullMap<typename Digraph::Node,Value> DistMap;
+    ///Instantiates a \ref DistMap.
+
+    ///This function instantiates a \ref DistMap.
     ///\param g is the digraph, to which we would like to define
-    ///the DistMap
+    ///the \ref DistMap
+#ifdef DOXYGEN
     static DistMap *createDistMap(const Digraph &g)
-    {
-      return new DistMap(g);
-    }
-
-    ///The type of the shortest paths.
-
-    ///The type of the shortest paths.
-    ///It must meet the \ref concepts::Path "Path" concept.
-    typedef lemon::Path<Digraph> Path;
+#else
+    static DistMap *createDistMap(const Digraph &)
+#endif
+    {
+      return new DistMap();
+    }
   };
 
-  /// Default traits class used by DijkstraWizard
+  /// Default traits class used by \ref DijkstraWizard
 
   /// To make it easier to use Dijkstra algorithm
@@ -1047,4 +1056,5 @@
   /// The \ref DijkstraWizardBase is a class to be the default traits of the
   /// \ref DijkstraWizard class.
+  /// \todo More named parameters are required...
   template<class GR,class LM>
   class DijkstraWizardBase : public DijkstraWizardDefaultTraits<GR,LM>
@@ -1057,5 +1067,5 @@
     //Pointer to the digraph the algorithm runs on.
     void *_g;
-    //Pointer to the length map.
+    //Pointer to the length map
     void *_length;
     //Pointer to the map of processed nodes.
@@ -1065,8 +1075,6 @@
     //Pointer to the map of distances.
     void *_dist;
-    //Pointer to the shortest path to the target node.
-    void *_path;
-    //Pointer to the distance of the target node.
-    void *_di;
+    //Pointer to the source node.
+    Node _source;
 
   public:
@@ -1074,30 +1082,44 @@
 
     /// This constructor does not require parameters, therefore it initiates
-    /// all of the attributes to \c 0.
+    /// all of the attributes to default values (0, INVALID).
     DijkstraWizardBase() : _g(0), _length(0), _processed(0), _pred(0),
-                           _dist(0), _path(0), _di(0) {}
+                           _dist(0), _source(INVALID) {}
 
     /// Constructor.
 
-    /// This constructor requires two parameters,
-    /// others are initiated to \c 0.
+    /// This constructor requires some parameters,
+    /// listed in the parameters list.
+    /// Others are initiated to 0.
     /// \param g The digraph the algorithm runs on.
     /// \param l The length map.
-    DijkstraWizardBase(const GR &g,const LM &l) :
+    /// \param s The source node.
+    DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
       _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
       _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
-      _processed(0), _pred(0), _dist(0), _path(0), _di(0) {}
+      _processed(0), _pred(0), _dist(0), _source(s) {}
 
   };
 
-  /// Auxiliary class for the function-type interface of Dijkstra algorithm.
-
-  /// This auxiliary class is created to implement the
-  /// \ref dijkstra() "function-type interface" of \ref Dijkstra algorithm.
-  /// It does not have own \ref run() method, it uses the functions
-  /// and features of the plain \ref Dijkstra.
+  /// Auxiliary class for the function type interface of Dijkstra algorithm.
+
+  /// This auxiliary class is created to implement the function type
+  /// interface of \ref Dijkstra algorithm. It uses the functions and features
+  /// of the plain \ref Dijkstra, but it is much simpler to use it.
+  /// It should only be used through the \ref dijkstra() function, which makes
+  /// it easier to use the algorithm.
   ///
-  /// This class should only be used through the \ref dijkstra() function,
-  /// which makes it easier to use the algorithm.
+  /// Simplicity means that the way to change the types defined
+  /// in the traits class is based on functions that returns the new class
+  /// and not on templatable built-in classes.
+  /// When using the plain \ref Dijkstra
+  /// the new class with the modified type comes from
+  /// the original class by using the ::
+  /// operator. In the case of \ref DijkstraWizard only
+  /// a function have to be called, and it will
+  /// return the needed class.
+  ///
+  /// It does not have own \ref run() method. When its \ref run() method
+  /// is called, it initiates a plain \ref Dijkstra object, and calls the
+  /// \ref Dijkstra::run() method of it.
   template<class TR>
   class DijkstraWizard : public TR
@@ -1124,6 +1146,4 @@
     ///The type of the map that indicates which nodes are processed.
     typedef typename TR::ProcessedMap ProcessedMap;
-    ///The type of the shortest paths
-    typedef typename TR::Path Path;
     ///The heap type used by the dijkstra algorithm.
     typedef typename TR::Heap Heap;
@@ -1138,8 +1158,6 @@
     /// Constructor that requires parameters.
     /// These parameters will be the default values for the traits class.
-    /// \param g The digraph the algorithm runs on.
-    /// \param l The length map.
-    DijkstraWizard(const Digraph &g, const LengthMap &l) :
-      TR(g,l) {}
+    DijkstraWizard(const Digraph &g,const LengthMap &l, Node s=INVALID) :
+      TR(g,l,s) {}
 
     ///Copy constructor
@@ -1148,146 +1166,111 @@
     ~DijkstraWizard() {}
 
-    ///Runs Dijkstra algorithm from the given source node.
-
-    ///This method runs %Dijkstra algorithm from the given source node
-    ///in order to compute the shortest path to each node.
+    ///Runs Dijkstra algorithm from a source node.
+
+    ///Runs Dijkstra algorithm from a source node.
+    ///The node can be given with the \ref source() function.
+    void run()
+    {
+      if(Base::_source==INVALID) throw UninitializedParameter();
+      Dijkstra<Digraph,LengthMap,TR>
+        dij(*reinterpret_cast<const Digraph*>(Base::_g),
+            *reinterpret_cast<const LengthMap*>(Base::_length));
+      if(Base::_processed)
+        dij.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
+      if(Base::_pred)
+        dij.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+      if(Base::_dist)
+        dij.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
+      dij.run(Base::_source);
+    }
+
+    ///Runs Dijkstra algorithm from the given node.
+
+    ///Runs Dijkstra algorithm from the given node.
+    ///\param s is the given source.
     void run(Node s)
     {
-      Dijkstra<Digraph,LengthMap,TR>
-        dijk(*reinterpret_cast<const Digraph*>(Base::_g),
-             *reinterpret_cast<const LengthMap*>(Base::_length));
-      if (Base::_pred)
-        dijk.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
-      if (Base::_dist)
-        dijk.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
-      if (Base::_processed)
-        dijk.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
-      dijk.run(s);
-    }
-
-    ///Finds the shortest path between \c s and \c t.
-
-    ///This method runs the %Dijkstra algorithm from node \c s
-    ///in order to compute the shortest path to node \c t
-    ///(it stops searching when \c t is processed).
-    ///
-    ///\return \c true if \c t is reachable form \c s.
-    bool run(Node s, Node t)
-    {
-      Dijkstra<Digraph,LengthMap,TR>
-        dijk(*reinterpret_cast<const Digraph*>(Base::_g),
-             *reinterpret_cast<const LengthMap*>(Base::_length));
-      if (Base::_pred)
-        dijk.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
-      if (Base::_dist)
-        dijk.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
-      if (Base::_processed)
-        dijk.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
-      dijk.run(s,t);
-      if (Base::_path)
-        *reinterpret_cast<Path*>(Base::_path) = dijk.path(t);
-      if (Base::_di)
-        *reinterpret_cast<Value*>(Base::_di) = dijk.dist(t);
-      return dijk.reached(t);
+      Base::_source=s;
+      run();
+    }
+
+    /// Sets the source node, from which the Dijkstra algorithm runs.
+
+    /// Sets the source node, from which the Dijkstra algorithm runs.
+    /// \param s is the source node.
+    DijkstraWizard<TR> &source(Node s)
+    {
+      Base::_source=s;
+      return *this;
     }
 
     template<class T>
-    struct SetPredMapBase : public Base {
+    struct DefPredMapBase : public Base {
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &) { return 0; };
-      SetPredMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting PredMap object.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for setting PredMap object.
+      DefPredMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref PredMap object.
+    ///
+    ///\ref named-templ-param "Named parameter"
+    ///for setting \ref PredMap object.
     template<class T>
-    DijkstraWizard<SetPredMapBase<T> > predMap(const T &t)
+    DijkstraWizard<DefPredMapBase<T> > predMap(const T &t)
     {
       Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DijkstraWizard<SetPredMapBase<T> >(*this);
+      return DijkstraWizard<DefPredMapBase<T> >(*this);
     }
 
     template<class T>
-    struct SetDistMapBase : public Base {
+    struct DefProcessedMapBase : public Base {
+      typedef T ProcessedMap;
+      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
+      DefProcessedMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref ProcessedMap object.
+    ///
+    /// \ref named-templ-param "Named parameter"
+    ///for setting \ref ProcessedMap object.
+    template<class T>
+    DijkstraWizard<DefProcessedMapBase<T> > processedMap(const T &t)
+    {
+      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
+      return DijkstraWizard<DefProcessedMapBase<T> >(*this);
+    }
+
+    template<class T>
+    struct DefDistMapBase : public Base {
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &) { return 0; };
-      SetDistMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting DistMap object.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for setting DistMap object.
+      DefDistMapBase(const TR &b) : TR(b) {}
+    };
+    ///\brief \ref named-templ-param "Named parameter"
+    ///for setting \ref DistMap object.
+    ///
+    ///\ref named-templ-param "Named parameter"
+    ///for setting \ref DistMap object.
     template<class T>
-    DijkstraWizard<SetDistMapBase<T> > distMap(const T &t)
+    DijkstraWizard<DefDistMapBase<T> > distMap(const T &t)
     {
       Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DijkstraWizard<SetDistMapBase<T> >(*this);
-    }
-
-    template<class T>
-    struct SetProcessedMapBase : public Base {
-      typedef T ProcessedMap;
-      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
-      SetProcessedMapBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for setting ProcessedMap object.
-    ///
-    /// \ref named-func-param "Named parameter"
-    ///for setting ProcessedMap object.
-    template<class T>
-    DijkstraWizard<SetProcessedMapBase<T> > processedMap(const T &t)
-    {
-      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DijkstraWizard<SetProcessedMapBase<T> >(*this);
-    }
-
-    template<class T>
-    struct SetPathBase : public Base {
-      typedef T Path;
-      SetPathBase(const TR &b) : TR(b) {}
-    };
-    ///\brief \ref named-func-param "Named parameter"
-    ///for getting the shortest path to the target node.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for getting the shortest path to the target node.
-    template<class T>
-    DijkstraWizard<SetPathBase<T> > path(const T &t)
-    {
-      Base::_path=reinterpret_cast<void*>(const_cast<T*>(&t));
-      return DijkstraWizard<SetPathBase<T> >(*this);
-    }
-
-    ///\brief \ref named-func-param "Named parameter"
-    ///for getting the distance of the target node.
-    ///
-    ///\ref named-func-param "Named parameter"
-    ///for getting the distance of the target node.
-    DijkstraWizard dist(const Value &d)
-    {
-      Base::_di=reinterpret_cast<void*>(const_cast<Value*>(&d));
-      return *this;
+      return DijkstraWizard<DefDistMapBase<T> >(*this);
     }
 
   };
 
-  ///Function-type interface for Dijkstra algorithm.
+  ///Function type interface for Dijkstra algorithm.
 
   /// \ingroup shortest_path
-  ///Function-type interface for Dijkstra algorithm.
+  ///Function type interface for Dijkstra algorithm.
   ///
-  ///This function also has several \ref named-func-param "named parameters",
+  ///This function also has several
+  ///\ref named-templ-func-param "named parameters",
   ///they are declared as the members of class \ref DijkstraWizard.
-  ///The following examples show how to use these parameters.
+  ///The following
+  ///example shows how to use these parameters.
   ///\code
-  ///  // Compute shortest path from node s to each node
-  ///  dijkstra(g,length).predMap(preds).distMap(dists).run(s);
-  ///
-  ///  // Compute shortest path from s to t
-  ///  bool reached = dijkstra(g,length).path(p).dist(d).run(s,t);
+  ///  dijkstra(g,length,source).predMap(preds).run();
   ///\endcode
   ///\warning Don't forget to put the \ref DijkstraWizard::run() "run()"
@@ -1297,7 +1280,7 @@
   template<class GR, class LM>
   DijkstraWizard<DijkstraWizardBase<GR,LM> >
-  dijkstra(const GR &digraph, const LM &length)
+  dijkstra(const GR &g,const LM &l,typename GR::Node s=INVALID)
   {
-    return DijkstraWizard<DijkstraWizardBase<GR,LM> >(digraph,length);
+    return DijkstraWizard<DijkstraWizardBase<GR,LM> >(g,l,s);
   }
 
Index: lemon/dim2.h
===================================================================
--- lemon/dim2.h	(revision 314)
+++ lemon/dim2.h	(revision 253)
@@ -260,8 +260,8 @@
 
 
-  /// Bounding box of plain vectors (points).
+  /// Bounding box of plain vectors (\ref Point points).
 
   /// A class to calculate or store the bounding box of plain vectors
-  /// (\ref Point "points").
+  /// (\ref Point points).
   template<typename T>
   class Box {
@@ -574,6 +574,7 @@
   }
 
-  ///Map of x-coordinates of a <tt>Point</tt>-map
-
+  ///Map of x-coordinates of a \ref Point "Point"-map
+
+  ///\ingroup maps
   ///Map of x-coordinates of a \ref Point "Point"-map.
   ///
@@ -592,7 +593,9 @@
   };
 
-  ///Returns an XMap class
-
-  ///This function just returns an XMap class.
+  ///Returns an \ref XMap class
+
+  ///This function just returns an \ref XMap class.
+  ///
+  ///\ingroup maps
   ///\relates XMap
   template<class M>
@@ -608,7 +611,8 @@
   }
 
-  ///Constant (read only) version of XMap
-
-  ///Constant (read only) version of XMap.
+  ///Constant (read only) version of \ref XMap
+
+  ///\ingroup maps
+  ///Constant (read only) version of \ref XMap
   ///
   template<class M>
@@ -625,7 +629,9 @@
   };
 
-  ///Returns a ConstXMap class
-
-  ///This function just returns a ConstXMap class.
+  ///Returns a \ref ConstXMap class
+
+  ///This function just returns a \ref ConstXMap class.
+  ///
+  ///\ingroup maps
   ///\relates ConstXMap
   template<class M>
@@ -635,6 +641,7 @@
   }
 
-  ///Map of y-coordinates of a <tt>Point</tt>-map
-
+  ///Map of y-coordinates of a \ref Point "Point"-map
+
+  ///\ingroup maps
   ///Map of y-coordinates of a \ref Point "Point"-map.
   ///
@@ -653,7 +660,9 @@
   };
 
-  ///Returns a YMap class
-
-  ///This function just returns a YMap class.
+  ///Returns a \ref YMap class
+
+  ///This function just returns a \ref YMap class.
+  ///
+  ///\ingroup maps
   ///\relates YMap
   template<class M>
@@ -669,7 +678,8 @@
   }
 
-  ///Constant (read only) version of YMap
-
-  ///Constant (read only) version of YMap.
+  ///Constant (read only) version of \ref YMap
+
+  ///\ingroup maps
+  ///Constant (read only) version of \ref YMap
   ///
   template<class M>
@@ -686,7 +696,9 @@
   };
 
-  ///Returns a ConstYMap class
-
-  ///This function just returns a ConstYMap class.
+  ///Returns a \ref ConstYMap class
+
+  ///This function just returns a \ref ConstYMap class.
+  ///
+  ///\ingroup maps
   ///\relates ConstYMap
   template<class M>
@@ -697,8 +709,10 @@
 
 
-  ///\brief Map of the normSquare() of a <tt>Point</tt>-map
+  ///\brief Map of the \ref Point::normSquare() "normSquare()"
+  ///of a \ref Point "Point"-map
   ///
   ///Map of the \ref Point::normSquare() "normSquare()"
   ///of a \ref Point "Point"-map.
+  ///\ingroup maps
   template<class M>
   class NormSquareMap
@@ -714,7 +728,9 @@
   };
 
-  ///Returns a NormSquareMap class
-
-  ///This function just returns a NormSquareMap class.
+  ///Returns a \ref NormSquareMap class
+
+  ///This function just returns a \ref NormSquareMap class.
+  ///
+  ///\ingroup maps
   ///\relates NormSquareMap
   template<class M>
Index: lemon/error.h
===================================================================
--- lemon/error.h	(revision 291)
+++ lemon/error.h	(revision 212)
@@ -36,15 +36,144 @@
   /// @{
 
-  /// \brief Generic exception class.
+  /// \brief Exception safe wrapper class.
   ///
+  /// Exception safe wrapper class to implement the members of exceptions.
+  template <typename _Type>
+  class ExceptionMember {
+  public:
+    typedef _Type Type;
+
+    ExceptionMember() throw() {
+      try {
+        ptr.reset(new Type());
+      } catch (...) {}
+    }
+
+    ExceptionMember(const Type& type) throw() {
+      try {
+        ptr.reset(new Type());
+        if (ptr.get() == 0) return;
+        *ptr = type;
+      } catch (...) {}
+    }
+
+    ExceptionMember(const ExceptionMember& copy) throw() {
+      try {
+        if (!copy.valid()) return;
+        ptr.reset(new Type());
+        if (ptr.get() == 0) return;
+        *ptr = copy.get();
+      } catch (...) {}
+    }
+
+    ExceptionMember& operator=(const ExceptionMember& copy) throw() {
+      if (ptr.get() == 0) return;
+      try {
+        if (!copy.valid()) return;
+        *ptr = copy.get();
+      } catch (...) {}
+    }
+
+    void set(const Type& type) throw() {
+      if (ptr.get() == 0) return;
+      try {
+        *ptr = type;
+      } catch (...) {}
+    }
+
+    const Type& get() const {
+      return *ptr;
+    }
+
+    bool valid() const throw() {
+      return ptr.get() != 0;
+    }
+
+  private:
+    std::auto_ptr<_Type> ptr;
+  };
+
+  /// Exception-safe convenient error message builder class.
+
+  /// Helper class which provides a convenient ostream-like (operator <<
+  /// based) interface to create a string message. Mostly useful in
+  /// exception classes (therefore the name).
+  class ErrorMessage {
+  protected:
+    ///\e
+
+    ///\todo The good solution is boost::shared_ptr...
+    ///
+    mutable std::auto_ptr<std::ostringstream> buf;
+
+    ///\e
+    bool init() throw() {
+      try {
+        buf.reset(new std::ostringstream);
+      }
+      catch(...) {
+        buf.reset();
+      }
+      return buf.get();
+    }
+
+  public:
+
+    ///\e
+    ErrorMessage() throw() { init(); }
+
+    ErrorMessage(const ErrorMessage& em) throw() : buf(em.buf) { }
+
+    ///\e
+    ErrorMessage(const char *msg) throw() {
+      init();
+      *this << msg;
+    }
+
+    ///\e
+    ErrorMessage(const std::string &msg) throw() {
+      init();
+      *this << msg;
+    }
+
+    ///\e
+    template <typename T>
+    ErrorMessage& operator<<(const T &t) throw() {
+      if( ! buf.get() ) return *this;
+
+      try {
+        *buf << t;
+      }
+      catch(...) {
+        buf.reset();
+      }
+      return *this;
+    }
+
+    ///\e
+    const char* message() throw() {
+      if( ! buf.get() ) return 0;
+
+      const char* mes = 0;
+      try {
+        mes = buf->str().c_str();
+      }
+      catch(...) {}
+      return mes;
+    }
+
+  };
+
+  /// Generic exception class.
+
   /// Base class for exceptions used in LEMON.
   ///
   class Exception : public std::exception {
   public:
-    ///Constructor
-    Exception() throw() {}
-    ///Virtual destructor
+    ///\e
+    Exception() {}
+    ///\e
     virtual ~Exception() throw() {}
-    ///A short description of the exception
+    ///\e
     virtual const char* what() const throw() {
       return "lemon::Exception";
@@ -52,220 +181,235 @@
   };
 
-  /// \brief Input-Output error
+  /// One of the two main subclasses of \ref Exception.
+
+  /// Logic errors represent problems in the internal logic of a program;
+  /// in theory, these are preventable, and even detectable before the
+  /// program runs (e.g. violations of class invariants).
   ///
-  /// This exception is thrown when a file operation cannot be
-  /// succeeded.
-  class IoError : public Exception {
+  /// A typical example for this is \ref UninitializedParameter.
+  class LogicError : public Exception {
+  public:
+    virtual const char* what() const throw() {
+      return "lemon::LogicError";
+    }
+  };
+
+  /// \ref Exception for uninitialized parameters.
+
+  /// This error represents problems in the initialization
+  /// of the parameters of the algorithms.
+  class UninitializedParameter : public LogicError {
+  public:
+    virtual const char* what() const throw() {
+      return "lemon::UninitializedParameter";
+    }
+  };
+
+
+  /// One of the two main subclasses of \ref Exception.
+
+  /// Runtime errors represent problems outside the scope of a program;
+  /// they cannot be easily predicted and can generally only be caught
+  /// as the program executes.
+  class RuntimeError : public Exception {
+  public:
+    virtual const char* what() const throw() {
+      return "lemon::RuntimeError";
+    }
+  };
+
+  ///\e
+  class RangeError : public RuntimeError {
+  public:
+    virtual const char* what() const throw() {
+      return "lemon::RangeError";
+    }
+  };
+
+  ///\e
+  class IoError : public RuntimeError {
+  public:
+    virtual const char* what() const throw() {
+      return "lemon::IoError";
+    }
+  };
+
+  ///\e
+  class DataFormatError : public IoError {
   protected:
-    std::string _message;
-    std::string _file;
-
-    mutable std::string _what;
-  public:
-
-    /// Copy constructor
-    IoError(const IoError &error) throw() : Exception() {
-      message(error._message);
-      file(error._file);
-    }
-
-    /// Constructor
-    explicit IoError(const char *message) throw() {
-      IoError::message(message);
-    }
-
-    /// Constructor
-    explicit IoError(const std::string &message) throw() {
-      IoError::message(message);
-    }
-
-    /// Constructor
-    explicit IoError(const char *message,
-                     const std::string &file) throw() {
-      IoError::message(message);
-      IoError::file(file);
-    }
-
-    /// Constructor
-    explicit IoError(const std::string &message,
-                     const std::string &file) throw() {
-      IoError::message(message);
-      IoError::file(file);
-    }
-
-    /// Virtual destructor
-    virtual ~IoError() throw() {}
-
-    /// Set the error message
-    void message(const char *message) throw() {
-      try {
-        _message = message;
-      } catch (...) {}
-    }
-
-    /// Set the error message
-    void message(const std::string& message) throw() {
-      try {
-        _message = message;
-      } catch (...) {}
-    }
-
-    /// Set the file name
-    void file(const std::string &file) throw() {
-      try {
-        _file = file;
-      } catch (...) {}
-    }
-
-    /// Returns the error message
-    const std::string& message() const throw() {
-      return _message;
-    }
-
-    /// \brief Returns the filename
+    ExceptionMember<std::string> _message;
+    ExceptionMember<std::string> _file;
+    int _line;
+
+    mutable ExceptionMember<std::string> _message_holder;
+  public:
+
+    DataFormatError(const DataFormatError &dfe) :
+      IoError(dfe), _message(dfe._message), _file(dfe._file),
+      _line(dfe._line) {}
+
+    ///\e
+    explicit DataFormatError(const char *the_message)
+      : _message(the_message), _line(0) {}
+
+    ///\e
+    DataFormatError(const std::string &file_name, int line_num,
+                    const char *the_message)
+      : _message(the_message), _line(line_num) { file(file_name); }
+
+    ///\e
+    void line(int ln) { _line = ln; }
+    ///\e
+    void message(const std::string& msg) { _message.set(msg); }
+    ///\e
+    void file(const std::string &fl) { _file.set(fl); }
+
+    ///\e
+    int line() const { return _line; }
+    ///\e
+    const char* message() const {
+      if (_message.valid() && !_message.get().empty()) {
+        return _message.get().c_str();
+      } else {
+        return 0;
+      }
+    }
+
+    /// \brief Returns the filename.
     ///
-    /// Returns the filename or an empty string if it was not specified.
-    const std::string& file() const throw() {
-      return _file;
-    }
-
-    /// \brief Returns a short error message
+    /// Returns \e null if the filename was not specified.
+    const char* file() const {
+      if (_file.valid() && !_file.get().empty()) {
+        return _file.get().c_str();
+      } else {
+        return 0;
+      }
+    }
+
+    ///\e
+    virtual const char* what() const throw() {
+      try {
+        std::ostringstream ostr;
+        ostr << "lemon:DataFormatError" << ": ";
+        if (message()) ostr << message();
+        if( file() || line() != 0 ) {
+          ostr << " (";
+          if( file() ) ostr << "in file '" << file() << "'";
+          if( file() && line() != 0 ) ostr << " ";
+          if( line() != 0 ) ostr << "at line " << line();
+          ostr << ")";
+        }
+        _message_holder.set(ostr.str());
+      }
+      catch (...) {}
+      if( _message_holder.valid()) return _message_holder.get().c_str();
+      return "lemon:DataFormatError";
+    }
+
+    virtual ~DataFormatError() throw() {}
+  };
+
+  ///\e
+  class FileOpenError : public IoError {
+  protected:
+    ExceptionMember<std::string> _file;
+
+    mutable ExceptionMember<std::string> _message_holder;
+  public:
+
+    FileOpenError(const FileOpenError &foe) :
+      IoError(foe), _file(foe._file) {}
+
+    ///\e
+    explicit FileOpenError(const std::string& fl)
+      : _file(fl) {}
+
+
+    ///\e
+    void file(const std::string &fl) { _file.set(fl); }
+
+    /// \brief Returns the filename.
     ///
-    /// Returns a short error message which contains the message and the
-    /// file name.
-    virtual const char* what() const throw() {
-      try {
-        _what.clear();
-        std::ostringstream oss;
-        oss << "lemon:IoError" << ": ";
-        oss << _message;
-        if (!_file.empty()) {
-          oss << " ('" << _file << "')";
-        }
-        _what = oss.str();
+    /// Returns \e null if the filename was not specified.
+    const char* file() const {
+      if (_file.valid() && !_file.get().empty()) {
+        return _file.get().c_str();
+      } else {
+        return 0;
+      }
+    }
+
+    ///\e
+    virtual const char* what() const throw() {
+      try {
+        std::ostringstream ostr;
+        ostr << "lemon::FileOpenError" << ": ";
+        ostr << "Cannot open file - " << file();
+        _message_holder.set(ostr.str());
       }
       catch (...) {}
-      if (!_what.empty()) return _what.c_str();
-      else return "lemon:IoError";
-    }
-
-  };
-
-  /// \brief Format error
-  ///
-  /// This exception is thrown when an input file has wrong
-  /// format or a data representation is not legal.
-  class FormatError : public Exception {
+      if( _message_holder.valid()) return _message_holder.get().c_str();
+      return "lemon::FileOpenError";
+    }
+    virtual ~FileOpenError() throw() {}
+  };
+
+  class IoParameterError : public IoError {
   protected:
-    std::string _message;
-    std::string _file;
-    int _line;
-
-    mutable std::string _what;
-  public:
-
-    /// Copy constructor
-    FormatError(const FormatError &error) throw() : Exception() {
-      message(error._message);
-      file(error._file);
-      line(error._line);
-    }
-
-    /// Constructor
-    explicit FormatError(const char *message) throw() {
-      FormatError::message(message);
-      _line = 0;
-    }
-
-    /// Constructor
-    explicit FormatError(const std::string &message) throw() {
-      FormatError::message(message);
-      _line = 0;
-    }
-
-    /// Constructor
-    explicit FormatError(const char *message,
-                         const std::string &file, int line = 0) throw() {
-      FormatError::message(message);
-      FormatError::file(file);
-      FormatError::line(line);
-    }
-
-    /// Constructor
-    explicit FormatError(const std::string &message,
-                         const std::string &file, int line = 0) throw() {
-      FormatError::message(message);
-      FormatError::file(file);
-      FormatError::line(line);
-    }
-
-    /// Virtual destructor
-    virtual ~FormatError() throw() {}
-
-    /// Set the line number
-    void line(int line) throw() { _line = line; }
-
-    /// Set the error message
-    void message(const char *message) throw() {
-      try {
-        _message = message;
-      } catch (...) {}
-    }
-
-    /// Set the error message
-    void message(const std::string& message) throw() {
-      try {
-        _message = message;
-      } catch (...) {}
-    }
-
-    /// Set the file name
-    void file(const std::string &file) throw() {
-      try {
-        _file = file;
-      } catch (...) {}
-    }
-
-    /// \brief Returns the line number
+    ExceptionMember<std::string> _message;
+    ExceptionMember<std::string> _file;
+
+    mutable ExceptionMember<std::string> _message_holder;
+  public:
+
+    IoParameterError(const IoParameterError &ile) :
+      IoError(ile), _message(ile._message), _file(ile._file) {}
+
+    ///\e
+    explicit IoParameterError(const char *the_message)
+      : _message(the_message) {}
+
+    ///\e
+    IoParameterError(const char *file_name, const char *the_message)
+      : _message(the_message), _file(file_name) {}
+
+     ///\e
+    void message(const std::string& msg) { _message.set(msg); }
+    ///\e
+    void file(const std::string &fl) { _file.set(fl); }
+
+     ///\e
+    const char* message() const {
+      if (_message.valid()) {
+        return _message.get().c_str();
+      } else {
+        return 0;
+      }
+    }
+
+    /// \brief Returns the filename.
     ///
-    /// Returns the line number or zero if it was not specified.
-    int line() const throw() { return _line; }
-
-    /// Returns the error message
-    const std::string& message() const throw() {
-      return _message;
-    }
-
-    /// \brief Returns the filename
-    ///
-    /// Returns the filename or an empty string if it was not specified.
-    const std::string& file() const throw() {
-      return _file;
-    }
-
-    /// \brief Returns a short error message
-    ///
-    /// Returns a short error message which contains the message, the
-    /// file name and the line number.
-    virtual const char* what() const throw() {
-      try {
-        _what.clear();
-        std::ostringstream oss;
-        oss << "lemon:FormatError" << ": ";
-        oss << _message;
-        if (!_file.empty() || _line != 0) {
-          oss << " (";
-          if (!_file.empty()) oss << "in file '" << _file << "'";
-          if (!_file.empty() && _line != 0) oss << " ";
-          if (_line != 0) oss << "at line " << _line;
-          oss << ")";
-        }
-        _what = oss.str();
+    /// Returns \c 0 if the filename was not specified.
+    const char* file() const {
+      if (_file.valid()) {
+        return _file.get().c_str();
+      } else {
+        return 0;
+      }
+    }
+
+    ///\e
+    virtual const char* what() const throw() {
+      try {
+        std::ostringstream ostr;
+        if (message()) ostr << message();
+        if (file()) ostr << "(when reading file '" << file() << "')";
+        _message_holder.set(ostr.str());
       }
       catch (...) {}
-      if (!_what.empty()) return _what.c_str();
-      else return "lemon:FormatError";
-    }
-
+      if( _message_holder.valid() ) return _message_holder.get().c_str();
+      return "lemon:IoParameterError";
+    }
+    virtual ~IoParameterError() throw() {}
   };
 
Index: lemon/graph_to_eps.h
===================================================================
--- lemon/graph_to_eps.h	(revision 313)
+++ lemon/graph_to_eps.h	(revision 253)
@@ -41,5 +41,4 @@
 #include<lemon/color.h>
 #include<lemon/bits/bezier.h>
-#include<lemon/error.h>
 
 
@@ -63,5 +62,5 @@
   }
 
-///Default traits class of GraphToEps
+///Default traits class of \ref GraphToEps
 
 ///Default traits class of \ref GraphToEps.
@@ -668,4 +667,5 @@
   ///it draws the graph.
   void run() {
+    //\todo better 'epsilon' would be nice here.
     const double EPSILON=1e-9;
     if(dontPrint) return;
@@ -708,4 +708,5 @@
       for(ArcIt e(g);e!=INVALID;++e)
         max_w=std::max(double(_arcWidths[e]),max_w);
+      //\todo better 'epsilon' would be nice here.
       if(max_w>EPSILON) {
         _arcWidthScale/=max_w;
@@ -717,4 +718,5 @@
       for(NodeIt n(g);n!=INVALID;++n)
         max_s=std::max(double(_nodeSizes[n]),max_s);
+      //\todo better 'epsilon' would be nice here.
       if(max_s>EPSILON) {
         _nodeScale/=max_s;
@@ -872,4 +874,5 @@
       }
       else {
+        //\todo Verify centering
         double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.width(),
                   (A4WIDTH-2*A4BORDER)/bb.height());
@@ -904,4 +907,5 @@
             dvec(mycoords[g.target(*i)]-mycoords[g.source(*i)]);
           double l=std::sqrt(dvec.normSquare());
+          //\todo better 'epsilon' would be nice here.
           dim2::Point<double> d(dvec/std::max(l,EPSILON));
           dim2::Point<double> m;
@@ -1168,11 +1172,6 @@
 graphToEps(G &g,const char *file_name)
 {
-  std::ostream* os = new std::ofstream(file_name);
-  if (!(*os)) {
-    delete os;
-    throw IoError("Cannot write file", file_name);
-  }
   return GraphToEps<DefaultGraphToEpsTraits<G> >
-    (DefaultGraphToEpsTraits<G>(g,*os,true));
+    (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));
 }
 
@@ -1189,11 +1188,6 @@
 graphToEps(G &g,const std::string& file_name)
 {
-  std::ostream* os = new std::ofstream(file_name.c_str());
-  if (!(*os)) {
-    delete os;
-    throw IoError("Cannot write file", file_name);
-  }
   return GraphToEps<DefaultGraphToEpsTraits<G> >
-    (DefaultGraphToEpsTraits<G>(g,*os,true));
+    (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name.c_str()),true));
 }
 
Index: lemon/grid_graph.h
===================================================================
--- lemon/grid_graph.h	(revision 334)
+++ lemon/grid_graph.h	(revision 334)
@@ -0,0 +1,471 @@
+/* -*- mode: C++; indent-tabs-mode: nil; -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library.
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef GRID_GRAPH_H
+#define GRID_GRAPH_H
+
+#include <iostream>
+#include <lemon/core.h>
+#include <lemon/assert.h>
+
+#include <lemon/bits/base_extender.h>
+#include <lemon/bits/graph_extender.h>
+
+#include <lemon/dim2.h>
+
+///\ingroup graphs
+///\file
+///\brief GridGraph class.
+
+namespace lemon {
+
+  class GridGraphBase {
+
+  public:
+
+    typedef GridGraphBase Graph;
+
+    class Node;
+    class Arc;
+
+  public:
+
+    GridGraphBase() {}
+
+  protected:
+
+    void construct(int w, int h) {
+      _height = h; _width = w;
+      _nodeNum = h * w; _arcNum = 2 * _nodeNum - w - h;
+      _arcLimit = _nodeNum - w;
+    }
+
+    Arc _down(Node n) const {
+      if (n.id < _nodeNum - _width) {
+        return Arc(n.id);
+      } else {
+        return INVALID;
+      }
+    }
+
+    Arc _up(Node n) const {
+      if (n.id >= _width) {
+        return Arc(n.id - _width);
+      } else {
+        return INVALID;
+      }
+    }
+
+    Arc _right(Node n) const {
+      if (n.id % _width < _width - 1) {
+        return _arcLimit + n.id % _width + (n.id / _width) * (_width - 1);
+      } else {
+        return INVALID;
+      }
+    }
+
+    Arc _left(Node n) const {
+      if (n.id % _width > 0) {
+        return _arcLimit + n.id % _width + (n.id / _width) * (_width - 1) - 1;
+      } else {
+        return INVALID;
+      }
+    }
+
+  public:
+
+    Node operator()(int i, int j) const {
+      LEMON_ASSERT(0 <= i && i < width() &&
+                   0 <= j && j < height(), "lemon::GridGraph::IndexError");
+      return Node(i + j * _width);
+    }
+
+    int row(Node n) const {
+      return n.id / _width;
+    }
+
+    int col(Node n) const {
+      return n.id % _width;
+    }
+
+    int width() const {
+      return _width;
+    }
+
+    int height() const {
+      return _height;
+    }
+
+    typedef True NodeNumTag;
+    typedef True ArcNumTag;
+
+    int nodeNum() const { return _nodeNum; }
+    int arcNum() const { return _arcNum; }
+
+    int maxNodeId() const { return nodeNum() - 1; }
+    int maxArcId() const { return arcNum() - 1; }
+
+    Node source(Arc e) const {
+      if (e.id < _arcLimit) {
+        return e.id;
+      } else {
+        return (e.id - _arcLimit) % (_width - 1) +
+          (e.id - _arcLimit) / (_width - 1) * _width;
+      }
+    }
+
+    Node target(Arc e) const {
+      if (e.id < _arcLimit) {
+        return e.id + _width;
+      } else {
+        return (e.id - _arcLimit) % (_width - 1) +
+          (e.id - _arcLimit) / (_width - 1) * _width + 1;
+      }
+    }
+
+    static int id(Node v) { return v.id; }
+    static int id(Arc e) { return e.id; }
+
+    static Node nodeFromId(int id) { return Node(id);}
+
+    static Arc arcFromId(int id) { return Arc(id);}
+
+    typedef True FindArcTag;
+
+    Arc findArc(Node u, Node v, Arc prev = INVALID) const {
+      if (prev != INVALID) return INVALID;
+      if (v.id - u.id == _width) return Arc(u.id);
+      if (v.id - u.id == 1 && u.id % _width < _width - 1) {
+        return Arc(u.id / _width * (_width - 1) +
+                   u.id % _width + _arcLimit);
+      }
+      return INVALID;
+    }
+
+    class Node {
+      friend class GridGraphBase;
+
+    protected:
+      int id;
+      Node(int _id) : id(_id) {}
+    public:
+      Node() {}
+      Node (Invalid) { id = -1; }
+      bool operator==(const Node node) const { return id == node.id; }
+      bool operator!=(const Node node) const { return id != node.id; }
+      bool operator<(const Node node) const { return id < node.id; }
+    };
+
+    class Arc {
+      friend class GridGraphBase;
+
+    protected:
+      int id;
+      Arc(int _id) : id(_id) {}
+    public:
+      Arc() {}
+      Arc (Invalid) { id = -1; }
+      bool operator==(const Arc arc) const { return id == arc.id; }
+      bool operator!=(const Arc arc) const { return id != arc.id; }
+      bool operator<(const Arc arc) const { return id < arc.id; }
+    };
+
+    void first(Node& node) const {
+      node.id = nodeNum() - 1;
+    }
+
+    static void next(Node& node) {
+      --node.id;
+    }
+
+    void first(Arc& arc) const {
+      arc.id = arcNum() - 1;
+    }
+
+    static void next(Arc& arc) {
+      --arc.id;
+    }
+
+    void firstOut(Arc& arc, const Node& node) const {
+      if (node.id < _nodeNum - _width) {
+        arc.id = node.id;
+      } else if (node.id % _width < _width - 1) {
+        arc.id = _arcLimit + node.id % _width +
+          (node.id / _width) * (_width - 1);
+      } else {
+        arc.id = -1;
+      }
+    }
+
+    void nextOut(Arc& arc) const {
+      if (arc.id >= _arcLimit) {
+        arc.id = -1;
+      } else if (arc.id % _width < _width - 1) {
+        arc.id = _arcLimit + arc.id % _width +
+          (arc.id / _width) * (_width - 1);
+      } else {
+        arc.id = -1;
+      }
+    }
+
+    void firstIn(Arc& arc, const Node& node) const {
+      if (node.id >= _width) {
+        arc.id = node.id - _width;
+      } else if (node.id % _width > 0) {
+        arc.id = _arcLimit + node.id % _width +
+          (node.id / _width) * (_width - 1) - 1;
+      } else {
+        arc.id = -1;
+      }
+    }
+
+    void nextIn(Arc& arc) const {
+      if (arc.id >= _arcLimit) {
+        arc.id = -1;
+      } else if (arc.id % _width > 0) {
+        arc.id = _arcLimit + arc.id % _width +
+          (arc.id / _width + 1) * (_width - 1) - 1;
+      } else {
+        arc.id = -1;
+      }
+    }
+
+  private:
+    int _width, _height;
+    int _nodeNum, _arcNum;
+    int _arcLimit;
+  };
+
+  typedef GraphExtender<UndirDigraphExtender<GridGraphBase> >
+    ExtendedGridGraphBase;
+
+  /// \ingroup graphs
+  ///
+  /// \brief Grid graph class
+  ///
+  /// This class implements a special graph type. The nodes of the
+  /// graph can be indiced by two integer \c (i,j) value where \c i
+  /// is in the \c [0,width) range and j is in the [0, height) range.
+  /// Two nodes are connected in the graph if the indices differ only
+  /// on one position and only one is the difference.
+  ///
+  /// \image html grid_graph.png
+  /// \image latex grid_graph.eps "Grid graph" width=\textwidth
+  ///
+  /// The graph can be indiced in the following way:
+  ///\code
+  /// GridGraph gr(w, h);
+  /// GridGraph::NodeMap<int> val(gr);
+  /// for (int i = 0; i < gr.width(); ++i) {
+  ///   for (int j = 0; j < gr.height(); ++j) {
+  ///     val[gr(i, j)] = i + j;
+  ///   }
+  /// }
+  ///\endcode
+  ///
+  /// This graph type is fully conform to the \ref concepts::Graph
+  /// "Undirected Graph" concept, and it also has an important extra
+  /// feature that its maps are real \ref concepts::ReferenceMap
+  /// "reference map"s.
+  class GridGraph : public ExtendedGridGraphBase {
+  public:
+
+    typedef ExtendedGridGraphBase Parent;
+
+    /// \brief Map to get the indices of the nodes as dim2::Point<int>.
+    ///
+    /// Map to get the indices of the nodes as dim2::Point<int>.
+    class IndexMap {
+    public:
+      /// The key type of the map
+      typedef GridGraph::Node Key;
+      /// The value type of the map
+      typedef dim2::Point<int> Value;
+
+      /// Constructor
+      IndexMap(const GridGraph& graph) : _graph(graph) {}
+
+      /// The subscript operator
+      Value operator[](const Key& key) const {
+        return dim2::Point<int>(_graph.row(key), _graph.col(key));
+      }
+
+    private:
+      const GridGraph& _graph;
+    };
+
+    /// \brief Map to get the row of the nodes.
+    ///
+    /// Map to get the row of the nodes.
+    class RowMap {
+    public:
+      /// The key type of the map
+      typedef GridGraph::Node Key;
+      /// The value type of the map
+      typedef int Value;
+
+      /// Constructor
+      RowMap(const GridGraph& graph) : _graph(graph) {}
+
+      /// The subscript operator
+      Value operator[](const Key& key) const {
+        return _graph.row(key);
+      }
+
+    private:
+      const GridGraph& _graph;
+    };
+
+    /// \brief Map to get the column of the nodes.
+    ///
+    /// Map to get the column of the nodes.
+    class ColMap {
+    public:
+      /// The key type of the map
+      typedef GridGraph::Node Key;
+      /// The value type of the map
+      typedef int Value;
+
+      /// Constructor
+      ColMap(const GridGraph& graph) : _graph(graph) {}
+
+      /// The subscript operator
+      Value operator[](const Key& key) const {
+        return _graph.col(key);
+      }
+
+    private:
+      const GridGraph& _graph;
+    };
+
+    /// \brief Constructor
+    ///
+    /// Constructor.
+    /// \param width The width of the grid.
+    /// \param height The height of the grid.
+    GridGraph(int width, int height) { construct(width, height); }
+
+    /// \brief Resize the graph
+    ///
+    /// Resize the grid.
+    void resize(int width, int height) {
+      Parent::notifier(Arc()).clear();
+      Parent::notifier(Edge()).clear();
+      Parent::notifier(Node()).clear();
+      construct(width, height);
+      Parent::notifier(Node()).build();
+      Parent::notifier(Edge()).build();
+      Parent::notifier(Arc()).build();
+    }
+
+    /// \brief The node on the given position.
+    ///
+    /// Gives back the node on the given position.
+    Node operator()(int i, int j) const {
+      return Parent::operator()(i, j);
+    }
+
+    /// \brief Gives back the row index of the node.
+    ///
+    /// Gives back the row index of the node.
+    int row(Node n) const {
+      return Parent::row(n);
+    }
+
+    /// \brief Gives back the column index of the node.
+    ///
+    /// Gives back the column index of the node.
+    int col(Node n) const {
+      return Parent::col(n);
+    }
+
+    /// \brief Gives back the width of the grid.
+    ///
+    /// Gives back the width of the grid.
+    int width() const {
+      return Parent::width();
+    }
+
+    /// \brief Gives back the height of the grid.
+    ///
+    /// Gives back the height of the grid.
+    int height() const {
+      return Parent::height();
+    }
+
+    /// \brief Gives back the arc goes down from the node.
+    ///
+    /// Gives back the arc goes down from the node. If there is not
+    /// outgoing arc then it gives back \c INVALID.
+    Arc down(Node n) const {
+      Edge e = _down(n);
+      return e != INVALID ? direct(e, true) : INVALID;
+    }
+
+    /// \brief Gives back the arc goes up from the node.
+    ///
+    /// Gives back the arc goes up from the node. If there is not
+    /// outgoing arc then it gives back \c INVALID.
+    Arc up(Node n) const {
+      Edge e = _up(n);
+      return e != INVALID ? direct(e, false) : INVALID;
+    }
+
+    /// \brief Gives back the arc goes right from the node.
+    ///
+    /// Gives back the arc goes right from the node. If there is not
+    /// outgoing arc then it gives back \c INVALID.
+    Arc right(Node n) const {
+      Edge e = _right(n);
+      return e != INVALID ? direct(e, true) : INVALID;
+    }
+
+    /// \brief Gives back the arc goes left from the node.
+    ///
+    /// Gives back the arc goes left from the node. If there is not
+    /// outgoing arc then it gives back \c INVALID.
+    Arc left(Node n) const {
+      Edge e = _left(n);
+      return e != INVALID ? direct(e, false) : INVALID;
+    }
+
+  }; // class GridGraph
+
+  /// \brief Index map of the grid graph
+  ///
+  /// Just returns an IndexMap for the grid graph.
+  inline GridGraph::IndexMap indexMap(const GridGraph& graph) {
+    return GridGraph::IndexMap(graph);
+  }
+
+  /// \brief Row map of the grid graph
+  ///
+  /// Just returns a RowMap for the grid graph.
+  inline GridGraph::RowMap rowMap(const GridGraph& graph) {
+    return GridGraph::RowMap(graph);
+  }
+
+  /// \brief Column map of the grid graph
+  ///
+  /// Just returns a ColMap for the grid graph.
+  inline GridGraph::ColMap colMap(const GridGraph& graph) {
+    return GridGraph::ColMap(graph);
+  }
+}
+
+#endif // GRID_GRAPH_H
Index: lemon/lemon.pc.in
===================================================================
--- lemon/lemon.pc.in	(revision 259)
+++ lemon/lemon.pc.in	(revision 1)
@@ -7,4 +7,4 @@
 Description: Library of Efficient Models and Optimization in Networks
 Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lemon
-Cflags: -I${includedir}
+Libs: -L${libdir} -lemon @GLPK_LIBS@ @CPLEX_LIBS@
+Cflags: -I${includedir} @GLPK_CFLAGS@ @CPLEX_CFLAGS@
Index: lemon/lgf_reader.h
===================================================================
--- lemon/lgf_reader.h	(revision 319)
+++ lemon/lgf_reader.h	(revision 236)
@@ -32,4 +32,5 @@
 #include <map>
 
+#include <lemon/assert.h>
 #include <lemon/core.h>
 
@@ -48,11 +49,9 @@
         std::istringstream is(str);
         Value value;
-        if (!(is >> value)) {
-          throw FormatError("Cannot read token");
-        }
+        is >> value;
 
         char c;
         if (is >> std::ws >> c) {
-          throw FormatError("Remaining characters in token");
+          throw DataFormatError("Remaining characters in token");
         }
         return value;
@@ -168,5 +167,5 @@
           std::ostringstream msg;
           msg << "Item not found: " << str;
-          throw FormatError(msg.str());
+          throw DataFormatError(msg.str().c_str());
         }
         return it->second;
@@ -186,10 +185,10 @@
       typename Graph::Arc operator()(const std::string& str) {
         if (str.empty() || (str[0] != '+' && str[0] != '-')) {
-          throw FormatError("Item must start with '+' or '-'");
+          throw DataFormatError("Item must start with '+' or '-'");
         }
         typename std::map<std::string, typename Graph::Edge>
           ::const_iterator it = _map.find(str.substr(1));
         if (it == _map.end()) {
-          throw FormatError("Item not found");
+          throw DataFormatError("Item not found");
         }
         return _graph.direct(it->second, str[0] == '+');
@@ -237,5 +236,5 @@
       char c;
       if (!is.get(c))
-        throw FormatError("Escape format error");
+        throw DataFormatError("Escape format error");
 
       switch (c) {
@@ -266,5 +265,5 @@
           int code;
           if (!is.get(c) || !isHex(c))
-            throw FormatError("Escape format error");
+            throw DataFormatError("Escape format error");
           else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
           else code = code * 16 + valueHex(c);
@@ -275,5 +274,5 @@
           int code;
           if (!isOct(c))
-            throw FormatError("Escape format error");
+            throw DataFormatError("Escape format error");
           else if (code = valueOct(c), !is.get(c) || !isOct(c))
             is.putback(c);
@@ -302,5 +301,5 @@
         }
         if (!is)
-          throw FormatError("Quoted format error");
+          throw DataFormatError("Quoted format error");
       } else {
         is.putback(c);
@@ -391,35 +390,12 @@
   class DigraphReader;
 
-  /// \brief Return a \ref DigraphReader class
-  ///
-  /// This function just returns a \ref DigraphReader class.
-  /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(Digraph& digraph,
-                                       std::istream& is = std::cin) {
-    DigraphReader<Digraph> tmp(digraph, is);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphReader class
-  ///
-  /// This function just returns a \ref DigraphReader class.
-  /// \relates DigraphReader
+  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph);
+
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(Digraph& digraph,
-                                       const std::string& fn) {
-    DigraphReader<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphReader class
-  ///
-  /// This function just returns a \ref DigraphReader class.
-  /// \relates DigraphReader
+  DigraphReader<Digraph> digraphReader(const std::string& fn, Digraph& digraph);
+
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
-    DigraphReader<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
+  DigraphReader<Digraph> digraphReader(const char *fn, Digraph& digraph);
 
   /// \ingroup lemon_io
@@ -444,5 +420,5 @@
   ///
   ///\code
-  /// DigraphReader<Digraph>(digraph, std::cin).
+  /// DigraphReader<Digraph>(std::cin, digraph).
   ///   nodeMap("coordinates", coord_map).
   ///   arcMap("capacity", cap_map).
@@ -485,5 +461,4 @@
     std::istream* _is;
     bool local_is;
-    std::string _filename;
 
     Digraph& _digraph;
@@ -525,5 +500,5 @@
     /// Construct a directed graph reader, which reads from the given
     /// input stream.
-    DigraphReader(Digraph& digraph, std::istream& is = std::cin)
+    DigraphReader(std::istream& is, Digraph& digraph)
       : _is(&is), local_is(false), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
@@ -534,14 +509,8 @@
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(Digraph& digraph, const std::string& fn)
-      : _is(new std::ifstream(fn.c_str())), local_is(true),
-        _filename(fn), _digraph(digraph),
+    DigraphReader(const std::string& fn, Digraph& digraph)
+      : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
-        _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Constructor
@@ -549,14 +518,8 @@
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(Digraph& digraph, const char* fn)
-      : _is(new std::ifstream(fn)), local_is(true),
-        _filename(fn), _digraph(digraph),
+    DigraphReader(const char* fn, Digraph& digraph)
+      : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
-        _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Destructor
@@ -585,10 +548,10 @@
   private:
 
-    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
-                                                  std::istream& is);
-    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
-                                                  const std::string& fn);
-    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
-                                                  const char *fn);
+    friend DigraphReader<Digraph> digraphReader<>(std::istream& is,
+                                                  Digraph& digraph);
+    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn,
+                                                  Digraph& digraph);
+    friend DigraphReader<Digraph> digraphReader<>(const char *fn,
+                                                  Digraph& digraph);
 
     DigraphReader(DigraphReader& other)
@@ -883,5 +846,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_node_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -897,5 +860,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of node map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -908,6 +871,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _node_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _node_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -933,9 +896,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Node n;
@@ -946,5 +909,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Node>::iterator it =
             _node_index.find(tokens[label_index]);
@@ -952,5 +915,5 @@
             std::ostringstream msg;
             msg << "Node with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           n = it->second;
@@ -976,5 +939,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_arc_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -990,5 +953,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of arc map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -1001,6 +964,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _arc_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _arc_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -1025,8 +988,8 @@
 
         if (!_reader_bits::readToken(line, source_token))
-          throw FormatError("Source not found");
+          throw DataFormatError("Source not found");
 
         if (!_reader_bits::readToken(line, target_token))
-          throw FormatError("Target not found");
+          throw DataFormatError("Target not found");
 
         std::vector<std::string> tokens(map_num);
@@ -1035,9 +998,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Arc a;
@@ -1050,5 +1013,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << source_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node source = it->second;
@@ -1058,5 +1021,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << target_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node target = it->second;
@@ -1067,5 +1030,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Arc>::iterator it =
             _arc_index.find(tokens[label_index]);
@@ -1073,5 +1036,5 @@
             std::ostringstream msg;
             msg << "Arc with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           a = it->second;
@@ -1098,9 +1061,9 @@
         std::string attr, token;
         if (!_reader_bits::readToken(line, attr))
-          throw FormatError("Attribute name not found");
+          throw DataFormatError("Attribute name not found");
         if (!_reader_bits::readToken(line, token))
-          throw FormatError("Attribute value not found");
+          throw DataFormatError("Attribute value not found");
         if (line >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         {
@@ -1108,6 +1071,6 @@
           if (it != read_attr.end()) {
             std::ostringstream msg;
-            msg << "Multiple occurence of attribute: " << attr;
-            throw FormatError(msg.str());
+            msg << "Multiple occurence of attribute " << attr;
+            throw DataFormatError(msg.str().c_str());
           }
           read_attr.insert(attr);
@@ -1130,6 +1093,6 @@
         if (read_attr.find(it->first) == read_attr.end()) {
           std::ostringstream msg;
-          msg << "Attribute not found: " << it->first;
-          throw FormatError(msg.str());
+          msg << "Attribute not found in file: " << it->first;
+          throw DataFormatError(msg.str().c_str());
         }
       }
@@ -1146,4 +1109,7 @@
     void run() {
       LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
+      if (!*_is) {
+        throw DataFormatError("Cannot find file");
+      }
 
       bool nodes_done = _skip_nodes;
@@ -1164,5 +1130,5 @@
 
           if (line >> c)
-            throw FormatError("Extra character at the end of line");
+            throw DataFormatError("Extra character on the end of line");
 
           if (section == "nodes" && !nodes_done) {
@@ -1186,7 +1152,6 @@
             skipSection();
           }
-        } catch (FormatError& error) {
+        } catch (DataFormatError& error) {
           error.line(line_num);
-          error.file(_filename);
           throw;
         }
@@ -1194,13 +1159,13 @@
 
       if (!nodes_done) {
-        throw FormatError("Section @nodes not found");
+        throw DataFormatError("Section @nodes not found");
       }
 
       if (!arcs_done) {
-        throw FormatError("Section @arcs not found");
+        throw DataFormatError("Section @arcs not found");
       }
 
       if (!attributes_done && !_attributes.empty()) {
-        throw FormatError("Section @attributes not found");
+        throw DataFormatError("Section @attributes not found");
       }
 
@@ -1210,37 +1175,47 @@
 
   };
+
+  /// \brief Return a \ref DigraphReader class
+  ///
+  /// This function just returns a \ref DigraphReader class.
+  /// \relates DigraphReader
+  template <typename Digraph>
+  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
+    DigraphReader<Digraph> tmp(is, digraph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphReader class
+  ///
+  /// This function just returns a \ref DigraphReader class.
+  /// \relates DigraphReader
+  template <typename Digraph>
+  DigraphReader<Digraph> digraphReader(const std::string& fn,
+                                       Digraph& digraph) {
+    DigraphReader<Digraph> tmp(fn, digraph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphReader class
+  ///
+  /// This function just returns a \ref DigraphReader class.
+  /// \relates DigraphReader
+  template <typename Digraph>
+  DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
+    DigraphReader<Digraph> tmp(fn, digraph);
+    return tmp;
+  }
 
   template <typename Graph>
   class GraphReader;
 
-  /// \brief Return a \ref GraphReader class
-  ///
-  /// This function just returns a \ref GraphReader class.
-  /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) {
-    GraphReader<Graph> tmp(graph, is);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphReader class
-  ///
-  /// This function just returns a \ref GraphReader class.
-  /// \relates GraphReader
+  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);
+
   template <typename Graph>
-  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
-    GraphReader<Graph> tmp(graph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphReader class
-  ///
-  /// This function just returns a \ref GraphReader class.
-  /// \relates GraphReader
+  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);
+
   template <typename Graph>
-  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
-    GraphReader<Graph> tmp(graph, fn);
-    return tmp;
-  }
+  GraphReader<Graph> graphReader(const char *fn, Graph& graph);
 
   /// \ingroup lemon_io
@@ -1270,5 +1245,4 @@
     std::istream* _is;
     bool local_is;
-    std::string _filename;
 
     Graph& _graph;
@@ -1310,5 +1284,5 @@
     /// Construct an undirected graph reader, which reads from the given
     /// input stream.
-    GraphReader(Graph& graph, std::istream& is = std::cin)
+    GraphReader(std::istream& is, Graph& graph)
       : _is(&is), local_is(false), _graph(graph),
         _use_nodes(false), _use_edges(false),
@@ -1319,14 +1293,8 @@
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(Graph& graph, const std::string& fn)
-      : _is(new std::ifstream(fn.c_str())), local_is(true),
-        _filename(fn), _graph(graph),
+    GraphReader(const std::string& fn, Graph& graph)
+      : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph),
         _use_nodes(false), _use_edges(false),
-        _skip_nodes(false), _skip_edges(false) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Constructor
@@ -1334,14 +1302,8 @@
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(Graph& graph, const char* fn)
-      : _is(new std::ifstream(fn)), local_is(true),
-        _filename(fn), _graph(graph),
+    GraphReader(const char* fn, Graph& graph)
+      : _is(new std::ifstream(fn)), local_is(true), _graph(graph),
         _use_nodes(false), _use_edges(false),
-        _skip_nodes(false), _skip_edges(false) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Destructor
@@ -1369,8 +1331,8 @@
 
   private:
-    friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is);
-    friend GraphReader<Graph> graphReader<>(Graph& graph,
-                                            const std::string& fn);
-    friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn);
+    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);
+    friend GraphReader<Graph> graphReader<>(const std::string& fn,
+                                            Graph& graph);
+    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);
 
     GraphReader(GraphReader& other)
@@ -1712,5 +1674,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_node_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -1726,5 +1688,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of node map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -1737,6 +1699,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _node_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _node_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -1762,9 +1724,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Node n;
@@ -1775,5 +1737,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Node>::iterator it =
             _node_index.find(tokens[label_index]);
@@ -1781,5 +1743,5 @@
             std::ostringstream msg;
             msg << "Node with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           n = it->second;
@@ -1805,5 +1767,5 @@
         if (readSuccess() && line) line.putback(c);
         if (!_edge_maps.empty())
-          throw FormatError("Cannot find map names");
+          throw DataFormatError("Cannot find map names");
         return;
       }
@@ -1819,5 +1781,5 @@
             std::ostringstream msg;
             msg << "Multiple occurence of edge map: " << map;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           maps.insert(std::make_pair(map, index));
@@ -1830,6 +1792,6 @@
           if (jt == maps.end()) {
             std::ostringstream msg;
-            msg << "Map not found: " << _edge_maps[i].first;
-            throw FormatError(msg.str());
+            msg << "Map not found in file: " << _edge_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
           }
           map_index[i] = jt->second;
@@ -1854,8 +1816,8 @@
 
         if (!_reader_bits::readToken(line, source_token))
-          throw FormatError("Node u not found");
+          throw DataFormatError("Node u not found");
 
         if (!_reader_bits::readToken(line, target_token))
-          throw FormatError("Node v not found");
+          throw DataFormatError("Node v not found");
 
         std::vector<std::string> tokens(map_num);
@@ -1864,9 +1826,9 @@
             std::ostringstream msg;
             msg << "Column not found (" << i + 1 << ")";
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
         }
         if (line >> std::ws >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         Edge e;
@@ -1879,5 +1841,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << source_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node source = it->second;
@@ -1887,5 +1849,5 @@
             std::ostringstream msg;
             msg << "Item not found: " << target_token;
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           Node target = it->second;
@@ -1896,5 +1858,5 @@
         } else {
           if (label_index == -1)
-            throw FormatError("Label map not found");
+            throw DataFormatError("Label map not found in file");
           typename std::map<std::string, Edge>::iterator it =
             _edge_index.find(tokens[label_index]);
@@ -1902,5 +1864,5 @@
             std::ostringstream msg;
             msg << "Edge with label not found: " << tokens[label_index];
-            throw FormatError(msg.str());
+            throw DataFormatError(msg.str().c_str());
           }
           e = it->second;
@@ -1927,9 +1889,9 @@
         std::string attr, token;
         if (!_reader_bits::readToken(line, attr))
-          throw FormatError("Attribute name not found");
+          throw DataFormatError("Attribute name not found");
         if (!_reader_bits::readToken(line, token))
-          throw FormatError("Attribute value not found");
+          throw DataFormatError("Attribute value not found");
         if (line >> c)
-          throw FormatError("Extra character at the end of line");
+          throw DataFormatError("Extra character on the end of line");
 
         {
@@ -1937,6 +1899,6 @@
           if (it != read_attr.end()) {
             std::ostringstream msg;
-            msg << "Multiple occurence of attribute: " << attr;
-            throw FormatError(msg.str());
+            msg << "Multiple occurence of attribute " << attr;
+            throw DataFormatError(msg.str().c_str());
           }
           read_attr.insert(attr);
@@ -1959,6 +1921,6 @@
         if (read_attr.find(it->first) == read_attr.end()) {
           std::ostringstream msg;
-          msg << "Attribute not found: " << it->first;
-          throw FormatError(msg.str());
+          msg << "Attribute not found in file: " << it->first;
+          throw DataFormatError(msg.str().c_str());
         }
       }
@@ -1994,5 +1956,5 @@
 
           if (line >> c)
-            throw FormatError("Extra character at the end of line");
+            throw DataFormatError("Extra character on the end of line");
 
           if (section == "nodes" && !nodes_done) {
@@ -2016,7 +1978,6 @@
             skipSection();
           }
-        } catch (FormatError& error) {
+        } catch (DataFormatError& error) {
           error.line(line_num);
-          error.file(_filename);
           throw;
         }
@@ -2024,13 +1985,13 @@
 
       if (!nodes_done) {
-        throw FormatError("Section @nodes not found");
+        throw DataFormatError("Section @nodes not found");
       }
 
       if (!edges_done) {
-        throw FormatError("Section @edges not found");
+        throw DataFormatError("Section @edges not found");
       }
 
       if (!attributes_done && !_attributes.empty()) {
-        throw FormatError("Section @attributes not found");
+        throw DataFormatError("Section @attributes not found");
       }
 
@@ -2040,4 +2001,35 @@
 
   };
+
+  /// \brief Return a \ref GraphReader class
+  ///
+  /// This function just returns a \ref GraphReader class.
+  /// \relates GraphReader
+  template <typename Graph>
+  GraphReader<Graph> graphReader(std::istream& is, Graph& graph) {
+    GraphReader<Graph> tmp(is, graph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphReader class
+  ///
+  /// This function just returns a \ref GraphReader class.
+  /// \relates GraphReader
+  template <typename Graph>
+  GraphReader<Graph> graphReader(const std::string& fn,
+                                       Graph& graph) {
+    GraphReader<Graph> tmp(fn, graph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphReader class
+  ///
+  /// This function just returns a \ref GraphReader class.
+  /// \relates GraphReader
+  template <typename Graph>
+  GraphReader<Graph> graphReader(const char* fn, Graph& graph) {
+    GraphReader<Graph> tmp(fn, graph);
+    return tmp;
+  }
 
   class SectionReader;
@@ -2063,5 +2055,4 @@
     std::istream* _is;
     bool local_is;
-    std::string _filename;
 
     typedef std::map<std::string, _reader_bits::Section*> Sections;
@@ -2084,11 +2075,5 @@
     /// Construct a section reader, which reads from the given file.
     SectionReader(const std::string& fn)
-      : _is(new std::ifstream(fn.c_str())), local_is(true),
-        _filename(fn) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+      : _is(new std::ifstream(fn.c_str())), local_is(true) {}
 
     /// \brief Constructor
@@ -2096,11 +2081,5 @@
     /// Construct a section reader, which reads from the given file.
     SectionReader(const char* fn)
-      : _is(new std::ifstream(fn)), local_is(true),
-        _filename(fn) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+      : _is(new std::ifstream(fn)), local_is(true) {}
 
     /// \brief Destructor
@@ -2258,10 +2237,10 @@
 
           if (line >> c)
-            throw FormatError("Extra character at the end of line");
+            throw DataFormatError("Extra character on the end of line");
 
           if (extra_sections.find(section) != extra_sections.end()) {
             std::ostringstream msg;
-            msg << "Multiple occurence of section: " << section;
-            throw FormatError(msg.str());
+            msg << "Multiple occurence of section " << section;
+            throw DataFormatError(msg.str().c_str());
           }
           Sections::iterator it = _sections.find(section);
@@ -2272,7 +2251,6 @@
           readLine();
           skipSection();
-        } catch (FormatError& error) {
+        } catch (DataFormatError& error) {
           error.line(line_num);
-          error.file(_filename);
           throw;
         }
@@ -2283,5 +2261,5 @@
           std::ostringstream os;
           os << "Cannot find section: " << it->first;
-          throw FormatError(os.str());
+          throw DataFormatError(os.str().c_str());
         }
       }
@@ -2383,10 +2361,5 @@
     /// file.
     LgfContents(const std::string& fn)
-      : _is(new std::ifstream(fn.c_str())), local_is(true) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+      : _is(new std::ifstream(fn.c_str())), local_is(true) {}
 
     /// \brief Constructor
@@ -2395,10 +2368,5 @@
     /// file.
     LgfContents(const char* fn)
-      : _is(new std::ifstream(fn)), local_is(true) {
-      if (!(*_is)) {
-        delete _is;
-        throw IoError("Cannot open file", fn);
-      }
-    }
+      : _is(new std::ifstream(fn)), local_is(true) {}
 
     /// \brief Destructor
Index: lemon/lgf_writer.h
===================================================================
--- lemon/lgf_writer.h	(revision 319)
+++ lemon/lgf_writer.h	(revision 248)
@@ -34,4 +34,5 @@
 #include <functional>
 
+#include <lemon/assert.h>
 #include <lemon/core.h>
 #include <lemon/maps.h>
@@ -55,5 +56,5 @@
     template <typename T>
     bool operator<(const T&, const T&) {
-      throw FormatError("Label map is not comparable");
+      throw DataFormatError("Label map is not comparable");
     }
 
@@ -203,5 +204,5 @@
           _map.find(str);
         if (it == _map.end()) {
-          throw FormatError("Item not found");
+          throw DataFormatError("Item not found");
         }
         return it->second;
@@ -223,5 +224,5 @@
           ::const_iterator it = _map.find(val);
         if (it == _map.end()) {
-          throw FormatError("Item not found");
+          throw DataFormatError("Item not found");
         }
         return (_graph.direction(val) ? '+' : '-') + it->second;
@@ -351,36 +352,15 @@
   class DigraphWriter;
 
-  /// \brief Return a \ref DigraphWriter class
-  ///
-  /// This function just returns a \ref DigraphWriter class.
-  /// \relates DigraphWriter
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       std::ostream& os = std::cout) {
-    DigraphWriter<Digraph> tmp(digraph, os);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphWriter class
-  ///
-  /// This function just returns a \ref DigraphWriter class.
-  /// \relates DigraphWriter
+  DigraphWriter<Digraph> digraphWriter(std::ostream& os,
+                                       const Digraph& digraph);
+
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const std::string& fn) {
-    DigraphWriter<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphWriter class
-  ///
-  /// This function just returns a \ref DigraphWriter class.
-  /// \relates DigraphWriter
+  DigraphWriter<Digraph> digraphWriter(const std::string& fn,
+                                       const Digraph& digraph);
+
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const char* fn) {
-    DigraphWriter<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
+  DigraphWriter<Digraph> digraphWriter(const char *fn,
+                                       const Digraph& digraph);
 
   /// \ingroup lemon_io
@@ -403,5 +383,5 @@
   ///
   ///\code
-  /// DigraphWriter<Digraph>(digraph, std::cout).
+  /// DigraphWriter<Digraph>(std::cout, digraph).
   ///   nodeMap("coordinates", coord_map).
   ///   nodeMap("size", size).
@@ -473,6 +453,6 @@
     /// Construct a directed graph writer, which writes to the given
     /// output stream.
-    DigraphWriter(const Digraph& digraph, std::ostream& os = std::cout)
-      : _os(&os), local_os(false), _digraph(digraph),
+    DigraphWriter(std::ostream& is, const Digraph& digraph)
+      : _os(&is), local_os(false), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {}
 
@@ -481,12 +461,7 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    DigraphWriter(const Digraph& digraph, const std::string& fn)
+    DigraphWriter(const std::string& fn, const Digraph& digraph)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
-        _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_os)) {
-        delete _os;
-        throw IoError("Cannot write file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Constructor
@@ -494,12 +469,7 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    DigraphWriter(const Digraph& digraph, const char* fn)
+    DigraphWriter(const char* fn, const Digraph& digraph)
       : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
-        _skip_nodes(false), _skip_arcs(false) {
-      if (!(*_os)) {
-        delete _os;
-        throw IoError("Cannot write file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Destructor
@@ -527,10 +497,10 @@
   private:
 
-    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
-                                                  std::ostream& os);
-    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
-                                                  const std::string& fn);
-    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
-                                                  const char *fn);
+    friend DigraphWriter<Digraph> digraphWriter<>(std::ostream& os,
+                                                  const Digraph& digraph);
+    friend DigraphWriter<Digraph> digraphWriter<>(const std::string& fn,
+                                                  const Digraph& digraph);
+    friend DigraphWriter<Digraph> digraphWriter<>(const char *fn,
+                                                  const Digraph& digraph);
 
     DigraphWriter(DigraphWriter& other)
@@ -934,37 +904,48 @@
   };
 
+  /// \brief Return a \ref DigraphWriter class
+  ///
+  /// This function just returns a \ref DigraphWriter class.
+  /// \relates DigraphWriter
+  template <typename Digraph>
+  DigraphWriter<Digraph> digraphWriter(std::ostream& os,
+                                       const Digraph& digraph) {
+    DigraphWriter<Digraph> tmp(os, digraph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphWriter class
+  ///
+  /// This function just returns a \ref DigraphWriter class.
+  /// \relates DigraphWriter
+  template <typename Digraph>
+  DigraphWriter<Digraph> digraphWriter(const std::string& fn,
+                                       const Digraph& digraph) {
+    DigraphWriter<Digraph> tmp(fn, digraph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphWriter class
+  ///
+  /// This function just returns a \ref DigraphWriter class.
+  /// \relates DigraphWriter
+  template <typename Digraph>
+  DigraphWriter<Digraph> digraphWriter(const char* fn,
+                                       const Digraph& digraph) {
+    DigraphWriter<Digraph> tmp(fn, digraph);
+    return tmp;
+  }
+
   template <typename Graph>
   class GraphWriter;
 
-  /// \brief Return a \ref GraphWriter class
-  ///
-  /// This function just returns a \ref GraphWriter class.
-  /// \relates GraphWriter
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph,
-                                 std::ostream& os = std::cout) {
-    GraphWriter<Graph> tmp(graph, os);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphWriter class
-  ///
-  /// This function just returns a \ref GraphWriter class.
-  /// \relates GraphWriter
+  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph);
+
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {
-    GraphWriter<Graph> tmp(graph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphWriter class
-  ///
-  /// This function just returns a \ref GraphWriter class.
-  /// \relates GraphWriter
+  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph);
+
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {
-    GraphWriter<Graph> tmp(graph, fn);
-    return tmp;
-  }
+  GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph);
 
   /// \ingroup lemon_io
@@ -1028,6 +1009,6 @@
     /// Construct a directed graph writer, which writes to the given
     /// output stream.
-    GraphWriter(const Graph& graph, std::ostream& os = std::cout)
-      : _os(&os), local_os(false), _graph(graph),
+    GraphWriter(std::ostream& is, const Graph& graph)
+      : _os(&is), local_os(false), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {}
 
@@ -1036,12 +1017,7 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    GraphWriter(const Graph& graph, const std::string& fn)
+    GraphWriter(const std::string& fn, const Graph& graph)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
-        _skip_nodes(false), _skip_edges(false) {
-      if (!(*_os)) {
-        delete _os;
-        throw IoError("Cannot write file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Constructor
@@ -1049,12 +1025,7 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    GraphWriter(const Graph& graph, const char* fn)
+    GraphWriter(const char* fn, const Graph& graph)
       : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
-        _skip_nodes(false), _skip_edges(false) {
-      if (!(*_os)) {
-        delete _os;
-        throw IoError("Cannot write file", fn);
-      }
-    }
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Destructor
@@ -1082,10 +1053,10 @@
   private:
 
-    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
-                                            std::ostream& os);
-    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
-                                            const std::string& fn);
-    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
-                                            const char *fn);
+    friend GraphWriter<Graph> graphWriter<>(std::ostream& os,
+                                            const Graph& graph);
+    friend GraphWriter<Graph> graphWriter<>(const std::string& fn,
+                                            const Graph& graph);
+    friend GraphWriter<Graph> graphWriter<>(const char *fn,
+                                            const Graph& graph);
 
     GraphWriter(GraphWriter& other)
@@ -1535,4 +1506,34 @@
   };
 
+  /// \brief Return a \ref GraphWriter class
+  ///
+  /// This function just returns a \ref GraphWriter class.
+  /// \relates GraphWriter
+  template <typename Graph>
+  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph) {
+    GraphWriter<Graph> tmp(os, graph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphWriter class
+  ///
+  /// This function just returns a \ref GraphWriter class.
+  /// \relates GraphWriter
+  template <typename Graph>
+  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph) {
+    GraphWriter<Graph> tmp(fn, graph);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphWriter class
+  ///
+  /// This function just returns a \ref GraphWriter class.
+  /// \relates GraphWriter
+  template <typename Graph>
+  GraphWriter<Graph> graphWriter(const char* fn, const Graph& graph) {
+    GraphWriter<Graph> tmp(fn, graph);
+    return tmp;
+  }
+
   class SectionWriter;
 
@@ -1576,10 +1577,5 @@
     /// Construct a section writer, which writes into the given file.
     SectionWriter(const std::string& fn)
-      : _os(new std::ofstream(fn.c_str())), local_os(true) {
-      if (!(*_os)) {
-        delete _os;
-        throw IoError("Cannot write file", fn);
-      }
-    }
+      : _os(new std::ofstream(fn.c_str())), local_os(true) {}
 
     /// \brief Constructor
@@ -1587,10 +1583,5 @@
     /// Construct a section writer, which writes into the given file.
     SectionWriter(const char* fn)
-      : _os(new std::ofstream(fn)), local_os(true) {
-      if (!(*_os)) {
-        delete _os;
-        throw IoError("Cannot write file", fn);
-      }
-    }
+      : _os(new std::ofstream(fn)), local_os(true) {}
 
     /// \brief Destructor
Index: lemon/list_graph.h
===================================================================
--- lemon/list_graph.h	(revision 313)
+++ lemon/list_graph.h	(revision 239)
@@ -414,5 +414,5 @@
     ///
     ///\note The <tt>InArcIt</tt>s referencing the changed arc remain
-    ///valid. However the <tt>ArcIt</tt>s and <tt>OutArcIt</tt>s are
+    ///valid. However the <tt>ArcIt<tt>s and <tt>OutArcIt</tt>s are
     ///invalidated.
     ///
@@ -502,6 +502,8 @@
     ///be invalidated.
     ///
-    ///\warning This functionality cannot be used in conjunction with the
+    ///\warning This functionality cannot be used together with the
     ///Snapshot feature.
+    ///
+    ///\todo It could be implemented in a bit faster way.
     Node split(Node n, bool connect = true) {
       Node b = addNode();
Index: lemon/maps.h
===================================================================
--- lemon/maps.h	(revision 314)
+++ lemon/maps.h	(revision 220)
@@ -44,5 +44,5 @@
   class MapBase {
   public:
-    /// \brief The key type of the map.
+    /// \biref The key type of the map.
     typedef K Key;
     /// \brief The value type of the map.
@@ -74,7 +74,7 @@
   };
 
-  /// Returns a \c NullMap class
-
-  /// This function just returns a \c NullMap class.
+  /// Returns a \ref NullMap class
+
+  /// This function just returns a \ref NullMap class.
   /// \relates NullMap
   template <typename K, typename V>
@@ -89,5 +89,5 @@
   /// value to each key.
   ///
-  /// In other aspects it is equivalent to \c NullMap.
+  /// In other aspects it is equivalent to \ref NullMap.
   /// So it conforms the \ref concepts::ReadWriteMap "ReadWriteMap"
   /// concept, but it absorbs the data written to it.
@@ -134,7 +134,7 @@
   };
 
-  /// Returns a \c ConstMap class
-
-  /// This function just returns a \c ConstMap class.
+  /// Returns a \ref ConstMap class
+
+  /// This function just returns a \ref ConstMap class.
   /// \relates ConstMap
   template<typename K, typename V>
@@ -157,5 +157,5 @@
   /// value to each key.
   ///
-  /// In other aspects it is equivalent to \c NullMap.
+  /// In other aspects it is equivalent to \ref NullMap.
   /// So it conforms the \ref concepts::ReadWriteMap "ReadWriteMap"
   /// concept, but it absorbs the data written to it.
@@ -183,7 +183,7 @@
   };
 
-  /// Returns a \c ConstMap class with inlined constant value
-
-  /// This function just returns a \c ConstMap class with inlined
+  /// Returns a \ref ConstMap class with inlined constant value
+
+  /// This function just returns a \ref ConstMap class with inlined
   /// constant value.
   /// \relates ConstMap
@@ -213,7 +213,7 @@
   };
 
-  /// Returns an \c IdentityMap class
-
-  /// This function just returns an \c IdentityMap class.
+  /// Returns an \ref IdentityMap class
+
+  /// This function just returns an \ref IdentityMap class.
   /// \relates IdentityMap
   template<typename T>
@@ -229,5 +229,5 @@
   /// values to integer keys from the range <tt>[0..size-1]</tt>.
   /// It can be used with some data structures, for example
-  /// \c UnionFind, \c BinHeap, when the used items are small
+  /// \ref UnionFind, \ref BinHeap, when the used items are small
   /// integers. This map conforms the \ref concepts::ReferenceMap
   /// "ReferenceMap" concept.
@@ -269,5 +269,5 @@
       : _vector(vector.begin(), vector.end()) {}
 
-    /// Constructs the map from another \c RangeMap.
+    /// Constructs the map from another \ref RangeMap.
     template <typename V1>
     RangeMap(const RangeMap<V1> &c)
@@ -312,7 +312,7 @@
   };
 
-  /// Returns a \c RangeMap class
-
-  /// This function just returns a \c RangeMap class.
+  /// Returns a \ref RangeMap class
+
+  /// This function just returns a \ref RangeMap class.
   /// \relates RangeMap
   template<typename V>
@@ -321,8 +321,8 @@
   }
 
-  /// \brief Returns a \c RangeMap class created from an appropriate
+  /// \brief Returns a \ref RangeMap class created from an appropriate
   /// \c std::vector
 
-  /// This function just returns a \c RangeMap class created from an
+  /// This function just returns a \ref RangeMap class created from an
   /// appropriate \c std::vector.
   /// \relates RangeMap
@@ -389,5 +389,5 @@
       : _map(map.begin(), map.end()), _value(value) {}
 
-    /// \brief Constructs the map from another \c SparseMap.
+    /// \brief Constructs the map from another \ref SparseMap.
     template<typename V1, typename Comp1>
     SparseMap(const SparseMap<Key, V1, Comp1> &c)
@@ -434,7 +434,7 @@
   };
 
-  /// Returns a \c SparseMap class
-
-  /// This function just returns a \c SparseMap class with specified
+  /// Returns a \ref SparseMap class
+
+  /// This function just returns a \ref SparseMap class with specified
   /// default value.
   /// \relates SparseMap
@@ -449,8 +449,8 @@
   }
 
-  /// \brief Returns a \c SparseMap class created from an appropriate
+  /// \brief Returns a \ref SparseMap class created from an appropriate
   /// \c std::map
 
-  /// This function just returns a \c SparseMap class created from an
+  /// This function just returns a \ref SparseMap class created from an
   /// appropriate \c std::map.
   /// \relates SparseMap
@@ -485,4 +485,6 @@
   ///
   /// \sa CombineMap
+  ///
+  /// \todo Check the requirements.
   template <typename M1, typename M2>
   class ComposeMap : public MapBase<typename M2::Key, typename M1::Value> {
@@ -502,7 +504,7 @@
   };
 
-  /// Returns a \c ComposeMap class
-
-  /// This function just returns a \c ComposeMap class.
+  /// Returns a \ref ComposeMap class
+
+  /// This function just returns a \ref ComposeMap class.
   ///
   /// If \c m1 and \c m2 are maps and the \c Value type of \c m2 is
@@ -539,4 +541,6 @@
   ///
   /// \sa ComposeMap
+  ///
+  /// \todo Check the requirements.
   template<typename M1, typename M2, typename F,
            typename V = typename F::result_type>
@@ -557,7 +561,7 @@
   };
 
-  /// Returns a \c CombineMap class
-
-  /// This function just returns a \c CombineMap class.
+  /// Returns a \ref CombineMap class
+
+  /// This function just returns a \ref CombineMap class.
   ///
   /// For example, if \c m1 and \c m2 are both maps with \c double
@@ -626,7 +630,7 @@
   };
 
-  /// Returns a \c FunctorToMap class
-
-  /// This function just returns a \c FunctorToMap class.
+  /// Returns a \ref FunctorToMap class
+
+  /// This function just returns a \ref FunctorToMap class.
   ///
   /// This function is specialized for adaptable binary function
@@ -685,7 +689,7 @@
   };
 
-  /// Returns a \c MapToFunctor class
-
-  /// This function just returns a \c MapToFunctor class.
+  /// Returns a \ref MapToFunctor class
+
+  /// This function just returns a \ref MapToFunctor class.
   /// \relates MapToFunctor
   template<typename M>
@@ -724,7 +728,7 @@
   };
 
-  /// Returns a \c ConvertMap class
-
-  /// This function just returns a \c ConvertMap class.
+  /// Returns a \ref ConvertMap class
+
+  /// This function just returns a \ref ConvertMap class.
   /// \relates ConvertMap
   template<typename V, typename M>
@@ -764,7 +768,7 @@
   };
 
-  /// Returns a \c ForkMap class
-
-  /// This function just returns a \c ForkMap class.
+  /// Returns a \ref ForkMap class
+
+  /// This function just returns a \ref ForkMap class.
   /// \relates ForkMap
   template <typename M1, typename M2>
@@ -808,7 +812,7 @@
   };
 
-  /// Returns an \c AddMap class
-
-  /// This function just returns an \c AddMap class.
+  /// Returns an \ref AddMap class
+
+  /// This function just returns an \ref AddMap class.
   ///
   /// For example, if \c m1 and \c m2 are both maps with \c double
@@ -856,7 +860,7 @@
   };
 
-  /// Returns a \c SubMap class
-
-  /// This function just returns a \c SubMap class.
+  /// Returns a \ref SubMap class
+
+  /// This function just returns a \ref SubMap class.
   ///
   /// For example, if \c m1 and \c m2 are both maps with \c double
@@ -905,7 +909,7 @@
   };
 
-  /// Returns a \c MulMap class
-
-  /// This function just returns a \c MulMap class.
+  /// Returns a \ref MulMap class
+
+  /// This function just returns a \ref MulMap class.
   ///
   /// For example, if \c m1 and \c m2 are both maps with \c double
@@ -953,7 +957,7 @@
   };
 
-  /// Returns a \c DivMap class
-
-  /// This function just returns a \c DivMap class.
+  /// Returns a \ref DivMap class
+
+  /// This function just returns a \ref DivMap class.
   ///
   /// For example, if \c m1 and \c m2 are both maps with \c double
@@ -1039,7 +1043,7 @@
   };
 
-  /// Returns a \c ShiftMap class
-
-  /// This function just returns a \c ShiftMap class.
+  /// Returns a \ref ShiftMap class
+
+  /// This function just returns a \ref ShiftMap class.
   ///
   /// For example, if \c m is a map with \c double values and \c v is
@@ -1053,7 +1057,7 @@
   }
 
-  /// Returns a \c ShiftWriteMap class
-
-  /// This function just returns a \c ShiftWriteMap class.
+  /// Returns a \ref ShiftWriteMap class
+
+  /// This function just returns a \ref ShiftWriteMap class.
   ///
   /// For example, if \c m is a map with \c double values and \c v is
@@ -1141,7 +1145,7 @@
   };
 
-  /// Returns a \c ScaleMap class
-
-  /// This function just returns a \c ScaleMap class.
+  /// Returns a \ref ScaleMap class
+
+  /// This function just returns a \ref ScaleMap class.
   ///
   /// For example, if \c m is a map with \c double values and \c v is
@@ -1155,7 +1159,7 @@
   }
 
-  /// Returns a \c ScaleWriteMap class
-
-  /// This function just returns a \c ScaleWriteMap class.
+  /// Returns a \ref ScaleWriteMap class
+
+  /// This function just returns a \ref ScaleWriteMap class.
   ///
   /// For example, if \c m is a map with \c double values and \c v is
@@ -1241,7 +1245,7 @@
   };
 
-  /// Returns a \c NegMap class
-
-  /// This function just returns a \c NegMap class.
+  /// Returns a \ref NegMap class
+
+  /// This function just returns a \ref NegMap class.
   ///
   /// For example, if \c m is a map with \c double values, then
@@ -1254,7 +1258,7 @@
   }
 
-  /// Returns a \c NegWriteMap class
-
-  /// This function just returns a \c NegWriteMap class.
+  /// Returns a \ref NegWriteMap class
+
+  /// This function just returns a \ref NegWriteMap class.
   ///
   /// For example, if \c m is a map with \c double values, then
@@ -1297,7 +1301,7 @@
   };
 
-  /// Returns an \c AbsMap class
-
-  /// This function just returns an \c AbsMap class.
+  /// Returns an \ref AbsMap class
+
+  /// This function just returns an \ref AbsMap class.
   ///
   /// For example, if \c m is a map with \c double values, then
@@ -1346,7 +1350,7 @@
   };
 
-  /// Returns a \c TrueMap class
-
-  /// This function just returns a \c TrueMap class.
+  /// Returns a \ref TrueMap class
+
+  /// This function just returns a \ref TrueMap class.
   /// \relates TrueMap
   template<typename K>
@@ -1383,7 +1387,7 @@
   };
 
-  /// Returns a \c FalseMap class
-
-  /// This function just returns a \c FalseMap class.
+  /// Returns a \ref FalseMap class
+
+  /// This function just returns a \ref FalseMap class.
   /// \relates FalseMap
   template<typename K>
@@ -1430,7 +1434,7 @@
   };
 
-  /// Returns an \c AndMap class
-
-  /// This function just returns an \c AndMap class.
+  /// Returns an \ref AndMap class
+
+  /// This function just returns an \ref AndMap class.
   ///
   /// For example, if \c m1 and \c m2 are both maps with \c bool values,
@@ -1478,7 +1482,7 @@
   };
 
-  /// Returns an \c OrMap class
-
-  /// This function just returns an \c OrMap class.
+  /// Returns an \ref OrMap class
+
+  /// This function just returns an \ref OrMap class.
   ///
   /// For example, if \c m1 and \c m2 are both maps with \c bool values,
@@ -1545,7 +1549,7 @@
   };
 
-  /// Returns a \c NotMap class
-
-  /// This function just returns a \c NotMap class.
+  /// Returns a \ref NotMap class
+
+  /// This function just returns a \ref NotMap class.
   ///
   /// For example, if \c m is a map with \c bool values, then
@@ -1558,7 +1562,7 @@
   }
 
-  /// Returns a \c NotWriteMap class
-
-  /// This function just returns a \c NotWriteMap class.
+  /// Returns a \ref NotWriteMap class
+
+  /// This function just returns a \ref NotWriteMap class.
   ///
   /// For example, if \c m is a map with \c bool values, then
@@ -1606,7 +1610,7 @@
   };
 
-  /// Returns an \c EqualMap class
-
-  /// This function just returns an \c EqualMap class.
+  /// Returns an \ref EqualMap class
+
+  /// This function just returns an \ref EqualMap class.
   ///
   /// For example, if \c m1 and \c m2 are maps with keys and values of
@@ -1654,7 +1658,7 @@
   };
 
-  /// Returns an \c LessMap class
-
-  /// This function just returns an \c LessMap class.
+  /// Returns an \ref LessMap class
+
+  /// This function just returns an \ref LessMap class.
   ///
   /// For example, if \c m1 and \c m2 are maps with keys and values of
@@ -1683,9 +1687,4 @@
 
   }
-
-  /// @}
-
-  /// \addtogroup maps
-  /// @{
 
   /// \brief Writable bool map for logging each \c true assigned element
@@ -1751,7 +1750,7 @@
   };
 
-  /// Returns a \c LoggerBoolMap class
-
-  /// This function just returns a \c LoggerBoolMap class.
+  /// Returns a \ref LoggerBoolMap class
+
+  /// This function just returns a \ref LoggerBoolMap class.
   ///
   /// The most important usage of it is storing certain nodes or arcs
@@ -1773,5 +1772,5 @@
   /// \note LoggerBoolMap is just \ref concepts::WriteMap "writable", so
   /// it cannot be used when a readable map is needed, for example as
-  /// \c ReachedMap for \c Bfs, \c Dfs and \c Dijkstra algorithms.
+  /// \c ReachedMap for \ref Bfs, \ref Dfs and \ref Dijkstra algorithms.
   ///
   /// \relates LoggerBoolMap
@@ -1780,9 +1779,4 @@
     return LoggerBoolMap<Iterator>(it);
   }
-
-  /// @}
-
-  /// \addtogroup graph_maps
-  /// @{
 
   /// Provides an immutable and unique id for each item in the graph.
@@ -1892,4 +1886,6 @@
     /// The value type of the InvertableMap.
     typedef typename Map::Value Value;
+
+
 
     /// \brief Constructor.
@@ -2058,4 +2054,6 @@
     }
 
+
+
   };
 
@@ -2273,5 +2271,5 @@
     ///
     /// Constructor
-    /// \param digraph The digraph that the map belongs to.
+    /// \param _digraph The digraph that the map belongs to.
     explicit SourceMap(const Digraph& digraph) : _digraph(digraph) {}
 
@@ -2289,7 +2287,7 @@
   };
 
-  /// \brief Returns a \c SourceMap class.
-  ///
-  /// This function just returns an \c SourceMap class.
+  /// \brief Returns a \ref SourceMap class.
+  ///
+  /// This function just returns an \ref SourceMap class.
   /// \relates SourceMap
   template <typename Digraph>
@@ -2312,5 +2310,5 @@
     ///
     /// Constructor
-    /// \param digraph The digraph that the map belongs to.
+    /// \param _digraph The digraph that the map belongs to.
     explicit TargetMap(const Digraph& digraph) : _digraph(digraph) {}
 
@@ -2328,7 +2326,7 @@
   };
 
-  /// \brief Returns a \c TargetMap class.
-  ///
-  /// This function just returns a \c TargetMap class.
+  /// \brief Returns a \ref TargetMap class.
+  ///
+  /// This function just returns a \ref TargetMap class.
   /// \relates TargetMap
   template <typename Digraph>
@@ -2351,5 +2349,5 @@
     ///
     /// Constructor
-    /// \param graph The graph that the map belongs to.
+    /// \param _graph The graph that the map belongs to.
     explicit ForwardMap(const Graph& graph) : _graph(graph) {}
 
@@ -2367,7 +2365,7 @@
   };
 
-  /// \brief Returns a \c ForwardMap class.
-  ///
-  /// This function just returns an \c ForwardMap class.
+  /// \brief Returns a \ref ForwardMap class.
+  ///
+  /// This function just returns an \ref ForwardMap class.
   /// \relates ForwardMap
   template <typename Graph>
@@ -2390,5 +2388,5 @@
     ///
     /// Constructor
-    /// \param graph The graph that the map belongs to.
+    /// \param _graph The graph that the map belongs to.
     explicit BackwardMap(const Graph& graph) : _graph(graph) {}
 
@@ -2406,7 +2404,7 @@
   };
 
-  /// \brief Returns a \c BackwardMap class
-
-  /// This function just returns a \c BackwardMap class.
+  /// \brief Returns a \ref BackwardMap class
+
+  /// This function just returns a \ref BackwardMap class.
   /// \relates BackwardMap
   template <typename Graph>
Index: lemon/max_matching.h
===================================================================
--- lemon/max_matching.h	(revision 330)
+++ 	(revision )
@@ -1,3104 +1,0 @@
-/* -*- mode: C++; indent-tabs-mode: nil; -*-
- *
- * This file is a part of LEMON, a generic C++ optimization library.
- *
- * Copyright (C) 2003-2008
- * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
- * (Egervary Research Group on Combinatorial Optimization, EGRES).
- *
- * Permission to use, modify and distribute this software is granted
- * provided that this copyright notice appears in all copies. For
- * precise terms see the accompanying LICENSE file.
- *
- * This software is provided "AS IS" with no warranty of any kind,
- * express or implied, and with no claim as to its suitability for any
- * purpose.
- *
- */
-
-#ifndef LEMON_MAX_MATCHING_H
-#define LEMON_MAX_MATCHING_H
-
-#include <vector>
-#include <queue>
-#include <set>
-#include <limits>
-
-#include <lemon/core.h>
-#include <lemon/unionfind.h>
-#include <lemon/bin_heap.h>
-#include <lemon/maps.h>
-
-///\ingroup matching
-///\file
-///\brief Maximum matching algorithms in general graphs.
-
-namespace lemon {
-
-  /// \ingroup matching
-  ///
-  /// \brief Edmonds' alternating forest maximum matching algorithm.
-  ///
-  /// This class implements Edmonds' alternating forest matching
-  /// algorithm. The algorithm can be started from an arbitrary initial
-  /// matching (the default is the empty one)
-  ///
-  /// The dual solution of the problem is a map of the nodes to
-  /// MaxMatching::Status, having values \c EVEN/D, \c ODD/A and \c
-  /// MATCHED/C showing the Gallai-Edmonds decomposition of the
-  /// graph. The nodes in \c EVEN/D induce a graph with
-  /// factor-critical components, the nodes in \c ODD/A form the
-  /// barrier, and the nodes in \c MATCHED/C induce a graph having a
-  /// perfect matching. The number of the factor-critical components
-  /// minus the number of barrier nodes is a lower bound on the
-  /// unmatched nodes, and the matching is optimal if and only if this bound is
-  /// tight. This decomposition can be attained by calling \c
-  /// decomposition() after running the algorithm.
-  ///
-  /// \param _Graph The graph type the algorithm runs on.
-  template <typename _Graph>
-  class MaxMatching {
-  public:
-
-    typedef _Graph Graph;
-    typedef typename Graph::template NodeMap<typename Graph::Arc>
-    MatchingMap;
-
-    ///\brief Indicates the Gallai-Edmonds decomposition of the graph.
-    ///
-    ///Indicates the Gallai-Edmonds decomposition of the graph. The
-    ///nodes with Status \c EVEN/D induce a graph with factor-critical
-    ///components, the nodes in \c ODD/A form the canonical barrier,
-    ///and the nodes in \c MATCHED/C induce a graph having a perfect
-    ///matching.
-    enum Status {
-      EVEN = 1, D = 1, MATCHED = 0, C = 0, ODD = -1, A = -1, UNMATCHED = -2
-    };
-
-    typedef typename Graph::template NodeMap<Status> StatusMap;
-
-  private:
-
-    TEMPLATE_GRAPH_TYPEDEFS(Graph);
-
-    typedef UnionFindEnum<IntNodeMap> BlossomSet;
-    typedef ExtendFindEnum<IntNodeMap> TreeSet;
-    typedef RangeMap<Node> NodeIntMap;
-    typedef MatchingMap EarMap;
-    typedef std::vector<Node> NodeQueue;
-
-    const Graph& _graph;
-    MatchingMap* _matching;
-    StatusMap* _status;
-
-    EarMap* _ear;
-
-    IntNodeMap* _blossom_set_index;
-    BlossomSet* _blossom_set;
-    NodeIntMap* _blossom_rep;
-
-    IntNodeMap* _tree_set_index;
-    TreeSet* _tree_set;
-
-    NodeQueue _node_queue;
-    int _process, _postpone, _last;
-
-    int _node_num;
-
-  private:
-
-    void createStructures() {
-      _node_num = countNodes(_graph);
-      if (!_matching) {
-        _matching = new MatchingMap(_graph);
-      }
-      if (!_status) {
-        _status = new StatusMap(_graph);
-      }
-      if (!_ear) {
-        _ear = new EarMap(_graph);
-      }
-      if (!_blossom_set) {
-        _blossom_set_index = new IntNodeMap(_graph);
-        _blossom_set = new BlossomSet(*_blossom_set_index);
-      }
-      if (!_blossom_rep) {
-        _blossom_rep = new NodeIntMap(_node_num);
-      }
-      if (!_tree_set) {
-        _tree_set_index = new IntNodeMap(_graph);
-        _tree_set = new TreeSet(*_tree_set_index);
-      }
-      _node_queue.resize(_node_num);
-    }
-
-    void destroyStructures() {
-      if (_matching) {
-        delete _matching;
-      }
-      if (_status) {
-        delete _status;
-      }
-      if (_ear) {
-        delete _ear;
-      }
-      if (_blossom_set) {
-        delete _blossom_set;
-        delete _blossom_set_index;
-      }
-      if (_blossom_rep) {
-        delete _blossom_rep;
-      }
-      if (_tree_set) {
-        delete _tree_set_index;
-        delete _tree_set;
-      }
-    }
-
-    void processDense(const Node& n) {
-      _process = _postpone = _last = 0;
-      _node_queue[_last++] = n;
-
-      while (_process != _last) {
-        Node u = _node_queue[_process++];
-        for (OutArcIt a(_graph, u); a != INVALID; ++a) {
-          Node v = _graph.target(a);
-          if ((*_status)[v] == MATCHED) {
-            extendOnArc(a);
-          } else if ((*_status)[v] == UNMATCHED) {
-            augmentOnArc(a);
-            return;
-          }
-        }
-      }
-
-      while (_postpone != _last) {
-        Node u = _node_queue[_postpone++];
-
-        for (OutArcIt a(_graph, u); a != INVALID ; ++a) {
-          Node v = _graph.target(a);
-
-          if ((*_status)[v] == EVEN) {
-            if (_blossom_set->find(u) != _blossom_set->find(v)) {
-              shrinkOnEdge(a);
-            }
-          }
-
-          while (_process != _last) {
-            Node w = _node_queue[_process++];
-            for (OutArcIt b(_graph, w); b != INVALID; ++b) {
-              Node x = _graph.target(b);
-              if ((*_status)[x] == MATCHED) {
-                extendOnArc(b);
-              } else if ((*_status)[x] == UNMATCHED) {
-                augmentOnArc(b);
-                return;
-              }
-            }
-          }
-        }
-      }
-    }
-
-    void processSparse(const Node& n) {
-      _process = _last = 0;
-      _node_queue[_last++] = n;
-      while (_process != _last) {
-        Node u = _node_queue[_process++];
-        for (OutArcIt a(_graph, u); a != INVALID; ++a) {
-          Node v = _graph.target(a);
-
-          if ((*_status)[v] == EVEN) {
-            if (_blossom_set->find(u) != _blossom_set->find(v)) {
-              shrinkOnEdge(a);
-            }
-          } else if ((*_status)[v] == MATCHED) {
-            extendOnArc(a);
-          } else if ((*_status)[v] == UNMATCHED) {
-            augmentOnArc(a);
-            return;
-          }
-        }
-      }
-    }
-
-    void shrinkOnEdge(const Edge& e) {
-      Node nca = INVALID;
-
-      {
-        std::set<Node> left_set, right_set;
-
-        Node left = (*_blossom_rep)[_blossom_set->find(_graph.u(e))];
-        left_set.insert(left);
-
-        Node right = (*_blossom_rep)[_blossom_set->find(_graph.v(e))];
-        right_set.insert(right);
-
-        while (true) {
-          if ((*_matching)[left] == INVALID) break;
-          left = _graph.target((*_matching)[left]);
-          left = (*_blossom_rep)[_blossom_set->
-                                 find(_graph.target((*_ear)[left]))];
-          if (right_set.find(left) != right_set.end()) {
-            nca = left;
-            break;
-          }
-          left_set.insert(left);
-
-          if ((*_matching)[right] == INVALID) break;
-          right = _graph.target((*_matching)[right]);
-          right = (*_blossom_rep)[_blossom_set->
-                                  find(_graph.target((*_ear)[right]))];
-          if (left_set.find(right) != left_set.end()) {
-            nca = right;
-            break;
-          }
-          right_set.insert(right);
-        }
-
-        if (nca == INVALID) {
-          if ((*_matching)[left] == INVALID) {
-            nca = right;
-            while (left_set.find(nca) == left_set.end()) {
-              nca = _graph.target((*_matching)[nca]);
-              nca =(*_blossom_rep)[_blossom_set->
-                                   find(_graph.target((*_ear)[nca]))];
-            }
-          } else {
-            nca = left;
-            while (right_set.find(nca) == right_set.end()) {
-              nca = _graph.target((*_matching)[nca]);
-              nca = (*_blossom_rep)[_blossom_set->
-                                   find(_graph.target((*_ear)[nca]))];
-            }
-          }
-        }
-      }
-
-      {
-
-        Node node = _graph.u(e);
-        Arc arc = _graph.direct(e, true);
-        Node base = (*_blossom_rep)[_blossom_set->find(node)];
-
-        while (base != nca) {
-          _ear->set(node, arc);
-
-          Node n = node;
-          while (n != base) {
-            n = _graph.target((*_matching)[n]);
-            Arc a = (*_ear)[n];
-            n = _graph.target(a);
-            _ear->set(n, _graph.oppositeArc(a));
-          }
-          node = _graph.target((*_matching)[base]);
-          _tree_set->erase(base);
-          _tree_set->erase(node);
-          _blossom_set->insert(node, _blossom_set->find(base));
-          _status->set(node, EVEN);
-          _node_queue[_last++] = node;
-          arc = _graph.oppositeArc((*_ear)[node]);
-          node = _graph.target((*_ear)[node]);
-          base = (*_blossom_rep)[_blossom_set->find(node)];
-          _blossom_set->join(_graph.target(arc), base);
-        }
-      }
-
-      _blossom_rep->set(_blossom_set->find(nca), nca);
-
-      {
-
-        Node node = _graph.v(e);
-        Arc arc = _graph.direct(e, false);
-        Node base = (*_blossom_rep)[_blossom_set->find(node)];
-
-        while (base != nca) {
-          _ear->set(node, arc);
-
-          Node n = node;
-          while (n != base) {
-            n = _graph.target((*_matching)[n]);
-            Arc a = (*_ear)[n];
-            n = _graph.target(a);
-            _ear->set(n, _graph.oppositeArc(a));
-          }
-          node = _graph.target((*_matching)[base]);
-          _tree_set->erase(base);
-          _tree_set->erase(node);
-          _blossom_set->insert(node, _blossom_set->find(base));
-          _status->set(node, EVEN);
-          _node_queue[_last++] = node;
-          arc = _graph.oppositeArc((*_ear)[node]);
-          node = _graph.target((*_ear)[node]);
-          base = (*_blossom_rep)[_blossom_set->find(node)];
-          _blossom_set->join(_graph.target(arc), base);
-        }
-      }
-
-      _blossom_rep->set(_blossom_set->find(nca), nca);
-    }
-
-
-
-    void extendOnArc(const Arc& a) {
-      Node base = _graph.source(a);
-      Node odd = _graph.target(a);
-
-      _ear->set(odd, _graph.oppositeArc(a));
-      Node even = _graph.target((*_matching)[odd]);
-      _blossom_rep->set(_blossom_set->insert(even), even);
-      _status->set(odd, ODD);
-      _status->set(even, EVEN);
-      int tree = _tree_set->find((*_blossom_rep)[_blossom_set->find(base)]);
-      _tree_set->insert(odd, tree);
-      _tree_set->insert(even, tree);
-      _node_queue[_last++] = even;
-
-    }
-
-    void augmentOnArc(const Arc& a) {
-      Node even = _graph.source(a);
-      Node odd = _graph.target(a);
-
-      int tree = _tree_set->find((*_blossom_rep)[_blossom_set->find(even)]);
-
-      _matching->set(odd, _graph.oppositeArc(a));
-      _status->set(odd, MATCHED);
-
-      Arc arc = (*_matching)[even];
-      _matching->set(even, a);
-
-      while (arc != INVALID) {
-        odd = _graph.target(arc);
-        arc = (*_ear)[odd];
-        even = _graph.target(arc);
-        _matching->set(odd, arc);
-        arc = (*_matching)[even];
-        _matching->set(even, _graph.oppositeArc((*_matching)[odd]));
-      }
-
-      for (typename TreeSet::ItemIt it(*_tree_set, tree);
-           it != INVALID; ++it) {
-        if ((*_status)[it] == ODD) {
-          _status->set(it, MATCHED);
-        } else {
-          int blossom = _blossom_set->find(it);
-          for (typename BlossomSet::ItemIt jt(*_blossom_set, blossom);
-               jt != INVALID; ++jt) {
-            _status->set(jt, MATCHED);
-          }
-          _blossom_set->eraseClass(blossom);
-        }
-      }
-      _tree_set->eraseClass(tree);
-
-    }
-
-  public:
-
-    /// \brief Constructor
-    ///
-    /// Constructor.
-    MaxMatching(const Graph& graph)
-      : _graph(graph), _matching(0), _status(0), _ear(0),
-        _blossom_set_index(0), _blossom_set(0), _blossom_rep(0),
-        _tree_set_index(0), _tree_set(0) {}
-
-    ~MaxMatching() {
-      destroyStructures();
-    }
-
-    /// \name Execution control
-    /// The simplest way to execute the algorithm is to use the
-    /// \c run() member function.
-    /// \n
-
-    /// If you need better control on the execution, you must call
-    /// \ref init(), \ref greedyInit() or \ref matchingInit()
-    /// functions first, then you can start the algorithm with the \ref
-    /// startParse() or startDense() functions.
-
-    ///@{
-
-    /// \brief Sets the actual matching to the empty matching.
-    ///
-    /// Sets the actual matching to the empty matching.
-    ///
-    void init() {
-      createStructures();
-      for(NodeIt n(_graph); n != INVALID; ++n) {
-        _matching->set(n, INVALID);
-        _status->set(n, UNMATCHED);
-      }
-    }
-
-    ///\brief Finds an initial matching in a greedy way
-    ///
-    ///It finds an initial matching in a greedy way.
-    void greedyInit() {
-      createStructures();
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        _matching->set(n, INVALID);
-        _status->set(n, UNMATCHED);
-      }
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        if ((*_matching)[n] == INVALID) {
-          for (OutArcIt a(_graph, n); a != INVALID ; ++a) {
-            Node v = _graph.target(a);
-            if ((*_matching)[v] == INVALID && v != n) {
-              _matching->set(n, a);
-              _status->set(n, MATCHED);
-              _matching->set(v, _graph.oppositeArc(a));
-              _status->set(v, MATCHED);
-              break;
-            }
-          }
-        }
-      }
-    }
-
-
-    /// \brief Initialize the matching from a map containing.
-    ///
-    /// Initialize the matching from a \c bool valued \c Edge map. This
-    /// map must have the property that there are no two incident edges
-    /// with true value, ie. it contains a matching.
-    /// \return %True if the map contains a matching.
-    template <typename MatchingMap>
-    bool matchingInit(const MatchingMap& matching) {
-      createStructures();
-
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        _matching->set(n, INVALID);
-        _status->set(n, UNMATCHED);
-      }
-      for(EdgeIt e(_graph); e!=INVALID; ++e) {
-        if (matching[e]) {
-
-          Node u = _graph.u(e);
-          if ((*_matching)[u] != INVALID) return false;
-          _matching->set(u, _graph.direct(e, true));
-          _status->set(u, MATCHED);
-
-          Node v = _graph.v(e);
-          if ((*_matching)[v] != INVALID) return false;
-          _matching->set(v, _graph.direct(e, false));
-          _status->set(v, MATCHED);
-        }
-      }
-      return true;
-    }
-
-    /// \brief Starts Edmonds' algorithm
-    ///
-    /// If runs the original Edmonds' algorithm.
-    void startSparse() {
-      for(NodeIt n(_graph); n != INVALID; ++n) {
-        if ((*_status)[n] == UNMATCHED) {
-          (*_blossom_rep)[_blossom_set->insert(n)] = n;
-          _tree_set->insert(n);
-          _status->set(n, EVEN);
-          processSparse(n);
-        }
-      }
-    }
-
-    /// \brief Starts Edmonds' algorithm.
-    ///
-    /// It runs Edmonds' algorithm with a heuristic of postponing
-    /// shrinks, therefore resulting in a faster algorithm for dense graphs.
-    void startDense() {
-      for(NodeIt n(_graph); n != INVALID; ++n) {
-        if ((*_status)[n] == UNMATCHED) {
-          (*_blossom_rep)[_blossom_set->insert(n)] = n;
-          _tree_set->insert(n);
-          _status->set(n, EVEN);
-          processDense(n);
-        }
-      }
-    }
-
-
-    /// \brief Runs Edmonds' algorithm
-    ///
-    /// Runs Edmonds' algorithm for sparse graphs (<tt>m<2*n</tt>)
-    /// or Edmonds' algorithm with a heuristic of
-    /// postponing shrinks for dense graphs.
-    void run() {
-      if (countEdges(_graph) < 2 * countNodes(_graph)) {
-        greedyInit();
-        startSparse();
-      } else {
-        init();
-        startDense();
-      }
-    }
-
-    /// @}
-
-    /// \name Primal solution
-    /// Functions to get the primal solution, ie. the matching.
-
-    /// @{
-
-    ///\brief Returns the size of the current matching.
-    ///
-    ///Returns the size of the current matching. After \ref
-    ///run() it returns the size of the maximum matching in the graph.
-    int matchingSize() const {
-      int size = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        if ((*_matching)[n] != INVALID) {
-          ++size;
-        }
-      }
-      return size / 2;
-    }
-
-    /// \brief Returns true when the edge is in the matching.
-    ///
-    /// Returns true when the edge is in the matching.
-    bool matching(const Edge& edge) const {
-      return edge == (*_matching)[_graph.u(edge)];
-    }
-
-    /// \brief Returns the matching edge incident to the given node.
-    ///
-    /// Returns the matching edge of a \c node in the actual matching or
-    /// INVALID if the \c node is not covered by the actual matching.
-    Arc matching(const Node& n) const {
-      return (*_matching)[n];
-    }
-
-    ///\brief Returns the mate of a node in the actual matching.
-    ///
-    ///Returns the mate of a \c node in the actual matching or
-    ///INVALID if the \c node is not covered by the actual matching.
-    Node mate(const Node& n) const {
-      return (*_matching)[n] != INVALID ?
-        _graph.target((*_matching)[n]) : INVALID;
-    }
-
-    /// @}
-
-    /// \name Dual solution
-    /// Functions to get the dual solution, ie. the decomposition.
-
-    /// @{
-
-    /// \brief Returns the class of the node in the Edmonds-Gallai
-    /// decomposition.
-    ///
-    /// Returns the class of the node in the Edmonds-Gallai
-    /// decomposition.
-    Status decomposition(const Node& n) const {
-      return (*_status)[n];
-    }
-
-    /// \brief Returns true when the node is in the barrier.
-    ///
-    /// Returns true when the node is in the barrier.
-    bool barrier(const Node& n) const {
-      return (*_status)[n] == ODD;
-    }
-
-    /// @}
-
-  };
-
-  /// \ingroup matching
-  ///
-  /// \brief Weighted matching in general graphs
-  ///
-  /// This class provides an efficient implementation of Edmond's
-  /// maximum weighted matching algorithm. The implementation is based
-  /// on extensive use of priority queues and provides
-  /// \f$O(nm\log(n))\f$ time complexity.
-  ///
-  /// The maximum weighted matching problem is to find undirected
-  /// edges in the graph with maximum overall weight and no two of
-  /// them shares their ends. The problem can be formulated with the
-  /// following linear program.
-  /// \f[ \sum_{e \in \delta(u)}x_e \le 1 \quad \forall u\in V\f]
-  /** \f[ \sum_{e \in \gamma(B)}x_e \le \frac{\vert B \vert - 1}{2}
-      \quad \forall B\in\mathcal{O}\f] */
-  /// \f[x_e \ge 0\quad \forall e\in E\f]
-  /// \f[\max \sum_{e\in E}x_ew_e\f]
-  /// where \f$\delta(X)\f$ is the set of edges incident to a node in
-  /// \f$X\f$, \f$\gamma(X)\f$ is the set of edges with both ends in
-  /// \f$X\f$ and \f$\mathcal{O}\f$ is the set of odd cardinality
-  /// subsets of the nodes.
-  ///
-  /// The algorithm calculates an optimal matching and a proof of the
-  /// optimality. The solution of the dual problem can be used to check
-  /// the result of the algorithm. The dual linear problem is the
-  /** \f[ y_u + y_v + \sum_{B \in \mathcal{O}, uv \in \gamma(B)}
-      z_B \ge w_{uv} \quad \forall uv\in E\f] */
-  /// \f[y_u \ge 0 \quad \forall u \in V\f]
-  /// \f[z_B \ge 0 \quad \forall B \in \mathcal{O}\f]
-  /** \f[\min \sum_{u \in V}y_u + \sum_{B \in \mathcal{O}}
-      \frac{\vert B \vert - 1}{2}z_B\f] */
-  ///
-  /// The algorithm can be executed with \c run() or the \c init() and
-  /// then the \c start() member functions. After it the matching can
-  /// be asked with \c matching() or mate() functions. The dual
-  /// solution can be get with \c nodeValue(), \c blossomNum() and \c
-  /// blossomValue() members and \ref MaxWeightedMatching::BlossomIt
-  /// "BlossomIt" nested class, which is able to iterate on the nodes
-  /// of a blossom. If the value type is integral then the dual
-  /// solution is multiplied by \ref MaxWeightedMatching::dualScale "4".
-  template <typename _Graph,
-            typename _WeightMap = typename _Graph::template EdgeMap<int> >
-  class MaxWeightedMatching {
-  public:
-
-    typedef _Graph Graph;
-    typedef _WeightMap WeightMap;
-    typedef typename WeightMap::Value Value;
-
-    /// \brief Scaling factor for dual solution
-    ///
-    /// Scaling factor for dual solution, it is equal to 4 or 1
-    /// according to the value type.
-    static const int dualScale =
-      std::numeric_limits<Value>::is_integer ? 4 : 1;
-
-    typedef typename Graph::template NodeMap<typename Graph::Arc>
-    MatchingMap;
-
-  private:
-
-    TEMPLATE_GRAPH_TYPEDEFS(Graph);
-
-    typedef typename Graph::template NodeMap<Value> NodePotential;
-    typedef std::vector<Node> BlossomNodeList;
-
-    struct BlossomVariable {
-      int begin, end;
-      Value value;
-
-      BlossomVariable(int _begin, int _end, Value _value)
-        : begin(_begin), end(_end), value(_value) {}
-
-    };
-
-    typedef std::vector<BlossomVariable> BlossomPotential;
-
-    const Graph& _graph;
-    const WeightMap& _weight;
-
-    MatchingMap* _matching;
-
-    NodePotential* _node_potential;
-
-    BlossomPotential _blossom_potential;
-    BlossomNodeList _blossom_node_list;
-
-    int _node_num;
-    int _blossom_num;
-
-    typedef RangeMap<int> IntIntMap;
-
-    enum Status {
-      EVEN = -1, MATCHED = 0, ODD = 1, UNMATCHED = -2
-    };
-
-    typedef HeapUnionFind<Value, IntNodeMap> BlossomSet;
-    struct BlossomData {
-      int tree;
-      Status status;
-      Arc pred, next;
-      Value pot, offset;
-      Node base;
-    };
-
-    IntNodeMap *_blossom_index;
-    BlossomSet *_blossom_set;
-    RangeMap<BlossomData>* _blossom_data;
-
-    IntNodeMap *_node_index;
-    IntArcMap *_node_heap_index;
-
-    struct NodeData {
-
-      NodeData(IntArcMap& node_heap_index)
-        : heap(node_heap_index) {}
-
-      int blossom;
-      Value pot;
-      BinHeap<Value, IntArcMap> heap;
-      std::map<int, Arc> heap_index;
-
-      int tree;
-    };
-
-    RangeMap<NodeData>* _node_data;
-
-    typedef ExtendFindEnum<IntIntMap> TreeSet;
-
-    IntIntMap *_tree_set_index;
-    TreeSet *_tree_set;
-
-    IntNodeMap *_delta1_index;
-    BinHeap<Value, IntNodeMap> *_delta1;
-
-    IntIntMap *_delta2_index;
-    BinHeap<Value, IntIntMap> *_delta2;
-
-    IntEdgeMap *_delta3_index;
-    BinHeap<Value, IntEdgeMap> *_delta3;
-
-    IntIntMap *_delta4_index;
-    BinHeap<Value, IntIntMap> *_delta4;
-
-    Value _delta_sum;
-
-    void createStructures() {
-      _node_num = countNodes(_graph);
-      _blossom_num = _node_num * 3 / 2;
-
-      if (!_matching) {
-        _matching = new MatchingMap(_graph);
-      }
-      if (!_node_potential) {
-        _node_potential = new NodePotential(_graph);
-      }
-      if (!_blossom_set) {
-        _blossom_index = new IntNodeMap(_graph);
-        _blossom_set = new BlossomSet(*_blossom_index);
-        _blossom_data = new RangeMap<BlossomData>(_blossom_num);
-      }
-
-      if (!_node_index) {
-        _node_index = new IntNodeMap(_graph);
-        _node_heap_index = new IntArcMap(_graph);
-        _node_data = new RangeMap<NodeData>(_node_num,
-                                              NodeData(*_node_heap_index));
-      }
-
-      if (!_tree_set) {
-        _tree_set_index = new IntIntMap(_blossom_num);
-        _tree_set = new TreeSet(*_tree_set_index);
-      }
-      if (!_delta1) {
-        _delta1_index = new IntNodeMap(_graph);
-        _delta1 = new BinHeap<Value, IntNodeMap>(*_delta1_index);
-      }
-      if (!_delta2) {
-        _delta2_index = new IntIntMap(_blossom_num);
-        _delta2 = new BinHeap<Value, IntIntMap>(*_delta2_index);
-      }
-      if (!_delta3) {
-        _delta3_index = new IntEdgeMap(_graph);
-        _delta3 = new BinHeap<Value, IntEdgeMap>(*_delta3_index);
-      }
-      if (!_delta4) {
-        _delta4_index = new IntIntMap(_blossom_num);
-        _delta4 = new BinHeap<Value, IntIntMap>(*_delta4_index);
-      }
-    }
-
-    void destroyStructures() {
-      _node_num = countNodes(_graph);
-      _blossom_num = _node_num * 3 / 2;
-
-      if (_matching) {
-        delete _matching;
-      }
-      if (_node_potential) {
-        delete _node_potential;
-      }
-      if (_blossom_set) {
-        delete _blossom_index;
-        delete _blossom_set;
-        delete _blossom_data;
-      }
-
-      if (_node_index) {
-        delete _node_index;
-        delete _node_heap_index;
-        delete _node_data;
-      }
-
-      if (_tree_set) {
-        delete _tree_set_index;
-        delete _tree_set;
-      }
-      if (_delta1) {
-        delete _delta1_index;
-        delete _delta1;
-      }
-      if (_delta2) {
-        delete _delta2_index;
-        delete _delta2;
-      }
-      if (_delta3) {
-        delete _delta3_index;
-        delete _delta3;
-      }
-      if (_delta4) {
-        delete _delta4_index;
-        delete _delta4;
-      }
-    }
-
-    void matchedToEven(int blossom, int tree) {
-      if (_delta2->state(blossom) == _delta2->IN_HEAP) {
-        _delta2->erase(blossom);
-      }
-
-      if (!_blossom_set->trivial(blossom)) {
-        (*_blossom_data)[blossom].pot -=
-          2 * (_delta_sum - (*_blossom_data)[blossom].offset);
-      }
-
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-
-        _blossom_set->increase(n, std::numeric_limits<Value>::max());
-        int ni = (*_node_index)[n];
-
-        (*_node_data)[ni].heap.clear();
-        (*_node_data)[ni].heap_index.clear();
-
-        (*_node_data)[ni].pot += _delta_sum - (*_blossom_data)[blossom].offset;
-
-        _delta1->push(n, (*_node_data)[ni].pot);
-
-        for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.source(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if ((*_blossom_data)[vb].status == EVEN) {
-            if (_delta3->state(e) != _delta3->IN_HEAP && blossom != vb) {
-              _delta3->push(e, rw / 2);
-            }
-          } else if ((*_blossom_data)[vb].status == UNMATCHED) {
-            if (_delta3->state(e) != _delta3->IN_HEAP) {
-              _delta3->push(e, rw);
-            }
-          } else {
-            typename std::map<int, Arc>::iterator it =
-              (*_node_data)[vi].heap_index.find(tree);
-
-            if (it != (*_node_data)[vi].heap_index.end()) {
-              if ((*_node_data)[vi].heap[it->second] > rw) {
-                (*_node_data)[vi].heap.replace(it->second, e);
-                (*_node_data)[vi].heap.decrease(e, rw);
-                it->second = e;
-              }
-            } else {
-              (*_node_data)[vi].heap.push(e, rw);
-              (*_node_data)[vi].heap_index.insert(std::make_pair(tree, e));
-            }
-
-            if ((*_blossom_set)[v] > (*_node_data)[vi].heap.prio()) {
-              _blossom_set->decrease(v, (*_node_data)[vi].heap.prio());
-
-              if ((*_blossom_data)[vb].status == MATCHED) {
-                if (_delta2->state(vb) != _delta2->IN_HEAP) {
-                  _delta2->push(vb, _blossom_set->classPrio(vb) -
-                               (*_blossom_data)[vb].offset);
-                } else if ((*_delta2)[vb] > _blossom_set->classPrio(vb) -
-                           (*_blossom_data)[vb].offset){
-                  _delta2->decrease(vb, _blossom_set->classPrio(vb) -
-                                   (*_blossom_data)[vb].offset);
-                }
-              }
-            }
-          }
-        }
-      }
-      (*_blossom_data)[blossom].offset = 0;
-    }
-
-    void matchedToOdd(int blossom) {
-      if (_delta2->state(blossom) == _delta2->IN_HEAP) {
-        _delta2->erase(blossom);
-      }
-      (*_blossom_data)[blossom].offset += _delta_sum;
-      if (!_blossom_set->trivial(blossom)) {
-        _delta4->push(blossom, (*_blossom_data)[blossom].pot / 2 +
-                     (*_blossom_data)[blossom].offset);
-      }
-    }
-
-    void evenToMatched(int blossom, int tree) {
-      if (!_blossom_set->trivial(blossom)) {
-        (*_blossom_data)[blossom].pot += 2 * _delta_sum;
-      }
-
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-        int ni = (*_node_index)[n];
-        (*_node_data)[ni].pot -= _delta_sum;
-
-        _delta1->erase(n);
-
-        for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.source(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if (vb == blossom) {
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-          } else if ((*_blossom_data)[vb].status == EVEN) {
-
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-
-            int vt = _tree_set->find(vb);
-
-            if (vt != tree) {
-
-              Arc r = _graph.oppositeArc(e);
-
-              typename std::map<int, Arc>::iterator it =
-                (*_node_data)[ni].heap_index.find(vt);
-
-              if (it != (*_node_data)[ni].heap_index.end()) {
-                if ((*_node_data)[ni].heap[it->second] > rw) {
-                  (*_node_data)[ni].heap.replace(it->second, r);
-                  (*_node_data)[ni].heap.decrease(r, rw);
-                  it->second = r;
-                }
-              } else {
-                (*_node_data)[ni].heap.push(r, rw);
-                (*_node_data)[ni].heap_index.insert(std::make_pair(vt, r));
-              }
-
-              if ((*_blossom_set)[n] > (*_node_data)[ni].heap.prio()) {
-                _blossom_set->decrease(n, (*_node_data)[ni].heap.prio());
-
-                if (_delta2->state(blossom) != _delta2->IN_HEAP) {
-                  _delta2->push(blossom, _blossom_set->classPrio(blossom) -
-                               (*_blossom_data)[blossom].offset);
-                } else if ((*_delta2)[blossom] >
-                           _blossom_set->classPrio(blossom) -
-                           (*_blossom_data)[blossom].offset){
-                  _delta2->decrease(blossom, _blossom_set->classPrio(blossom) -
-                                   (*_blossom_data)[blossom].offset);
-                }
-              }
-            }
-
-          } else if ((*_blossom_data)[vb].status == UNMATCHED) {
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-          } else {
-
-            typename std::map<int, Arc>::iterator it =
-              (*_node_data)[vi].heap_index.find(tree);
-
-            if (it != (*_node_data)[vi].heap_index.end()) {
-              (*_node_data)[vi].heap.erase(it->second);
-              (*_node_data)[vi].heap_index.erase(it);
-              if ((*_node_data)[vi].heap.empty()) {
-                _blossom_set->increase(v, std::numeric_limits<Value>::max());
-              } else if ((*_blossom_set)[v] < (*_node_data)[vi].heap.prio()) {
-                _blossom_set->increase(v, (*_node_data)[vi].heap.prio());
-              }
-
-              if ((*_blossom_data)[vb].status == MATCHED) {
-                if (_blossom_set->classPrio(vb) ==
-                    std::numeric_limits<Value>::max()) {
-                  _delta2->erase(vb);
-                } else if ((*_delta2)[vb] < _blossom_set->classPrio(vb) -
-                           (*_blossom_data)[vb].offset) {
-                  _delta2->increase(vb, _blossom_set->classPrio(vb) -
-                                   (*_blossom_data)[vb].offset);
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-
-    void oddToMatched(int blossom) {
-      (*_blossom_data)[blossom].offset -= _delta_sum;
-
-      if (_blossom_set->classPrio(blossom) !=
-          std::numeric_limits<Value>::max()) {
-        _delta2->push(blossom, _blossom_set->classPrio(blossom) -
-                       (*_blossom_data)[blossom].offset);
-      }
-
-      if (!_blossom_set->trivial(blossom)) {
-        _delta4->erase(blossom);
-      }
-    }
-
-    void oddToEven(int blossom, int tree) {
-      if (!_blossom_set->trivial(blossom)) {
-        _delta4->erase(blossom);
-        (*_blossom_data)[blossom].pot -=
-          2 * (2 * _delta_sum - (*_blossom_data)[blossom].offset);
-      }
-
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-        int ni = (*_node_index)[n];
-
-        _blossom_set->increase(n, std::numeric_limits<Value>::max());
-
-        (*_node_data)[ni].heap.clear();
-        (*_node_data)[ni].heap_index.clear();
-        (*_node_data)[ni].pot +=
-          2 * _delta_sum - (*_blossom_data)[blossom].offset;
-
-        _delta1->push(n, (*_node_data)[ni].pot);
-
-        for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.source(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if ((*_blossom_data)[vb].status == EVEN) {
-            if (_delta3->state(e) != _delta3->IN_HEAP && blossom != vb) {
-              _delta3->push(e, rw / 2);
-            }
-          } else if ((*_blossom_data)[vb].status == UNMATCHED) {
-            if (_delta3->state(e) != _delta3->IN_HEAP) {
-              _delta3->push(e, rw);
-            }
-          } else {
-
-            typename std::map<int, Arc>::iterator it =
-              (*_node_data)[vi].heap_index.find(tree);
-
-            if (it != (*_node_data)[vi].heap_index.end()) {
-              if ((*_node_data)[vi].heap[it->second] > rw) {
-                (*_node_data)[vi].heap.replace(it->second, e);
-                (*_node_data)[vi].heap.decrease(e, rw);
-                it->second = e;
-              }
-            } else {
-              (*_node_data)[vi].heap.push(e, rw);
-              (*_node_data)[vi].heap_index.insert(std::make_pair(tree, e));
-            }
-
-            if ((*_blossom_set)[v] > (*_node_data)[vi].heap.prio()) {
-              _blossom_set->decrease(v, (*_node_data)[vi].heap.prio());
-
-              if ((*_blossom_data)[vb].status == MATCHED) {
-                if (_delta2->state(vb) != _delta2->IN_HEAP) {
-                  _delta2->push(vb, _blossom_set->classPrio(vb) -
-                               (*_blossom_data)[vb].offset);
-                } else if ((*_delta2)[vb] > _blossom_set->classPrio(vb) -
-                           (*_blossom_data)[vb].offset) {
-                  _delta2->decrease(vb, _blossom_set->classPrio(vb) -
-                                   (*_blossom_data)[vb].offset);
-                }
-              }
-            }
-          }
-        }
-      }
-      (*_blossom_data)[blossom].offset = 0;
-    }
-
-
-    void matchedToUnmatched(int blossom) {
-      if (_delta2->state(blossom) == _delta2->IN_HEAP) {
-        _delta2->erase(blossom);
-      }
-
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-        int ni = (*_node_index)[n];
-
-        _blossom_set->increase(n, std::numeric_limits<Value>::max());
-
-        (*_node_data)[ni].heap.clear();
-        (*_node_data)[ni].heap_index.clear();
-
-        for (OutArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.target(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if ((*_blossom_data)[vb].status == EVEN) {
-            if (_delta3->state(e) != _delta3->IN_HEAP) {
-              _delta3->push(e, rw);
-            }
-          }
-        }
-      }
-    }
-
-    void unmatchedToMatched(int blossom) {
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-        int ni = (*_node_index)[n];
-
-        for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.source(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if (vb == blossom) {
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-          } else if ((*_blossom_data)[vb].status == EVEN) {
-
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-
-            int vt = _tree_set->find(vb);
-
-            Arc r = _graph.oppositeArc(e);
-
-            typename std::map<int, Arc>::iterator it =
-              (*_node_data)[ni].heap_index.find(vt);
-
-            if (it != (*_node_data)[ni].heap_index.end()) {
-              if ((*_node_data)[ni].heap[it->second] > rw) {
-                (*_node_data)[ni].heap.replace(it->second, r);
-                (*_node_data)[ni].heap.decrease(r, rw);
-                it->second = r;
-              }
-            } else {
-              (*_node_data)[ni].heap.push(r, rw);
-              (*_node_data)[ni].heap_index.insert(std::make_pair(vt, r));
-            }
-
-            if ((*_blossom_set)[n] > (*_node_data)[ni].heap.prio()) {
-              _blossom_set->decrease(n, (*_node_data)[ni].heap.prio());
-
-              if (_delta2->state(blossom) != _delta2->IN_HEAP) {
-                _delta2->push(blossom, _blossom_set->classPrio(blossom) -
-                             (*_blossom_data)[blossom].offset);
-              } else if ((*_delta2)[blossom] > _blossom_set->classPrio(blossom)-
-                         (*_blossom_data)[blossom].offset){
-                _delta2->decrease(blossom, _blossom_set->classPrio(blossom) -
-                                 (*_blossom_data)[blossom].offset);
-              }
-            }
-
-          } else if ((*_blossom_data)[vb].status == UNMATCHED) {
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-          }
-        }
-      }
-    }
-
-    void alternatePath(int even, int tree) {
-      int odd;
-
-      evenToMatched(even, tree);
-      (*_blossom_data)[even].status = MATCHED;
-
-      while ((*_blossom_data)[even].pred != INVALID) {
-        odd = _blossom_set->find(_graph.target((*_blossom_data)[even].pred));
-        (*_blossom_data)[odd].status = MATCHED;
-        oddToMatched(odd);
-        (*_blossom_data)[odd].next = (*_blossom_data)[odd].pred;
-
-        even = _blossom_set->find(_graph.target((*_blossom_data)[odd].pred));
-        (*_blossom_data)[even].status = MATCHED;
-        evenToMatched(even, tree);
-        (*_blossom_data)[even].next =
-          _graph.oppositeArc((*_blossom_data)[odd].pred);
-      }
-
-    }
-
-    void destroyTree(int tree) {
-      for (TreeSet::ItemIt b(*_tree_set, tree); b != INVALID; ++b) {
-        if ((*_blossom_data)[b].status == EVEN) {
-          (*_blossom_data)[b].status = MATCHED;
-          evenToMatched(b, tree);
-        } else if ((*_blossom_data)[b].status == ODD) {
-          (*_blossom_data)[b].status = MATCHED;
-          oddToMatched(b);
-        }
-      }
-      _tree_set->eraseClass(tree);
-    }
-
-
-    void unmatchNode(const Node& node) {
-      int blossom = _blossom_set->find(node);
-      int tree = _tree_set->find(blossom);
-
-      alternatePath(blossom, tree);
-      destroyTree(tree);
-
-      (*_blossom_data)[blossom].status = UNMATCHED;
-      (*_blossom_data)[blossom].base = node;
-      matchedToUnmatched(blossom);
-    }
-
-
-    void augmentOnEdge(const Edge& edge) {
-
-      int left = _blossom_set->find(_graph.u(edge));
-      int right = _blossom_set->find(_graph.v(edge));
-
-      if ((*_blossom_data)[left].status == EVEN) {
-        int left_tree = _tree_set->find(left);
-        alternatePath(left, left_tree);
-        destroyTree(left_tree);
-      } else {
-        (*_blossom_data)[left].status = MATCHED;
-        unmatchedToMatched(left);
-      }
-
-      if ((*_blossom_data)[right].status == EVEN) {
-        int right_tree = _tree_set->find(right);
-        alternatePath(right, right_tree);
-        destroyTree(right_tree);
-      } else {
-        (*_blossom_data)[right].status = MATCHED;
-        unmatchedToMatched(right);
-      }
-
-      (*_blossom_data)[left].next = _graph.direct(edge, true);
-      (*_blossom_data)[right].next = _graph.direct(edge, false);
-    }
-
-    void extendOnArc(const Arc& arc) {
-      int base = _blossom_set->find(_graph.target(arc));
-      int tree = _tree_set->find(base);
-
-      int odd = _blossom_set->find(_graph.source(arc));
-      _tree_set->insert(odd, tree);
-      (*_blossom_data)[odd].status = ODD;
-      matchedToOdd(odd);
-      (*_blossom_data)[odd].pred = arc;
-
-      int even = _blossom_set->find(_graph.target((*_blossom_data)[odd].next));
-      (*_blossom_data)[even].pred = (*_blossom_data)[even].next;
-      _tree_set->insert(even, tree);
-      (*_blossom_data)[even].status = EVEN;
-      matchedToEven(even, tree);
-    }
-
-    void shrinkOnEdge(const Edge& edge, int tree) {
-      int nca = -1;
-      std::vector<int> left_path, right_path;
-
-      {
-        std::set<int> left_set, right_set;
-        int left = _blossom_set->find(_graph.u(edge));
-        left_path.push_back(left);
-        left_set.insert(left);
-
-        int right = _blossom_set->find(_graph.v(edge));
-        right_path.push_back(right);
-        right_set.insert(right);
-
-        while (true) {
-
-          if ((*_blossom_data)[left].pred == INVALID) break;
-
-          left =
-            _blossom_set->find(_graph.target((*_blossom_data)[left].pred));
-          left_path.push_back(left);
-          left =
-            _blossom_set->find(_graph.target((*_blossom_data)[left].pred));
-          left_path.push_back(left);
-
-          left_set.insert(left);
-
-          if (right_set.find(left) != right_set.end()) {
-            nca = left;
-            break;
-          }
-
-          if ((*_blossom_data)[right].pred == INVALID) break;
-
-          right =
-            _blossom_set->find(_graph.target((*_blossom_data)[right].pred));
-          right_path.push_back(right);
-          right =
-            _blossom_set->find(_graph.target((*_blossom_data)[right].pred));
-          right_path.push_back(right);
-
-          right_set.insert(right);
-
-          if (left_set.find(right) != left_set.end()) {
-            nca = right;
-            break;
-          }
-
-        }
-
-        if (nca == -1) {
-          if ((*_blossom_data)[left].pred == INVALID) {
-            nca = right;
-            while (left_set.find(nca) == left_set.end()) {
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              right_path.push_back(nca);
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              right_path.push_back(nca);
-            }
-          } else {
-            nca = left;
-            while (right_set.find(nca) == right_set.end()) {
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              left_path.push_back(nca);
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              left_path.push_back(nca);
-            }
-          }
-        }
-      }
-
-      std::vector<int> subblossoms;
-      Arc prev;
-
-      prev = _graph.direct(edge, true);
-      for (int i = 0; left_path[i] != nca; i += 2) {
-        subblossoms.push_back(left_path[i]);
-        (*_blossom_data)[left_path[i]].next = prev;
-        _tree_set->erase(left_path[i]);
-
-        subblossoms.push_back(left_path[i + 1]);
-        (*_blossom_data)[left_path[i + 1]].status = EVEN;
-        oddToEven(left_path[i + 1], tree);
-        _tree_set->erase(left_path[i + 1]);
-        prev = _graph.oppositeArc((*_blossom_data)[left_path[i + 1]].pred);
-      }
-
-      int k = 0;
-      while (right_path[k] != nca) ++k;
-
-      subblossoms.push_back(nca);
-      (*_blossom_data)[nca].next = prev;
-
-      for (int i = k - 2; i >= 0; i -= 2) {
-        subblossoms.push_back(right_path[i + 1]);
-        (*_blossom_data)[right_path[i + 1]].status = EVEN;
-        oddToEven(right_path[i + 1], tree);
-        _tree_set->erase(right_path[i + 1]);
-
-        (*_blossom_data)[right_path[i + 1]].next =
-          (*_blossom_data)[right_path[i + 1]].pred;
-
-        subblossoms.push_back(right_path[i]);
-        _tree_set->erase(right_path[i]);
-      }
-
-      int surface =
-        _blossom_set->join(subblossoms.begin(), subblossoms.end());
-
-      for (int i = 0; i < int(subblossoms.size()); ++i) {
-        if (!_blossom_set->trivial(subblossoms[i])) {
-          (*_blossom_data)[subblossoms[i]].pot += 2 * _delta_sum;
-        }
-        (*_blossom_data)[subblossoms[i]].status = MATCHED;
-      }
-
-      (*_blossom_data)[surface].pot = -2 * _delta_sum;
-      (*_blossom_data)[surface].offset = 0;
-      (*_blossom_data)[surface].status = EVEN;
-      (*_blossom_data)[surface].pred = (*_blossom_data)[nca].pred;
-      (*_blossom_data)[surface].next = (*_blossom_data)[nca].pred;
-
-      _tree_set->insert(surface, tree);
-      _tree_set->erase(nca);
-    }
-
-    void splitBlossom(int blossom) {
-      Arc next = (*_blossom_data)[blossom].next;
-      Arc pred = (*_blossom_data)[blossom].pred;
-
-      int tree = _tree_set->find(blossom);
-
-      (*_blossom_data)[blossom].status = MATCHED;
-      oddToMatched(blossom);
-      if (_delta2->state(blossom) == _delta2->IN_HEAP) {
-        _delta2->erase(blossom);
-      }
-
-      std::vector<int> subblossoms;
-      _blossom_set->split(blossom, std::back_inserter(subblossoms));
-
-      Value offset = (*_blossom_data)[blossom].offset;
-      int b = _blossom_set->find(_graph.source(pred));
-      int d = _blossom_set->find(_graph.source(next));
-
-      int ib = -1, id = -1;
-      for (int i = 0; i < int(subblossoms.size()); ++i) {
-        if (subblossoms[i] == b) ib = i;
-        if (subblossoms[i] == d) id = i;
-
-        (*_blossom_data)[subblossoms[i]].offset = offset;
-        if (!_blossom_set->trivial(subblossoms[i])) {
-          (*_blossom_data)[subblossoms[i]].pot -= 2 * offset;
-        }
-        if (_blossom_set->classPrio(subblossoms[i]) !=
-            std::numeric_limits<Value>::max()) {
-          _delta2->push(subblossoms[i],
-                        _blossom_set->classPrio(subblossoms[i]) -
-                        (*_blossom_data)[subblossoms[i]].offset);
-        }
-      }
-
-      if (id > ib ? ((id - ib) % 2 == 0) : ((ib - id) % 2 == 1)) {
-        for (int i = (id + 1) % subblossoms.size();
-             i != ib; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          (*_blossom_data)[sb].next =
-            _graph.oppositeArc((*_blossom_data)[tb].next);
-        }
-
-        for (int i = ib; i != id; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          int ub = subblossoms[(i + 2) % subblossoms.size()];
-
-          (*_blossom_data)[sb].status = ODD;
-          matchedToOdd(sb);
-          _tree_set->insert(sb, tree);
-          (*_blossom_data)[sb].pred = pred;
-          (*_blossom_data)[sb].next =
-                           _graph.oppositeArc((*_blossom_data)[tb].next);
-
-          pred = (*_blossom_data)[ub].next;
-
-          (*_blossom_data)[tb].status = EVEN;
-          matchedToEven(tb, tree);
-          _tree_set->insert(tb, tree);
-          (*_blossom_data)[tb].pred = (*_blossom_data)[tb].next;
-        }
-
-        (*_blossom_data)[subblossoms[id]].status = ODD;
-        matchedToOdd(subblossoms[id]);
-        _tree_set->insert(subblossoms[id], tree);
-        (*_blossom_data)[subblossoms[id]].next = next;
-        (*_blossom_data)[subblossoms[id]].pred = pred;
-
-      } else {
-
-        for (int i = (ib + 1) % subblossoms.size();
-             i != id; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          (*_blossom_data)[sb].next =
-            _graph.oppositeArc((*_blossom_data)[tb].next);
-        }
-
-        for (int i = id; i != ib; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          int ub = subblossoms[(i + 2) % subblossoms.size()];
-
-          (*_blossom_data)[sb].status = ODD;
-          matchedToOdd(sb);
-          _tree_set->insert(sb, tree);
-          (*_blossom_data)[sb].next = next;
-          (*_blossom_data)[sb].pred =
-            _graph.oppositeArc((*_blossom_data)[tb].next);
-
-          (*_blossom_data)[tb].status = EVEN;
-          matchedToEven(tb, tree);
-          _tree_set->insert(tb, tree);
-          (*_blossom_data)[tb].pred =
-            (*_blossom_data)[tb].next =
-            _graph.oppositeArc((*_blossom_data)[ub].next);
-          next = (*_blossom_data)[ub].next;
-        }
-
-        (*_blossom_data)[subblossoms[ib]].status = ODD;
-        matchedToOdd(subblossoms[ib]);
-        _tree_set->insert(subblossoms[ib], tree);
-        (*_blossom_data)[subblossoms[ib]].next = next;
-        (*_blossom_data)[subblossoms[ib]].pred = pred;
-      }
-      _tree_set->erase(blossom);
-    }
-
-    void extractBlossom(int blossom, const Node& base, const Arc& matching) {
-      if (_blossom_set->trivial(blossom)) {
-        int bi = (*_node_index)[base];
-        Value pot = (*_node_data)[bi].pot;
-
-        _matching->set(base, matching);
-        _blossom_node_list.push_back(base);
-        _node_potential->set(base, pot);
-      } else {
-
-        Value pot = (*_blossom_data)[blossom].pot;
-        int bn = _blossom_node_list.size();
-
-        std::vector<int> subblossoms;
-        _blossom_set->split(blossom, std::back_inserter(subblossoms));
-        int b = _blossom_set->find(base);
-        int ib = -1;
-        for (int i = 0; i < int(subblossoms.size()); ++i) {
-          if (subblossoms[i] == b) { ib = i; break; }
-        }
-
-        for (int i = 1; i < int(subblossoms.size()); i += 2) {
-          int sb = subblossoms[(ib + i) % subblossoms.size()];
-          int tb = subblossoms[(ib + i + 1) % subblossoms.size()];
-
-          Arc m = (*_blossom_data)[tb].next;
-          extractBlossom(sb, _graph.target(m), _graph.oppositeArc(m));
-          extractBlossom(tb, _graph.source(m), m);
-        }
-        extractBlossom(subblossoms[ib], base, matching);
-
-        int en = _blossom_node_list.size();
-
-        _blossom_potential.push_back(BlossomVariable(bn, en, pot));
-      }
-    }
-
-    void extractMatching() {
-      std::vector<int> blossoms;
-      for (typename BlossomSet::ClassIt c(*_blossom_set); c != INVALID; ++c) {
-        blossoms.push_back(c);
-      }
-
-      for (int i = 0; i < int(blossoms.size()); ++i) {
-        if ((*_blossom_data)[blossoms[i]].status == MATCHED) {
-
-          Value offset = (*_blossom_data)[blossoms[i]].offset;
-          (*_blossom_data)[blossoms[i]].pot += 2 * offset;
-          for (typename BlossomSet::ItemIt n(*_blossom_set, blossoms[i]);
-               n != INVALID; ++n) {
-            (*_node_data)[(*_node_index)[n]].pot -= offset;
-          }
-
-          Arc matching = (*_blossom_data)[blossoms[i]].next;
-          Node base = _graph.source(matching);
-          extractBlossom(blossoms[i], base, matching);
-        } else {
-          Node base = (*_blossom_data)[blossoms[i]].base;
-          extractBlossom(blossoms[i], base, INVALID);
-        }
-      }
-    }
-
-  public:
-
-    /// \brief Constructor
-    ///
-    /// Constructor.
-    MaxWeightedMatching(const Graph& graph, const WeightMap& weight)
-      : _graph(graph), _weight(weight), _matching(0),
-        _node_potential(0), _blossom_potential(), _blossom_node_list(),
-        _node_num(0), _blossom_num(0),
-
-        _blossom_index(0), _blossom_set(0), _blossom_data(0),
-        _node_index(0), _node_heap_index(0), _node_data(0),
-        _tree_set_index(0), _tree_set(0),
-
-        _delta1_index(0), _delta1(0),
-        _delta2_index(0), _delta2(0),
-        _delta3_index(0), _delta3(0),
-        _delta4_index(0), _delta4(0),
-
-        _delta_sum() {}
-
-    ~MaxWeightedMatching() {
-      destroyStructures();
-    }
-
-    /// \name Execution control
-    /// The simplest way to execute the algorithm is to use the
-    /// \c run() member function.
-
-    ///@{
-
-    /// \brief Initialize the algorithm
-    ///
-    /// Initialize the algorithm
-    void init() {
-      createStructures();
-
-      for (ArcIt e(_graph); e != INVALID; ++e) {
-        _node_heap_index->set(e, BinHeap<Value, IntArcMap>::PRE_HEAP);
-      }
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        _delta1_index->set(n, _delta1->PRE_HEAP);
-      }
-      for (EdgeIt e(_graph); e != INVALID; ++e) {
-        _delta3_index->set(e, _delta3->PRE_HEAP);
-      }
-      for (int i = 0; i < _blossom_num; ++i) {
-        _delta2_index->set(i, _delta2->PRE_HEAP);
-        _delta4_index->set(i, _delta4->PRE_HEAP);
-      }
-
-      int index = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        Value max = 0;
-        for (OutArcIt e(_graph, n); e != INVALID; ++e) {
-          if (_graph.target(e) == n) continue;
-          if ((dualScale * _weight[e]) / 2 > max) {
-            max = (dualScale * _weight[e]) / 2;
-          }
-        }
-        _node_index->set(n, index);
-        (*_node_data)[index].pot = max;
-        _delta1->push(n, max);
-        int blossom =
-          _blossom_set->insert(n, std::numeric_limits<Value>::max());
-
-        _tree_set->insert(blossom);
-
-        (*_blossom_data)[blossom].status = EVEN;
-        (*_blossom_data)[blossom].pred = INVALID;
-        (*_blossom_data)[blossom].next = INVALID;
-        (*_blossom_data)[blossom].pot = 0;
-        (*_blossom_data)[blossom].offset = 0;
-        ++index;
-      }
-      for (EdgeIt e(_graph); e != INVALID; ++e) {
-        int si = (*_node_index)[_graph.u(e)];
-        int ti = (*_node_index)[_graph.v(e)];
-        if (_graph.u(e) != _graph.v(e)) {
-          _delta3->push(e, ((*_node_data)[si].pot + (*_node_data)[ti].pot -
-                            dualScale * _weight[e]) / 2);
-        }
-      }
-    }
-
-    /// \brief Starts the algorithm
-    ///
-    /// Starts the algorithm
-    void start() {
-      enum OpType {
-        D1, D2, D3, D4
-      };
-
-      int unmatched = _node_num;
-      while (unmatched > 0) {
-        Value d1 = !_delta1->empty() ?
-          _delta1->prio() : std::numeric_limits<Value>::max();
-
-        Value d2 = !_delta2->empty() ?
-          _delta2->prio() : std::numeric_limits<Value>::max();
-
-        Value d3 = !_delta3->empty() ?
-          _delta3->prio() : std::numeric_limits<Value>::max();
-
-        Value d4 = !_delta4->empty() ?
-          _delta4->prio() : std::numeric_limits<Value>::max();
-
-        _delta_sum = d1; OpType ot = D1;
-        if (d2 < _delta_sum) { _delta_sum = d2; ot = D2; }
-        if (d3 < _delta_sum) { _delta_sum = d3; ot = D3; }
-        if (d4 < _delta_sum) { _delta_sum = d4; ot = D4; }
-
-
-        switch (ot) {
-        case D1:
-          {
-            Node n = _delta1->top();
-            unmatchNode(n);
-            --unmatched;
-          }
-          break;
-        case D2:
-          {
-            int blossom = _delta2->top();
-            Node n = _blossom_set->classTop(blossom);
-            Arc e = (*_node_data)[(*_node_index)[n]].heap.top();
-            extendOnArc(e);
-          }
-          break;
-        case D3:
-          {
-            Edge e = _delta3->top();
-
-            int left_blossom = _blossom_set->find(_graph.u(e));
-            int right_blossom = _blossom_set->find(_graph.v(e));
-
-            if (left_blossom == right_blossom) {
-              _delta3->pop();
-            } else {
-              int left_tree;
-              if ((*_blossom_data)[left_blossom].status == EVEN) {
-                left_tree = _tree_set->find(left_blossom);
-              } else {
-                left_tree = -1;
-                ++unmatched;
-              }
-              int right_tree;
-              if ((*_blossom_data)[right_blossom].status == EVEN) {
-                right_tree = _tree_set->find(right_blossom);
-              } else {
-                right_tree = -1;
-                ++unmatched;
-              }
-
-              if (left_tree == right_tree) {
-                shrinkOnEdge(e, left_tree);
-              } else {
-                augmentOnEdge(e);
-                unmatched -= 2;
-              }
-            }
-          } break;
-        case D4:
-          splitBlossom(_delta4->top());
-          break;
-        }
-      }
-      extractMatching();
-    }
-
-    /// \brief Runs %MaxWeightedMatching algorithm.
-    ///
-    /// This method runs the %MaxWeightedMatching algorithm.
-    ///
-    /// \note mwm.run() is just a shortcut of the following code.
-    /// \code
-    ///   mwm.init();
-    ///   mwm.start();
-    /// \endcode
-    void run() {
-      init();
-      start();
-    }
-
-    /// @}
-
-    /// \name Primal solution
-    /// Functions to get the primal solution, ie. the matching.
-
-    /// @{
-
-    /// \brief Returns the weight of the matching.
-    ///
-    /// Returns the weight of the matching.
-    Value matchingValue() const {
-      Value sum = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        if ((*_matching)[n] != INVALID) {
-          sum += _weight[(*_matching)[n]];
-        }
-      }
-      return sum /= 2;
-    }
-
-    /// \brief Returns the cardinality of the matching.
-    ///
-    /// Returns the cardinality of the matching.
-    int matchingSize() const {
-      int num = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        if ((*_matching)[n] != INVALID) {
-          ++num;
-        }
-      }
-      return num /= 2;
-    }
-
-    /// \brief Returns true when the edge is in the matching.
-    ///
-    /// Returns true when the edge is in the matching.
-    bool matching(const Edge& edge) const {
-      return edge == (*_matching)[_graph.u(edge)];
-    }
-
-    /// \brief Returns the incident matching arc.
-    ///
-    /// Returns the incident matching arc from given node. If the
-    /// node is not matched then it gives back \c INVALID.
-    Arc matching(const Node& node) const {
-      return (*_matching)[node];
-    }
-
-    /// \brief Returns the mate of the node.
-    ///
-    /// Returns the adjancent node in a mathcing arc. If the node is
-    /// not matched then it gives back \c INVALID.
-    Node mate(const Node& node) const {
-      return (*_matching)[node] != INVALID ?
-        _graph.target((*_matching)[node]) : INVALID;
-    }
-
-    /// @}
-
-    /// \name Dual solution
-    /// Functions to get the dual solution.
-
-    /// @{
-
-    /// \brief Returns the value of the dual solution.
-    ///
-    /// Returns the value of the dual solution. It should be equal to
-    /// the primal value scaled by \ref dualScale "dual scale".
-    Value dualValue() const {
-      Value sum = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        sum += nodeValue(n);
-      }
-      for (int i = 0; i < blossomNum(); ++i) {
-        sum += blossomValue(i) * (blossomSize(i) / 2);
-      }
-      return sum;
-    }
-
-    /// \brief Returns the value of the node.
-    ///
-    /// Returns the the value of the node.
-    Value nodeValue(const Node& n) const {
-      return (*_node_potential)[n];
-    }
-
-    /// \brief Returns the number of the blossoms in the basis.
-    ///
-    /// Returns the number of the blossoms in the basis.
-    /// \see BlossomIt
-    int blossomNum() const {
-      return _blossom_potential.size();
-    }
-
-
-    /// \brief Returns the number of the nodes in the blossom.
-    ///
-    /// Returns the number of the nodes in the blossom.
-    int blossomSize(int k) const {
-      return _blossom_potential[k].end - _blossom_potential[k].begin;
-    }
-
-    /// \brief Returns the value of the blossom.
-    ///
-    /// Returns the the value of the blossom.
-    /// \see BlossomIt
-    Value blossomValue(int k) const {
-      return _blossom_potential[k].value;
-    }
-
-    /// \brief Iterator for obtaining the nodes of the blossom.
-    ///
-    /// Iterator for obtaining the nodes of the blossom. This class
-    /// provides a common lemon style iterator for listing a
-    /// subset of the nodes.
-    class BlossomIt {
-    public:
-
-      /// \brief Constructor.
-      ///
-      /// Constructor to get the nodes of the variable.
-      BlossomIt(const MaxWeightedMatching& algorithm, int variable)
-        : _algorithm(&algorithm)
-      {
-        _index = _algorithm->_blossom_potential[variable].begin;
-        _last = _algorithm->_blossom_potential[variable].end;
-      }
-
-      /// \brief Conversion to node.
-      ///
-      /// Conversion to node.
-      operator Node() const {
-        return _algorithm->_blossom_node_list[_index];
-      }
-
-      /// \brief Increment operator.
-      ///
-      /// Increment operator.
-      BlossomIt& operator++() {
-        ++_index;
-        return *this;
-      }
-
-      /// \brief Validity checking
-      ///
-      /// Checks whether the iterator is invalid.
-      bool operator==(Invalid) const { return _index == _last; }
-
-      /// \brief Validity checking
-      ///
-      /// Checks whether the iterator is valid.
-      bool operator!=(Invalid) const { return _index != _last; }
-
-    private:
-      const MaxWeightedMatching* _algorithm;
-      int _last;
-      int _index;
-    };
-
-    /// @}
-
-  };
-
-  /// \ingroup matching
-  ///
-  /// \brief Weighted perfect matching in general graphs
-  ///
-  /// This class provides an efficient implementation of Edmond's
-  /// maximum weighted perfect matching algorithm. The implementation
-  /// is based on extensive use of priority queues and provides
-  /// \f$O(nm\log(n))\f$ time complexity.
-  ///
-  /// The maximum weighted matching problem is to find undirected
-  /// edges in the graph with maximum overall weight and no two of
-  /// them shares their ends and covers all nodes. The problem can be
-  /// formulated with the following linear program.
-  /// \f[ \sum_{e \in \delta(u)}x_e = 1 \quad \forall u\in V\f]
-  /** \f[ \sum_{e \in \gamma(B)}x_e \le \frac{\vert B \vert - 1}{2}
-      \quad \forall B\in\mathcal{O}\f] */
-  /// \f[x_e \ge 0\quad \forall e\in E\f]
-  /// \f[\max \sum_{e\in E}x_ew_e\f]
-  /// where \f$\delta(X)\f$ is the set of edges incident to a node in
-  /// \f$X\f$, \f$\gamma(X)\f$ is the set of edges with both ends in
-  /// \f$X\f$ and \f$\mathcal{O}\f$ is the set of odd cardinality
-  /// subsets of the nodes.
-  ///
-  /// The algorithm calculates an optimal matching and a proof of the
-  /// optimality. The solution of the dual problem can be used to check
-  /// the result of the algorithm. The dual linear problem is the
-  /** \f[ y_u + y_v + \sum_{B \in \mathcal{O}, uv \in \gamma(B)}z_B \ge
-      w_{uv} \quad \forall uv\in E\f] */
-  /// \f[z_B \ge 0 \quad \forall B \in \mathcal{O}\f]
-  /** \f[\min \sum_{u \in V}y_u + \sum_{B \in \mathcal{O}}
-      \frac{\vert B \vert - 1}{2}z_B\f] */
-  ///
-  /// The algorithm can be executed with \c run() or the \c init() and
-  /// then the \c start() member functions. After it the matching can
-  /// be asked with \c matching() or mate() functions. The dual
-  /// solution can be get with \c nodeValue(), \c blossomNum() and \c
-  /// blossomValue() members and \ref MaxWeightedMatching::BlossomIt
-  /// "BlossomIt" nested class which is able to iterate on the nodes
-  /// of a blossom. If the value type is integral then the dual
-  /// solution is multiplied by \ref MaxWeightedMatching::dualScale "4".
-  template <typename _Graph,
-            typename _WeightMap = typename _Graph::template EdgeMap<int> >
-  class MaxWeightedPerfectMatching {
-  public:
-
-    typedef _Graph Graph;
-    typedef _WeightMap WeightMap;
-    typedef typename WeightMap::Value Value;
-
-    /// \brief Scaling factor for dual solution
-    ///
-    /// Scaling factor for dual solution, it is equal to 4 or 1
-    /// according to the value type.
-    static const int dualScale =
-      std::numeric_limits<Value>::is_integer ? 4 : 1;
-
-    typedef typename Graph::template NodeMap<typename Graph::Arc>
-    MatchingMap;
-
-  private:
-
-    TEMPLATE_GRAPH_TYPEDEFS(Graph);
-
-    typedef typename Graph::template NodeMap<Value> NodePotential;
-    typedef std::vector<Node> BlossomNodeList;
-
-    struct BlossomVariable {
-      int begin, end;
-      Value value;
-
-      BlossomVariable(int _begin, int _end, Value _value)
-        : begin(_begin), end(_end), value(_value) {}
-
-    };
-
-    typedef std::vector<BlossomVariable> BlossomPotential;
-
-    const Graph& _graph;
-    const WeightMap& _weight;
-
-    MatchingMap* _matching;
-
-    NodePotential* _node_potential;
-
-    BlossomPotential _blossom_potential;
-    BlossomNodeList _blossom_node_list;
-
-    int _node_num;
-    int _blossom_num;
-
-    typedef RangeMap<int> IntIntMap;
-
-    enum Status {
-      EVEN = -1, MATCHED = 0, ODD = 1
-    };
-
-    typedef HeapUnionFind<Value, IntNodeMap> BlossomSet;
-    struct BlossomData {
-      int tree;
-      Status status;
-      Arc pred, next;
-      Value pot, offset;
-    };
-
-    IntNodeMap *_blossom_index;
-    BlossomSet *_blossom_set;
-    RangeMap<BlossomData>* _blossom_data;
-
-    IntNodeMap *_node_index;
-    IntArcMap *_node_heap_index;
-
-    struct NodeData {
-
-      NodeData(IntArcMap& node_heap_index)
-        : heap(node_heap_index) {}
-
-      int blossom;
-      Value pot;
-      BinHeap<Value, IntArcMap> heap;
-      std::map<int, Arc> heap_index;
-
-      int tree;
-    };
-
-    RangeMap<NodeData>* _node_data;
-
-    typedef ExtendFindEnum<IntIntMap> TreeSet;
-
-    IntIntMap *_tree_set_index;
-    TreeSet *_tree_set;
-
-    IntIntMap *_delta2_index;
-    BinHeap<Value, IntIntMap> *_delta2;
-
-    IntEdgeMap *_delta3_index;
-    BinHeap<Value, IntEdgeMap> *_delta3;
-
-    IntIntMap *_delta4_index;
-    BinHeap<Value, IntIntMap> *_delta4;
-
-    Value _delta_sum;
-
-    void createStructures() {
-      _node_num = countNodes(_graph);
-      _blossom_num = _node_num * 3 / 2;
-
-      if (!_matching) {
-        _matching = new MatchingMap(_graph);
-      }
-      if (!_node_potential) {
-        _node_potential = new NodePotential(_graph);
-      }
-      if (!_blossom_set) {
-        _blossom_index = new IntNodeMap(_graph);
-        _blossom_set = new BlossomSet(*_blossom_index);
-        _blossom_data = new RangeMap<BlossomData>(_blossom_num);
-      }
-
-      if (!_node_index) {
-        _node_index = new IntNodeMap(_graph);
-        _node_heap_index = new IntArcMap(_graph);
-        _node_data = new RangeMap<NodeData>(_node_num,
-                                            NodeData(*_node_heap_index));
-      }
-
-      if (!_tree_set) {
-        _tree_set_index = new IntIntMap(_blossom_num);
-        _tree_set = new TreeSet(*_tree_set_index);
-      }
-      if (!_delta2) {
-        _delta2_index = new IntIntMap(_blossom_num);
-        _delta2 = new BinHeap<Value, IntIntMap>(*_delta2_index);
-      }
-      if (!_delta3) {
-        _delta3_index = new IntEdgeMap(_graph);
-        _delta3 = new BinHeap<Value, IntEdgeMap>(*_delta3_index);
-      }
-      if (!_delta4) {
-        _delta4_index = new IntIntMap(_blossom_num);
-        _delta4 = new BinHeap<Value, IntIntMap>(*_delta4_index);
-      }
-    }
-
-    void destroyStructures() {
-      _node_num = countNodes(_graph);
-      _blossom_num = _node_num * 3 / 2;
-
-      if (_matching) {
-        delete _matching;
-      }
-      if (_node_potential) {
-        delete _node_potential;
-      }
-      if (_blossom_set) {
-        delete _blossom_index;
-        delete _blossom_set;
-        delete _blossom_data;
-      }
-
-      if (_node_index) {
-        delete _node_index;
-        delete _node_heap_index;
-        delete _node_data;
-      }
-
-      if (_tree_set) {
-        delete _tree_set_index;
-        delete _tree_set;
-      }
-      if (_delta2) {
-        delete _delta2_index;
-        delete _delta2;
-      }
-      if (_delta3) {
-        delete _delta3_index;
-        delete _delta3;
-      }
-      if (_delta4) {
-        delete _delta4_index;
-        delete _delta4;
-      }
-    }
-
-    void matchedToEven(int blossom, int tree) {
-      if (_delta2->state(blossom) == _delta2->IN_HEAP) {
-        _delta2->erase(blossom);
-      }
-
-      if (!_blossom_set->trivial(blossom)) {
-        (*_blossom_data)[blossom].pot -=
-          2 * (_delta_sum - (*_blossom_data)[blossom].offset);
-      }
-
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-
-        _blossom_set->increase(n, std::numeric_limits<Value>::max());
-        int ni = (*_node_index)[n];
-
-        (*_node_data)[ni].heap.clear();
-        (*_node_data)[ni].heap_index.clear();
-
-        (*_node_data)[ni].pot += _delta_sum - (*_blossom_data)[blossom].offset;
-
-        for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.source(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if ((*_blossom_data)[vb].status == EVEN) {
-            if (_delta3->state(e) != _delta3->IN_HEAP && blossom != vb) {
-              _delta3->push(e, rw / 2);
-            }
-          } else {
-            typename std::map<int, Arc>::iterator it =
-              (*_node_data)[vi].heap_index.find(tree);
-
-            if (it != (*_node_data)[vi].heap_index.end()) {
-              if ((*_node_data)[vi].heap[it->second] > rw) {
-                (*_node_data)[vi].heap.replace(it->second, e);
-                (*_node_data)[vi].heap.decrease(e, rw);
-                it->second = e;
-              }
-            } else {
-              (*_node_data)[vi].heap.push(e, rw);
-              (*_node_data)[vi].heap_index.insert(std::make_pair(tree, e));
-            }
-
-            if ((*_blossom_set)[v] > (*_node_data)[vi].heap.prio()) {
-              _blossom_set->decrease(v, (*_node_data)[vi].heap.prio());
-
-              if ((*_blossom_data)[vb].status == MATCHED) {
-                if (_delta2->state(vb) != _delta2->IN_HEAP) {
-                  _delta2->push(vb, _blossom_set->classPrio(vb) -
-                               (*_blossom_data)[vb].offset);
-                } else if ((*_delta2)[vb] > _blossom_set->classPrio(vb) -
-                           (*_blossom_data)[vb].offset){
-                  _delta2->decrease(vb, _blossom_set->classPrio(vb) -
-                                   (*_blossom_data)[vb].offset);
-                }
-              }
-            }
-          }
-        }
-      }
-      (*_blossom_data)[blossom].offset = 0;
-    }
-
-    void matchedToOdd(int blossom) {
-      if (_delta2->state(blossom) == _delta2->IN_HEAP) {
-        _delta2->erase(blossom);
-      }
-      (*_blossom_data)[blossom].offset += _delta_sum;
-      if (!_blossom_set->trivial(blossom)) {
-        _delta4->push(blossom, (*_blossom_data)[blossom].pot / 2 +
-                     (*_blossom_data)[blossom].offset);
-      }
-    }
-
-    void evenToMatched(int blossom, int tree) {
-      if (!_blossom_set->trivial(blossom)) {
-        (*_blossom_data)[blossom].pot += 2 * _delta_sum;
-      }
-
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-        int ni = (*_node_index)[n];
-        (*_node_data)[ni].pot -= _delta_sum;
-
-        for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.source(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if (vb == blossom) {
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-          } else if ((*_blossom_data)[vb].status == EVEN) {
-
-            if (_delta3->state(e) == _delta3->IN_HEAP) {
-              _delta3->erase(e);
-            }
-
-            int vt = _tree_set->find(vb);
-
-            if (vt != tree) {
-
-              Arc r = _graph.oppositeArc(e);
-
-              typename std::map<int, Arc>::iterator it =
-                (*_node_data)[ni].heap_index.find(vt);
-
-              if (it != (*_node_data)[ni].heap_index.end()) {
-                if ((*_node_data)[ni].heap[it->second] > rw) {
-                  (*_node_data)[ni].heap.replace(it->second, r);
-                  (*_node_data)[ni].heap.decrease(r, rw);
-                  it->second = r;
-                }
-              } else {
-                (*_node_data)[ni].heap.push(r, rw);
-                (*_node_data)[ni].heap_index.insert(std::make_pair(vt, r));
-              }
-
-              if ((*_blossom_set)[n] > (*_node_data)[ni].heap.prio()) {
-                _blossom_set->decrease(n, (*_node_data)[ni].heap.prio());
-
-                if (_delta2->state(blossom) != _delta2->IN_HEAP) {
-                  _delta2->push(blossom, _blossom_set->classPrio(blossom) -
-                               (*_blossom_data)[blossom].offset);
-                } else if ((*_delta2)[blossom] >
-                           _blossom_set->classPrio(blossom) -
-                           (*_blossom_data)[blossom].offset){
-                  _delta2->decrease(blossom, _blossom_set->classPrio(blossom) -
-                                   (*_blossom_data)[blossom].offset);
-                }
-              }
-            }
-          } else {
-
-            typename std::map<int, Arc>::iterator it =
-              (*_node_data)[vi].heap_index.find(tree);
-
-            if (it != (*_node_data)[vi].heap_index.end()) {
-              (*_node_data)[vi].heap.erase(it->second);
-              (*_node_data)[vi].heap_index.erase(it);
-              if ((*_node_data)[vi].heap.empty()) {
-                _blossom_set->increase(v, std::numeric_limits<Value>::max());
-              } else if ((*_blossom_set)[v] < (*_node_data)[vi].heap.prio()) {
-                _blossom_set->increase(v, (*_node_data)[vi].heap.prio());
-              }
-
-              if ((*_blossom_data)[vb].status == MATCHED) {
-                if (_blossom_set->classPrio(vb) ==
-                    std::numeric_limits<Value>::max()) {
-                  _delta2->erase(vb);
-                } else if ((*_delta2)[vb] < _blossom_set->classPrio(vb) -
-                           (*_blossom_data)[vb].offset) {
-                  _delta2->increase(vb, _blossom_set->classPrio(vb) -
-                                   (*_blossom_data)[vb].offset);
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-
-    void oddToMatched(int blossom) {
-      (*_blossom_data)[blossom].offset -= _delta_sum;
-
-      if (_blossom_set->classPrio(blossom) !=
-          std::numeric_limits<Value>::max()) {
-        _delta2->push(blossom, _blossom_set->classPrio(blossom) -
-                       (*_blossom_data)[blossom].offset);
-      }
-
-      if (!_blossom_set->trivial(blossom)) {
-        _delta4->erase(blossom);
-      }
-    }
-
-    void oddToEven(int blossom, int tree) {
-      if (!_blossom_set->trivial(blossom)) {
-        _delta4->erase(blossom);
-        (*_blossom_data)[blossom].pot -=
-          2 * (2 * _delta_sum - (*_blossom_data)[blossom].offset);
-      }
-
-      for (typename BlossomSet::ItemIt n(*_blossom_set, blossom);
-           n != INVALID; ++n) {
-        int ni = (*_node_index)[n];
-
-        _blossom_set->increase(n, std::numeric_limits<Value>::max());
-
-        (*_node_data)[ni].heap.clear();
-        (*_node_data)[ni].heap_index.clear();
-        (*_node_data)[ni].pot +=
-          2 * _delta_sum - (*_blossom_data)[blossom].offset;
-
-        for (InArcIt e(_graph, n); e != INVALID; ++e) {
-          Node v = _graph.source(e);
-          int vb = _blossom_set->find(v);
-          int vi = (*_node_index)[v];
-
-          Value rw = (*_node_data)[ni].pot + (*_node_data)[vi].pot -
-            dualScale * _weight[e];
-
-          if ((*_blossom_data)[vb].status == EVEN) {
-            if (_delta3->state(e) != _delta3->IN_HEAP && blossom != vb) {
-              _delta3->push(e, rw / 2);
-            }
-          } else {
-
-            typename std::map<int, Arc>::iterator it =
-              (*_node_data)[vi].heap_index.find(tree);
-
-            if (it != (*_node_data)[vi].heap_index.end()) {
-              if ((*_node_data)[vi].heap[it->second] > rw) {
-                (*_node_data)[vi].heap.replace(it->second, e);
-                (*_node_data)[vi].heap.decrease(e, rw);
-                it->second = e;
-              }
-            } else {
-              (*_node_data)[vi].heap.push(e, rw);
-              (*_node_data)[vi].heap_index.insert(std::make_pair(tree, e));
-            }
-
-            if ((*_blossom_set)[v] > (*_node_data)[vi].heap.prio()) {
-              _blossom_set->decrease(v, (*_node_data)[vi].heap.prio());
-
-              if ((*_blossom_data)[vb].status == MATCHED) {
-                if (_delta2->state(vb) != _delta2->IN_HEAP) {
-                  _delta2->push(vb, _blossom_set->classPrio(vb) -
-                               (*_blossom_data)[vb].offset);
-                } else if ((*_delta2)[vb] > _blossom_set->classPrio(vb) -
-                           (*_blossom_data)[vb].offset) {
-                  _delta2->decrease(vb, _blossom_set->classPrio(vb) -
-                                   (*_blossom_data)[vb].offset);
-                }
-              }
-            }
-          }
-        }
-      }
-      (*_blossom_data)[blossom].offset = 0;
-    }
-
-    void alternatePath(int even, int tree) {
-      int odd;
-
-      evenToMatched(even, tree);
-      (*_blossom_data)[even].status = MATCHED;
-
-      while ((*_blossom_data)[even].pred != INVALID) {
-        odd = _blossom_set->find(_graph.target((*_blossom_data)[even].pred));
-        (*_blossom_data)[odd].status = MATCHED;
-        oddToMatched(odd);
-        (*_blossom_data)[odd].next = (*_blossom_data)[odd].pred;
-
-        even = _blossom_set->find(_graph.target((*_blossom_data)[odd].pred));
-        (*_blossom_data)[even].status = MATCHED;
-        evenToMatched(even, tree);
-        (*_blossom_data)[even].next =
-          _graph.oppositeArc((*_blossom_data)[odd].pred);
-      }
-
-    }
-
-    void destroyTree(int tree) {
-      for (TreeSet::ItemIt b(*_tree_set, tree); b != INVALID; ++b) {
-        if ((*_blossom_data)[b].status == EVEN) {
-          (*_blossom_data)[b].status = MATCHED;
-          evenToMatched(b, tree);
-        } else if ((*_blossom_data)[b].status == ODD) {
-          (*_blossom_data)[b].status = MATCHED;
-          oddToMatched(b);
-        }
-      }
-      _tree_set->eraseClass(tree);
-    }
-
-    void augmentOnEdge(const Edge& edge) {
-
-      int left = _blossom_set->find(_graph.u(edge));
-      int right = _blossom_set->find(_graph.v(edge));
-
-      int left_tree = _tree_set->find(left);
-      alternatePath(left, left_tree);
-      destroyTree(left_tree);
-
-      int right_tree = _tree_set->find(right);
-      alternatePath(right, right_tree);
-      destroyTree(right_tree);
-
-      (*_blossom_data)[left].next = _graph.direct(edge, true);
-      (*_blossom_data)[right].next = _graph.direct(edge, false);
-    }
-
-    void extendOnArc(const Arc& arc) {
-      int base = _blossom_set->find(_graph.target(arc));
-      int tree = _tree_set->find(base);
-
-      int odd = _blossom_set->find(_graph.source(arc));
-      _tree_set->insert(odd, tree);
-      (*_blossom_data)[odd].status = ODD;
-      matchedToOdd(odd);
-      (*_blossom_data)[odd].pred = arc;
-
-      int even = _blossom_set->find(_graph.target((*_blossom_data)[odd].next));
-      (*_blossom_data)[even].pred = (*_blossom_data)[even].next;
-      _tree_set->insert(even, tree);
-      (*_blossom_data)[even].status = EVEN;
-      matchedToEven(even, tree);
-    }
-
-    void shrinkOnEdge(const Edge& edge, int tree) {
-      int nca = -1;
-      std::vector<int> left_path, right_path;
-
-      {
-        std::set<int> left_set, right_set;
-        int left = _blossom_set->find(_graph.u(edge));
-        left_path.push_back(left);
-        left_set.insert(left);
-
-        int right = _blossom_set->find(_graph.v(edge));
-        right_path.push_back(right);
-        right_set.insert(right);
-
-        while (true) {
-
-          if ((*_blossom_data)[left].pred == INVALID) break;
-
-          left =
-            _blossom_set->find(_graph.target((*_blossom_data)[left].pred));
-          left_path.push_back(left);
-          left =
-            _blossom_set->find(_graph.target((*_blossom_data)[left].pred));
-          left_path.push_back(left);
-
-          left_set.insert(left);
-
-          if (right_set.find(left) != right_set.end()) {
-            nca = left;
-            break;
-          }
-
-          if ((*_blossom_data)[right].pred == INVALID) break;
-
-          right =
-            _blossom_set->find(_graph.target((*_blossom_data)[right].pred));
-          right_path.push_back(right);
-          right =
-            _blossom_set->find(_graph.target((*_blossom_data)[right].pred));
-          right_path.push_back(right);
-
-          right_set.insert(right);
-
-          if (left_set.find(right) != left_set.end()) {
-            nca = right;
-            break;
-          }
-
-        }
-
-        if (nca == -1) {
-          if ((*_blossom_data)[left].pred == INVALID) {
-            nca = right;
-            while (left_set.find(nca) == left_set.end()) {
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              right_path.push_back(nca);
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              right_path.push_back(nca);
-            }
-          } else {
-            nca = left;
-            while (right_set.find(nca) == right_set.end()) {
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              left_path.push_back(nca);
-              nca =
-                _blossom_set->find(_graph.target((*_blossom_data)[nca].pred));
-              left_path.push_back(nca);
-            }
-          }
-        }
-      }
-
-      std::vector<int> subblossoms;
-      Arc prev;
-
-      prev = _graph.direct(edge, true);
-      for (int i = 0; left_path[i] != nca; i += 2) {
-        subblossoms.push_back(left_path[i]);
-        (*_blossom_data)[left_path[i]].next = prev;
-        _tree_set->erase(left_path[i]);
-
-        subblossoms.push_back(left_path[i + 1]);
-        (*_blossom_data)[left_path[i + 1]].status = EVEN;
-        oddToEven(left_path[i + 1], tree);
-        _tree_set->erase(left_path[i + 1]);
-        prev = _graph.oppositeArc((*_blossom_data)[left_path[i + 1]].pred);
-      }
-
-      int k = 0;
-      while (right_path[k] != nca) ++k;
-
-      subblossoms.push_back(nca);
-      (*_blossom_data)[nca].next = prev;
-
-      for (int i = k - 2; i >= 0; i -= 2) {
-        subblossoms.push_back(right_path[i + 1]);
-        (*_blossom_data)[right_path[i + 1]].status = EVEN;
-        oddToEven(right_path[i + 1], tree);
-        _tree_set->erase(right_path[i + 1]);
-
-        (*_blossom_data)[right_path[i + 1]].next =
-          (*_blossom_data)[right_path[i + 1]].pred;
-
-        subblossoms.push_back(right_path[i]);
-        _tree_set->erase(right_path[i]);
-      }
-
-      int surface =
-        _blossom_set->join(subblossoms.begin(), subblossoms.end());
-
-      for (int i = 0; i < int(subblossoms.size()); ++i) {
-        if (!_blossom_set->trivial(subblossoms[i])) {
-          (*_blossom_data)[subblossoms[i]].pot += 2 * _delta_sum;
-        }
-        (*_blossom_data)[subblossoms[i]].status = MATCHED;
-      }
-
-      (*_blossom_data)[surface].pot = -2 * _delta_sum;
-      (*_blossom_data)[surface].offset = 0;
-      (*_blossom_data)[surface].status = EVEN;
-      (*_blossom_data)[surface].pred = (*_blossom_data)[nca].pred;
-      (*_blossom_data)[surface].next = (*_blossom_data)[nca].pred;
-
-      _tree_set->insert(surface, tree);
-      _tree_set->erase(nca);
-    }
-
-    void splitBlossom(int blossom) {
-      Arc next = (*_blossom_data)[blossom].next;
-      Arc pred = (*_blossom_data)[blossom].pred;
-
-      int tree = _tree_set->find(blossom);
-
-      (*_blossom_data)[blossom].status = MATCHED;
-      oddToMatched(blossom);
-      if (_delta2->state(blossom) == _delta2->IN_HEAP) {
-        _delta2->erase(blossom);
-      }
-
-      std::vector<int> subblossoms;
-      _blossom_set->split(blossom, std::back_inserter(subblossoms));
-
-      Value offset = (*_blossom_data)[blossom].offset;
-      int b = _blossom_set->find(_graph.source(pred));
-      int d = _blossom_set->find(_graph.source(next));
-
-      int ib = -1, id = -1;
-      for (int i = 0; i < int(subblossoms.size()); ++i) {
-        if (subblossoms[i] == b) ib = i;
-        if (subblossoms[i] == d) id = i;
-
-        (*_blossom_data)[subblossoms[i]].offset = offset;
-        if (!_blossom_set->trivial(subblossoms[i])) {
-          (*_blossom_data)[subblossoms[i]].pot -= 2 * offset;
-        }
-        if (_blossom_set->classPrio(subblossoms[i]) !=
-            std::numeric_limits<Value>::max()) {
-          _delta2->push(subblossoms[i],
-                        _blossom_set->classPrio(subblossoms[i]) -
-                        (*_blossom_data)[subblossoms[i]].offset);
-        }
-      }
-
-      if (id > ib ? ((id - ib) % 2 == 0) : ((ib - id) % 2 == 1)) {
-        for (int i = (id + 1) % subblossoms.size();
-             i != ib; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          (*_blossom_data)[sb].next =
-            _graph.oppositeArc((*_blossom_data)[tb].next);
-        }
-
-        for (int i = ib; i != id; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          int ub = subblossoms[(i + 2) % subblossoms.size()];
-
-          (*_blossom_data)[sb].status = ODD;
-          matchedToOdd(sb);
-          _tree_set->insert(sb, tree);
-          (*_blossom_data)[sb].pred = pred;
-          (*_blossom_data)[sb].next =
-                           _graph.oppositeArc((*_blossom_data)[tb].next);
-
-          pred = (*_blossom_data)[ub].next;
-
-          (*_blossom_data)[tb].status = EVEN;
-          matchedToEven(tb, tree);
-          _tree_set->insert(tb, tree);
-          (*_blossom_data)[tb].pred = (*_blossom_data)[tb].next;
-        }
-
-        (*_blossom_data)[subblossoms[id]].status = ODD;
-        matchedToOdd(subblossoms[id]);
-        _tree_set->insert(subblossoms[id], tree);
-        (*_blossom_data)[subblossoms[id]].next = next;
-        (*_blossom_data)[subblossoms[id]].pred = pred;
-
-      } else {
-
-        for (int i = (ib + 1) % subblossoms.size();
-             i != id; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          (*_blossom_data)[sb].next =
-            _graph.oppositeArc((*_blossom_data)[tb].next);
-        }
-
-        for (int i = id; i != ib; i = (i + 2) % subblossoms.size()) {
-          int sb = subblossoms[i];
-          int tb = subblossoms[(i + 1) % subblossoms.size()];
-          int ub = subblossoms[(i + 2) % subblossoms.size()];
-
-          (*_blossom_data)[sb].status = ODD;
-          matchedToOdd(sb);
-          _tree_set->insert(sb, tree);
-          (*_blossom_data)[sb].next = next;
-          (*_blossom_data)[sb].pred =
-            _graph.oppositeArc((*_blossom_data)[tb].next);
-
-          (*_blossom_data)[tb].status = EVEN;
-          matchedToEven(tb, tree);
-          _tree_set->insert(tb, tree);
-          (*_blossom_data)[tb].pred =
-            (*_blossom_data)[tb].next =
-            _graph.oppositeArc((*_blossom_data)[ub].next);
-          next = (*_blossom_data)[ub].next;
-        }
-
-        (*_blossom_data)[subblossoms[ib]].status = ODD;
-        matchedToOdd(subblossoms[ib]);
-        _tree_set->insert(subblossoms[ib], tree);
-        (*_blossom_data)[subblossoms[ib]].next = next;
-        (*_blossom_data)[subblossoms[ib]].pred = pred;
-      }
-      _tree_set->erase(blossom);
-    }
-
-    void extractBlossom(int blossom, const Node& base, const Arc& matching) {
-      if (_blossom_set->trivial(blossom)) {
-        int bi = (*_node_index)[base];
-        Value pot = (*_node_data)[bi].pot;
-
-        _matching->set(base, matching);
-        _blossom_node_list.push_back(base);
-        _node_potential->set(base, pot);
-      } else {
-
-        Value pot = (*_blossom_data)[blossom].pot;
-        int bn = _blossom_node_list.size();
-
-        std::vector<int> subblossoms;
-        _blossom_set->split(blossom, std::back_inserter(subblossoms));
-        int b = _blossom_set->find(base);
-        int ib = -1;
-        for (int i = 0; i < int(subblossoms.size()); ++i) {
-          if (subblossoms[i] == b) { ib = i; break; }
-        }
-
-        for (int i = 1; i < int(subblossoms.size()); i += 2) {
-          int sb = subblossoms[(ib + i) % subblossoms.size()];
-          int tb = subblossoms[(ib + i + 1) % subblossoms.size()];
-
-          Arc m = (*_blossom_data)[tb].next;
-          extractBlossom(sb, _graph.target(m), _graph.oppositeArc(m));
-          extractBlossom(tb, _graph.source(m), m);
-        }
-        extractBlossom(subblossoms[ib], base, matching);
-
-        int en = _blossom_node_list.size();
-
-        _blossom_potential.push_back(BlossomVariable(bn, en, pot));
-      }
-    }
-
-    void extractMatching() {
-      std::vector<int> blossoms;
-      for (typename BlossomSet::ClassIt c(*_blossom_set); c != INVALID; ++c) {
-        blossoms.push_back(c);
-      }
-
-      for (int i = 0; i < int(blossoms.size()); ++i) {
-
-        Value offset = (*_blossom_data)[blossoms[i]].offset;
-        (*_blossom_data)[blossoms[i]].pot += 2 * offset;
-        for (typename BlossomSet::ItemIt n(*_blossom_set, blossoms[i]);
-             n != INVALID; ++n) {
-          (*_node_data)[(*_node_index)[n]].pot -= offset;
-        }
-
-        Arc matching = (*_blossom_data)[blossoms[i]].next;
-        Node base = _graph.source(matching);
-        extractBlossom(blossoms[i], base, matching);
-      }
-    }
-
-  public:
-
-    /// \brief Constructor
-    ///
-    /// Constructor.
-    MaxWeightedPerfectMatching(const Graph& graph, const WeightMap& weight)
-      : _graph(graph), _weight(weight), _matching(0),
-        _node_potential(0), _blossom_potential(), _blossom_node_list(),
-        _node_num(0), _blossom_num(0),
-
-        _blossom_index(0), _blossom_set(0), _blossom_data(0),
-        _node_index(0), _node_heap_index(0), _node_data(0),
-        _tree_set_index(0), _tree_set(0),
-
-        _delta2_index(0), _delta2(0),
-        _delta3_index(0), _delta3(0),
-        _delta4_index(0), _delta4(0),
-
-        _delta_sum() {}
-
-    ~MaxWeightedPerfectMatching() {
-      destroyStructures();
-    }
-
-    /// \name Execution control
-    /// The simplest way to execute the algorithm is to use the
-    /// \c run() member function.
-
-    ///@{
-
-    /// \brief Initialize the algorithm
-    ///
-    /// Initialize the algorithm
-    void init() {
-      createStructures();
-
-      for (ArcIt e(_graph); e != INVALID; ++e) {
-        _node_heap_index->set(e, BinHeap<Value, IntArcMap>::PRE_HEAP);
-      }
-      for (EdgeIt e(_graph); e != INVALID; ++e) {
-        _delta3_index->set(e, _delta3->PRE_HEAP);
-      }
-      for (int i = 0; i < _blossom_num; ++i) {
-        _delta2_index->set(i, _delta2->PRE_HEAP);
-        _delta4_index->set(i, _delta4->PRE_HEAP);
-      }
-
-      int index = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        Value max = - std::numeric_limits<Value>::max();
-        for (OutArcIt e(_graph, n); e != INVALID; ++e) {
-          if (_graph.target(e) == n) continue;
-          if ((dualScale * _weight[e]) / 2 > max) {
-            max = (dualScale * _weight[e]) / 2;
-          }
-        }
-        _node_index->set(n, index);
-        (*_node_data)[index].pot = max;
-        int blossom =
-          _blossom_set->insert(n, std::numeric_limits<Value>::max());
-
-        _tree_set->insert(blossom);
-
-        (*_blossom_data)[blossom].status = EVEN;
-        (*_blossom_data)[blossom].pred = INVALID;
-        (*_blossom_data)[blossom].next = INVALID;
-        (*_blossom_data)[blossom].pot = 0;
-        (*_blossom_data)[blossom].offset = 0;
-        ++index;
-      }
-      for (EdgeIt e(_graph); e != INVALID; ++e) {
-        int si = (*_node_index)[_graph.u(e)];
-        int ti = (*_node_index)[_graph.v(e)];
-        if (_graph.u(e) != _graph.v(e)) {
-          _delta3->push(e, ((*_node_data)[si].pot + (*_node_data)[ti].pot -
-                            dualScale * _weight[e]) / 2);
-        }
-      }
-    }
-
-    /// \brief Starts the algorithm
-    ///
-    /// Starts the algorithm
-    bool start() {
-      enum OpType {
-        D2, D3, D4
-      };
-
-      int unmatched = _node_num;
-      while (unmatched > 0) {
-        Value d2 = !_delta2->empty() ?
-          _delta2->prio() : std::numeric_limits<Value>::max();
-
-        Value d3 = !_delta3->empty() ?
-          _delta3->prio() : std::numeric_limits<Value>::max();
-
-        Value d4 = !_delta4->empty() ?
-          _delta4->prio() : std::numeric_limits<Value>::max();
-
-        _delta_sum = d2; OpType ot = D2;
-        if (d3 < _delta_sum) { _delta_sum = d3; ot = D3; }
-        if (d4 < _delta_sum) { _delta_sum = d4; ot = D4; }
-
-        if (_delta_sum == std::numeric_limits<Value>::max()) {
-          return false;
-        }
-
-        switch (ot) {
-        case D2:
-          {
-            int blossom = _delta2->top();
-            Node n = _blossom_set->classTop(blossom);
-            Arc e = (*_node_data)[(*_node_index)[n]].heap.top();
-            extendOnArc(e);
-          }
-          break;
-        case D3:
-          {
-            Edge e = _delta3->top();
-
-            int left_blossom = _blossom_set->find(_graph.u(e));
-            int right_blossom = _blossom_set->find(_graph.v(e));
-
-            if (left_blossom == right_blossom) {
-              _delta3->pop();
-            } else {
-              int left_tree = _tree_set->find(left_blossom);
-              int right_tree = _tree_set->find(right_blossom);
-
-              if (left_tree == right_tree) {
-                shrinkOnEdge(e, left_tree);
-              } else {
-                augmentOnEdge(e);
-                unmatched -= 2;
-              }
-            }
-          } break;
-        case D4:
-          splitBlossom(_delta4->top());
-          break;
-        }
-      }
-      extractMatching();
-      return true;
-    }
-
-    /// \brief Runs %MaxWeightedPerfectMatching algorithm.
-    ///
-    /// This method runs the %MaxWeightedPerfectMatching algorithm.
-    ///
-    /// \note mwm.run() is just a shortcut of the following code.
-    /// \code
-    ///   mwm.init();
-    ///   mwm.start();
-    /// \endcode
-    bool run() {
-      init();
-      return start();
-    }
-
-    /// @}
-
-    /// \name Primal solution
-    /// Functions to get the primal solution, ie. the matching.
-
-    /// @{
-
-    /// \brief Returns the matching value.
-    ///
-    /// Returns the matching value.
-    Value matchingValue() const {
-      Value sum = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        if ((*_matching)[n] != INVALID) {
-          sum += _weight[(*_matching)[n]];
-        }
-      }
-      return sum /= 2;
-    }
-
-    /// \brief Returns true when the edge is in the matching.
-    ///
-    /// Returns true when the edge is in the matching.
-    bool matching(const Edge& edge) const {
-      return static_cast<const Edge&>((*_matching)[_graph.u(edge)]) == edge;
-    }
-
-    /// \brief Returns the incident matching edge.
-    ///
-    /// Returns the incident matching arc from given edge.
-    Arc matching(const Node& node) const {
-      return (*_matching)[node];
-    }
-
-    /// \brief Returns the mate of the node.
-    ///
-    /// Returns the adjancent node in a mathcing arc.
-    Node mate(const Node& node) const {
-      return _graph.target((*_matching)[node]);
-    }
-
-    /// @}
-
-    /// \name Dual solution
-    /// Functions to get the dual solution.
-
-    /// @{
-
-    /// \brief Returns the value of the dual solution.
-    ///
-    /// Returns the value of the dual solution. It should be equal to
-    /// the primal value scaled by \ref dualScale "dual scale".
-    Value dualValue() const {
-      Value sum = 0;
-      for (NodeIt n(_graph); n != INVALID; ++n) {
-        sum += nodeValue(n);
-      }
-      for (int i = 0; i < blossomNum(); ++i) {
-        sum += blossomValue(i) * (blossomSize(i) / 2);
-      }
-      return sum;
-    }
-
-    /// \brief Returns the value of the node.
-    ///
-    /// Returns the the value of the node.
-    Value nodeValue(const Node& n) const {
-      return (*_node_potential)[n];
-    }
-
-    /// \brief Returns the number of the blossoms in the basis.
-    ///
-    /// Returns the number of the blossoms in the basis.
-    /// \see BlossomIt
-    int blossomNum() const {
-      return _blossom_potential.size();
-    }
-
-
-    /// \brief Returns the number of the nodes in the blossom.
-    ///
-    /// Returns the number of the nodes in the blossom.
-    int blossomSize(int k) const {
-      return _blossom_potential[k].end - _blossom_potential[k].begin;
-    }
-
-    /// \brief Returns the value of the blossom.
-    ///
-    /// Returns the the value of the blossom.
-    /// \see BlossomIt
-    Value blossomValue(int k) const {
-      return _blossom_potential[k].value;
-    }
-
-    /// \brief Iterator for obtaining the nodes of the blossom.
-    ///
-    /// Iterator for obtaining the nodes of the blossom. This class
-    /// provides a common lemon style iterator for listing a
-    /// subset of the nodes.
-    class BlossomIt {
-    public:
-
-      /// \brief Constructor.
-      ///
-      /// Constructor to get the nodes of the variable.
-      BlossomIt(const MaxWeightedPerfectMatching& algorithm, int variable)
-        : _algorithm(&algorithm)
-      {
-        _index = _algorithm->_blossom_potential[variable].begin;
-        _last = _algorithm->_blossom_potential[variable].end;
-      }
-
-      /// \brief Conversion to node.
-      ///
-      /// Conversion to node.
-      operator Node() const {
-        return _algorithm->_blossom_node_list[_index];
-      }
-
-      /// \brief Increment operator.
-      ///
-      /// Increment operator.
-      BlossomIt& operator++() {
-        ++_index;
-        return *this;
-      }
-
-      /// \brief Validity checking
-      ///
-      /// Checks whether the iterator is invalid.
-      bool operator==(Invalid) const { return _index == _last; }
-
-      /// \brief Validity checking
-      ///
-      /// Checks whether the iterator is valid.
-      bool operator!=(Invalid) const { return _index != _last; }
-
-    private:
-      const MaxWeightedPerfectMatching* _algorithm;
-      int _last;
-      int _index;
-    };
-
-    /// @}
-
-  };
-
-
-} //END OF NAMESPACE LEMON
-
-#endif //LEMON_MAX_MATCHING_H
Index: lemon/path.h
===================================================================
--- lemon/path.h	(revision 313)
+++ lemon/path.h	(revision 236)
@@ -850,5 +850,5 @@
     int empty() const { return len == 0; }
 
-    /// \brief Erase all arcs in the digraph.
+    /// \break Erase all arcs in the digraph.
     void clear() {
       len = 0;
Index: lemon/random.h
===================================================================
--- lemon/random.h	(revision 280)
+++ lemon/random.h	(revision 209)
@@ -822,4 +822,5 @@
     /// \note The Cartesian form of the Box-Muller
     /// transformation is used to generate a random normal distribution.
+    /// \todo Consider using the "ziggurat" method instead.
     double gauss()
     {
Index: lemon/smart_graph.h
===================================================================
--- lemon/smart_graph.h	(revision 313)
+++ lemon/smart_graph.h	(revision 238)
@@ -301,4 +301,5 @@
     ///\warning This functionality cannot be used together with the Snapshot
     ///feature.
+    ///\todo It could be implemented in a bit faster way.
     Node split(Node n, bool connect = true)
     {
@@ -366,5 +367,5 @@
 
       ///This constructor immediately makes a snapshot of the digraph.
-      ///\param graph The digraph we make a snapshot of.
+      ///\param _g The digraph we make a snapshot of.
       Snapshot(SmartDigraph &graph) : _graph(&graph) {
         node_num=_graph->nodes.size();
@@ -378,5 +379,5 @@
       ///This function can be called more than once. In case of a repeated
       ///call, the previous snapshot gets lost.
-      ///\param graph The digraph we make the snapshot of.
+      ///\param _g The digraph we make the snapshot of.
       void save(SmartDigraph &graph)
       {
@@ -776,5 +777,5 @@
 
       ///This constructor immediately makes a snapshot of the digraph.
-      ///\param graph The digraph we make a snapshot of.
+      ///\param g The digraph we make a snapshot of.
       Snapshot(SmartGraph &graph) {
         graph.saveSnapshot(*this);
@@ -787,5 +788,5 @@
       ///This function can be called more than once. In case of a repeated
       ///call, the previous snapshot gets lost.
-      ///\param graph The digraph we make the snapshot of.
+      ///\param g The digraph we make the snapshot of.
       void save(SmartGraph &graph)
       {
Index: lemon/time_measure.h
===================================================================
--- lemon/time_measure.h	(revision 314)
+++ lemon/time_measure.h	(revision 210)
@@ -293,4 +293,5 @@
   ///function, consider the usage of \ref TimeReport instead.
   ///
+  ///\todo This shouldn't be Unix (Linux) specific.
   ///\sa TimeReport
   class Timer
@@ -312,9 +313,10 @@
     ///Basically a Timer can be either running or stopped,
     ///but it provides a bit finer control on the execution.
-    ///The \ref lemon::Timer "Timer" also counts the number of
-    ///\ref lemon::Timer::start() "start()" executions, and it stops
-    ///only after the same amount (or more) \ref lemon::Timer::stop()
-    ///"stop()"s. This can be useful e.g. to compute the running time
+    ///The \ref Timer also counts the number of \ref start()
+    ///executions, and is stops only after the same amount (or more)
+    ///\ref stop() "stop()"s. This can be useful e.g. to compute
+    ///the running time
     ///of recursive functions.
+    ///
 
     ///@{
@@ -472,5 +474,5 @@
   };
 
-  ///Same as Timer but prints a report on destruction.
+  ///Same as \ref Timer but prints a report on destruction.
 
   ///Same as \ref Timer but prints a report on destruction.
@@ -486,4 +488,5 @@
   ///\sa Timer
   ///\sa NoTimeReport
+  ///\todo There is no test case for this
   class TimeReport : public Timer
   {
@@ -491,13 +494,13 @@
     std::ostream &_os;
   public:
-    ///Constructor
-
-    ///Constructor.
+    ///\e
+
     ///\param title This text will be printed before the ellapsed time.
     ///\param os The stream to print the report to.
     ///\param run Sets whether the timer should start immediately.
+
     TimeReport(std::string title,std::ostream &os=std::cerr,bool run=true)
       : Timer(run), _title(title), _os(os){}
-    ///Destructor that prints the ellapsed time
+    ///\e Prints the ellapsed time on destruction.
     ~TimeReport()
     {
@@ -506,5 +509,5 @@
   };
 
-  ///'Do nothing' version of TimeReport
+  ///'Do nothing' version of \ref TimeReport
 
   ///\sa TimeReport
Index: lemon/tolerance.h
===================================================================
--- lemon/tolerance.h	(revision 280)
+++ lemon/tolerance.h	(revision 209)
@@ -25,4 +25,6 @@
 ///floating point numbers.
 ///
+///\todo It should be in a module like "Basic tools"
+
 
 namespace lemon {
