Index: lemon/lgf_writer.h
===================================================================
--- lemon/lgf_writer.h	(revision 631)
+++ lemon/lgf_writer.h	(revision 645)
@@ -348,17 +348,15 @@
   }
 
-  template <typename Digraph>
+  template <typename DGR>
   class DigraphWriter;
 
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       std::ostream& os = std::cout);
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const std::string& fn);
-
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const char* fn);
+  template <typename TDGR>
+  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
+                                   std::ostream& os = std::cout);
+  template <typename TDGR>
+  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const std::string& fn);
+
+  template <typename TDGR>
+  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const char* fn);
 
 
@@ -382,5 +380,5 @@
   ///
   ///\code
-  /// DigraphWriter<Digraph>(digraph, std::cout).
+  /// DigraphWriter<DGR>(digraph, std::cout).
   ///   nodeMap("coordinates", coord_map).
   ///   nodeMap("size", size).
@@ -407,10 +405,10 @@
   /// the \c ostream() function, hence the second pass can append its
   /// output to the output of the first pass.
-  template <typename GR>
+  template <typename DGR>
   class DigraphWriter {
   public:
 
-    typedef GR Digraph;
-    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
+    typedef DGR Digraph;
+    TEMPLATE_DIGRAPH_TYPEDEFS(DGR);
 
   private:
@@ -420,5 +418,5 @@
     bool local_os;
 
-    const Digraph& _digraph;
+    const DGR& _digraph;
 
     std::string _nodes_caption;
@@ -452,5 +450,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output stream.
-    DigraphWriter(const Digraph& digraph, std::ostream& os = std::cout)
+    DigraphWriter(const DGR& digraph, std::ostream& os = std::cout)
       : _os(&os), local_os(false), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {}
@@ -460,5 +458,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    DigraphWriter(const Digraph& digraph, const std::string& fn)
+    DigraphWriter(const DGR& digraph, const std::string& fn)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {
@@ -473,5 +471,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    DigraphWriter(const Digraph& digraph, const char* fn)
+    DigraphWriter(const DGR& digraph, const char* fn)
       : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {
@@ -506,13 +504,13 @@
   private:
 
-    template <typename DGR>
-    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph, 
-                                            std::ostream& os);
-    template <typename DGR>
-    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph,
-                                            const std::string& fn);
-    template <typename DGR>
-    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph,
-                                            const char *fn);
+    template <typename TDGR>
+    friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
+                                             std::ostream& os);
+    template <typename TDGR>
+    friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
+                                             const std::string& fn);
+    template <typename TDGR>
+    friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
+                                             const char *fn);
 
     DigraphWriter(DigraphWriter& other)
@@ -539,5 +537,5 @@
   public:
 
-    /// \name Writing Rules
+    /// \name Writing rules
     /// @{
 
@@ -642,5 +640,5 @@
     }
 
-    /// \name Section Captions
+    /// \name Section captions
     /// @{
 
@@ -669,5 +667,5 @@
     }
 
-    /// \name Skipping Section
+    /// \name Skipping section
     /// @{
 
