Index: .hgignore
===================================================================
--- .hgignore	(revision 111)
+++ .hgignore	(revision 128)
@@ -25,4 +25,5 @@
 .libs/*
 .deps/*
+demo/*.eps
 
 syntax: regexp
Index: demo/Makefile.am
===================================================================
--- demo/Makefile.am	(revision 127)
+++ demo/Makefile.am	(revision 128)
@@ -6,9 +6,10 @@
 noinst_PROGRAMS += \
         demo/arg_parser_demo \
-	demo/lgf_demo
+        demo/graph_to_eps_demo
 
 endif WANT_DEMO
 
 demo_arg_parser_demo_SOURCES = demo/arg_parser_demo.cc
-demo_lgf_demo_SOURCES = demo/lgf_demo.cc
 
+demo_graph_to_eps_demo_SOURCES = demo/graph_to_eps_demo.cc
+
Index: demo/arg_parser_demo.cc
===================================================================
--- demo/arg_parser_demo.cc	(revision 88)
+++ demo/arg_parser_demo.cc	(revision 128)
@@ -38,4 +38,5 @@
   ap.refOption("n", "An integer input.", i, true)
     .refOption("val", "A double input.", d)
+    .doubleOption("val2", "A double input.", d)
     .synonym("vals","val")
     .refOption("name", "A string input.", s)
@@ -46,5 +47,5 @@
     .refOption("grc","Choice C",g3)
     .optionGroup("gr","gra")
-    .optionGroup("gr","grb")
+    .optionGroup("gr","grbkk")
     .optionGroup("gr","grc")
     .mandatoryGroup("gr")
Index: demo/graph_to_eps_demo.cc
===================================================================
--- demo/graph_to_eps_demo.cc	(revision 128)
+++ demo/graph_to_eps_demo.cc	(revision 128)
@@ -0,0 +1,208 @@
+/* -*- C++ -*-
+ *
+ * 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.
+ *
+ */
+
+/// \ingroup demos
+/// \file
+/// \brief Demo of the graph grawing function \ref graphToEps()
+///
+/// This demo program shows examples how to  use the function \ref
+/// graphToEps(). It takes no input but simply creates  six
+/// <tt>.eps</tt> files demonstrating the capability of \ref
+/// graphToEps(), and showing how to draw directed/graphs,
+/// how to handle parallel egdes, how to change the properties (like
+/// color, shape, size, title etc.) of nodes and arcs individually
+/// using appropriate \ref maps-page "graph maps".
+///
+/// \include graph_to_eps_demo.cc
+
+#include <lemon/math.h>
+
+#include<lemon/graph_to_eps.h>
+#include<lemon/list_graph.h>
+#include<lemon/graph_utils.h>
+
+using namespace std;
+using namespace lemon;
+
+int main()
+{
+  Palette palette;
+  Palette paletteW(-1,true);
+
+  ListDigraph g;
+  typedef ListDigraph::Node Node;
+  typedef ListDigraph::NodeIt NodeIt;
+  typedef ListDigraph::Arc Arc;
+  typedef dim2::Point<int> Point;
+  
+  Node n1=g.addNode();
+  Node n2=g.addNode();
+  Node n3=g.addNode();
+  Node n4=g.addNode();
+  Node n5=g.addNode();
+
+  ListDigraph::NodeMap<Point> coords(g);
+  ListDigraph::NodeMap<double> sizes(g);
+  ListDigraph::NodeMap<int> colors(g);
+  ListDigraph::NodeMap<int> shapes(g);
+  ListDigraph::ArcMap<int> ecolors(g);
+  ListDigraph::ArcMap<int> widths(g);
+  
+  coords[n1]=Point(50,50);  sizes[n1]=1; colors[n1]=1; shapes[n1]=0;
+  coords[n2]=Point(50,70);  sizes[n2]=2; colors[n2]=2; shapes[n2]=2;
+  coords[n3]=Point(70,70);  sizes[n3]=1; colors[n3]=3; shapes[n3]=0;
+  coords[n4]=Point(70,50);  sizes[n4]=2; colors[n4]=4; shapes[n4]=1;
+  coords[n5]=Point(85,60);  sizes[n5]=3; colors[n5]=5; shapes[n5]=2;
+  
+  Arc e;
+
+  e=g.addArc(n1,n2); ecolors[e]=0; widths[e]=1;
+  e=g.addArc(n2,n3); ecolors[e]=0; widths[e]=1;
+  e=g.addArc(n3,n5); ecolors[e]=0; widths[e]=3;
+  e=g.addArc(n5,n4); ecolors[e]=0; widths[e]=1;
+  e=g.addArc(n4,n1); ecolors[e]=0; widths[e]=1;
+  e=g.addArc(n2,n4); ecolors[e]=1; widths[e]=2;
+  e=g.addArc(n3,n4); ecolors[e]=2; widths[e]=1;
+  
+  IdMap<ListDigraph,Node> id(g);
+
+  cout << "Create 'graph_to_eps_demo_out_pure.eps'" << endl;
+  graphToEps(g,"graph_to_eps_demo_out_pure.eps").
+    //scale(10).
+    coords(coords).
+    title("Sample .eps figure").
+    copyright("(C) 2003-2007 LEMON Project").
+    run();
+
+  cout << "Create 'graph_to_eps_demo_out.eps'" << endl;
+  graphToEps(g,"graph_to_eps_demo_out.eps").
+    //scale(10).
+    coords(coords).
+    title("Sample .eps figure").
+    copyright("(C) 2003-2007 LEMON Project").
+    absoluteNodeSizes().absoluteArcWidths().
+    nodeScale(2).nodeSizes(sizes).
+    nodeShapes(shapes).
+    nodeColors(composeMap(palette,colors)).
+    arcColors(composeMap(palette,ecolors)).
+    arcWidthScale(.4).arcWidths(widths).
+    nodeTexts(id).nodeTextSize(3).
+    run();
+
+
+  cout << "Create 'graph_to_eps_demo_out_arr.eps'" << endl;
+  graphToEps(g,"graph_to_eps_demo_out_arr.eps").
+    //scale(10).
+    title("Sample .eps figure (with arrowheads)").
+    copyright("(C) 2003-2007 LEMON Project").
+    absoluteNodeSizes().absoluteArcWidths().
+    nodeColors(composeMap(palette,colors)).
+    coords(coords).
+    nodeScale(2).nodeSizes(sizes).
+    nodeShapes(shapes).
+    arcColors(composeMap(palette,ecolors)).
+    arcWidthScale(.4).arcWidths(widths).
+    nodeTexts(id).nodeTextSize(3).
+    drawArrows().arrowWidth(1).arrowLength(1).
+    run();
+
+  e=g.addArc(n1,n4); ecolors[e]=2; widths[e]=1;
+  e=g.addArc(n4,n1); ecolors[e]=1; widths[e]=2;
+
+  e=g.addArc(n1,n2); ecolors[e]=1; widths[e]=1;
+  e=g.addArc(n1,n2); ecolors[e]=2; widths[e]=1;
+  e=g.addArc(n1,n2); ecolors[e]=3; widths[e]=1;
+  e=g.addArc(n1,n2); ecolors[e]=4; widths[e]=1;
+  e=g.addArc(n1,n2); ecolors[e]=5; widths[e]=1;
+  e=g.addArc(n1,n2); ecolors[e]=6; widths[e]=1;
+  e=g.addArc(n1,n2); ecolors[e]=7; widths[e]=1;
+
+  cout << "Create 'graph_to_eps_demo_out_par.eps'" << endl;
+  graphToEps(g,"graph_to_eps_demo_out_par.eps").
+    //scale(10).
+    title("Sample .eps figure (parallel arcs)").
+    copyright("(C) 2003-2007 LEMON Project").
+    absoluteNodeSizes().absoluteArcWidths().
+    nodeShapes(shapes).
+    coords(coords).
+    nodeScale(2).nodeSizes(sizes).
+    nodeColors(composeMap(palette,colors)).
+    arcColors(composeMap(palette,ecolors)).
+    arcWidthScale(.4).arcWidths(widths).
+    nodeTexts(id).nodeTextSize(3).
+    enableParallel().parArcDist(1.5).
+    run();
+  
+  cout << "Create 'graph_to_eps_demo_out_par_arr.eps'" << endl;
+  graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").
+    //scale(10).
+    title("Sample .eps figure (parallel arcs and arrowheads)").
+    copyright("(C) 2003-2007 LEMON Project").
+    absoluteNodeSizes().absoluteArcWidths().
+    nodeScale(2).nodeSizes(sizes).
+    coords(coords).
+    nodeShapes(shapes).
+    nodeColors(composeMap(palette,colors)).
+    arcColors(composeMap(palette,ecolors)).
+    arcWidthScale(.3).arcWidths(widths).
+    nodeTexts(id).nodeTextSize(3).
+    enableParallel().parArcDist(1).
+    drawArrows().arrowWidth(1).arrowLength(1).
+    run();
+
+  cout << "Create 'graph_to_eps_demo_out_a4.eps'" << endl;
+  graphToEps(g,"graph_to_eps_demo_out_a4.eps").scaleToA4().
+    title("Sample .eps figure (fits to A4)").
+    copyright("(C) 2003-2007 LEMON Project").
+    absoluteNodeSizes().absoluteArcWidths().
+    nodeScale(2).nodeSizes(sizes).
+    coords(coords).
+    nodeShapes(shapes).
+    nodeColors(composeMap(palette,colors)).
+    arcColors(composeMap(palette,ecolors)).
+    arcWidthScale(.3).arcWidths(widths).
+    nodeTexts(id).nodeTextSize(3).
+    enableParallel().parArcDist(1).
+    drawArrows().arrowWidth(1).arrowLength(1).
+    run();
+
+  ListDigraph h;
+  ListDigraph::NodeMap<int> hcolors(h);
+  ListDigraph::NodeMap<Point> hcoords(h);
+  
+  int cols=int(sqrt(double(palette.size())));
+  for(int i=0;i<int(paletteW.size());i++) {
+    Node n=h.addNode();
+    hcoords[n]=Point(i%cols,i/cols);
+    hcolors[n]=i;
+  }
+  
+  cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl;
+  graphToEps(h,"graph_to_eps_demo_out_colors.eps").
+    //scale(60).
+    title("Sample .eps figure (Palette demo)").
+    copyright("(C) 2003-2007 LEMON Project").
+    coords(hcoords).
+    absoluteNodeSizes().absoluteArcWidths().
+    nodeScale(45).
+    distantColorNodeTexts().
+    //    distantBWNodeTexts().
+    nodeTexts(hcolors).nodeTextSize(.6).
+    nodeColors(composeMap(paletteW,hcolors)).
+    run();
+}
Index: mo/lgf_demo.cc
===================================================================
--- demo/lgf_demo.cc	(revision 127)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/* -*- C++ -*-
- *
- * 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.
- *
- */
-
-///\ingroup demos
-///\file
-///\brief Demonstrating graph input and output
-///
-/// This simple demo program gives an example of how to read and write
-/// a graph and additional maps (on the nodes or the edges) from/to a
-/// stream. 
-///
-/// \include reader_writer_demo.cc
-
-#include <iostream>
-#include <lemon/smart_graph.h>
-#include <lemon/lgf_reader.h>
-#include <lemon/lgf_writer.h>
-#include <lemon/random.h>
-
-
-using namespace lemon;
-
-int main(int argc, const char *argv[]) {
-  const int n = argc > 1 ? std::atoi(argv[1]) : 20;
-  const int e = argc > 2 ? std::atoi(argv[2]) : static_cast<int>(n * log(n));
-  const int m = argc > 3 ? std::atoi(argv[3]) : 100;
-
-  SmartDigraph digraph;
-
-  std::stringstream ss;
-
-  try {
-
-    typedef SmartDigraph Digraph;
-    typedef Digraph::Node Node;
-    typedef Digraph::Arc Arc;
-    typedef Digraph::ArcIt ArcIt;
-
-    typedef Digraph::NodeMap<int> PotentialMap;
-    typedef Digraph::ArcMap<int> CapacityMap;
-    typedef Digraph::ArcMap<std::string> NameMap;
-
-    Digraph digraph;
-    PotentialMap potential(digraph);
-    CapacityMap capacity(digraph);
-    NameMap name(digraph);
-
-    std::vector<Node> nodes;
-    for (int i = 0; i < n; ++i) {
-      Node node = digraph.addNode();
-      potential[node] = rnd[m];
-      nodes.push_back(node);
-    }
-
-    std::vector<Arc> arcs;
-    for (int i = 0; i < e; ++i) {
-      int s = rnd[n];
-      int t = rnd[n];
-      int c = rnd[m];
-      Arc arc = digraph.addArc(nodes[s], nodes[t]);
-      capacity[arc] = c;
-      std::ostringstream os;
-      os << "arc \t" << i << std::endl;
-      name[arc] = os.str();
-      arcs.push_back(arc);
-    }
-
-
-    DigraphWriter<Digraph>(ss, digraph).
-      nodeMap("potential", potential).
-      arcMap("capacity", capacity).
-      arcMap("name", name).
-      node("source", nodes[0]).
-      node("target", nodes[1]).
-      arc("bottleneck", arcs[e / 2]).
-      attribute("creator", "lemon library").
-      run();
-
-  } catch (DataFormatError& error) {
-    std::cerr << error.what() << std::endl;
-  }
-
-  try {
-
-    typedef SmartDigraph Digraph;
-    typedef Digraph::Node Node;
-    typedef Digraph::Arc Arc;
-    typedef Digraph::ArcIt ArcIt;
-
-    typedef Digraph::NodeMap<int> LabelMap;
-    typedef Digraph::NodeMap<int> PotentialMap;
-    typedef Digraph::ArcMap<int> CapacityMap;
-    typedef Digraph::ArcMap<std::string> NameMap;
-
-    Digraph digraph;
-    LabelMap label(digraph);
-    PotentialMap potential(digraph);
-    CapacityMap capacity(digraph);
-    NameMap name(digraph);
-
-    Node s, t;
-    Arc a;
-    
-    std::string creator;
-
-    for (int i = 0; i < n; ++i) {
-      Node node = digraph.addNode();
-      label[node] = i;
-    }
-    
-    DigraphReader<Digraph>(ss, digraph).
-      useNodes(label).
-      nodeMap("potential", potential).
-      arcMap("capacity", capacity).
-      arcMap("name", name).
-      node("source", s).
-      node("target", t).
-      arc("bottleneck", a).
-      attribute("creator", creator).
-      run();
-
-    DigraphWriter<Digraph>(std::cout, digraph).
-      nodeMap("potential", potential).
-      arcMap("capacity", capacity).
-      arcMap("name", name).
-      node("source", s).
-      node("target", t).
-      arc("bottleneck", a).
-      attribute("creator", creator).
-      run();
-
-  } catch (DataFormatError& error) {
-    std::cerr << error.what() << std::endl;
-  }
-
-
-  return 0;
-}
Index: lemon/Makefile.am
===================================================================
--- lemon/Makefile.am	(revision 127)
+++ lemon/Makefile.am	(revision 128)
@@ -10,4 +10,5 @@
         lemon/arg_parser.cc \
         lemon/base.cc \
+        lemon/color.cc \
         lemon/random.cc
 
@@ -21,12 +22,12 @@
         lemon/bfs.h \
         lemon/bin_heap.h \
-        lemon/counter.h \
+        lemon/color.h \
         lemon/dfs.h \
         lemon/dijkstra.h \
         lemon/dim2.h \
 	lemon/error.h \
+        lemon/graph_to_eps.h \
 	lemon/graph_utils.h \
 	lemon/kruskal.h \
-	lemon/lgf_reader.h \
 	lemon/list_graph.h \
 	lemon/maps.h \
@@ -35,5 +36,4 @@
         lemon/random.h \
 	lemon/smart_graph.h \
-        lemon/time_measure.h \
         lemon/tolerance.h \
 	lemon/unionfind.h
@@ -43,4 +43,5 @@
 	lemon/bits/array_map.h \
 	lemon/bits/base_extender.h \
+        lemon/bits/bezier.h \
 	lemon/bits/default_map.h \
 	lemon/bits/graph_extender.h \
Index: lemon/arg_parser.cc
===================================================================
--- lemon/arg_parser.cc	(revision 88)
+++ lemon/arg_parser.cc	(revision 128)
@@ -195,4 +195,5 @@
     Opts::iterator i = _opts.find(opt);
     LEMON_ASSERT(i!=_opts.end(), "Unknown option: '"+opt+"'");
+    if(i==_opts.end()) std::cout << "JAJJJJJJJJ\n";
     LEMON_ASSERT(!(i->second.ingroup), 
                  "Option already in option group: '"+opt+"'");
Index: lemon/assert.h
===================================================================
--- lemon/assert.h	(revision 118)
+++ lemon/assert.h	(revision 112)
@@ -27,4 +27,69 @@
 
 namespace lemon {
+
+  /// @{
+
+  ///\e
+  class AssertionFailedError : public LogicError {
+  protected:
+    const char *_assertion;
+    const char *_file;
+    int _line;
+    const char *_function;
+    const char *_message;
+
+    mutable ExceptionMember<std::string> _message_holder;
+  public:
+    ///\e
+    AssertionFailedError(const char *file, int line, const char *function,
+			 const char *msg, const char *assertion = 0) :
+      _assertion(assertion), _file(file), _line(line), 
+      _function(function), _message(msg) {}
+
+    ///\e
+    const char* assertion() const { return _assertion; }
+    ///\e
+    const char* message() const { return _message; }
+    ///\e
+    const char* file() const { return _file; }
+    ///\e
+    const char* function() const { return _function; }
+    ///\e
+    int line() const { return _line; }
+
+
+    virtual const char* what() const throw() {
+      try {
+	std::ostringstream ostr;
+	ostr << _file << ":" << _line << ": ";
+	if (_function)
+	  ostr << _function << ": ";
+	ostr << _message;
+	if (_assertion)
+	   ostr << " (assertion '" << _assertion << "' failed)";
+	_message_holder.set(ostr.str());
+	return ostr.str().c_str();
+      }
+      catch(...) {}
+      if( _message_holder.valid() ) return _message_holder.get().c_str();
+      return "lemon::AssertionFailedError";
+    }
+    virtual ~AssertionFailedError() throw() {}
+  };
+
+
+  inline void assert_fail_log(const char *file, int line,
+			      const char *function,
+			      const std::exception& exception, 
+			      const char *assertion)
+  {
+    std::cerr << file << ":" << line << ": ";
+    if (function)
+      std::cerr << function << ": ";
+    std::cerr << exception.what();
+    if (assertion)
+      std::cerr << " (assertion '" << assertion << "' failed)";
+    std::cerr << std::endl;
+  }
 
   inline void assert_fail_log(const char *file, int line, const char *function,
@@ -40,4 +105,19 @@
   }
 
+  inline void assert_fail_log(const char *file, int line, const char *function, 
+			      const std::string& message, const char *assertion)
+  {
+    assert_fail_log(file, line, function, message.c_str(), assertion);
+  }
+
+  inline void assert_fail_abort(const char *file, int line, 
+				const char *function,
+				const std::exception& exception,
+				const char *assertion)
+  {
+    assert_fail_log(file, line, function, exception, assertion);
+    std::abort();
+  }
+
   inline void assert_fail_abort(const char *file, int line,
 				const char *function, const char* message,
@@ -48,25 +128,73 @@
   }
 
-  namespace _assert_bits {
-    
-    
-    inline const char* cstringify(const std::string& str) {
-      return str.c_str();
-    }
-
-    inline const char* cstringify(const char* str) {
-      return str;
-    }    
-  }
+  inline void assert_fail_abort(const char *file, int line, 
+				const char *function, 
+				const std::string& message,
+				const char *assertion)
+  {
+    assert_fail_log(file, line, function, message.c_str(), assertion);
+    std::abort();
+  }
+
+  inline void assert_fail_error(const char *file, int line, 
+				  const char *function,
+				  const std::exception& exception,
+				  const char *assertion)
+  {
+    throw AssertionFailedError(file, line, function, 
+			       exception.what(), assertion);
+  }
+
+  inline void assert_fail_error(const char *file, int line,
+				  const char *function, const char *message,
+				  const char *assertion)
+  {
+    throw AssertionFailedError(file, line, function, message, assertion);
+  }
+
+  inline void assert_fail_error(const char *file, int line,
+				  const char *function, 
+				  const std::string& message,
+				  const char *assertion)
+  {
+    throw AssertionFailedError(file, line, function, message.c_str(), assertion);
+  }
+
+  template <typename Exception>
+  inline void assert_fail_exception(const char *, int, const char *,
+				    const Exception& exception,
+				    const char *, const std::exception* = 
+				    static_cast<const Exception*>(0))
+  {
+    throw exception;
+  }
+
+  inline void assert_fail_exception(const char *file, int line,
+				    const char *function, const char *message,
+				    const char *assertion)
+  {
+    throw AssertionFailedError(file, line, function, message, assertion);
+  }
+
+  inline void assert_fail_exception(const char *file, int line, 
+				    const char *function, 
+				    const std::string& message,
+				    const char *assertion)
+  {
+    throw AssertionFailedError(file, line, function, message.c_str(), assertion);
+  }
+
+/// @}
+
 }