@@ -725,6 +723,6 @@
 
       if (label == 0) {
-        IdMap<Digraph, Node> id_map(_digraph);
-        _writer_bits::MapLess<IdMap<Digraph, Node> > id_less(id_map);
+        IdMap<DGR, Node> id_map(_digraph);
+        _writer_bits::MapLess<IdMap<DGR, Node> > id_less(id_map);
         std::sort(nodes.begin(), nodes.end(), id_less);
       } else {
@@ -810,6 +808,6 @@
 
       if (label == 0) {
-        IdMap<Digraph, Arc> id_map(_digraph);
-        _writer_bits::MapLess<IdMap<Digraph, Arc> > id_less(id_map);
+        IdMap<DGR, Arc> id_map(_digraph);
+        _writer_bits::MapLess<IdMap<DGR, Arc> > id_less(id_map);
         std::sort(arcs.begin(), arcs.end(), id_less);
       } else {
@@ -886,5 +884,5 @@
   public:
 
-    /// \name Execution of the Writer
+    /// \name Execution of the writer
     /// @{
 
@@ -916,12 +914,51 @@
   };
 
+  /// \ingroup lemon_io
+  ///
+  /// \brief Return a \ref DigraphWriter class
+  ///
+  /// This function just returns a \ref DigraphWriter class. 
+  ///
+  /// With this function a digraph can be write to a file or output
+  /// stream in \ref lgf-format "LGF" format with several maps and
+  /// attributes. For example, with the following code a network flow
+  /// problem can be written to the standard output, i.e. a digraph
+  /// with a \e capacity map on the arcs and \e source and \e target
+  /// nodes:
+  ///
+  ///\code
+  ///ListDigraph digraph;
+  ///ListDigraph::ArcMap<int> cap(digraph);
+  ///ListDigraph::Node src, trg;
+  ///  // Setting the capacity map and source and target nodes
+  ///digraphWriter(digraph, std::cout).
+  ///  arcMap("capacity", cap).
+  ///  node("source", src).
+  ///  node("target", trg).
+  ///  run();
+  ///\endcode
+  ///
+  /// For a complete documentation, please see the \ref DigraphWriter
+  /// class documentation.
+  /// \warning Don't forget to put the \ref DigraphWriter::run() "run()"
+  /// to the end of the parameter list.
+  /// \relates DigraphWriter
+  /// \sa digraphWriter(const TDGR& digraph, const std::string& fn)
+  /// \sa digraphWriter(const TDGR& digraph, const char* fn)
+  template <typename TDGR>
+  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, std::ostream& os) {
+    DigraphWriter<TDGR> tmp(digraph, os);
+    return tmp;
+  }
+
   /// \brief Return a \ref DigraphWriter class
   ///
   /// This function just returns a \ref DigraphWriter class.
   /// \relates DigraphWriter
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       std::ostream& os) {
-    DigraphWriter<Digraph> tmp(digraph, os);
+  /// \sa digraphWriter(const TDGR& digraph, std::ostream& os)
+  template <typename TDGR>
+  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
+                                    const std::string& fn) {
+    DigraphWriter<TDGR> tmp(digraph, fn);
     return tmp;
   }
@@ -931,32 +968,20 @@
   /// This function just returns a \ref DigraphWriter class.
   /// \relates DigraphWriter
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const std::string& fn) {
-    DigraphWriter<Digraph> tmp(digraph, fn);
+  /// \sa digraphWriter(const TDGR& digraph, std::ostream& os)
+  template <typename TDGR>
+  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const char* fn) {
+    DigraphWriter<TDGR> tmp(digraph, fn);
     return tmp;
   }
 
-  /// \brief Return a \ref DigraphWriter class
-  ///
-  /// This function just returns a \ref DigraphWriter class.
-  /// \relates DigraphWriter
-  template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const char* fn) {
-    DigraphWriter<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
-
-  template <typename Graph>
+  template <typename GR>
   class GraphWriter;
 
-  template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph,
-                                 std::ostream& os = std::cout);
-  template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn);
-  template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn);
+  template <typename TGR>
+  GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os = std::cout);
+  template <typename TGR>
+  GraphWriter<TGR> graphWriter(const TGR& graph, const std::string& fn);
+  template <typename TGR>
+  GraphWriter<TGR> graphWriter(const TGR& graph, const char* fn);
 
   /// \ingroup lemon_io
@@ -980,5 +1005,5 @@
 
     typedef GR Graph;
-    TEMPLATE_GRAPH_TYPEDEFS(Graph);
+    TEMPLATE_GRAPH_TYPEDEFS(GR);
 
   private:
@@ -988,5 +1013,5 @@
     bool local_os;
 
-    const Graph& _graph;
+    const GR& _graph;
 
     std::string _nodes_caption;
@@ -1020,5 +1045,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output stream.
-    GraphWriter(const Graph& graph, std::ostream& os = std::cout)
+    GraphWriter(const GR& graph, std::ostream& os = std::cout)
       : _os(&os), local_os(false), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {}
@@ -1028,5 +1053,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    GraphWriter(const Graph& graph, const std::string& fn)
+    GraphWriter(const GR& graph, const std::string& fn)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {
@@ -1041,5 +1066,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    GraphWriter(const Graph& graph, const char* fn)
+    GraphWriter(const GR& graph, const char* fn)
       : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {
@@ -1074,13 +1099,11 @@
   private:
 
-    template <typename Graph>
-    friend GraphWriter<Graph> graphWriter(const Graph& graph,
-                                          std::ostream& os);
-    template <typename Graph>
-    friend GraphWriter<Graph> graphWriter(const Graph& graph,
-                                          const std::string& fn);
-    template <typename Graph>
-    friend GraphWriter<Graph> graphWriter(const Graph& graph,
-                                          const char *fn);
+    template <typename TGR>
+    friend GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os);
+    template <typename TGR>
+    friend GraphWriter<TGR> graphWriter(const TGR& graph, 
+                                        const std::string& fn);
+    template <typename TGR>
+    friend GraphWriter<TGR> graphWriter(const TGR& graph, const char *fn);
     
     GraphWriter(GraphWriter& other)
@@ -1107,5 +1130,5 @@
   public:
 
-    /// \name Writing Rules
+    /// \name Writing rules
     /// @{
 
@@ -1169,8 +1192,8 @@
       checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
       _writer_bits::MapStorageBase<Edge>* forward_storage =
-        new _writer_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
+        new _writer_bits::GraphArcMapStorage<GR, true, Map>(_graph, map);
       _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
       _writer_bits::MapStorageBase<Edge>* backward_storage =
-        new _writer_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
+        new _writer_bits::GraphArcMapStorage<GR, false, Map>(_graph, map);
       _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
       return *this;
@@ -1186,9 +1209,9 @@
       checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
       _writer_bits::MapStorageBase<Edge>* forward_storage =
-        new _writer_bits::GraphArcMapStorage<Graph, true, Map, Converter>
+        new _writer_bits::GraphArcMapStorage<GR, true, Map, Converter>
         (_graph, map, converter);
       _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
       _writer_bits::MapStorageBase<Edge>* backward_storage =
-        new _writer_bits::GraphArcMapStorage<Graph, false, Map, Converter>
+        new _writer_bits::GraphArcMapStorage<GR, false, Map, Converter>
         (_graph, map, converter);
       _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
@@ -1248,5 +1271,5 @@
     /// Add an arc writing rule to writer.
     GraphWriter& arc(const std::string& caption, const Arc& arc) {
-      typedef _writer_bits::GraphArcLookUpConverter<Graph> Converter;
+      typedef _writer_bits::GraphArcLookUpConverter<GR> Converter;
       Converter converter(_graph, _edge_index);
       _writer_bits::ValueStorageBase* storage =
@@ -1256,5 +1279,5 @@
     }
 
-    /// \name Section Captions
+    /// \name Section captions
     /// @{
 
@@ -1283,5 +1306,5 @@
     }
 
-    /// \name Skipping Section
+    /// \name Skipping section
     /// @{
 