-
 #endif // LEMON_ASSERT_H
 
 #undef LEMON_ASSERT
 #undef LEMON_FIXME
-#undef LEMON_DEBUG
 
 #if (defined(LEMON_ASSERT_LOG) ? 1 : 0) +		\
   (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +		\
+  (defined(LEMON_ASSERT_ERROR) ? 1 : 0) +		\
+  (defined(LEMON_ASSERT_EXCEPTION) ? 1 : 0) +		\
   (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) > 1
 #error "LEMON assertion system is not set properly"
@@ -75,8 +203,9 @@
 #if ((defined(LEMON_ASSERT_LOG) ? 1 : 0) +		\
      (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +		\
+     (defined(LEMON_ASSERT_ERROR) ? 1 : 0) +		\
+     (defined(LEMON_ASSERT_EXCEPTION) ? 1 : 0) +	\
      (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) == 1 ||	\
      defined(LEMON_ENABLE_ASSERTS)) &&			\
-  (defined(LEMON_DISABLE_ASSERTS) ||			\
-   defined(NDEBUG))
+  defined(LEMON_DISABLE_ASSERTS)
 #error "LEMON assertion system is not set properly"
 #endif
@@ -89,4 +218,10 @@
 #  undef LEMON_ASSERT_HANDLER
 #  define LEMON_ASSERT_HANDLER ::lemon::assert_fail_abort
+#elif defined LEMON_ASSERT_ERROR
+#  undef LEMON_ASSERT_HANDLER
+#  define LEMON_ASSERT_HANDLER ::lemon::assert_fail_error
+#elif defined LEMON_ASSERT_EXCEPTION
+#  undef LEMON_ASSERT_HANDLER
+#  define LEMON_ASSERT_HANDLER ::lemon::assert_fail_exception
 #elif defined LEMON_ASSERT_CUSTOM
 #  undef LEMON_ASSERT_HANDLER
@@ -95,11 +230,11 @@
 #  endif
 #  define LEMON_ASSERT_HANDLER LEMON_CUSTOM_ASSERT_HANDLER
-#elif defined LEMON_DISABLE_ASSERTS
-#  undef LEMON_ASSERT_HANDLER
-#elif defined NDEBUG
-#  undef LEMON_ASSERT_HANDLER
+#elif defined LEMON_ENABLE_ASSERTS
+#  undef LEMON_ASSERT_HANDLER
+#  define LEMON_ASSERT_HANDLER ::lemon::assert_fail_abort
 #else
-#  define LEMON_ASSERT_HANDLER ::lemon::assert_fail_abort
-#endif
+#  undef LEMON_ASSERT_HANDLER
+#endif
+
 
 #ifndef LEMON_FUNCTION_NAME
@@ -113,22 +248,22 @@
 /// \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.
-///
-/// The assertions are enabled in the default behaviour.
-/// You can disable them with the following code:
+/// 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>, a <tt>const std::string&</tt> or
+/// a <tt>const std::exception&</tt> parameter, which can be used to
+/// provide information about the circumstances of the failed assertion.
+///
+/// The assertions are disabled in the default behaviour.
+/// You can enable them with the following code:
 /// \code
-/// #define LEMON_DISABLE_ASSERTS
+/// #define LEMON_ENABLE_ASSERTS
 /// \endcode
 /// or with compilation parameters:
 /// \code
-/// g++ -DLEMON_DISABLE_ASSERTS
-/// make CXXFLAGS='-DLEMON_DISABLE_ASSERTS'
+/// g++ -DLEMON_ENABLE_ASSERTS
+/// make CXXFLAGS='-DLEMON_ENABLE_ASSERTS'
 /// \endcode
-/// The checking is also disabled when the standard macro \c NDEBUG is defined.
 /// 
 /// The LEMON assertion system has a wide range of customization
@@ -140,20 +275,36 @@
 /// - \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_ABORT This mode is similar to the
+///   \c LEMON_ASSERT_LOG, but it aborts the program. It is the default
+///   behaviour mode when the assertions are enabled with
+///   \c LEMON_ENABLE_ASSERTS.
+/// - \c LEMON_ASSERT_ERROR The assertion throws an
+///   \ref lemon::AssertionFailedError "AssertionFailedError".
+///   If the \c msg parameter is an exception, then the result of the
+///   \ref lemon::Exception::what() "what()" member function is passed
+///   as error message.
+/// - \c LEMON_ASSERT_EXCEPTION If the specified \c msg is an
+///   exception, then it raised directly (solving that the exception
+///   can not be thrown polymorphically), otherwise an \ref
+///   lemon::AssertionFailedError "AssertionFailedError" is thrown with
+///   the given parameters.
 /// - \c LEMON_ASSERT_CUSTOM The user can define own assertion handler
-///   function.
+///   functions. Three overloaded functions should be defined with the
+///   following parameter lists:
 ///   \code
 ///     void custom_assert_handler(const char* file, int line, const char* function,
 ///                                const char* message, const char* assertion);
+///     void custom_assert_handler(const char* file, int line, const char* function,
+///                                const std::string& message, const char* assertion);
+///     void custom_assert_handler(const char* file, int line, const char* function,
+///                                const std::exception& message, const char* assertion);
 ///   \endcode
-///   The name of the function should be defined as the \c
+///   The name of the functions should be defined as the \c
 ///   LEMON_CUSTOM_ASSERT_HANDLER macro name. 
 ///   \code
 ///     #define LEMON_CUSTOM_ASSERT_HANDLER custom_assert_handler
 ///   \endcode
-///   Whenever an assertion is occured, the custom assertion
-///   handler is called with appropiate parameters.
+///   Whenever an assertion is occured, one of the custom assertion
+///   handlers is called with appropiate parameters.
 ///
 /// The assertion mode can also be changed within one compilation unit.
@@ -165,5 +316,6 @@
     LEMON_ASSERT_HANDLER(__FILE__, __LINE__,				\
 			 LEMON_FUNCTION_NAME,				\
-			 ::lemon::_assert_bits::cstringify(msg), #exp), 0)))
+			 msg, #exp), 0)))
+
 
 /// \ingroup exceptions
@@ -176,39 +328,7 @@
 ///   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
-///
-/// Macro for internal assertions, it is used in the library to check
-/// the consistency of results of algorithms, several pre- and
-/// postconditions and invariants. The checking is disabled by
-/// default, but it can be turned on with the macro \c
-/// LEMON_ENABLE_DEBUG.
-/// \code
-/// #define LEMON_ENABLE_DEBUG
-/// \endcode
-/// or with compilation parameters:
-/// \code
-/// g++ -DLEMON_ENABLE_DEBUG
-/// make CXXFLAGS='-DLEMON_ENABLE_DEBUG'
-/// \endcode
-///
-/// This macro works like the \c LEMON_ASSERT macro, therefore the
-/// current behaviour depends on the settings of \c LEMON_ASSERT
-/// macro.
-///
-/// \see LEMON_ASSERT 
-#  define LEMON_DEBUG(exp, msg)						\
-  (static_cast<void> (!!(exp) ? 0 : (					\
-    LEMON_ASSERT_HANDLER(__FILE__, __LINE__,                            \
-			 LEMON_FUNCTION_NAME,				\
-			 ::lemon::_assert_bits::cstringify(msg), #exp), 0)))
+       (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,	\
+			     "FIXME: " msg, static_cast<const char*>(0)))
 
 #else
@@ -217,38 +337,16 @@
 #    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
-#    define LEMON_ASSERT(exp, msg)					\
-       (static_cast<void> (!!(exp) ? 0 : (				\
-        LEMON_ASSERT_HANDLER(__FILE__, __LINE__,                        \
-			     LEMON_FUNCTION_NAME,			\
-			     ::lemon::_assert_bits::cstringify(msg),	\
-			     #exp), 0)))
-#    define LEMON_FIXME(msg)						\
+#    define LEMON_ASSERT(exp, msg)                 \
+       (static_cast<void> (!!(exp) ? 0 : (         \
+         LEMON_ASSERT_HANDLER(__FILE__, __LINE__,  \
+                              LEMON_FUNCTION_NAME, \
+                              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)
-         (static_cast<void> (!!(exp) ? 0 : (         \
-           LEMON_ASSERT_HANDLER(__FILE__, __LINE__,  \
-                                LEMON_FUNCTION_NAME, \
-				::lemon::_assert_bits::cstringify(msg),	\
-				#exp), 0)))
-#    else
-#      define LEMON_DEBUG(exp, msg) (static_cast<void>(0))
-#    endif
+			     "FIXME: " msg,  static_cast<const char*>(0)))
 #  endif
 
 #endif
 
-#ifdef DOXYGEN
-
-
-#else
-
-
-#endif
-
-
+
Index: lemon/bits/bezier.h
===================================================================
--- lemon/bits/bezier.h	(revision 128)
+++ lemon/bits/bezier.h	(revision 128)
@@ -0,0 +1,176 @@
+/* -*- C++ -*-
+ *
+ * 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_BEZIER_H
+#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
+///
+///\author Alpar Juttner
+
+#include<lemon/dim2.h>
+
+namespace lemon {
+  namespace dim2 {
+
+class BezierBase {
+public:
+  typedef Point<double> Point;
+protected:
+  static Point conv(Point x,Point y,double t) {return (1-t)*x+t*y;}
+};
+
+class Bezier1 : public BezierBase
+{
+public:
+  Point p1,p2;
+
+  Bezier1() {}
+  Bezier1(Point _p1, Point _p2) :p1(_p1), p2(_p2) {}
+  
+  Point operator()(double t) const
+  {
+    //    return conv(conv(p1,p2,t),conv(p2,p3,t),t);
+    return conv(p1,p2,t);
+  }
+  Bezier1 before(double t) const
+  {
+    return Bezier1(p1,conv(p1,p2,t));
+  }
+  
+  Bezier1 after(double t) const
+  {
+    return Bezier1(conv(p1,p2,t),p2);
+  }
+
+  Bezier1 revert() const { return Bezier1(p2,p1);}
+  Bezier1 operator()(double a,double b) const { return before(b).after(a/b); }
+  Point grad() const { return p2-p1; }
+  Point norm() const { return rot90(p2-p1); }
+  Point grad(double) const { return grad(); }
+  Point norm(double t) const { return rot90(grad(t)); }
+};
+
+class Bezier2 : public BezierBase
+{
+public:
+  Point p1,p2,p3;
+
+  Bezier2() {}
+  Bezier2(Point _p1, Point _p2, Point _p3) :p1(_p1), p2(_p2), p3(_p3) {}
+  Bezier2(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,.5)), p3(b.p2) {}
+  Point operator()(double t) const
+  {
+    //    return conv(conv(p1,p2,t),conv(p2,p3,t),t);
+    return ((1-t)*(1-t))*p1+(2*(1-t)*t)*p2+(t*t)*p3;
+  }
+  Bezier2 before(double t) const
+  {
+    Point q(conv(p1,p2,t));
+    Point r(conv(p2,p3,t));
+    return Bezier2(p1,q,conv(q,r,t));
+  }
+  
+  Bezier2 after(double t) const
+  {
+    Point q(conv(p1,p2,t));
+    Point r(conv(p2,p3,t));
+    return Bezier2(conv(q,r,t),r,p3);
+  }
+  Bezier2 revert() const { return Bezier2(p3,p2,p1);}
+  Bezier2 operator()(double a,double b) const { return before(b).after(a/b); }
+  Bezier1 grad() const { return Bezier1(2.0*(p2-p1),2.0*(p3-p2)); }
+  Bezier1 norm() const { return Bezier1(2.0*rot90(p2-p1),2.0*rot90(p3-p2)); }
+  Point grad(double t) const { return grad()(t); }
+  Point norm(double t) const { return rot90(grad(t)); }
+};
+
+class Bezier3 : public BezierBase
+{
+public:
+  Point p1,p2,p3,p4;
+
+  Bezier3() {}
+  Bezier3(Point _p1, Point _p2, Point _p3, Point _p4)
+    : p1(_p1), p2(_p2), p3(_p3), p4(_p4) {}
+  Bezier3(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,1.0/3.0)), 
+			      p3(conv(b.p1,b.p2,2.0/3.0)), p4(b.p2) {}
+  Bezier3(const Bezier2 &b) : p1(b.p1), p2(conv(b.p1,b.p2,2.0/3.0)),
+			      p3(conv(b.p2,b.p3,1.0/3.0)), p4(b.p3) {}
+  
+  Point operator()(double t) const 
+    {
+      //    return Bezier2(conv(p1,p2,t),conv(p2,p3,t),conv(p3,p4,t))(t);
+      return ((1-t)*(1-t)*(1-t))*p1+(3*t*(1-t)*(1-t))*p2+
+	(3*t*t*(1-t))*p3+(t*t*t)*p4;
+    }
+  Bezier3 before(double t) const
+    {
+      Point p(conv(p1,p2,t));
+      Point q(conv(p2,p3,t));
+      Point r(conv(p3,p4,t));
+      Point a(conv(p,q,t));
+      Point b(conv(q,r,t));
+      Point c(conv(a,b,t));
+      return Bezier3(p1,p,a,c);
+    }
+  
+  Bezier3 after(double t) const
+    {
+      Point p(conv(p1,p2,t));
+      Point q(conv(p2,p3,t));
+      Point r(conv(p3,p4,t));
+      Point a(conv(p,q,t));
+      Point b(conv(q,r,t));
+      Point c(conv(a,b,t));
+      return Bezier3(c,b,r,p4);
+    }
+  Bezier3 revert() const { return Bezier3(p4,p3,p2,p1);}
+  Bezier3 operator()(double a,double b) const { return before(b).after(a/b); }
+  Bezier2 grad() const { return Bezier2(3.0*(p2-p1),3.0*(p3-p2),3.0*(p4-p3)); }
+  Bezier2 norm() const { return Bezier2(3.0*rot90(p2-p1),
+				  3.0*rot90(p3-p2),
+				  3.0*rot90(p4-p3)); }
+  Point grad(double t) const { return grad()(t); }
+  Point norm(double t) const { return rot90(grad(t)); }
+
+  template<class R,class F,class S,class D>
+  R recSplit(F &_f,const S &_s,D _d) const 
+  {
+    const Point a=(p1+p2)/2;
+    const Point b=(p2+p3)/2;
+    const Point c=(p3+p4)/2;
+    const Point d=(a+b)/2;
+    const Point e=(b+c)/2;
+    const Point f=(d+e)/2;
+    R f1=_f(Bezier3(p1,a,d,e),_d);
+    R f2=_f(Bezier3(e,d,c,p4),_d);
+    return _s(f1,f2);
+  }
+  
+};
+
+
+} //END OF NAMESPACE dim2
+} //END OF NAMESPACE lemon
+
+#endif // LEMON_BEZIER_H
Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h	(revision 125)
+++ lemon/bits/graph_extender.h	(revision 107)
@@ -368,8 +368,8 @@
 
     Node oppositeNode(const Node &n, const Edge &e) const {
-      if( n == Parent::u(e))
-	return Parent::v(e);
-      else if( n == Parent::v(e))
-	return Parent::u(e);
+      if( n == Parent::source(e))
+	return Parent::target(e);
+      else if( n == Parent::target(e))
+	return Parent::source(e);
       else
 	return INVALID;
@@ -382,5 +382,5 @@
     using Parent::direct;
     Arc direct(const Edge &edge, const Node &node) const {
-      return Parent::direct(edge, Parent::u(edge) == node);
+      return Parent::direct(edge, Parent::source(edge) == node);
     }
 
@@ -587,5 +587,5 @@
     /// Returns the base node of the iterator
     Node baseNode(const IncEdgeIt &edge) const {
-      return edge._direction ? u(edge) : v(edge);
+      return edge._direction ? source(edge) : target(edge);
     }
     /// Running node of the iterator
@@ -593,5 +593,5 @@
     /// Returns the running node of the iterator
     Node runningNode(const IncEdgeIt &edge) const {
-      return edge._direction ? v(edge) : u(edge);
+      return edge._direction ? target(edge) : source(edge);
     }
 
Index: lemon/bits/utility.h
===================================================================
--- lemon/bits/utility.h	(revision 117)
+++ lemon/bits/utility.h	(revision 39)
@@ -22,5 +22,5 @@
 // Boost enable_if library
 
-// Copyright 2003 (c) The Trustees of Indiana University.
+// Copyright 2003 © The Trustees of Indiana University.
 
 // Use, modification, and distribution is subject to the Boost Software
@@ -28,5 +28,5 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
-//    Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
+//    Authors: Jaakko Järvi (jajarvi at osl.iu.edu)
 //             Jeremiah Willcock (jewillco at osl.iu.edu)
 //             Andrew Lumsdaine (lums at osl.iu.edu)
Index: lemon/color.cc
===================================================================
--- lemon/color.cc	(revision 128)
+++ lemon/color.cc	(revision 128)
@@ -0,0 +1,44 @@
+/* -*- C++ -*-
+ *
+ * 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.
+ *
+ */
+
+///\file
+///\brief Color constants
+
+#include<lemon/color.h>
+
+namespace lemon {
+
+  const Color WHITE(1,1,1);
+  
+  const Color BLACK(0,0,0);
+  const Color RED(1,0,0);
+  const Color GREEN(0,1,0);
+  const Color BLUE(0,0,1);
+  const Color YELLOW(1,1,0);
+  const Color MAGENTA(1,0,1);
+  const Color CYAN(0,1,1);
+
+  const Color GREY(0,0,0);
+  const Color DARK_RED(.5,0,0);
+  const Color DARK_GREEN(0,.5,0);
+  const Color DARK_BLUE(0,0,.5);
+  const Color DARK_YELLOW(.5,.5,0);
+  const Color DARK_MAGENTA(.5,0,.5);
+  const Color DARK_CYAN(0,.5,.5);
+    
+} //namespace lemon
Index: lemon/color.h
===================================================================
--- lemon/color.h	(revision 128)
+++ lemon/color.h	(revision 128)
@@ -0,0 +1,207 @@
+/* -*- C++ -*-
+ *
+ * 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_COLOR_H
+#define LEMON_COLOR_H
+
+#include<vector>
+#include<lemon/math.h>
+#include<lemon/maps.h>
+
+
+///\ingroup misc
+///\file
+///\brief Tools to manage RGB colors.
+///
+///\author Alpar Juttner
+
+namespace lemon {
+
+
+  /// \addtogroup misc
+  /// @{
+
+  ///Data structure representing RGB colors.
+
+  ///Data structure representing RGB colors.
+  class Color
+  {
+    double _r,_g,_b;
+  public:
+    ///Default constructor
+    Color() {}
+    ///Constructor
+    Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};
+    ///Set the red component
+    double & red() {return _r;}
+    ///Return the red component
+    const double & red() const {return _r;}
+    ///Set the green component
+    double & green() {return _g;}
+    ///Return the green component
+    const double & green() const {return _g;}
+    ///Set the blue component
+    double & blue() {return _b;}
+    ///Return the blue component
+    const double & blue() const {return _b;}
+    ///Set the color components
+    void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
+  };
+
+  /// White color constant
+  extern const Color WHITE;  
+  /// Black color constant
+  extern const Color BLACK;
+  /// Red color constant
+  extern const Color RED;
+  /// Green color constant
+  extern const Color GREEN;
+  /// Blue color constant
+  extern const Color BLUE;
+  /// Yellow color constant
+  extern const Color YELLOW;
+  /// Magenta color constant
+  extern const Color MAGENTA;
+  /// Cyan color constant
+  extern const Color CYAN;
+  /// Grey color constant
+  extern const Color GREY;
+  /// Dark red color constant
+  extern const Color DARK_RED;
+  /// Dark green color constant
+  extern const Color DARK_GREEN;
+  /// Drak blue color constant
+  extern const Color DARK_BLUE;
+  /// Dark yellow color constant
+  extern const Color DARK_YELLOW;
+  /// Dark magenta color constant
+  extern const Color DARK_MAGENTA;
+  /// Dark cyan color constant
+  extern const Color DARK_CYAN;
+
+  ///Map <tt>int</tt>s to different \ref Color "Color"s
+
+  ///This map assigns one of the predefined \ref Color "Color"s to
+  ///each <tt>int</tt>. It is possible to change the colors as well as
+  ///their number. The integer range is cyclically mapped to the
+  ///provided set of colors.
+  ///
+  ///This is a true \ref concepts::ReferenceMap "reference map", so
+  ///you can also change the actual colors.
+
+  class Palette : public MapBase<int,Color>
+  {
+    std::vector<Color> colors;
+  public:
+    ///Constructor
+
+    ///Constructor 
+    ///\param num the number of the allocated colors. If it is \c -1,
+    ///the default color configuration is set up (26 color plus the
+    ///white).  If \c num is less then 26/27 then the default color
+    ///list is cut. Otherwise the color list is filled repeatedly with
+    ///the default color list.  (The colors can be changed later on.)
+    ///\param have_white indicates whether white is amongst the
+    ///provided color (\c true) or not (\c false). If it is true,
+    ///white will be assigned to \c 0.
+    Palette(int num=-1,bool have_white=false)
+    {
+      if (num==0) return;
+      do {
+        if(have_white) colors.push_back(Color(1,1,1));
+
+        colors.push_back(Color(0,0,0));
+        colors.push_back(Color(1,0,0));
+        colors.push_back(Color(0,1,0));
+        colors.push_back(Color(0,0,1));
+        colors.push_back(Color(1,1,0));
+        colors.push_back(Color(1,0,1));
+        colors.push_back(Color(0,1,1));
+      
+        colors.push_back(Color(.5,0,0));
+        colors.push_back(Color(0,.5,0));
+        colors.push_back(Color(0,0,.5));
+        colors.push_back(Color(.5,.5,0));
+        colors.push_back(Color(.5,0,.5));
+        colors.push_back(Color(0,.5,.5));
+      
+        colors.push_back(Color(.5,.5,.5));
+        colors.push_back(Color(1,.5,.5));
+        colors.push_back(Color(.5,1,.5));
+        colors.push_back(Color(.5,.5,1));
+        colors.push_back(Color(1,1,.5));
+        colors.push_back(Color(1,.5,1));
+        colors.push_back(Color(.5,1,1));
+      
+        colors.push_back(Color(1,.5,0));
+        colors.push_back(Color(.5,1,0));
+        colors.push_back(Color(1,0,.5));
+        colors.push_back(Color(0,1,.5));
+        colors.push_back(Color(0,.5,1));
+        colors.push_back(Color(.5,0,1));
+      } while(int(colors.size())<num);
+      //    colors.push_back(Color(1,1,1));
+      if(num>=0) colors.resize(num);
+    }
+    ///\e
+    Color &operator[](int i)
+    {
+      return colors[i%colors.size()];
+    }
+    ///\e
+    const Color &operator[](int i) const
+    {
+      return colors[i%colors.size()];
+    }
+    ///\e
+    void set(int i,const Color &c)
+    {
+      colors[i%colors.size()]=c;
+    }
+    ///\e
+    void add(const Color &c) 
+    {
+      colors.push_back(c);
+    }
+
+    ///Sets the number of the exiting colors.
+    void resize(int s) { colors.resize(s);}
+    ///Returns the number of the existing colors.
+    int size() const { return int(colors.size());}
+  };
+
+  ///Returns a visible distinct \ref Color
+
+  ///Returns a \ref Color which is as different from the given parameter
+  ///as it is possible.
+  inline Color distantColor(const Color &c) 
+  {
+    return Color(c.red()<.5?1:0,c.green()<.5?1:0,c.blue()<.5?1:0);
+  }
+  ///Returns black for light colors and white for the dark ones.
+
+  ///Returns black for light colors and white for the dark ones.
+  inline Color distantBW(const Color &c){
+    return (.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5 ? WHITE : BLACK;
+  }
+
+  /// @}
+
+} //END OF NAMESPACE LEMON
+
+#endif // LEMON_COLOR_H
Index: lemon/concepts/digraph.h
===================================================================
--- lemon/concepts/digraph.h	(revision 125)
+++ lemon/concepts/digraph.h	(revision 107)
@@ -468,10 +468,10 @@
       };
 
-      template <typename _Digraph>
+      template <typename RDigraph>
       struct Constraints {
         void constraints() {
-          checkConcept<IterableDigraphComponent<>, _Digraph>();
-	  checkConcept<IDableDigraphComponent<>, _Digraph>();
-          checkConcept<MappableDigraphComponent<>, _Digraph>();
+          checkConcept<IterableDigraphComponent<>, Digraph>();
+	  checkConcept<IDableDigraphComponent<>, Digraph>();
+          checkConcept<MappableDigraphComponent<>, Digraph>();
         }
       };
Index: lemon/concepts/graph.h
===================================================================
--- lemon/concepts/graph.h	(revision 125)
+++ lemon/concepts/graph.h	(revision 107)
@@ -732,10 +732,10 @@
       }
 
-      template <typename _Graph>
+      template <typename Graph>
       struct Constraints {
 	void constraints() {
-	  checkConcept<IterableGraphComponent<>, _Graph>();
-	  checkConcept<IDableGraphComponent<>, _Graph>();
-	  checkConcept<MappableGraphComponent<>, _Graph>();
+	  checkConcept<IterableGraphComponent<>, Graph>();
+	  checkConcept<IDableGraphComponent<>, Graph>();
+	  checkConcept<MappableGraphComponent<>, Graph>();
 	}
       };
Index: mon/counter.h
===================================================================
--- lemon/counter.h	(revision 121)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/* -*- C++ -*-
- *
- * 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_COUNTER_H
-#define LEMON_COUNTER_H
-
-#include <string>
-#include <iostream>
-
-///\ingroup timecount
-///\file
-///\brief Tools for counting steps and events
-
-namespace lemon 
-{
-
-  template<class P> class _NoSubCounter;
-
-  template<class P>
-  class _SubCounter 
-  {
-    P &_parent;
-    std::string _title;
-    std::ostream &_os;
-    int count;
-  public:
-
-    typedef _SubCounter<_SubCounter<P> > SubCounter;
-    typedef _NoSubCounter<_SubCounter<P> > NoSubCounter;
-
-    _SubCounter(P &parent)
-      : _parent(parent), _title(), _os(std::cerr), count(0) {}
-    _SubCounter(P &parent,std::string title,std::ostream &os=std::cerr)
-      : _parent(parent), _title(title), _os(os), count(0) {}
-    _SubCounter(P &parent,const char *title,std::ostream &os=std::cerr)
-      : _parent(parent), _title(title), _os(os), count(0) {}
-    ~_SubCounter() { 
-      _os << _title << count <<std::endl;
-      _parent+=count;
-    }
-    _SubCounter &operator++() { count++; return *this;}
-    int operator++(int) { return count++; }
-    _SubCounter &operator--() { count--; return *this;}
-    int operator--(int) { return count--; }
-    _SubCounter &operator+=(int c) { count+=c; return *this;}
-    _SubCounter &operator-=(int c) { count-=c; return *this;}
-    void reset(int c=0) {count=c;}
-    operator int() {return count;}
-  };
-
-  template<class P>
-  class _NoSubCounter 
-  {
-    P &_parent;
-  public:
-    typedef _NoSubCounter<_NoSubCounter<P> > SubCounter;
-    typedef _NoSubCounter<_NoSubCounter<P> > NoSubCounter;
-  
-    _NoSubCounter(P &parent) :_parent(parent) {}
-    _NoSubCounter(P &parent,std::string,std::ostream &) 
-      :_parent(parent) {}
-    _NoSubCounter(P &parent,std::string) 
-      :_parent(parent) {}
-    _NoSubCounter(P &parent,const char *,std::ostream &)
-      :_parent(parent) {}
-    _NoSubCounter(P &parent,const char *)
-      :_parent(parent) {}
-    ~_NoSubCounter() {}
-    _NoSubCounter &operator++() { ++_parent; return *this;}
-    int operator++(int) { _parent++; return 0;}
-    _NoSubCounter &operator--() { --_parent; return *this;}
-    int operator--(int) { _parent--; return 0;}
-    _NoSubCounter &operator+=(int c) { _parent+=c; return *this;}
-    _NoSubCounter &operator-=(int c) { _parent-=c; return *this;}
-    void reset(int) {}
-    void reset() {}
-    operator int() {return 0;}
-  };
-
-
-  /// \addtogroup timecount
-  /// @{
-
-  ///A counter class
-
-  ///This class makes it easier to count certain events. You can increment
-  ///or decrement the counter using operator++ and operator--.
-  ///A report is automatically printed on destruction.
-  ///\todo More doc
-  class Counter 
-  {
-    std::string _title;
-    std::ostream &_os;
-    int count;
-  public:
-    ///\e
-
-    ///\todo document please.
-    ///
-    typedef _SubCounter<Counter> SubCounter;
-    ///\e
-
-    ///\todo document please.
-    ///
-    typedef _NoSubCounter<Counter> NoSubCounter;
-
-    ///\e
-    Counter() : _title(), _os(std::cerr), count(0) {}
-    ///\e
-    Counter(std::string title,std::ostream &os=std::cerr) 
-      : _title(title), _os(os), count(0) {}
-    ///\e
-    Counter(const char *title,std::ostream &os=std::cerr)
-      : _title(title), _os(os), count(0) {}
-    ///Destructor. Prints the given title and the value of the counter.
-    ~Counter() {
-      _os << _title << count <<std::endl;
-    }
-    ///\e
-    Counter &operator++() { count++; return *this;}
-    ///\e
-    int operator++(int) { return count++;}
-    ///\e
-    Counter &operator--() { count--; return *this;}
-    ///\e
-    int operator--(int) { return count--;}
-    ///\e
-    Counter &operator+=(int c) { count+=c; return *this;}
-    ///\e
-    Counter &operator-=(int c) { count-=c; return *this;}
-    ///\e
-    void reset(int c=0) {count=c;}
-    ///\e
-    operator int() {return count;}
-  };
-
-  ///'Do nothing' version of \ref Counter
-
-  ///'Do nothing' version of \ref Counter.
-  ///\sa Counter
-  class NoCounter
-  {
-  public:
-    typedef _NoSubCounter<NoCounter> SubCounter;
-    typedef _NoSubCounter<NoCounter> NoSubCounter;
-
-    NoCounter() {}
-    NoCounter(std::string,std::ostream &) {}
-    NoCounter(const char *,std::ostream &) {}
-    NoCounter(std::string) {}
-    NoCounter(const char *) {}
-    NoCounter &operator++() { return *this; }
-    int operator++(int) { return 0; }
-    NoCounter &operator--() { return *this; }
-    int operator--(int) { return 0; }
-    NoCounter &operator+=(int) { return *this;}
-    NoCounter &operator-=(int) { return *this;}
-    void reset(int) {}
-    void reset() {}
-    operator int() {return 0;}
-  };
-
-  ///@}
-}
-
-#endif
Index: lemon/graph_to_eps.h
===================================================================
--- lemon/graph_to_eps.h	(revision 128)
+++ lemon/graph_to_eps.h	(revision 128)
@@ -0,0 +1,1170 @@
+/* -*- C++ -*-
+ *
+ * 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_GRAPH_TO_EPS_H
+#define LEMON_GRAPH_TO_EPS_H
+
+#include <sys/time.h>
+
+#ifdef WIN32
+#include <lemon/bits/mingw32_time.h>
+#endif
+
+#include<iostream>
+#include<fstream>
+#include<sstream>
+#include<algorithm>
+#include<vector>
+
+#include<ctime>
+
+#include<lemon/math.h>
+#include<lemon/bits/invalid.h>
+#include<lemon/dim2.h>
+#include<lemon/maps.h>
+#include<lemon/color.h>
+#include<lemon/bits/bezier.h>
+
+
+///\ingroup eps_io
+///\file
+///\brief Simple graph drawer
+///
+///\author Alpar Juttner
+
+namespace lemon {
+
+template<class MT>
+class _NegY {
+public:
+  typedef typename MT::Key Key;
+  typedef typename MT::Value Value;
+  const MT &map;
+  int yscale;
+  _NegY(const MT &m,bool b) : map(m), yscale(1-b*2) {}
+  Value operator[](Key n) { return Value(map[n].x,map[n].y*yscale);}
+};
+
+///Default traits class of \ref GraphToEps
+
+///Default traits class of \ref GraphToEps
+///
+///\c G is the type of the underlying graph.
+template<class G>
+struct DefaultGraphToEpsTraits
+{
+  typedef G Graph;
+  typedef typename Graph::Node Node;
+  typedef typename Graph::NodeIt NodeIt;
+  typedef typename Graph::Arc Arc;
+  typedef typename Graph::ArcIt ArcIt;
+  typedef typename Graph::InArcIt InArcIt;
+  typedef typename Graph::OutArcIt OutArcIt;
+  
+
+  const Graph &g;
+
+  std::ostream& os;
+  
+  typedef ConstMap<typename Graph::Node,dim2::Point<double> > CoordsMapType;
+  CoordsMapType _coords;
+  ConstMap<typename Graph::Node,double > _nodeSizes;
+  ConstMap<typename Graph::Node,int > _nodeShapes;
+
+  ConstMap<typename Graph::Node,Color > _nodeColors;
+  ConstMap<typename Graph::Arc,Color > _arcColors;
+
+  ConstMap<typename Graph::Arc,double > _arcWidths;
+
+  double _arcWidthScale;
+  
+  double _nodeScale;
+  double _xBorder, _yBorder;
+  double _scale;
+  double _nodeBorderQuotient;
+  
+  bool _drawArrows;
+  double _arrowLength, _arrowWidth;
+  
+  bool _showNodes, _showArcs;
+
+  bool _enableParallel;
+  double _parArcDist;
+
+  bool _showNodeText;
+  ConstMap<typename Graph::Node,bool > _nodeTexts;  
+  double _nodeTextSize;
+
+  bool _showNodePsText;
+  ConstMap<typename Graph::Node,bool > _nodePsTexts;  
+  char *_nodePsTextsPreamble;
+  
+  bool _undirected;
+
+  bool _pleaseRemoveOsStream;
+
+  bool _scaleToA4;
+
+  std::string _title;
+  std::string _copyright;
+
+  enum NodeTextColorType 
+    { DIST_COL=0, DIST_BW=1, CUST_COL=2, SAME_COL=3 } _nodeTextColorType;
+  ConstMap<typename Graph::Node,Color > _nodeTextColors;
+
+  bool _autoNodeScale;
+  bool _autoArcWidthScale;
+
+  bool _absoluteNodeSizes;
+  bool _absoluteArcWidths;
+
+  bool _negY;
+
+  bool _preScale;
+  ///Constructor
+
+  ///Constructor
+  ///\param _g is a reference to the graph to be printed
+  ///\param _os is a reference to the output stream.
+  ///\param _os is a reference to the output stream.
+  ///\param _pros If it is \c true, then the \c ostream referenced by \c _os
+  ///will be explicitly deallocated by the destructor.
+  ///By default it is <tt>std::cout</tt>
+  DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
+			  bool _pros=false) :
+    g(_g), os(_os),
+    _coords(dim2::Point<double>(1,1)), _nodeSizes(.01), _nodeShapes(0),
+    _nodeColors(WHITE), _arcColors(BLACK),
+    _arcWidths(1.0), _arcWidthScale(0.003),
+    _nodeScale(1.0), _xBorder(10), _yBorder(10), _scale(1.0),
+    _nodeBorderQuotient(.1),
+    _drawArrows(false), _arrowLength(1), _arrowWidth(0.3),
+    _showNodes(true), _showArcs(true),
+    _enableParallel(false), _parArcDist(1),
+    _showNodeText(false), _nodeTexts(false), _nodeTextSize(1),
+    _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0),
+    _undirected(false),
+    _pleaseRemoveOsStream(_pros), _scaleToA4(false),
+    _nodeTextColorType(SAME_COL), _nodeTextColors(BLACK),
+    _autoNodeScale(false),
+    _autoArcWidthScale(false),
+    _absoluteNodeSizes(false),
+    _absoluteArcWidths(false),
+    _negY(false),
+    _preScale(true)
+  {}
+};
+
+///Helper class to implement the named parameters of \ref graphToEps()
+
+///Helper class to implement the named parameters of \ref graphToEps()
+///\todo Is 'helper class' a good name for this?
+///
+///\todo Follow PostScript's DSC.
+/// Use own dictionary.
+///\todo Useful new features.
+/// - Linestyles: dotted, dashed etc.
+/// - A second color and percent value for the lines.
+template<class T> class GraphToEps : public T 
+{
+  // Can't believe it is required by the C++ standard
+  using T::g;
+  using T::os;
+
+  using T::_coords;
+  using T::_nodeSizes;
+  using T::_nodeShapes;
+  using T::_nodeColors;
+  using T::_arcColors;
+  using T::_arcWidths;
+
+  using T::_arcWidthScale;
+  using T::_nodeScale;
+  using T::_xBorder;
+  using T::_yBorder;
+  using T::_scale;
+  using T::_nodeBorderQuotient;
+  
+  using T::_drawArrows;
+  using T::_arrowLength;
+  using T::_arrowWidth;
+  
+  using T::_showNodes;
+  using T::_showArcs;
+
+  using T::_enableParallel;
+  using T::_parArcDist;
+
+  using T::_showNodeText;
+  using T::_nodeTexts;  
+  using T::_nodeTextSize;
+
+  using T::_showNodePsText;
+  using T::_nodePsTexts;  
+  using T::_nodePsTextsPreamble;
+  
+  using T::_undirected;
+
+  using T::_pleaseRemoveOsStream;
+
+  using T::_scaleToA4;
+
+  using T::_title;
+  using T::_copyright;
+
+  using T::NodeTextColorType;
+  using T::CUST_COL;
+  using T::DIST_COL;
+  using T::DIST_BW;
+  using T::_nodeTextColorType;
+  using T::_nodeTextColors;
+
+  using T::_autoNodeScale;
+  using T::_autoArcWidthScale;
+
+  using T::_absoluteNodeSizes;
+  using T::_absoluteArcWidths;
+
+
+  using T::_negY;
+  using T::_preScale;
+
+  // dradnats ++C eht yb deriuqer si ti eveileb t'naC
+
+  typedef typename T::Graph Graph;
+  typedef typename Graph::Node Node;
+  typedef typename Graph::NodeIt NodeIt;
+  typedef typename Graph::Arc Arc;
+  typedef typename Graph::ArcIt ArcIt;
+  typedef typename Graph::InArcIt InArcIt;
+  typedef typename Graph::OutArcIt OutArcIt;
+
+  static const int INTERPOL_PREC;
+  static const double A4HEIGHT;
+  static const double A4WIDTH;
+  static const double A4BORDER;
+
+  bool dontPrint;
+
+public:
+  ///Node shapes
+
+  ///Node shapes
+  ///
+  enum NodeShapes { 
+    /// = 0
+    ///\image html nodeshape_0.png
+    ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm
+    CIRCLE=0, 
+    /// = 1
+    ///\image html nodeshape_1.png
+    ///\image latex nodeshape_1.eps "SQUARE shape (1)" width=2cm
+    ///
+    SQUARE=1, 
+    /// = 2
+    ///\image html nodeshape_2.png
+    ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
+    ///
+    DIAMOND=2,
+    /// = 3
+    ///\image html nodeshape_3.png
+    ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
+    ///
+    MALE=3,
+    /// = 4
+    ///\image html nodeshape_4.png
+    ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
+    ///
+    FEMALE=4
+  };
+
+private:
+  class arcLess {
+    const Graph &g;
+  public:
+    arcLess(const Graph &_g) : g(_g) {}
+    bool operator()(Arc a,Arc b) const 
+    {
+      Node ai=std::min(g.source(a),g.target(a));
+      Node aa=std::max(g.source(a),g.target(a));
+      Node bi=std::min(g.source(b),g.target(b));
+      Node ba=std::max(g.source(b),g.target(b));
+      return ai<bi ||
+	(ai==bi && (aa < ba || 
+		    (aa==ba && ai==g.source(a) && bi==g.target(b))));
+    }
+  };
+  bool isParallel(Arc e,Arc f) const
+  {
+    return (g.source(e)==g.source(f)&&
+	    g.target(e)==g.target(f)) ||
+      (g.source(e)==g.target(f)&&
+       g.target(e)==g.source(f));
+  }
+  template<class TT>
+  static std::string psOut(const dim2::Point<TT> &p) 
+    {
+      std::ostringstream os;	
+      os << p.x << ' ' << p.y;
+      return os.str();
+    }
+  static std::string psOut(const Color &c) 
+    {
+      std::ostringstream os;	
+      os << c.red() << ' ' << c.green() << ' ' << c.blue();
+      return os.str();
+    }
+  
+public:
+  GraphToEps(const T &t) : T(t), dontPrint(false) {};
+  
+  template<class X> struct CoordsTraits : public T {
+  typedef X CoordsMapType;
+    const X &_coords;
+    CoordsTraits(const T &t,const X &x) : T(t), _coords(x) {}
+  };
+  ///Sets the map of the node coordinates
+
+  ///Sets the map of the node coordinates.
+  ///\param x must be a node map with dim2::Point<double> or
+  ///\ref dim2::Point "dim2::Point<int>" values. 
+  template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
+    dontPrint=true;
+    return GraphToEps<CoordsTraits<X> >(CoordsTraits<X>(*this,x));
+  }
+  template<class X> struct NodeSizesTraits : public T {
+    const X &_nodeSizes;
+    NodeSizesTraits(const T &t,const X &x) : T(t), _nodeSizes(x) {}
+  };
+  ///Sets the map of the node sizes
+
+  ///Sets the map of the node sizes
+  ///\param x must be a node map with \c double (or convertible) values. 
+  template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
+  {
+    dontPrint=true;
+    return GraphToEps<NodeSizesTraits<X> >(NodeSizesTraits<X>(*this,x));
+  }
+  template<class X> struct NodeShapesTraits : public T {
+    const X &_nodeShapes;
+    NodeShapesTraits(const T &t,const X &x) : T(t), _nodeShapes(x) {}
+  };
+  ///Sets the map of the node shapes
+
+  ///Sets the map of the node shapes.
+  ///The availabe shape values
+  ///can be found in \ref NodeShapes "enum NodeShapes".
+  ///\param x must be a node map with \c int (or convertible) values. 
+  ///\sa NodeShapes
+  template<class X> GraphToEps<NodeShapesTraits<X> > nodeShapes(const X &x)
+  {
+    dontPrint=true;
+    return GraphToEps<NodeShapesTraits<X> >(NodeShapesTraits<X>(*this,x));
+  }
+  template<class X> struct NodeTextsTraits : public T {
+    const X &_nodeTexts;
+    NodeTextsTraits(const T &t,const X &x) : T(t), _nodeTexts(x) {}
+  };
+  ///Sets the text printed on the nodes
+
+  ///Sets the text printed on the nodes
+  ///\param x must be a node map with type that can be pushed to a standard
+  ///ostream. 
+  template<class X> GraphToEps<NodeTextsTraits<X> > nodeTexts(const X &x)
+  {
+    dontPrint=true;
+    _showNodeText=true;
+    return GraphToEps<NodeTextsTraits<X> >(NodeTextsTraits<X>(*this,x));
+  }
+  template<class X> struct NodePsTextsTraits : public T {
+    const X &_nodePsTexts;
+    NodePsTextsTraits(const T &t,const X &x) : T(t), _nodePsTexts(x) {}
+  };
+  ///Inserts a PostScript block to the nodes
+
+  ///With this command it is possible to insert a verbatim PostScript
+  ///block to the nodes.
+  ///The PS current point will be moved to the centre of the node before
+  ///the PostScript block inserted.
+  ///
+  ///Before and after the block a newline character is inserted so you
+  ///don't have to bother with the separators.
+  ///
+  ///\param x must be a node map with type that can be pushed to a standard
+  ///ostream.
+  ///
+  ///\sa nodePsTextsPreamble()
+  ///\todo Offer the choise not to move to the centre but pass the coordinates
+  ///to the Postscript block inserted.
+  template<class X> GraphToEps<NodePsTextsTraits<X> > nodePsTexts(const X &x)
+  {
+    dontPrint=true;
+    _showNodePsText=true;
+    return GraphToEps<NodePsTextsTraits<X> >(NodePsTextsTraits<X>(*this,x));
+  }
+  template<class X> struct ArcWidthsTraits : public T {
+    const X &_arcWidths;
+    ArcWidthsTraits(const T &t,const X &x) : T(t), _arcWidths(x) {}
+  };
+  ///Sets the map of the arc widths
+
+  ///Sets the map of the arc widths
+  ///\param x must be a arc map with \c double (or convertible) values. 
+  template<class X> GraphToEps<ArcWidthsTraits<X> > arcWidths(const X &x)
+  {
+    dontPrint=true;
+    return GraphToEps<ArcWidthsTraits<X> >(ArcWidthsTraits<X>(*this,x));
+  }
+
+  template<class X> struct NodeColorsTraits : public T {
+    const X &_nodeColors;
+    NodeColorsTraits(const T &t,const X &x) : T(t), _nodeColors(x) {}
+  };
+  ///Sets the map of the node colors
+
+  ///Sets the map of the node colors
+  ///\param x must be a node map with \ref Color values.
+  ///
+  ///\sa Palette
+  template<class X> GraphToEps<NodeColorsTraits<X> >
+  nodeColors(const X &x)
+  {
+    dontPrint=true;
+    return GraphToEps<NodeColorsTraits<X> >(NodeColorsTraits<X>(*this,x));
+  }
+  template<class X> struct NodeTextColorsTraits : public T {
+    const X &_nodeTextColors;
+    NodeTextColorsTraits(const T &t,const X &x) : T(t), _nodeTextColors(x) {}
+  };
+  ///Sets the map of the node text colors
+
+  ///Sets the map of the node text colors
+  ///\param x must be a node map with \ref Color values. 
+  ///
+  ///\sa Palette
+  template<class X> GraphToEps<NodeTextColorsTraits<X> >
+  nodeTextColors(const X &x)
+  {
+    dontPrint=true;
+    _nodeTextColorType=CUST_COL;
+    return GraphToEps<NodeTextColorsTraits<X> >
+      (NodeTextColorsTraits<X>(*this,x));
+  }
+  template<class X> struct ArcColorsTraits : public T {
+    const X &_arcColors;
+    ArcColorsTraits(const T &t,const X &x) : T(t), _arcColors(x) {}
+  };
+  ///Sets the map of the arc colors
+
+  ///Sets the map of the arc colors
+  ///\param x must be a arc map with \ref Color values. 
+  ///
+  ///\sa Palette
+  template<class X> GraphToEps<ArcColorsTraits<X> >
+  arcColors(const X &x)
+  {
+    dontPrint=true;
+    return GraphToEps<ArcColorsTraits<X> >(ArcColorsTraits<X>(*this,x));
+  }
+  ///Sets a global scale factor for node sizes
+
+  ///Sets a global scale factor for node sizes.
+  /// 
+  /// If nodeSizes() is not given, this function simply sets the node
+  /// sizes to \c d.  If nodeSizes() is given, but
+  /// autoNodeScale() is not, then the node size given by
+  /// nodeSizes() will be multiplied by the value \c d.
+  /// If both nodeSizes() and autoNodeScale() are used, then the
+  /// node sizes will be scaled in such a way that the greatest size will be
+  /// equal to \c d.
+  /// \sa nodeSizes()
+  /// \sa autoNodeScale()
+  GraphToEps<T> &nodeScale(double d) {_nodeScale=d;return *this;}
+  ///Turns on/off the automatic node width scaling.
+
+  ///Turns on/off the automatic node width scaling.
+  ///
+  ///\sa nodeScale()
+  ///
+  GraphToEps<T> &autoNodeScale(bool b=true) {
+    _autoNodeScale=b;return *this;
+  }
+
+  ///Turns on/off the absolutematic node width scaling.
+
+  ///Turns on/off the absolutematic node width scaling.
+  ///
+  ///\sa nodeScale()
+  ///
+  GraphToEps<T> &absoluteNodeSizes(bool b=true) {
+    _absoluteNodeSizes=b;return *this;
+  }
+
+  ///Negates the Y coordinates.
+
+  ///Negates the Y coordinates.
+  ///
+  ///\todo More docs.
+  ///
+  GraphToEps<T> &negateY(bool b=true) {
+    _negY=b;return *this;
+  }
+
+  ///Turn on/off prescaling
+
+  ///By default graphToEps() rescales the whole image in order to avoid
+  ///very big or very small bounding boxes.
+  ///
+  ///This (p)rescaling can be turned off with this function.
+  ///
+  GraphToEps<T> &preScale(bool b=true) {
+    _preScale=b;return *this;
+  }
+
+  ///Sets a global scale factor for arc widths
+
+  /// Sets a global scale factor for arc widths.
+  ///
+  /// If arcWidths() is not given, this function simply sets the arc
+  /// widths to \c d.  If arcWidths() is given, but
+  /// autoArcWidthScale() is not, then the arc withs given by
+  /// arcWidths() will be multiplied by the value \c d.
+  /// If both arcWidths() and autoArcWidthScale() are used, then the
+  /// arc withs will be scaled in such a way that the greatest width will be
+  /// equal to \c d.
+  GraphToEps<T> &arcWidthScale(double d) {_arcWidthScale=d;return *this;}
+  ///Turns on/off the automatic arc width scaling.
+
+  ///Turns on/off the automatic arc width scaling.
+  ///
+  ///\sa arcWidthScale()
+  ///
+  GraphToEps<T> &autoArcWidthScale(bool b=true) {
+    _autoArcWidthScale=b;return *this;
+  }
+  ///Turns on/off the absolutematic arc width scaling.
+
+  ///Turns on/off the absolutematic arc width scaling.
+  ///
+  ///\sa arcWidthScale()
+  ///
+  GraphToEps<T> &absoluteArcWidths(bool b=true) {
+    _absoluteArcWidths=b;return *this;
+  }
+  ///Sets a global scale factor for the whole picture
+
+  ///Sets a global scale factor for the whole picture
+  ///
+
+  GraphToEps<T> &scale(double d) {_scale=d;return *this;}
+  ///Sets the width of the border around the picture
+
+  ///Sets the width of the border around the picture
+  ///
+  GraphToEps<T> &border(double b) {_xBorder=_yBorder=b;return *this;}
+  ///Sets the width of the border around the picture
+
+  ///Sets the width of the border around the picture
+  ///
+  GraphToEps<T> &border(double x, double y) {
+    _xBorder=x;_yBorder=y;return *this;
+  }
+  ///Sets whether to draw arrows
+
+  ///Sets whether to draw arrows
+  ///
+  GraphToEps<T> &drawArrows(bool b=true) {_drawArrows=b;return *this;}
+  ///Sets the length of the arrowheads
+
+  ///Sets the length of the arrowheads
+  ///
+  GraphToEps<T> &arrowLength(double d) {_arrowLength*=d;return *this;}
+  ///Sets the width of the arrowheads
+
+  ///Sets the width of the arrowheads
+  ///
+  GraphToEps<T> &arrowWidth(double d) {_arrowWidth*=d;return *this;}
+  
+  ///Scales the drawing to fit to A4 page
+
+  ///Scales the drawing to fit to A4 page
+  ///
+  GraphToEps<T> &scaleToA4() {_scaleToA4=true;return *this;}
+  
+  ///Enables parallel arcs
+
+  ///Enables parallel arcs
+  GraphToEps<T> &enableParallel(bool b=true) {_enableParallel=b;return *this;}
+  
+  ///Sets the distance 
+  
+  ///Sets the distance 
+  ///
+  GraphToEps<T> &parArcDist(double d) {_parArcDist*=d;return *this;}
+  
+  ///Hides the arcs
+  
+  ///Hides the arcs
+  ///
+  GraphToEps<T> &hideArcs(bool b=true) {_showArcs=!b;return *this;}
+  ///Hides the nodes
+  
+  ///Hides the nodes
+  ///
+  GraphToEps<T> &hideNodes(bool b=true) {_showNodes=!b;return *this;}
+  
+  ///Sets the size of the node texts
+  
+  ///Sets the size of the node texts
+  ///
+  GraphToEps<T> &nodeTextSize(double d) {_nodeTextSize=d;return *this;}
+
+  ///Sets the color of the node texts to be different from the node color
+
+  ///Sets the color of the node texts to be as different from the node color
+  ///as it is possible
+  ///
+  GraphToEps<T> &distantColorNodeTexts()
+  {_nodeTextColorType=DIST_COL;return *this;}
+  ///Sets the color of the node texts to be black or white and always visible.
+
+  ///Sets the color of the node texts to be black or white according to
+  ///which is more 
+  ///different from the node color
+  ///
+  GraphToEps<T> &distantBWNodeTexts()
+  {_nodeTextColorType=DIST_BW;return *this;}
+
+  ///Gives a preamble block for node Postscript block.
+  
+  ///Gives a preamble block for node Postscript block.
+  ///
+  ///\sa nodePsTexts()
+  GraphToEps<T> & nodePsTextsPreamble(const char *str) {
+    _nodePsTextsPreamble=str ;return *this;
+  }
+  ///Sets whether the the graph is undirected
+
+  ///Sets whether the the graph is undirected
+  ///
+  GraphToEps<T> &undirected(bool b=true) {_undirected=b;return *this;}
+
+  ///Sets whether the the graph is directed
+
+  ///Sets whether the the graph is directed.
+  ///Use it to show the edges as a pair of directed ones.
+  GraphToEps<T> &bidir(bool b=true) {_undirected=!b;return *this;}
+
+  ///Sets the title.
+
+  ///Sets the title of the generated image,
+  ///namely it inserts a <tt>%%Title:</tt> DSC field to the header of
+  ///the EPS file.
+  GraphToEps<T> &title(const std::string &t) {_title=t;return *this;}
+  ///Sets the copyright statement.
+
+  ///Sets the copyright statement of the generated image,
+  ///namely it inserts a <tt>%%Copyright:</tt> DSC field to the header of
+  ///the EPS file.
+  ///\todo Multiline copyright notice could be supported.
+  GraphToEps<T> &copyright(const std::string &t) {_copyright=t;return *this;}
+
+protected:
+  bool isInsideNode(dim2::Point<double> p, double r,int t) 
+  {
+    switch(t) {
+    case CIRCLE:
+    case MALE:
+    case FEMALE:
+      return p.normSquare()<=r*r;
+    case SQUARE:
+      return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r;
+    case DIAMOND:
+      return p.x+p.y<=r && p.x-p.y<=r && -p.x+p.y<=r && -p.x-p.y<=r;
+    }
+    return false;
+  }
+
+public:
+  ~GraphToEps() { }
+  
+  ///Draws the graph.
+
+  ///Like other functions using
+  ///\ref named-templ-func-param "named template parameters",
+  ///this function calles the algorithm itself, i.e. in this case
+  ///it draws the graph.
+  void run() {
+    ///\todo better 'epsilon' would be nice here.
+    const double EPSILON=1e-9;
+    if(dontPrint) return;
+    
+    _NegY<typename T::CoordsMapType> mycoords(_coords,_negY);
+
+    os << "%!PS-Adobe-2.0 EPSF-2.0\n";
+    if(_title.size()>0) os << "%%Title: " << _title << '\n';
+     if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
+//        << "%%Copyright: XXXX\n"
+    os << "%%Creator: LEMON, graphToEps()\n";
+    
+    {
+      char cbuf[50];
+      timeval tv;
+      gettimeofday(&tv, 0);
+      ctime_r(&tv.tv_sec,cbuf);
+      os << "%%CreationDate: " << cbuf;
+    }
+
+    if (_autoArcWidthScale) {
+      double max_w=0;
+      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;
+      }
+    }
+
+    if (_autoNodeScale) {
+      double max_s=0;
+      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;
+      }
+    }
+
+    double diag_len = 1;
+    if(!(_absoluteNodeSizes&&_absoluteArcWidths)) {
+      dim2::BoundingBox<double> bb;
+      for(NodeIt n(g);n!=INVALID;++n) bb.add(mycoords[n]);
+      if (bb.empty()) {
+	bb = dim2::BoundingBox<double>(dim2::Point<double>(0,0));
+      }
+      diag_len = std::sqrt((bb.bottomLeft()-bb.topRight()).normSquare());
+      if(diag_len<EPSILON) diag_len = 1;
+      if(!_absoluteNodeSizes) _nodeScale*=diag_len;
+      if(!_absoluteArcWidths) _arcWidthScale*=diag_len;
+    }
+    
+    dim2::BoundingBox<double> bb;
+    for(NodeIt n(g);n!=INVALID;++n) {
+      double ns=_nodeSizes[n]*_nodeScale;
+      dim2::Point<double> p(ns,ns);
+      switch(_nodeShapes[n]) {
+      case CIRCLE:
+      case SQUARE:
+      case DIAMOND:
+	bb.add(p+mycoords[n]);
+	bb.add(-p+mycoords[n]);
+	break;
+      case MALE:
+	bb.add(-p+mycoords[n]);
+	bb.add(dim2::Point<double>(1.5*ns,1.5*std::sqrt(3.0)*ns)+mycoords[n]);
+	break;
+      case FEMALE:
+	bb.add(p+mycoords[n]);
+	bb.add(dim2::Point<double>(-ns,-3.01*ns)+mycoords[n]);
+	break;
+      }
+    }
+    if (bb.empty()) {
+      bb = dim2::BoundingBox<double>(dim2::Point<double>(0,0));
+    }
+    
+    if(_scaleToA4)
+      os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
+    else {
+      if(_preScale) {
+	//Rescale so that BoundingBox won't be neither to big nor too small.
+	while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10;
+	while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10;
+      }
+      
+      os << "%%BoundingBox: "
+	 << int(floor(bb.left()   * _scale - _xBorder)) << ' '
+	 << int(floor(bb.bottom() * _scale - _yBorder)) << ' '
+	 << int(ceil(bb.right()  * _scale + _xBorder)) << ' '
+	 << int(ceil(bb.top()    * _scale + _yBorder)) << '\n';
+    }
+    
+    os << "%%EndComments\n";
+    
+    //x1 y1 x2 y2 x3 y3 cr cg cb w
+    os << "/lb { setlinewidth setrgbcolor newpath moveto\n"
+       << "      4 2 roll 1 index 1 index curveto stroke } bind def\n";
+    os << "/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def\n";
+    //x y r
+    os << "/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def\n";
+    //x y r
+    os << "/sq { newpath 2 index 1 index add 2 index 2 index add moveto\n"
+       << "      2 index 1 index sub 2 index 2 index add lineto\n"
+       << "      2 index 1 index sub 2 index 2 index sub lineto\n"
+       << "      2 index 1 index add 2 index 2 index sub lineto\n"
+       << "      closepath pop pop pop} bind def\n";
+    //x y r
+    os << "/di { newpath 2 index 1 index add 2 index moveto\n"
+       << "      2 index             2 index 2 index add lineto\n"
+       << "      2 index 1 index sub 2 index             lineto\n"
+       << "      2 index             2 index 2 index sub lineto\n"
+       << "      closepath pop pop pop} bind def\n";
+    // x y r cr cg cb
+    os << "/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill\n"
+       << "     setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
+       << "   } bind def\n";
+    os << "/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill\n"
+       << "     setrgbcolor " << 1+_nodeBorderQuotient << " div sq fill\n"
+       << "   } bind def\n";
+    os << "/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill\n"
+       << "     setrgbcolor " << 1+_nodeBorderQuotient << " div di fill\n"
+       << "   } bind def\n";
+    os << "/nfemale { 0 0 0 setrgbcolor 3 index "
+       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
+       << " 1.5 mul mul setlinewidth\n"
+       << "  newpath 5 index 5 index moveto "
+       << "5 index 5 index 5 index 3.01 mul sub\n"
+       << "  lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto\n"
+       << "  5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke\n"
+       << "  5 index 5 index 5 index c fill\n"
+       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
+       << "  } bind def\n";
+    os << "/nmale {\n"
+       << "  0 0 0 setrgbcolor 3 index "
+       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
+       <<" 1.5 mul mul setlinewidth\n"
+       << "  newpath 5 index 5 index moveto\n"
+       << "  5 index 4 index 1 mul 1.5 mul add\n"
+       << "  5 index 5 index 3 sqrt 1.5 mul mul add\n"
+       << "  1 index 1 index lineto\n"
+       << "  1 index 1 index 7 index sub moveto\n"
+       << "  1 index 1 index lineto\n"
+       << "  exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto\n"
+       << "  stroke\n"
+       << "  5 index 5 index 5 index c fill\n"
+       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
+       << "  } bind def\n";
+    
+
+    os << "/arrl " << _arrowLength << " def\n";
+    os << "/arrw " << _arrowWidth << " def\n";
+    // l dx_norm dy_norm
+    os << "/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def\n";
+    //len w dx_norm dy_norm x1 y1 cr cg cb
+    os << "/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def\n"
+       << "       /w exch def /len exch def\n"
+      //	 << "       0.1 setlinewidth x1 y1 moveto dx len mul dy len mul rlineto stroke"
+       << "       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto\n"
+       << "       len w sub arrl sub dx dy lrl\n"
+       << "       arrw dy dx neg lrl\n"
+       << "       dx arrl w add mul dy w 2 div arrw add mul sub\n"
+       << "       dy arrl w add mul dx w 2 div arrw add mul add rlineto\n"
+       << "       dx arrl w add mul neg dy w 2 div arrw add mul sub\n"
+       << "       dy arrl w add mul neg dx w 2 div arrw add mul add rlineto\n"
+       << "       arrw dy dx neg lrl\n"
+       << "       len w sub arrl sub neg dx dy lrl\n"
+       << "       closepath fill } bind def\n";
+    os << "/cshow { 2 index 2 index moveto dup stringwidth pop\n"
+       << "         neg 2 div fosi .35 mul neg rmoveto show pop pop} def\n";
+
+    os << "\ngsave\n";
+    if(_scaleToA4)
+      if(bb.height()>bb.width()) {
+	double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.height(),
+		  (A4WIDTH-2*A4BORDER)/bb.width());
+	os << ((A4WIDTH -2*A4BORDER)-sc*bb.width())/2 + A4BORDER << ' '
+	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.height())/2 + A4BORDER
+	   << " translate\n"
+	   << sc << " dup scale\n"
+	   << -bb.left() << ' ' << -bb.bottom() << " translate\n";
+      }
+      else {
+	//\todo Verify centering
+	double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.width(),
+		  (A4WIDTH-2*A4BORDER)/bb.height());
+	os << ((A4WIDTH -2*A4BORDER)-sc*bb.height())/2 + A4BORDER << ' '
+	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.width())/2 + A4BORDER 
+	   << " translate\n"
+	   << sc << " dup scale\n90 rotate\n"
+	   << -bb.left() << ' ' << -bb.top() << " translate\n";	
+	}
+    else if(_scale!=1.0) os << _scale << " dup scale\n";
+    
+    if(_showArcs) {
+      os << "%Arcs:\ngsave\n";      
+      if(_enableParallel) {
+	std::vector<Arc> el;
+	for(ArcIt e(g);e!=INVALID;++e)
+	  if((!_undirected||g.source(e)<g.target(e))&&_arcWidths[e]>0
+	     &&g.source(e)!=g.target(e))
+	    el.push_back(e);
+	std::sort(el.begin(),el.end(),arcLess(g));
+	
+	typename std::vector<Arc>::iterator j;
+	for(typename std::vector<Arc>::iterator i=el.begin();i!=el.end();i=j) {
+	  for(j=i+1;j!=el.end()&&isParallel(*i,*j);++j) ;
+
+	  double sw=0;
+	  for(typename std::vector<Arc>::iterator e=i;e!=j;++e)
+	    sw+=_arcWidths[*e]*_arcWidthScale+_parArcDist;
+	  sw-=_parArcDist;
+	  sw/=-2.0;
+	  dim2::Point<double>
+	    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;
+// 	  m=dim2::Point<double>(mycoords[g.target(*i)]+mycoords[g.source(*i)])/2.0;
+
+//  	  m=dim2::Point<double>(mycoords[g.source(*i)])+
+// 	    dvec*(double(_nodeSizes[g.source(*i)])/
+// 	       (_nodeSizes[g.source(*i)]+_nodeSizes[g.target(*i)]));
+
+ 	  m=dim2::Point<double>(mycoords[g.source(*i)])+
+	    d*(l+_nodeSizes[g.source(*i)]-_nodeSizes[g.target(*i)])/2.0;
+
+	  for(typename std::vector<Arc>::iterator e=i;e!=j;++e) {
+	    sw+=_arcWidths[*e]*_arcWidthScale/2.0;
+	    dim2::Point<double> mm=m+rot90(d)*sw/.75;
+	    if(_drawArrows) {
+	      int node_shape;
+	      dim2::Point<double> s=mycoords[g.source(*e)];
+	      dim2::Point<double> t=mycoords[g.target(*e)];
+	      double rn=_nodeSizes[g.target(*e)]*_nodeScale;
+	      node_shape=_nodeShapes[g.target(*e)];
+	      dim2::Bezier3 bez(s,mm,mm,t);
+	      double t1=0,t2=1;
+	      for(int ii=0;ii<INTERPOL_PREC;++ii)
+		if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
+		else t1=(t1+t2)/2;
+	      dim2::Point<double> apoint=bez((t1+t2)/2);
+	      rn = _arrowLength+_arcWidths[*e]*_arcWidthScale;
+	      rn*=rn;
+	      t2=(t1+t2)/2;t1=0;
+	      for(int ii=0;ii<INTERPOL_PREC;++ii)
+		if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
+		else t2=(t1+t2)/2;
+	      dim2::Point<double> linend=bez((t1+t2)/2);	      
+	      bez=bez.before((t1+t2)/2);
+// 	      rn=_nodeSizes[g.source(*e)]*_nodeScale;
+// 	      node_shape=_nodeShapes[g.source(*e)];
+// 	      t1=0;t2=1;
+// 	      for(int i=0;i<INTERPOL_PREC;++i)
+// 		if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t1=(t1+t2)/2;
+// 		else t2=(t1+t2)/2;
+// 	      bez=bez.after((t1+t2)/2);
+	      os << _arcWidths[*e]*_arcWidthScale << " setlinewidth "
+		 << _arcColors[*e].red() << ' '
+		 << _arcColors[*e].green() << ' '
+		 << _arcColors[*e].blue() << " setrgbcolor newpath\n"
+		 << bez.p1.x << ' ' <<  bez.p1.y << " moveto\n"
+		 << bez.p2.x << ' ' << bez.p2.y << ' '
+		 << bez.p3.x << ' ' << bez.p3.y << ' '
+		 << bez.p4.x << ' ' << bez.p4.y << " curveto stroke\n";
+	      dim2::Point<double> dd(rot90(linend-apoint));
+	      dd*=(.5*_arcWidths[*e]*_arcWidthScale+_arrowWidth)/
+		std::sqrt(dd.normSquare());
+	      os << "newpath " << psOut(apoint) << " moveto "
+		 << psOut(linend+dd) << " lineto "
+		 << psOut(linend-dd) << " lineto closepath fill\n";
+	    }
+	    else {
+	      os << mycoords[g.source(*e)].x << ' '
+		 << mycoords[g.source(*e)].y << ' '
+		 << mm.x << ' ' << mm.y << ' '
+		 << mycoords[g.target(*e)].x << ' '
+		 << mycoords[g.target(*e)].y << ' '
+		 << _arcColors[*e].red() << ' '
+		 << _arcColors[*e].green() << ' '
+		 << _arcColors[*e].blue() << ' '
+		 << _arcWidths[*e]*_arcWidthScale << " lb\n";
+	    }
+	    sw+=_arcWidths[*e]*_arcWidthScale/2.0+_parArcDist;
+	  }
+	}
+      }
+      else for(ArcIt e(g);e!=INVALID;++e)
+	if((!_undirected||g.source(e)<g.target(e))&&_arcWidths[e]>0
+	   &&g.source(e)!=g.target(e))
+	  if(_drawArrows) {
+	    dim2::Point<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]);
+	    double rn=_nodeSizes[g.target(e)]*_nodeScale;
+	    int node_shape=_nodeShapes[g.target(e)];
+	    double t1=0,t2=1;
+	    for(int i=0;i<INTERPOL_PREC;++i)
+	      if(isInsideNode((-(t1+t2)/2)*d,rn,node_shape)) t1=(t1+t2)/2;
+	      else t2=(t1+t2)/2;
+	    double l=std::sqrt(d.normSquare());
+	    d/=l;
+	    
+	    os << l*(1-(t1+t2)/2) << ' '
+	       << _arcWidths[e]*_arcWidthScale << ' '
+	       << d.x << ' ' << d.y << ' '
+	       << mycoords[g.source(e)].x << ' '
+	       << mycoords[g.source(e)].y << ' '
+	       << _arcColors[e].red() << ' '
+	       << _arcColors[e].green() << ' '
+	       << _arcColors[e].blue() << " arr\n";
+	  }
+	  else os << mycoords[g.source(e)].x << ' '
+		  << mycoords[g.source(e)].y << ' '
+		  << mycoords[g.target(e)].x << ' '
+		  << mycoords[g.target(e)].y << ' '
+		  << _arcColors[e].red() << ' '
+		  << _arcColors[e].green() << ' '
+		  << _arcColors[e].blue() << ' '
+		  << _arcWidths[e]*_arcWidthScale << " l\n";
+      os << "grestore\n";
+    }
+    if(_showNodes) {
+      os << "%Nodes:\ngsave\n";
+      for(NodeIt n(g);n!=INVALID;++n) {
+	os << mycoords[n].x << ' ' << mycoords[n].y << ' '
+	   << _nodeSizes[n]*_nodeScale << ' '
+	   << _nodeColors[n].red() << ' '
+	   << _nodeColors[n].green() << ' '
+	   << _nodeColors[n].blue() << ' ';
+	switch(_nodeShapes[n]) {
+	case CIRCLE:
+	  os<< "nc";break;
+	case SQUARE:
+	  os<< "nsq";break;
+	case DIAMOND:
+	  os<< "ndi";break;
+	case MALE:
+	  os<< "nmale";break;
+	case FEMALE:
+	  os<< "nfemale";break;
+	}
+	os<<'\n';
+      }
+      os << "grestore\n";
+    }
+    if(_showNodeText) {
+      os << "%Node texts:\ngsave\n";
+      os << "/fosi " << _nodeTextSize << " def\n";
+      os << "(Helvetica) findfont fosi scalefont setfont\n";
+      for(NodeIt n(g);n!=INVALID;++n) {
+	switch(_nodeTextColorType) {
+	case DIST_COL:
+	  os << psOut(distantColor(_nodeColors[n])) << " setrgbcolor\n";
+	  break;
+	case DIST_BW:
+	  os << psOut(distantBW(_nodeColors[n])) << " setrgbcolor\n";
+	  break;
+	case CUST_COL:
+	  os << psOut(distantColor(_nodeTextColors[n])) << " setrgbcolor\n";
+	  break;
+	default:
+	  os << "0 0 0 setrgbcolor\n";
+	}
+	os << mycoords[n].x << ' ' << mycoords[n].y
+	   << " (" << _nodeTexts[n] << ") cshow\n";
+      }
+      os << "grestore\n";
+    }
+    if(_showNodePsText) {
+      os << "%Node PS blocks:\ngsave\n";
+      for(NodeIt n(g);n!=INVALID;++n)
+	os << mycoords[n].x << ' ' << mycoords[n].y
+	   << " moveto\n" << _nodePsTexts[n] << "\n";
+      os << "grestore\n";
+    }
+    
+    os << "grestore\nshowpage\n";
+
+    //CleanUp:
+    if(_pleaseRemoveOsStream) {delete &os;}
+  } 
+};
+
+template<class T>
+const int GraphToEps<T>::INTERPOL_PREC = 20;
+template<class T>
+const double GraphToEps<T>::A4HEIGHT = 841.8897637795276;
+template<class T>
+const double GraphToEps<T>::A4WIDTH  = 595.275590551181;
+template<class T>
+const double GraphToEps<T>::A4BORDER = 15;
+
+
+///Generates an EPS file from a graph
+
+///\ingroup eps_io
+///Generates an EPS file from a graph.
+///\param g is a reference to the graph to be printed
+///\param os is a reference to the output stream.
+///By default it is <tt>std::cout</tt>
+///
+///This function also has a lot of
+///\ref named-templ-func-param "named parameters",
+///they are declared as the members of class \ref GraphToEps. The following
+///example shows how to use these parameters.
+///\code
+/// graphToEps(g,os).scale(10).coords(coords)
+///              .nodeScale(2).nodeSizes(sizes)
+///              .arcWidthScale(.4).run();
+///\endcode
+///\warning Don't forget to put the \ref GraphToEps::run() "run()"
+///to the end of the parameter list.
+///\sa GraphToEps
+///\sa graphToEps(G &g, const char *file_name)
+template<class G>
+GraphToEps<DefaultGraphToEpsTraits<G> > 
+graphToEps(G &g, std::ostream& os=std::cout)
+{
+  return 
+    GraphToEps<DefaultGraphToEpsTraits<G> >(DefaultGraphToEpsTraits<G>(g,os));
+}
+ 
+///Generates an EPS file from a graph
+
+///\ingroup eps_io
+///This function does the same as
+///\ref graphToEps(G &g,std::ostream& os)
+///but it writes its output into the file \c file_name
+///instead of a stream.
+///\sa graphToEps(G &g, std::ostream& os)
+template<class G>
+GraphToEps<DefaultGraphToEpsTraits<G> > 
+graphToEps(G &g,const char *file_name)
+{
+  return GraphToEps<DefaultGraphToEpsTraits<G> >
+    (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));
+}
+
+///Generates an EPS file from a graph
+
+///\ingroup eps_io
+///This function does the same as
+///\ref graphToEps(G &g,std::ostream& os)
+///but it writes its output into the file \c file_name
+///instead of a stream.
+///\sa graphToEps(G &g, std::ostream& os)
+template<class G>
+GraphToEps<DefaultGraphToEpsTraits<G> > 
+graphToEps(G &g,const std::string& file_name)
+{
+  return GraphToEps<DefaultGraphToEpsTraits<G> >
+    (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name.c_str()),true));
+}
+
+} //END OF NAMESPACE LEMON
+
+#endif // LEMON_GRAPH_TO_EPS_H
Index: mon/lgf_reader.h
===================================================================
--- lemon/lgf_reader.h	(revision 127)
+++ 	(revision )
@@ -1,914 +1,0 @@
-/* -*- C++ -*-
- *
- * 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.
- *
- */
-
-///\ingroup lemon_io
-///\file
-///\brief Lemon Graph Format reader.
-
-
-#ifndef LEMON_LGF_READER_H
-#define LEMON_LGF_READER_H
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <set>
-#include <map>
-
-#include <lemon/assert.h>
-#include <lemon/graph_utils.h>
-
-#include <lemon/lgf_writer.h>
-
-#include <lemon/concept_check.h>
-#include <lemon/concepts/maps.h>
-
-namespace lemon {
-
-  namespace _reader_bits {
-
-    template <typename Value>
-    struct DefaultConverter {
-      Value operator()(const std::string& str) {
-	std::istringstream is(str);
-	Value value;
-	is >> value;
-
-	char c;
-	if (is >> std::ws >> c) {
-	  throw DataFormatError("Remaining characters in token");
-	}
-	return value;
-      }
-    };
-
-    template <>
-    struct DefaultConverter<std::string> {
-      std::string operator()(const std::string& str) {
-	return str;
-      }
-    };
-
-    template <typename _Item>    
-    class MapStorageBase {
-    public:
-      typedef _Item Item;
-
-    public:
-      MapStorageBase() {}
-      virtual ~MapStorageBase() {}
-
-      virtual void set(const Item& item, const std::string& value) = 0;
-
-    };
-
-    template <typename _Item, typename _Map, 
-	      typename _Converter = DefaultConverter<typename _Map::Value> >
-    class MapStorage : public MapStorageBase<_Item> {
-    public:
-      typedef _Map Map;
-      typedef _Converter Converter;
-      typedef _Item Item;
-      
-    private:
-      Map& _map;
-      Converter _converter;
-
-    public:
-      MapStorage(Map& map, const Converter& converter = Converter()) 
-	: _map(map), _converter(converter) {}
-      virtual ~MapStorage() {}
-
-      virtual void set(const Item& item ,const std::string& value) {
-	_map.set(item, _converter(value));
-      }
-    };
-
-    class ValueStorageBase {
-    public:
-      ValueStorageBase() {}
-      virtual ~ValueStorageBase() {}
-
-      virtual void set(const std::string&) = 0;
-    };
-
-    template <typename _Value, typename _Converter = DefaultConverter<_Value> >
-    class ValueStorage : public ValueStorageBase {
-    public:
-      typedef _Value Value;
-      typedef _Converter Converter;
-
-    private:
-      Value& _value;
-      Converter _converter;
-
-    public:
-      ValueStorage(Value& value, const Converter& converter = Converter())
- 	: _value(value), _converter(converter) {}
-
-      virtual void set(const std::string& value) {
-	_value = _converter(value);
-      }
-    };
-
-    template <typename Value>
-    struct MapLookUpConverter {
-      const std::map<std::string, Value>& _map;
-
-      MapLookUpConverter(const std::map<std::string, Value>& map)
-        : _map(map) {}
-
-      Value operator()(const std::string& str) {
-        typename std::map<std::string, Value>::const_iterator it =
-          _map.find(str);
-        if (it == _map.end()) {
-          std::ostringstream msg;
-          msg << "Item not found: " << str;
-          throw DataFormatError(msg.str().c_str());
-        }
-        return it->second;
-      }
-    };
-
-    bool isWhiteSpace(char c) {
-      return c == ' ' || c == '\t' || c == '\v' || 
-        c == '\n' || c == '\r' || c == '\f'; 
-    }
-    
-    bool isOct(char c) {
-      return '0' <= c && c <='7'; 
-    }
-    
-    int valueOct(char c) {
-      LEMON_ASSERT(isOct(c), "The character is not octal.");
-      return c - '0';
-    }
-
-    bool isHex(char c) {
-      return ('0' <= c && c <= '9') || 
-	('a' <= c && c <= 'z') || 
-	('A' <= c && c <= 'Z'); 
-    }
-    
-    int valueHex(char c) {
-      LEMON_ASSERT(isHex(c), "The character is not hexadecimal.");
-      if ('0' <= c && c <= '9') return c - '0';
-      if ('a' <= c && c <= 'z') return c - 'a' + 10;
-      return c - 'A' + 10;
-    }
-
-    bool isIdentifierFirstChar(char c) {
-      return ('a' <= c && c <= 'z') ||
-	('A' <= c && c <= 'Z') || c == '_';
-    }
-
-    bool isIdentifierChar(char c) {
-      return isIdentifierFirstChar(c) ||
-	('0' <= c && c <= '9');
-    }
-
-    char readEscape(std::istream& is) {
-      char c;
-      if (!is.get(c))
-	throw DataFormatError("Escape format error");
-
-      switch (c) {
-      case '\\':
-	return '\\';
-      case '\"':
-	return '\"';
-      case '\'':
-	return '\'';
-      case '\?':
-	return '\?';
-      case 'a':
-	return '\a';
-      case 'b':
-	return '\b';
-      case 'f':
-	return '\f';
-      case 'n':
-	return '\n';
-      case 'r':
-	return '\r';
-      case 't':
-	return '\t';
-      case 'v':
-	return '\v';
-      case 'x':
-	{
-	  int code;
-	  if (!is.get(c) || !isHex(c)) 
-	    throw DataFormatError("Escape format error");
-	  else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
-	  else code = code * 16 + valueHex(c);
-	  return code;
-	}
-      default:
-	{
-	  int code;
-	  if (!isOct(c)) 
-	    throw DataFormatError("Escape format error");
-	  else if (code = valueOct(c), !is.get(c) || !isOct(c)) 
-	    is.putback(c);
-	  else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c)) 
-	    is.putback(c);
-	  else code = code * 8 + valueOct(c);
-	  return code;
-	}	      
-      } 
-    }
-    
-    std::istream& readToken(std::istream& is, std::string& str) {
-      std::ostringstream os;
-
-      char c;
-      is >> std::ws;
-      
-      if (!is.get(c)) 
-	return is;
-
-      if (c == '\"') {
-	while (is.get(c) && c != '\"') {
-	  if (c == '\\') 
-	    c = readEscape(is);
-	  os << c;
-	}
-	if (!is) 
-	  throw DataFormatError("Quoted format error");
-      } else {
-	is.putback(c);
-	while (is.get(c) && !isWhiteSpace(c)) {
-	  if (c == '\\') 
-	    c = readEscape(is);
-	  os << c;
-	}
-	if (!is) {
-	  is.clear();
-	} else {
-	  is.putback(c);
-	}
-      }
-      str = os.str();
-      return is;
-    }
-
-    std::istream& readIdentifier(std::istream& is, std::string& str) {
-      std::ostringstream os;
-
-      char c;
-      is >> std::ws;
-      
-      if (!is.get(c))
-	return is;
-
-      if (!isIdentifierFirstChar(c))
-	throw DataFormatError("Wrong char in identifier");
-      
-      os << c;
-      
-      while (is.get(c) && !isWhiteSpace(c)) {
-	if (!isIdentifierChar(c)) 
-	  throw DataFormatError("Wrong char in identifier");	  
-	os << c;
-      }
-      if (!is) is.clear();
-     
-      str = os.str();
-      return is;
-    }
-    
-  }
-  
-  /// \e
-  template <typename _Digraph>
-  class DigraphReader {
-  public:
-
-    typedef _Digraph Digraph;
-    GRAPH_TYPEDEFS(typename Digraph);
-    
-  private:
-
-
-    std::istream* _is;
-    bool local_is;
-
-    Digraph& _digraph;
-
-    std::string _nodes_caption;
-    std::string _arcs_caption;
-    std::string _attributes_caption;
-
-    typedef std::map<std::string, Node> NodeIndex;
-    NodeIndex _node_index;
-    typedef std::map<std::string, Arc> ArcIndex;
-    ArcIndex _arc_index;
-    
-    typedef std::vector<std::pair<std::string, 
-      _reader_bits::MapStorageBase<Node>*> > NodeMaps;    
-    NodeMaps _node_maps; 
-
-    typedef std::vector<std::pair<std::string,
-      _reader_bits::MapStorageBase<Arc>*> >ArcMaps;
-    ArcMaps _arc_maps;
-
-    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*> 
-      Attributes;
-    Attributes _attributes;
-
-    bool _use_nodes;
-    bool _use_arcs;
-
-    int line_num;
-    std::istringstream line;
-
-  public:
-
-    /// \e
-    DigraphReader(std::istream& is, Digraph& digraph) 
-      : _is(&is), local_is(false), _digraph(digraph),
-	_use_nodes(false), _use_arcs(false) {}
-
-    /// \e
-    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) {}
-
-
-    /// \e
-    DigraphReader(const char* fn, Digraph& digraph) 
-      : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph),
-    	_use_nodes(false), _use_arcs(false) {}
-
-    /// \e
-    DigraphReader(DigraphReader& other) 
-      : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
-	_use_nodes(other._use_nodes), _use_arcs(other._use_arcs) {
-
-      other.is = 0;
-      other.local_is = false;
-      
-      _node_index.swap(other._node_index);
-      _arc_index.swap(other._arc_index);
-
-      _node_maps.swap(other._node_maps);
-      _arc_maps.swap(other._arc_maps);
-      _attributes.swap(other._attributes);
-
-      _nodes_caption = other._nodes_caption;
-      _arcs_caption = other._arcs_caption;
-      _attributes_caption = other._attributes_caption;
-    }
-
-    /// \e
-    ~DigraphReader() {
-      for (typename NodeMaps::iterator it = _node_maps.begin(); 
-	   it != _node_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename ArcMaps::iterator it = _arc_maps.begin(); 
-	   it != _arc_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename Attributes::iterator it = _attributes.begin(); 
-	   it != _attributes.end(); ++it) {
-	delete it->second;
-      }
-
-      if (local_is) {
-	delete _is;
-      }
-
-    }
-
-  private:
-    
-    DigraphReader& operator=(const DigraphReader&);
-
-  public:
-
-    /// \e
-    template <typename Map>
-    DigraphReader& nodeMap(const std::string& caption, Map& map) {
-      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Node>* storage = 
-	new _reader_bits::MapStorage<Node, Map>(map);
-      _node_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Map, typename Converter>
-    DigraphReader& nodeMap(const std::string& caption, Map& map, 
-			   const Converter& converter = Converter()) {
-      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Node>* storage = 
-	new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
-      _node_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Map>
-    DigraphReader& arcMap(const std::string& caption, Map& map) {
-      checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Arc>* storage = 
-	new _reader_bits::MapStorage<Arc, Map>(map);
-      _arc_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Map, typename Converter>
-    DigraphReader& arcMap(const std::string& caption, Map& map, 
-			  const Converter& converter = Converter()) {
-      checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Arc>* storage = 
-	new _reader_bits::MapStorage<Arc, Map, Converter>(map, converter);
-      _arc_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Value>
-    DigraphReader& attribute(const std::string& caption, Value& value) {
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Value>(value);
-      _attributes.insert(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Value, typename Converter>
-    DigraphReader& attribute(const std::string& caption, Value& value, 
-			     const Converter& converter = Converter()) {
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Value, Converter>(value, converter);
-      _attributes.insert(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    DigraphReader& node(const std::string& caption, Node& node) {
-      typedef _reader_bits::MapLookUpConverter<Node> Converter;
-      Converter converter(_node_index);
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Node, Converter>(node, converter);
-      _attributes.insert(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    DigraphReader& arc(const std::string& caption, Arc& arc) {
-      typedef _reader_bits::MapLookUpConverter<Arc> Converter;
-      Converter converter(_arc_index);
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
-      _attributes.insert(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    DigraphReader& nodes(const std::string& caption) {
-      _nodes_caption = caption;
-      return *this;
-    }
-
-    /// \e
-    DigraphReader& arcs(const std::string& caption) {
-      _arcs_caption = caption;
-      return *this;
-    }
-
-    /// \e
-    DigraphReader& attributes(const std::string& caption) {
-      _attributes_caption = caption;
-      return *this;
-    }
-
-    /// \e
-    template <typename Map>
-    DigraphReader& useNodes(const Map& map) {
-      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
-      _use_nodes = true;
-      _writer_bits::DefaultConverter<typename Map::Value> converter;
-      for (NodeIt n(_digraph); n != INVALID; ++n) {
-	_node_index.insert(std::make_pair(converter(map[n]), n));
-      }
-      return *this;
-    }
-
-    /// \e
-    template <typename Map, typename Converter>
-    DigraphReader& useNodes(const Map& map, 
-			    const Converter& converter = Converter()) {
-      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
-      _use_nodes = true;
-      for (NodeIt n(_digraph); n != INVALID; ++n) {
-	_node_index.insert(std::make_pair(converter(map[n]), n));
-      }
-      return *this;
-    }
-
-    /// \e
-    template <typename Map>
-    DigraphReader& useArcs(const Map& map) {
-      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member");
-      _use_arcs = true;
-      _writer_bits::DefaultConverter<typename Map::Value> converter;
-      for (ArcIt a(_digraph); a != INVALID; ++a) {
-	_arc_index.insert(std::make_pair(converter(map[a]), a));
-      }
-      return *this;
-    }
-
-    /// \e
-    template <typename Map, typename Converter>
-    DigraphReader& useArcs(const Map& map, 
-			    const Converter& converter = Converter()) {
-      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member"); 
-      _use_arcs = true;
-      for (ArcIt a(_digraph); a != INVALID; ++a) {
-	_arc_index.insert(std::make_pair(converter(map[a]), a));
-      }
-      return *this;
-    }
-
-  private:
-
-    bool readLine() {
-      std::string str;
-      while(++line_num, std::getline(*_is, str)) {
-	line.clear(); line.str(str);
-	char c;
-	if (line >> std::ws >> c && c != '#') {
-	  line.putback(c);
-	  return true;
-	}
-      }
-      return false;
-    }
-
-    bool readSuccess() {
-      return static_cast<bool>(*_is);
-    }
-    
-    void skipSection() {
-      char c;
-      while (readSuccess() && line >> c && c != '@') {
-	readLine();
-      }
-      line.putback(c);
-    }
-
-    void readNodes() {
-
-      std::vector<int> map_index(_node_maps.size());
-      int map_num, label_index;
-
-      if (!readLine()) 
-	throw DataFormatError("Cannot find map captions");
-      
-      {
-	std::map<std::string, int> maps;
-	
-	std::string map;
-	int index = 0;
-	while (_reader_bits::readIdentifier(line, map)) {
-	  if (maps.find(map) != maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of node map: " << map;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  maps.insert(std::make_pair(map, index));
-	  ++index;
-	}
-	
-	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
-	  std::map<std::string, int>::iterator jt = 
-	    maps.find(_node_maps[i].first);
-	  if (jt == maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Map not found in file: " << _node_maps[i].first;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  map_index[i] = jt->second;
-	}
-
-	{
-	  std::map<std::string, int>::iterator jt = maps.find("label");
-	  if (jt == maps.end())
-	    throw DataFormatError("Label map not found in file");
-	  label_index = jt->second;
-	}
-	map_num = maps.size();
-      }
-
-      char c;
-      while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-
-	std::vector<std::string> tokens(map_num);
-	for (int i = 0; i < map_num; ++i) {
-	  if (!_reader_bits::readToken(line, tokens[i])) {
-	    std::ostringstream msg;
-	    msg << "Column not found (" << i + 1 << ")";
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	}
-	if (line >> std::ws >> c)
-	  throw DataFormatError("Extra character on the end of line");
-	
-	Node n;
-	if (!_use_nodes) {
-	  n = _digraph.addNode();
-	  _node_index.insert(std::make_pair(tokens[label_index], n));
-	} else {
-	  typename std::map<std::string, Node>::iterator it =
-	    _node_index.find(tokens[label_index]);
-	  if (it == _node_index.end()) {
-	    std::ostringstream msg;
-	    msg << "Node with label not found: " << tokens[label_index];
-	    throw DataFormatError(msg.str().c_str());	    
-	  }
-	  n = it->second;
-	}
-
-	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
-	  _node_maps[i].second->set(n, tokens[map_index[i]]);
-	}
-
-      }
-      if (readSuccess()) {
-	line.putback(c);
-      }
-    }
-
-    void readArcs() {
-
-      std::vector<int> map_index(_arc_maps.size());
-      int map_num, label_index;
-
-      if (!readLine()) 
-	throw DataFormatError("Cannot find map captions");
-      
-      {
-	std::map<std::string, int> maps;
-	
-	std::string map;
-	int index = 0;
-	while (_reader_bits::readIdentifier(line, map)) {
-	  if (maps.find(map) != maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of arc map: " << map;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  maps.insert(std::make_pair(map, index));
-	  ++index;
-	}
-	
-	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
-	  std::map<std::string, int>::iterator jt = 
-	    maps.find(_arc_maps[i].first);
-	  if (jt == maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Map not found in file: " << _arc_maps[i].first;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  map_index[i] = jt->second;
-	}
-
-	{
-	  std::map<std::string, int>::iterator jt = maps.find("label");
-	  if (jt == maps.end())
-	    throw DataFormatError("Label map not found in file");
-	  label_index = jt->second;
-	}
-	map_num = maps.size();
-      }
-
-      char c;
-      while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-
-	std::string source_token;
-	std::string target_token;
-
-	if (!_reader_bits::readToken(line, source_token))
-	  throw DataFormatError("Source not found");
-
-	if (!_reader_bits::readToken(line, target_token))
-	  throw DataFormatError("Source not found");
-	
-	std::vector<std::string> tokens(map_num);
-	for (int i = 0; i < map_num; ++i) {
-	  if (!_reader_bits::readToken(line, tokens[i])) {
-	    std::ostringstream msg;
-	    msg << "Column not found (" << i + 1 << ")";
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	}
-	if (line >> std::ws >> c)
-	  throw DataFormatError("Extra character on the end of line");
-	
-	Arc a;
-	if (!_use_arcs) {
-
-          typename NodeIndex::iterator it;
- 
-          it = _node_index.find(source_token);
-          if (it == _node_index.end()) {
-            std::ostringstream msg;
-            msg << "Item not found: " << source_token;
-            throw DataFormatError(msg.str().c_str());
-          }
-          Node source = it->second;
-
-          it = _node_index.find(target_token);
-          if (it == _node_index.end()) {       
-            std::ostringstream msg;            
-            msg << "Item not found: " << target_token;
-            throw DataFormatError(msg.str().c_str());
-          }                                          
-          Node target = it->second;                            
-
-	  a = _digraph.addArc(source, target);
-	  _arc_index.insert(std::make_pair(tokens[label_index], a));
-	} else {
-	  typename std::map<std::string, Arc>::iterator it =
-	    _arc_index.find(tokens[label_index]);
-	  if (it == _arc_index.end()) {
-	    std::ostringstream msg;
-	    msg << "Arc with label not found: " << tokens[label_index];
-	    throw DataFormatError(msg.str().c_str());	    
-	  }
-	  a = it->second;
-	}
-
-	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
-	  _arc_maps[i].second->set(a, tokens[map_index[i]]);
-	}
-
-      }
-      if (readSuccess()) {
-	line.putback(c);
-      }
-    }
-
-    void readAttributes() {
-
-      std::set<std::string> read_attr;
-
-      char c;
-      while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-	
-	std::string attr, token;
-	if (!_reader_bits::readIdentifier(line, attr))
-	  throw DataFormatError("Attribute name not found");
-	if (!_reader_bits::readToken(line, token))
-	  throw DataFormatError("Attribute value not found");
-	if (line >> c)
-	  throw DataFormatError("Extra character on the end of line");	  
-
-	{
-	  std::set<std::string>::iterator it = read_attr.find(attr);
-	  if (it != read_attr.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of attribute " << attr;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  read_attr.insert(attr);
-	}
-	
-	{
-	  typename Attributes::iterator it = _attributes.lower_bound(attr);
-	  while (it != _attributes.end() && it->first == attr) {
-	    it->second->set(token);
-	    ++it;
-	  }
-	}
-
-      }
-      if (readSuccess()) {
-	line.putback(c);
-      }
-      for (typename Attributes::iterator it = _attributes.begin();
-	   it != _attributes.end(); ++it) {
-	if (read_attr.find(it->first) == read_attr.end()) {
-	  std::ostringstream msg;
-	  msg << "Attribute not found in file: " << it->first;
-	  throw DataFormatError(msg.str().c_str());
-	}	
-      }
-    }
-
-  public:
-    
-    /// \e
-    void run() {
-      
-      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
-      
-      bool nodes_done = false;
-      bool arcs_done = false;
-      bool attributes_done = false;
-
-      line_num = 0;      
-      readLine();
-
-      while (readSuccess()) {
-	skipSection();
-	try {
-	  char c;
-	  std::string section, caption;
-	  line >> c;
-	  _reader_bits::readIdentifier(line, section);
-	  _reader_bits::readIdentifier(line, caption);
-
-	  if (line >> c) 
-	    throw DataFormatError("Extra character on the end of line");
-
-	  if (section == "nodes" && !nodes_done) {
-	    if (_nodes_caption.empty() || _nodes_caption == caption) {
-	      readNodes();
-	      nodes_done = true;
-	    }
-	  } else if ((section == "arcs" || section == "edges") && 
-		     !arcs_done) {
-	    if (_arcs_caption.empty() || _arcs_caption == caption) {
-	      readArcs();
-	      arcs_done = true;
-	    }
-	  } else if (section == "attributes" && !attributes_done) {
-	    if (_attributes_caption.empty() || _attributes_caption == caption) {
-	      readAttributes();
-	      attributes_done = true;
-	    }
-	  } else {
-	    readLine();
-	    skipSection();
-	  }
-	} catch (DataFormatError& error) {
-	  error.line(line_num);
-	  throw;
-	}	
-      }
-
-      if (!nodes_done) {
-	throw DataFormatError("Section @nodes not found");
-      }
-
-      if (!arcs_done) {
-	throw DataFormatError("Section @arcs not found");
-      }
-
-      if (!attributes_done && !_attributes.empty()) {
-	throw DataFormatError("Section @attributes not found");
-      }
-
-    }
-    
-  };
-
-  template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
-    return DigraphReader<Digraph>(is, digraph);
-  }
-
-  template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const std::string& fn, 
-				       Digraph& digraph) {
-    return DigraphReader<Digraph>(fn, digraph);
-  }
-
-  template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
-    return DigraphReader<Digraph>(fn, digraph);
-  }
-}
-
-#endif
Index: mon/lgf_writer.h
===================================================================
--- lemon/lgf_writer.h	(revision 127)
+++ 	(revision )
@@ -1,627 +1,0 @@
-/* -*- C++ -*-
- *
- * 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.
- *
- */
-
-///\ingroup lemon_io
-///\file
-///\brief Lemon Graph Format writer.
-
-
-#ifndef LEMON_LGF_WRITER_H
-#define LEMON_LGF_WRITER_H
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <algorithm>
-
-#include <vector>
-#include <functional>
-
-#include <lemon/assert.h>
-#include <lemon/graph_utils.h>
-
-namespace lemon {
-
-  namespace _writer_bits {
-
-    template <typename Value>
-    struct DefaultConverter {
-      std::string operator()(const Value& value) {
-	std::ostringstream os;
-	os << value;
-	return os.str();
-      }
-    };
-
-    template <typename T>
-    bool operator<(const T&, const T&) {
-      throw DataFormatError("Label map is not comparable");
-    }
-
-    template <typename _Map>
-    class MapLess {
-    public:
-      typedef _Map Map;
-      typedef typename Map::Key Item;
-
-    private:
-      const Map& _map;
-      
-    public:
-      MapLess(const Map& map) : _map(map) {}
-
-      bool operator()(const Item& left, const Item& right) {
-	return _map[left] < _map[right];
-      }
-    };
-
-    template <typename _Item>    
-    class MapStorageBase {
-    public:
-      typedef _Item Item;
-
-    public:
-      MapStorageBase() {}
-      virtual ~MapStorageBase() {}
-
-      virtual std::string get(const Item& item) = 0;
-      virtual void sort(std::vector<Item>&) = 0;
-    };
-
-    template <typename _Item, typename _Map, 
-	      typename _Converter = DefaultConverter<typename _Map::Value> >
-    class MapStorage : public MapStorageBase<_Item> {
-    public:
-      typedef _Map Map;
-      typedef _Converter Converter;
-      typedef _Item Item;
-      
-    private:
-      const Map& _map;
-      Converter _converter;
-
-    public:
-      MapStorage(const Map& map, const Converter& converter = Converter()) 
-	: _map(map), _converter(converter) {}
-      virtual ~MapStorage() {}
-
-      virtual std::string get(const Item& item) {
-	return _converter(_map[item]);
-      }
-      virtual void sort(std::vector<Item>& items) {
-	MapLess<Map> less(_map);
-	std::sort(items.begin(), items.end(), less);
-      }
-    };
-
-    class ValueStorageBase {
-    public:
-      ValueStorageBase() {}
-      virtual ~ValueStorageBase() {}
-
-      virtual std::string get() = 0;      
-    };
-
-    template <typename _Value, typename _Converter = DefaultConverter<_Value> >
-    class ValueStorage : public ValueStorageBase {
-    public:
-      typedef _Value Value;
-      typedef _Converter Converter;
-
-    private:
-      const Value& _value;
-      Converter _converter;
-
-    public:
-      ValueStorage(const Value& value, const Converter& converter = Converter())
- 	: _value(value), _converter(converter) {}
-
-      virtual std::string get() {
-	return _converter(_value);
-      }
-    };
-
-    template <typename Value>
-    struct MapLookUpConverter {
-      const std::map<Value, std::string>& _map;
-      
-      MapLookUpConverter(const std::map<Value, std::string>& map) 
-	: _map(map) {}
-      
-      std::string operator()(const Value& str) {
-	typename std::map<Value, std::string>::const_iterator it = 
-	  _map.find(str);
-	if (it == _map.end()) {
-	  throw DataFormatError("Item not found");
-	}
-	return it->second;
-      }
-    };
-
-    bool isWhiteSpace(char c) {
-      return c == ' ' || c == '\t' || c == '\v' || 
-        c == '\n' || c == '\r' || c == '\f'; 
-    }
-
-    bool isEscaped(char c) {
-      return c == '\\' || c == '\"' || c == '\'' || 
-	c == '\a' || c == '\b';
-    }
-
-    static void writeEscape(std::ostream& os, char c) {
-      switch (c) {
-      case '\\':
-	os << "\\\\";
-	return;
-      case '\"':
-	os << "\\\"";
-	return;
-      case '\a':
-	os << "\\a";
-	return;
-      case '\b':
-	os << "\\b";
-	return;
-      case '\f':
-	os << "\\f";
-	return;
-      case '\r':
-	os << "\\r";
-	return;
-      case '\n':
-	os << "\\n";
-	return;
-      case '\t':
-	os << "\\t";
-	return;
-      case '\v':
-	os << "\\v";
-	return;
-      default:
-	if (c < 0x20) {
-	  os << '\\' << std::oct << static_cast<int>(c);
-	} else {
-	  os << c;
-	}
-	return;
-      }     
-    }
-
-    bool requireEscape(const std::string& str) {
-      std::istringstream is(str);
-      char c;
-      while (is.get(c)) {
-	if (isWhiteSpace(c) || isEscaped(c)) {
-	  return true;
-	}
-      }
-      return false;
-    }
-    
-    std::ostream& writeToken(std::ostream& os, const std::string& str) {
-
-      if (requireEscape(str)) {
-	os << '\"';
-	for (std::string::const_iterator it = str.begin(); 
-	     it != str.end(); ++it) {
-	  writeEscape(os, *it);
-	}	
-	os << '\"';
-      } else {
-	os << str;
-      }
-      return os;
-    }
-
-  }
-  
-  /// \e
-  template <typename _Digraph>
-  class DigraphWriter {
-  public:
-
-    typedef _Digraph Digraph;
-    GRAPH_TYPEDEFS(typename Digraph);
-    
-  private:
-
-
-    std::ostream* _os;
-    bool local_os;
-
-    Digraph& _digraph;
-
-    std::string _nodes_caption;
-    std::string _arcs_caption;
-    std::string _attributes_caption;
-    
-    typedef std::map<Node, std::string> NodeIndex;
-    NodeIndex _node_index;
-    typedef std::map<Arc, std::string> ArcIndex;
-    ArcIndex _arc_index;
-
-    typedef std::vector<std::pair<std::string, 
-      _writer_bits::MapStorageBase<Node>* > > NodeMaps;    
-    NodeMaps _node_maps; 
-
-    typedef std::vector<std::pair<std::string, 
-      _writer_bits::MapStorageBase<Arc>* > >ArcMaps;
-    ArcMaps _arc_maps;
-
-    typedef std::vector<std::pair<std::string, 
-      _writer_bits::ValueStorageBase*> > Attributes;
-    Attributes _attributes;
-
-    bool _skip_nodes;
-    bool _skip_arcs;
-
-  public:
-
-    /// \e
-    DigraphWriter(std::ostream& is, Digraph& digraph) 
-      : _os(&is), local_os(false), _digraph(digraph),
-	_skip_nodes(false), _skip_arcs(false) {}
-
-    /// \e
-    DigraphWriter(const std::string& fn, Digraph& digraph) 
-      : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
-	_skip_nodes(false), _skip_arcs(false) {}
-
-    /// \e
-    DigraphWriter(const char* fn, Digraph& digraph) 
-      : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
-	_skip_nodes(false), _skip_arcs(false) {}
-
-    DigraphWriter(DigraphWriter& other) 
-      : _os(other._os), local_os(other.local_os), _digraph(other._digraph),
-	_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
-
-      other.is = 0;
-      other.local_os = false;
-
-      _node_index.swap(other._node_index);
-      _arc_index.swap(other._arc_index);
-
-      _node_maps.swap(other._node_maps);
-      _arc_maps.swap(other._arc_maps);
-      _attributes.swap(other._attributes);
-
-      _nodes_caption = other._nodes_caption;
-      _arcs_caption = other._arcs_caption;
-      _attributes_caption = other._attributes_caption;
-    }
-
-    /// \e
-    ~DigraphWriter() {
-      for (typename NodeMaps::iterator it = _node_maps.begin(); 
-	   it != _node_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename ArcMaps::iterator it = _arc_maps.begin(); 
-	   it != _arc_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename Attributes::iterator it = _attributes.begin(); 
-	   it != _attributes.end(); ++it) {
-	delete it->second;
-      }
-
-      if (local_os) {
-	delete _os;
-      }
-    }
-
-  private:
-    
-    DigraphWriter& operator=(const DigraphWriter&);
-
-  public:
-
-    /// \e
-    template <typename Map>
-    DigraphWriter& nodeMap(const std::string& caption, const Map& map) {
-      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      _writer_bits::MapStorageBase<Node>* storage = 
-	new _writer_bits::MapStorage<Node, Map>(map);
-      _node_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Map, typename Converter>
-    DigraphWriter& nodeMap(const std::string& caption, const Map& map, 
-			   const Converter& converter = Converter()) {
-      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      _writer_bits::MapStorageBase<Node>* storage = 
-	new _writer_bits::MapStorage<Node, Map, Converter>(map, converter);
-      _node_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Map>
-    DigraphWriter& arcMap(const std::string& caption, const Map& map) {
-      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
-      _writer_bits::MapStorageBase<Arc>* storage = 
-	new _writer_bits::MapStorage<Arc, Map>(map);
-      _arc_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Map, typename Converter>
-    DigraphWriter& arcMap(const std::string& caption, const Map& map, 
-			  const Converter& converter = Converter()) {
-      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
-      _writer_bits::MapStorageBase<Arc>* storage = 
-	new _writer_bits::MapStorage<Arc, Map, Converter>(map, converter);
-      _arc_maps.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Value>
-    DigraphWriter& attribute(const std::string& caption, const Value& value) {
-      _writer_bits::ValueStorageBase* storage = 
-	new _writer_bits::ValueStorage<Value>(value);
-      _attributes.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    template <typename Value, typename Converter>
-    DigraphWriter& attribute(const std::string& caption, const Value& value, 
-			     const Converter& converter = Converter()) {
-      _writer_bits::ValueStorageBase* storage = 
-	new _writer_bits::ValueStorage<Value, Converter>(value, converter);
-      _attributes.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    DigraphWriter& node(const std::string& caption, const Node& node) {
-      typedef _writer_bits::MapLookUpConverter<Node> Converter;
-      Converter converter(_node_index);
-      _writer_bits::ValueStorageBase* storage = 
-	new _writer_bits::ValueStorage<Node, Converter>(node, converter);
-      _attributes.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    DigraphWriter& arc(const std::string& caption, const Arc& arc) {
-      typedef _writer_bits::MapLookUpConverter<Arc> Converter;
-      Converter converter(_arc_index);
-      _writer_bits::ValueStorageBase* storage = 
-	new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
-      _attributes.push_back(std::make_pair(caption, storage));
-      return *this;
-    }
-
-    /// \e
-    DigraphWriter& nodes(const std::string& caption) {
-      _nodes_caption = caption;
-      return *this;
-    }
-
-    /// \e
-    DigraphWriter& arcs(const std::string& caption) {
-      _arcs_caption = caption;
-      return *this;
-    }
-
-    /// \e
-    DigraphWriter& attributes(const std::string& caption) {
-      _attributes_caption = caption;
-      return *this;
-    }
-
-    DigraphWriter& skipNodes() {
-      LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
-      return *this;
-    }
-
-    DigraphWriter& skipArcs() {
-      LEMON_ASSERT(!_skip_arcs, "Multiple usage of skipArcs() member");
-      return *this;
-    }
-
-  private:
-
-    void writeNodes() {
-      _writer_bits::MapStorageBase<Node>* label = 0;
-      for (typename NodeMaps::iterator it = _node_maps.begin();
-	   it != _node_maps.end(); ++it) {
-        if (it->first == "label") {
-	  label = it->second;
-	  break;
-	}
-      }
-
-      *_os << "@nodes";
-      if (!_nodes_caption.empty()) {
-	*_os << ' ' << _nodes_caption;
-      }
-      *_os << std::endl;
-
-      if (label == 0) {
-	*_os << "label" << '\t';
-      }
-      for (typename NodeMaps::iterator it = _node_maps.begin();
-	   it != _node_maps.end(); ++it) {
-	*_os << it->first << '\t';
-      }
-      *_os << std::endl;
-
-      std::vector<Node> nodes;
-      for (NodeIt n(_digraph); n != INVALID; ++n) {
-	nodes.push_back(n);
-      }
-      
-      if (label == 0) {
-	IdMap<Digraph, Node> id_map(_digraph);
-	_writer_bits::MapLess<IdMap<Digraph, Node> > id_less(id_map);
-	std::sort(nodes.begin(), nodes.end(), id_less);
-      } else {
-	label->sort(nodes);
-      }
-
-      for (int i = 0; i < static_cast<int>(nodes.size()); ++i) {
-	Node n = nodes[i];
-	if (label == 0) {
-	  std::ostringstream os;
-	  os << _digraph.id(n);
-	  _writer_bits::writeToken(*_os, os.str());
-	  *_os << '\t';
-	  _node_index.insert(std::make_pair(n, os.str()));
-	}
-	for (typename NodeMaps::iterator it = _node_maps.begin();
-	     it != _node_maps.end(); ++it) {
-	  std::string value = it->second->get(n);
-	  _writer_bits::writeToken(*_os, value);
-	  if (it->first == "label") {
-	    _node_index.insert(std::make_pair(n, value));
-	  }
-	  *_os << '\t';
-	}
-	*_os << std::endl;
-      }
-    }
-
-    void writeArcs() {
-      _writer_bits::MapStorageBase<Arc>* label = 0;
-      for (typename ArcMaps::iterator it = _arc_maps.begin();
-	   it != _arc_maps.end(); ++it) {
-        if (it->first == "label") {
-	  label = it->second;
-	  break;
-	}
-      }
-
-      *_os << "@arcs";
-      if (!_arcs_caption.empty()) {
-	*_os << ' ' << _arcs_caption;
-      }
-      *_os << std::endl;
-
-      *_os << '\t' << '\t';
-      if (label == 0) {
-	*_os << "label" << '\t';
-      }
-      for (typename ArcMaps::iterator it = _arc_maps.begin();
-	   it != _arc_maps.end(); ++it) {
-	*_os << it->first << '\t';
-      }
-      *_os << std::endl;
-
-      std::vector<Arc> arcs;
-      for (ArcIt n(_digraph); n != INVALID; ++n) {
-	arcs.push_back(n);
-      }
-      
-      if (label == 0) {
-	IdMap<Digraph, Arc> id_map(_digraph);
-	_writer_bits::MapLess<IdMap<Digraph, Arc> > id_less(id_map);
-	std::sort(arcs.begin(), arcs.end(), id_less);
-      } else {
-	label->sort(arcs);
-      }
-
-      for (int i = 0; i < static_cast<int>(arcs.size()); ++i) {
-	Arc a = arcs[i];
-	_writer_bits::writeToken(*_os, _node_index.
-				 find(_digraph.source(a))->second);
-	*_os << '\t';
-	_writer_bits::writeToken(*_os, _node_index.
-				 find(_digraph.target(a))->second);
-	*_os << '\t';
-	if (label == 0) {
-	  std::ostringstream os;
-	  os << _digraph.id(a);
-	  _writer_bits::writeToken(*_os, os.str());
-	  *_os << '\t';
-	  _arc_index.insert(std::make_pair(a, os.str()));
-	}
-	for (typename ArcMaps::iterator it = _arc_maps.begin();
-	     it != _arc_maps.end(); ++it) {
-	  std::string value = it->second->get(a);
-	  _writer_bits::writeToken(*_os, value);
-	  if (it->first == "label") {
-	    _arc_index.insert(std::make_pair(a, value));
-	  }
-	  *_os << '\t';
-	}
-	*_os << std::endl;
-      }
-    }
-
-    void writeAttributes() {
-      if (_attributes.empty()) return;
-      *_os << "@attributes";
-      if (!_attributes_caption.empty()) {
-	*_os << ' ' << _attributes_caption;
-      }
-      *_os << std::endl;
-      for (typename Attributes::iterator it = _attributes.begin();
-	   it != _attributes.end(); ++it) {
-	*_os << it->first << ' ';
-	_writer_bits::writeToken(*_os, it->second->get());
-	*_os << std::endl;
-      }
-    }
-    
-  public:
-    
-    /// \e
-    void run() {
-      if (!_skip_nodes) {
-	writeNodes();
-      }
-      if (!_skip_arcs) {      
-	writeArcs();
-      }
-      writeAttributes();
-    }
-
-    /// \e
-    std::ostream& stream() {
-      return *_os;
-    }
-  };
-
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(std::istream& is, Digraph& digraph) {
-    return DigraphWriter<Digraph>(is, digraph);
-  }
-
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const std::string& fn, 
-				       Digraph& digraph) {
-    return DigraphWriter<Digraph>(fn, digraph);
-  }
-
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const char* fn, Digraph& digraph) {
-    return DigraphWriter<Digraph>(fn, digraph);
-  }
-}
-
-#endif
Index: lemon/maps.h
===================================================================
--- lemon/maps.h	(revision 123)
+++ lemon/maps.h	(revision 104)
@@ -117,5 +117,5 @@
 
     /// Constructor with specified initial value.
-    /// \param v The initial value of the map.
+    /// \param v is the initial value of the map.
     ConstMap(const Value &v) : _value(v) {}
 
@@ -142,9 +142,4 @@
   inline ConstMap<K, V> constMap(const V &v) {
     return ConstMap<K, V>(v);
-  }
-
-  template<typename K, typename V>
-  inline ConstMap<K, V> constMap() {
-    return ConstMap<K, V>();
   }
 
@@ -619,5 +614,5 @@
 	   typename V = typename F::result_type>
   class FunctorToMap : public MapBase<K, V> {
-    F _f;
+    const F &_f;
   public:
     typedef MapBase<K, V> Parent;
Index: lemon/random.h
===================================================================
--- lemon/random.h	(revision 116)
+++ lemon/random.h	(revision 110)
@@ -796,5 +796,5 @@
 	  }
       } while(nu>std::pow(xi,delta-1.0)*std::exp(-xi));
-      return theta*(xi+gamma(int(std::floor(k))));
+      return theta*(xi-gamma(int(std::floor(k))));
     }
     
@@ -820,5 +820,5 @@
     double pareto(double k,double x_min)
     {
-      return exponential(gamma(k,1.0/x_min))+x_min;
+      return exponential(gamma(k,1.0/x_min));
     }  
       
Index: lemon/smart_graph.h
===================================================================
--- lemon/smart_graph.h	(revision 125)
+++ lemon/smart_graph.h	(revision 109)
@@ -471,6 +471,6 @@
     Node target(Arc e) const { return Node(arcs[e._id].target); }
 
-    Node u(Edge e) const { return Node(arcs[2 * e._id].target); }
-    Node v(Edge e) const { return Node(arcs[2 * e._id + 1].target); }
+    Node source(Edge e) const { return Node(arcs[2 * e._id].target); }
+    Node target(Edge e) const { return Node(arcs[2 * e._id + 1].target); }
 
     static bool direction(Arc e) {
Index: mon/time_measure.h
===================================================================
--- lemon/time_measure.h	(revision 126)
+++ 	(revision )
@@ -1,576 +1,0 @@
-/* -*- C++ -*-
- *
- * 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_TIME_MEASURE_H
-#define LEMON_TIME_MEASURE_H
-
-///\ingroup timecount
-///\file
-///\brief Tools for measuring cpu usage
-
-#ifdef WIN32
-#include <windows.h>
-#include <cmath>
-#else
-#include <sys/times.h>
-#include <sys/time.h>
-#endif
-
-#include <fstream>
-#include <iostream>
-
-namespace lemon {
-
-  /// \addtogroup timecount
-  /// @{
-
-  /// A class to store (cpu)time instances.
-
-  /// This class stores five time values.
-  /// - a real time
-  /// - a user cpu time
-  /// - a system cpu time
-  /// - a user cpu time of children
-  /// - a system cpu time of children
-  ///
-  /// TimeStamp's can be added to or substracted from each other and
-  /// they can be pushed to a stream.
-  ///
-  /// In most cases, perhaps the \ref Timer or the \ref TimeReport
-  /// class is what you want to use instead.
-  ///
-  ///\author Alpar Juttner
-
-  class TimeStamp
-  {
-    double utime;
-    double stime;
-    double cutime;
-    double cstime;
-    double rtime;
-  
-    void _reset() { 
-      utime = stime = cutime = cstime = rtime = 0;
-    }
-
-  public:
-
-    ///Read the current time values of the process
-    void stamp()
-    {
-#ifndef WIN32
-      timeval tv;
-      gettimeofday(&tv, 0);
-      rtime=tv.tv_sec+double(tv.tv_usec)/1e6;
-
-      tms ts;
-      double tck=sysconf(_SC_CLK_TCK);
-      times(&ts);
-      utime=ts.tms_utime/tck;
-      stime=ts.tms_stime/tck;
-      cutime=ts.tms_cutime/tck;
-      cstime=ts.tms_cstime/tck;
-#else
-      static const double ch = 4294967296.0e-7;
-      static const double cl = 1.0e-7;
-
-      FILETIME system;
-      GetSystemTimeAsFileTime(&system);
-      rtime = ch * system.dwHighDateTime + cl * system.dwLowDateTime;
-
-      FILETIME create, exit, kernel, user;
-      if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
-	utime = ch * user.dwHighDateTime + cl * user.dwLowDateTime;
-	stime = ch * kernel.dwHighDateTime + cl * kernel.dwLowDateTime;
-	cutime = 0;
-	cstime = 0;
-      } else {
-	rtime = 0;
-	utime = 0;
-	stime = 0;
-	cutime = 0;
-	cstime = 0;
-      }
-#endif      
-    }
-  
-    /// Constructor initializing with zero
-    TimeStamp()
-    { _reset(); }
-    ///Constructor initializing with the current time values of the process
-    TimeStamp(void *) { stamp();}
-  
-    ///Set every time value to zero
-    TimeStamp &reset() {_reset();return *this;}
-
-    ///\e
-    TimeStamp &operator+=(const TimeStamp &b)
-    {
-      utime+=b.utime;
-      stime+=b.stime;
-      cutime+=b.cutime;
-      cstime+=b.cstime;
-      rtime+=b.rtime;
-      return *this;
-    }
-    ///\e
-    TimeStamp operator+(const TimeStamp &b) const
-    {
-      TimeStamp t(*this);
-      return t+=b;
-    }
-    ///\e
-    TimeStamp &operator-=(const TimeStamp &b)
-    {
-      utime-=b.utime;
-      stime-=b.stime;
-      cutime-=b.cutime;
-      cstime-=b.cstime;
-      rtime-=b.rtime;
-      return *this;
-    }
-    ///\e
-    TimeStamp operator-(const TimeStamp &b) const
-    {
-      TimeStamp t(*this);
-      return t-=b;
-    }
-    ///\e
-    TimeStamp &operator*=(double b)
-    {
-      utime*=b;
-      stime*=b;
-      cutime*=b;
-      cstime*=b;
-      rtime*=b;
-      return *this;
-    }
-    ///\e
-    TimeStamp operator*(double b) const
-    {
-      TimeStamp t(*this);
-      return t*=b;
-    }
-    friend TimeStamp operator*(double b,const TimeStamp &t);
-    ///\e
-    TimeStamp &operator/=(double b)
-    {
-      utime/=b;
-      stime/=b;
-      cutime/=b;
-      cstime/=b;
-      rtime/=b;
-      return *this;
-    }
-    ///\e
-    TimeStamp operator/(double b) const
-    {
-      TimeStamp t(*this);
-      return t/=b;
-    }
-    ///The time ellapsed since the last call of stamp()
-    TimeStamp ellapsed() const
-    {
-      TimeStamp t(NULL);
-      return t-*this;
-    }
-  
-    friend std::ostream& operator<<(std::ostream& os,const TimeStamp &t);
-  
-    ///Gives back the user time of the process
-    double userTime() const
-    {
-      return utime;
-    }
-    ///Gives back the system time of the process
-    double systemTime() const
-    {
-      return stime;
-    }
-    ///Gives back the user time of the process' children
-
-    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
-    ///
-    double cUserTime() const
-    {
-      return cutime;
-    }
-    ///Gives back the user time of the process' children
-
-    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
-    ///
-    double cSystemTime() const
-    {
-      return cstime;
-    }
-    ///Gives back the real time
-    double realTime() const {return rtime;}
-  };
-
-  TimeStamp operator*(double b,const TimeStamp &t) 
-  {
-    return t*b;
-  }
-  
-  ///Prints the time counters
-
-  ///Prints the time counters in the following form:
-  ///
-  /// <tt>u: XX.XXs s: XX.XXs cu: XX.XXs cs: XX.XXs real: XX.XXs</tt>
-  ///
-  /// where the values are the
-  /// \li \c u: user cpu time,
-  /// \li \c s: system cpu time,
-  /// \li \c cu: user cpu time of children,
-  /// \li \c cs: system cpu time of children,
-  /// \li \c real: real time.
-  /// \relates TimeStamp
-  /// \note On <tt>WIN32</tt> platform the cummulative values are not
-  /// calculated.
-  inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t)
-  {
-    os << "u: " << t.userTime() <<
-      "s, s: " << t.systemTime() <<
-      "s, cu: " << t.cUserTime() <<
-      "s, cs: " << t.cSystemTime() <<
-      "s, real: " << t.realTime() << "s";
-    return os;
-  }
-
-  ///Class for measuring the cpu time and real time usage of the process
-
-  ///Class for measuring the cpu time and real time usage of the process.
-  ///It is quite easy-to-use, here is a short example.
-  ///\code
-  /// #include<lemon/time_measure.h>
-  /// #include<iostream>
-  ///
-  /// int main()
-  /// {
-  ///
-  ///   ...
-  ///
-  ///   Timer t;
-  ///   doSomething();
-  ///   std::cout << t << '\n';
-  ///   t.restart();
-  ///   doSomethingElse();
-  ///   std::cout << t << '\n';
-  ///
-  ///   ...
-  ///
-  /// }
-  ///\endcode
-  ///
-  ///The \ref Timer can also be \ref stop() "stopped" and
-  ///\ref start() "started" again, so it is possible to compute collected
-  ///running times.
-  ///
-  ///\warning Depending on the operation system and its actual configuration
-  ///the time counters have a certain (10ms on a typical Linux system)
-  ///granularity.
-  ///Therefore this tool is not appropriate to measure very short times.
-  ///Also, if you start and stop the timer very frequently, it could lead to
-  ///distorted results.
-  ///
-  ///\note If you want to measure the running time of the execution of a certain
-  ///function, consider the usage of \ref TimeReport instead.
-  ///
-  ///\todo This shouldn't be Unix (Linux) specific.
-  ///\sa TimeReport
-  ///
-  ///\author Alpar Juttner
-  class Timer
-  {
-    int _running; //Timer is running iff _running>0; (_running>=0 always holds)
-    TimeStamp start_time; //This is the relativ start-time if the timer
-                          //is _running, the collected _running time otherwise.
-    
-    void _reset() {if(_running) start_time.stamp(); else start_time.reset();}
-  
-  public: 
-    ///Constructor.
-
-    ///\param run indicates whether or not the timer starts immediately.
-    ///
-    Timer(bool run=true) :_running(run) {_reset();}
-
-    ///\name Control the state of the timer
-    ///Basically a Timer can be either running or stopped,
-    ///but it provides a bit finer control on the execution.
-    ///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.
-    ///
-
-    ///@{
-
-    ///Reset and stop the time counters
-
-    ///This function resets and stops the time counters
-    ///\sa restart()
-    void reset()
-    {
-      _running=0;
-      _reset();
-    }
-
-    ///Start the time counters
-    
-    ///This function starts the time counters.
-    ///
-    ///If the timer is started more than ones, it will remain running
-    ///until the same amount of \ref stop() is called.
-    ///\sa stop()
-    void start() 
-    {
-      if(_running) _running++;
-      else {
-	_running=1;
-	TimeStamp t;
-	t.stamp();
-	start_time=t-start_time;
-      }
-    }
-
-    
-    ///Stop the time counters
-
-    ///This function stops the time counters. If start() was executed more than
-    ///once, then the same number of stop() execution is necessary the really
-    ///stop the timer.
-    /// 
-    ///\sa halt()
-    ///\sa start()
-    ///\sa restart()
-    ///\sa reset()
-
-    void stop() 
-    {
-      if(_running && !--_running) {
-	TimeStamp t;
-	t.stamp();
-	start_time=t-start_time;
-      }
-    }
-
-    ///Halt (i.e stop immediately) the time counters
-
-    ///This function stops immediately the time counters, i.e. <tt>t.halt()</tt>
-    ///is a faster
-    ///equivalent of the following.
-    ///\code
-    ///  while(t.running()) t.stop()
-    ///\endcode
-    ///
-    ///
-    ///\sa stop()
-    ///\sa restart()
-    ///\sa reset()
-
-    void halt() 
-    {
-      if(_running) {
-	_running=0;
-	TimeStamp t;
-	t.stamp();
-	start_time=t-start_time;
-      }
-    }
-
-    ///Returns the running state of the timer
-
-    ///This function returns the number of stop() exections that is
-    ///necessary to really stop the timer.
-    ///For example the timer
-    ///is running if and only if the return value is \c true
-    ///(i.e. greater than
-    ///zero).
-    int running()  { return _running; }
-    
-    
-    ///Restart the time counters
-
-    ///This function is a shorthand for
-    ///a reset() and a start() calls.
-    ///
-    void restart() 
-    {
-      reset();
-      start();
-    }
-    
-    ///@}
-
-    ///\name Query Functions for the ellapsed time
-
-    ///@{
-
-    ///Gives back the ellapsed user time of the process
-    double userTime() const
-    {
-      return operator TimeStamp().userTime();
-    }
-    ///Gives back the ellapsed system time of the process
-    double systemTime() const
-    {
-      return operator TimeStamp().systemTime();
-    }
-    ///Gives back the ellapsed user time of the process' children
-
-    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
-    ///
-    double cUserTime() const
-    {
-      return operator TimeStamp().cUserTime();
-    }
-    ///Gives back the ellapsed user time of the process' children
-
-    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
-    ///
-    double cSystemTime() const
-    {
-      return operator TimeStamp().cSystemTime();
-    }
-    ///Gives back the ellapsed real time
-    double realTime() const
-    {
-      return operator TimeStamp().realTime();
-    }
-    ///Computes the ellapsed time
-
-    ///This conversion computes the ellapsed time, therefore you can print
-    ///the ellapsed time like this.
-    ///\code
-    ///  Timer t;
-    ///  doSomething();
-    ///  std::cout << t << '\n';
-    ///\endcode
-    operator TimeStamp () const
-    {
-      TimeStamp t;
-      t.stamp();
-      return _running?t-start_time:start_time;
-    }
-
-
-    ///@}
-  };
-
-  ///Same as \ref Timer but prints a report on destruction.
-
-  ///Same as \ref Timer but prints a report on destruction.
-  ///This example shows its usage.
-  ///\code
-  ///  void myAlg(ListGraph &g,int n)
-  ///  {
-  ///    TimeReport tr("Running time of myAlg: ");
-  ///    ... //Here comes the algorithm
-  ///  }
-  ///\endcode
-  ///
-  ///\sa Timer
-  ///\sa NoTimeReport
-  ///\todo There is no test case for this
-  class TimeReport : public Timer 
-  {
-    std::string _title;
-    std::ostream &_os;
-  public:
-    ///\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){}
-    ///\e Prints the ellapsed time on destruction.
-    ~TimeReport() 
-    {
-      _os << _title << *this << std::endl;
-    }
-  };
-      
-  ///'Do nothing' version of \ref TimeReport
-
-  ///\sa TimeReport
-  ///
-  class NoTimeReport
-  {
-  public:
-    ///\e
-    NoTimeReport(std::string,std::ostream &,bool) {}
-    ///\e
-    NoTimeReport(std::string,std::ostream &) {}
-    ///\e
-    NoTimeReport(std::string) {}
-    ///\e Do nothing.
-    ~NoTimeReport() {}
-
-    operator TimeStamp () const { return TimeStamp(); }
-    void reset() {}
-    void start() {}
-    void stop() {}
-    void halt() {} 
-    int running() { return 0; }
-    void restart() {}
-    double userTime() const { return 0; }
-    double systemTime() const { return 0; }
-    double cUserTime() const { return 0; }
-    double cSystemTime() const { return 0; }
-    double realTime() const { return 0; }
-  };
-      
-  ///Tool to measure the running time more exactly.
-  
-  ///This function calls \c f several times and returns the average
-  ///running time. The number of the executions will be choosen in such a way
-  ///that the full real running time will be roughly between \c min_time
-  ///and <tt>2*min_time</tt>.
-  ///\param f the function object to be measured.
-  ///\param min_time the minimum total running time.
-  ///\retval num if it is not \c NULL, then the actual
-  ///        number of execution of \c f will be written into <tt>*num</tt>.
-  ///\retval full_time if it is not \c NULL, then the actual
-  ///        total running time will be written into <tt>*full_time</tt>.
-  ///\return The average running time of \c f.
-  
-  template<class F>
-  TimeStamp runningTimeTest(F f,double min_time=10,unsigned int *num = NULL,
-                            TimeStamp *full_time=NULL)
-  {
-    TimeStamp full;
-    unsigned int total=0;
-    Timer t;
-    for(unsigned int tn=1;tn <= 1U<<31 && full.realTime()<=min_time; tn*=2) {
-      for(;total<tn;total++) f();
-      full=t;
-    }
-    if(num) *num=total;
-    if(full_time) *full_time=full;
-    return full/total;
-  }
-  
-  /// @}  
-
-
-} //namespace lemon
-
-#endif //LEMON_TIME_MEASURE_H
Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 119)
+++ test/Makefile.am	(revision 108)
@@ -10,5 +10,4 @@
 check_PROGRAMS += \
 	test/bfs_test \
-        test/counter_test \
 	test/dfs_test \
 	test/digraph_test \
@@ -22,5 +21,4 @@
         test/test_tools_fail \
         test/test_tools_pass \
-        test/time_measure_test \
 	test/unionfind_test
 
@@ -29,5 +27,4 @@
 
 test_bfs_test_SOURCES = test/bfs_test.cc
-test_counter_test_SOURCES = test/counter_test.cc
 test_dfs_test_SOURCES = test/dfs_test.cc
 test_digraph_test_SOURCES = test/digraph_test.cc
@@ -42,4 +39,3 @@
 test_test_tools_fail_SOURCES = test/test_tools_fail.cc
 test_test_tools_pass_SOURCES = test/test_tools_pass.cc
-test_time_measure_test_SOURCES = test/time_measure_test.cc
 test_unionfind_test_SOURCES = test/unionfind_test.cc
Index: st/counter_test.cc
===================================================================
--- test/counter_test.cc	(revision 119)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/* -*- C++ -*-
- *
- * 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.
- *
- */
-
-#include <lemon/counter.h>
-
-///\file \brief Test cases for time_measure.h
-///
-///\todo To be extended
-
-
-int fibonacci(int f) 
-{
-  static lemon::Counter count("Fibonacci steps: ");
-  count++;
-  if(f<1) return 0;
-  else if(f==1) return 1;
-  else return fibonacci(f-1)+fibonacci(f-2);
-}
-
-int main()
-{
-  fibonacci(10);
-  
-  {  
-    typedef lemon::Counter MyCounter;
-    MyCounter c("Main counter: ");
-    c++;
-    c++;
-    MyCounter::SubCounter d(c,"Subcounter: ");
-    d++;
-    d++;
-    MyCounter::SubCounter::SubCounter e(d,"SubSubCounter: ");
-    e++;
-    e++;
-  }
-  
-  {
-    typedef lemon::NoCounter MyCounter;
-    MyCounter c("Main counter: ");
-    c++;
-    c++;
-    MyCounter::SubCounter d(c,"Subcounter: ");
-    d++;
-    d++;
-    MyCounter::SubCounter::SubCounter e(d,"SubSubCounter: ");
-    e++;
-    e++;
-  }
-
-  return 0;
-}
Index: test/error_test.cc
===================================================================
--- test/error_test.cc	(revision 118)
+++ test/error_test.cc	(revision 108)
@@ -40,6 +40,14 @@
 }
 
+void no_assertion_exception_disable() {
+  LEMON_ASSERT(true, Exception());
+}
+
 void assertion_text_disable() {
   LEMON_ASSERT(false, "This is a fault message");
+}
+
+void assertion_exception_disable() {
+  LEMON_ASSERT(false, Exception());
 }
 
@@ -50,8 +58,144 @@
 void check_assertion_disable() {
   no_assertion_text_disable();
+  no_assertion_exception_disable();
+  assertion_exception_disable();
   assertion_text_disable();
   fixme_disable();
 }
 #undef LEMON_DISABLE_ASSERTS
+
+
+#define LEMON_ASSERT_ERROR
+#include <lemon/assert.h>
+
+void no_assertion_text_error() {
+  LEMON_ASSERT(true, "This is a fault message");
+}
+
+void no_assertion_exception_error() {
+  LEMON_ASSERT(true, Exception());
+}
+
+void assertion_text_error() {
+  LEMON_ASSERT(false, "This is a fault message");
+}
+
+void assertion_exception_error() {
+  LEMON_ASSERT(false, Exception());
+}
+
+void fixme_error() {
+  LEMON_FIXME("fixme_error() is fixme!");
+}
+
+void check_assertion_error() {
+  no_assertion_text_error();
+  no_assertion_exception_error();
+  try {
+    assertion_exception_error();
+    check(false, "Assertion error");
+  } catch (const AssertionFailedError& e) {
+  }
+
+  try {
+    assertion_text_error();
+    check(false, "Assertion error");
+  } catch (const AssertionFailedError& e) {
+  }
+
+  try {
+    fixme_error();
+    check(false, "Assertion error");
+  } catch (const AssertionFailedError& e) {
+  }
+}
+#undef LEMON_ASSERT_ERROR
+
+#define LEMON_ASSERT_EXCEPTION
+#include <lemon/assert.h>
+
+void no_assertion_text_exception() {
+  LEMON_ASSERT(true, "This is a fault message");
+}
+
+void no_assertion_exception_exception() {
+  LEMON_ASSERT(true, Exception());
+}
+
+void assertion_text_exception() {
+  LEMON_ASSERT(false, "This is a fault message");
+}
+
+void assertion_exception_exception() {
+  LEMON_ASSERT(false, Exception());
+}
+
+void fixme_exception() {
+  LEMON_FIXME("fixme_exception() is fixme!");
+}
+
+void check_assertion_exception() {
+  no_assertion_text_exception();
+  no_assertion_exception_exception();
+  try {
+    assertion_exception_exception();
+    check(false, "Assertion error");
+  } catch (const Exception& e) {
+  }
+
+  try {
+    assertion_text_exception();
+    check(false, "Assertion error");
+  } catch (const AssertionFailedError& e) {
+  }
+
+  try {
+    assertion_text_exception();
+    check(false, "Assertion error");
+  } catch (const AssertionFailedError& e) {
+  }
+
+  try {
+    fixme_exception();
+    check(false, "Assertion error");
+  } catch (const AssertionFailedError& e) {
+  }
+}
+#undef LEMON_ASSERT_EXCEPTION
+
+#define LEMON_ASSERT_LOG
+
+#include <lemon/assert.h>
+
+void no_assertion_text_log() {
+  LEMON_ASSERT(true, "This is a fault message");
+}
+
+void no_assertion_exception_log() {
+  LEMON_ASSERT(true, Exception());
+}
+
+void assertion_text_log() {
+  LEMON_ASSERT(false, "This is a fault message");
+}
+
+void assertion_exception_log() {
+  LEMON_ASSERT(false, Exception());
+}
+
+void fixme_log() {
+  LEMON_FIXME("fixme_log() is fixme!");
+}
+
+void check_assertion_log() {
+  no_assertion_text_log();
+  no_assertion_exception_log();
+  std::cerr << "The next 3 failure messages are expected: " << std::endl;
+  assertion_exception_log();
+  assertion_text_log();
+  fixme_log();
+  std::cerr << "End of expected error messages" << std::endl;
+}
+#undef LEMON_ASSERT_LOG
 
 #define LEMON_ASSERT_CUSTOM
@@ -63,4 +207,15 @@
 }
 
+void my_assert_handler(const char*, int, const char*, 
+		       const std::exception&, const char*) {
+  ++cnt;
+}
+
+void my_assert_handler(const char*, int, const char*, 
+		       const std::string&, const char*) {
+  ++cnt;
+}
+
+
 #define LEMON_CUSTOM_ASSERT_HANDLER my_assert_handler
 #include <lemon/assert.h>
@@ -70,6 +225,14 @@
 }
 
+void no_assertion_exception_custom() {
+  LEMON_ASSERT(true, Exception());
+}
+
 void assertion_text_custom() {
   LEMON_ASSERT(false, "This is a fault message");
+}
+
+void assertion_exception_custom() {
+  LEMON_ASSERT(false, Exception());
 }
 
@@ -80,7 +243,9 @@
 void check_assertion_custom() {
   no_assertion_text_custom();
+  no_assertion_exception_custom();
+  assertion_exception_custom();
   assertion_text_custom();
   fixme_custom();
-  check(cnt == 2, "The custom assert handler does not work");
+  check(cnt == 3, "The custom assert handler does not work");
 }
 
@@ -90,4 +255,7 @@
 int main() {
   check_assertion_disable();
+  check_assertion_error();
+  check_assertion_exception();
+  check_assertion_log();
   check_assertion_custom();
 
Index: test/maps_test.cc
===================================================================
--- test/maps_test.cc	(revision 123)
+++ test/maps_test.cc	(revision 94)
@@ -84,15 +84,9 @@
   {
     checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >();
-    checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >();
     ConstMap<A,B> map1;
     ConstMap<A,B> map2(B());
     ConstMap<A,B> map3 = map1;
     map1 = constMap<A>(B());
-    map1 = constMap<A,B>();
     map1.setAll(B());
-    ConstMap<A,C> map4(C(1));
-    ConstMap<A,C> map5 = map4;
-    map4 = constMap<A>(C(2));
-    map4.setAll(C(3));
 
     checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >();
@@ -100,9 +94,8 @@
 
     checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >();
-    ConstMap<A,Const<int,10> > map6;
-    ConstMap<A,Const<int,10> > map7 = map6;
-    map6 = constMap<A,int,10>();
-    map7 = constMap<A,Const<int,10> >();
-    check(map6[A()] == 10 && map7[A()] == 10, "Something is wrong with ConstMap");
+    ConstMap<A,Const<int,10> > map4;
+    ConstMap<A,Const<int,10> > map5 = map4;
+    map4 = map5;
+    check(map4[A()] == 10 && map5[A()] == 10, "Something is wrong with ConstMap");
   }
 
Index: st/time_measure_test.cc
===================================================================
--- test/time_measure_test.cc	(revision 119)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/* -*- C++ -*-
- *
- * 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.
- *
- */
-
-#include <lemon/time_measure.h>
-
-///\file \brief Test cases for time_measure.h
-///
-///\todo To be extended
-
-
-using namespace lemon;
-
-void f() 
-{
-  double d=0;
-  for(int i=0;i<1000;i++)
-    d+=0.1;
-}
-
-void g() 
-{
-  static Timer T;
-  
-  for(int i=0;i<1000;i++)
-    TimeStamp x(T);
-}
-
-int main()
-{
-  Timer T;
-  unsigned int n;
-  for(n=0;T.realTime()<1.0;n++) ;
-  std::cout << T << " (" << n << " time queries)\n";
-  T.restart();
-  while(T.realTime()<2.0) ;
-  std::cout << T << '\n';
-  TimeStamp full;
-  TimeStamp t;
-  t=runningTimeTest(f,1,&n,&full);
-  std::cout << t << " (" << n << " tests)\n";
-  std::cout << "Total: " << full << "\n";
-  
-  t=runningTimeTest(g,1,&n,&full);
-  std::cout << t << " (" << n << " tests)\n";
-  std::cout << "Total: " << full << "\n";
-  
-  return 0;
-}