@@ -1339,6 +1362,6 @@
 
       if (label == 0) {
-        IdMap<Graph, Node> id_map(_graph);
-        _writer_bits::MapLess<IdMap<Graph, Node> > id_less(id_map);
+        IdMap<GR, Node> id_map(_graph);
+        _writer_bits::MapLess<IdMap<GR, Node> > id_less(id_map);
         std::sort(nodes.begin(), nodes.end(), id_less);
       } else {
@@ -1424,6 +1447,6 @@
 
       if (label == 0) {
-        IdMap<Graph, Edge> id_map(_graph);
-        _writer_bits::MapLess<IdMap<Graph, Edge> > id_less(id_map);
+        IdMap<GR, Edge> id_map(_graph);
+        _writer_bits::MapLess<IdMap<GR, Edge> > id_less(id_map);
         std::sort(edges.begin(), edges.end(), id_less);
       } else {
@@ -1500,5 +1523,5 @@
   public:
 
-    /// \name Execution of the Writer
+    /// \name Execution of the writer
     /// @{
 
@@ -1530,12 +1553,46 @@
   };
 
+  /// \ingroup lemon_io
+  ///
+  /// \brief Return a \ref GraphWriter class
+  ///
+  /// This function just returns a \ref GraphWriter class. 
+  ///
+  /// With this function a graph can be write to a file or output
+  /// stream in \ref lgf-format "LGF" format with several maps and
+  /// attributes. For example, with the following code a weighted
+  /// matching problem can be written to the standard output, i.e. a
+  /// graph with a \e weight map on the edges:
+  ///
+  ///\code
+  ///ListGraph graph;
+  ///ListGraph::EdgeMap<int> weight(graph);
+  ///  // Setting the weight map
+  ///graphWriter(graph, std::cout).
+  ///  edgeMap("weight", weight).
+  ///  run();
+  ///\endcode
+  ///
+  /// For a complete documentation, please see the \ref GraphWriter
+  /// class documentation.
+  /// \warning Don't forget to put the \ref GraphWriter::run() "run()"
+  /// to the end of the parameter list.
+  /// \relates GraphWriter
+  /// \sa graphWriter(const TGR& graph, const std::string& fn)
+  /// \sa graphWriter(const TGR& graph, const char* fn)
+  template <typename TGR>
+  GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os) {
+    GraphWriter<TGR> tmp(graph, os);
+    return tmp;
+  }
+
   /// \brief Return a \ref GraphWriter class
   ///
   /// This function just returns a \ref GraphWriter class.
   /// \relates GraphWriter
-  template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph,
-                                 std::ostream& os) {
-    GraphWriter<Graph> tmp(graph, os);
+  /// \sa graphWriter(const TGR& graph, std::ostream& os)
+  template <typename TGR>
+  GraphWriter<TGR> graphWriter(const TGR& graph, const std::string& fn) {
+    GraphWriter<TGR> tmp(graph, fn);
     return tmp;
   }
@@ -1545,17 +1602,8 @@
   /// This function just returns a \ref GraphWriter class.
   /// \relates GraphWriter
-  template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {
-    GraphWriter<Graph> tmp(graph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphWriter class
-  ///
-  /// This function just returns a \ref GraphWriter class.
-  /// \relates GraphWriter
-  template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {
-    GraphWriter<Graph> tmp(graph, fn);
+  /// \sa graphWriter(const TGR& graph, std::ostream& os)
+  template <typename TGR>
+  GraphWriter<TGR> graphWriter(const TGR& graph, const char* fn) {
+    GraphWriter<TGR> tmp(graph, fn);
     return tmp;
   }
@@ -1652,5 +1700,5 @@
   public:
 
-    /// \name Section Writers
+    /// \name Section writers
     /// @{
 
@@ -1719,5 +1767,5 @@
 
 
-    /// \name Execution of the Writer
+    /// \name Execution of the writer
     /// @{
 
@@ -1747,8 +1795,16 @@
   };
 
+  /// \ingroup lemon_io
+  ///
   /// \brief Return a \ref SectionWriter class
   ///
   /// This function just returns a \ref SectionWriter class.
+  ///
+  /// Please see SectionWriter documentation about the custom section
+  /// output.
+  ///
   /// \relates SectionWriter
+  /// \sa sectionWriter(const std::string& fn)
+  /// \sa sectionWriter(const char *fn)
   inline SectionWriter sectionWriter(std::ostream& os) {
     SectionWriter tmp(os);
@@ -1760,4 +1816,5 @@
   /// This function just returns a \ref SectionWriter class.
   /// \relates SectionWriter
+  /// \sa sectionWriter(std::ostream& os)
   inline SectionWriter sectionWriter(const std::string& fn) {
     SectionWriter tmp(fn);
@@ -1769,4 +1826,5 @@
   /// This function just returns a \ref SectionWriter class.
   /// \relates SectionWriter
+  /// \sa sectionWriter(std::ostream& os)
   inline SectionWriter sectionWriter(const char* fn) {
     SectionWriter tmp(fn);
