lemon/lgf_writer.h
changeset 802 994c7df296c9
parent 598 a3402913cffe
parent 584 33c6b6e755cd
child 877 141f9c0db4a3
     1.1 --- a/lemon/lgf_writer.h	Fri Nov 13 12:33:33 2009 +0100
     1.2 +++ b/lemon/lgf_writer.h	Thu Dec 10 17:05:35 2009 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2008
     1.8 + * Copyright (C) 2003-2009
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -347,19 +347,17 @@
    1.13  
    1.14    }
    1.15  
    1.16 -  template <typename Digraph>
    1.17 +  template <typename DGR>
    1.18    class DigraphWriter;
    1.19  
    1.20 -  template <typename Digraph>
    1.21 -  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
    1.22 -                                       std::ostream& os = std::cout);
    1.23 -  template <typename Digraph>
    1.24 -  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
    1.25 -                                       const std::string& fn);
    1.26 +  template <typename TDGR>
    1.27 +  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
    1.28 +                                   std::ostream& os = std::cout);
    1.29 +  template <typename TDGR>
    1.30 +  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const std::string& fn);
    1.31  
    1.32 -  template <typename Digraph>
    1.33 -  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
    1.34 -                                       const char* fn);
    1.35 +  template <typename TDGR>
    1.36 +  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const char* fn);
    1.37  
    1.38  
    1.39    /// \ingroup lemon_io
    1.40 @@ -381,7 +379,7 @@
    1.41    /// arc() functions are used to add attribute writing rules.
    1.42    ///
    1.43    ///\code
    1.44 -  /// DigraphWriter<Digraph>(digraph, std::cout).
    1.45 +  /// DigraphWriter<DGR>(digraph, std::cout).
    1.46    ///   nodeMap("coordinates", coord_map).
    1.47    ///   nodeMap("size", size).
    1.48    ///   nodeMap("title", title).
    1.49 @@ -406,12 +404,12 @@
    1.50    /// section to the stream. The output stream can be retrieved with
    1.51    /// the \c ostream() function, hence the second pass can append its
    1.52    /// output to the output of the first pass.
    1.53 -  template <typename _Digraph>
    1.54 +  template <typename DGR>
    1.55    class DigraphWriter {
    1.56    public:
    1.57  
    1.58 -    typedef _Digraph Digraph;
    1.59 -    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
    1.60 +    typedef DGR Digraph;
    1.61 +    TEMPLATE_DIGRAPH_TYPEDEFS(DGR);
    1.62  
    1.63    private:
    1.64  
    1.65 @@ -419,7 +417,7 @@
    1.66      std::ostream* _os;
    1.67      bool local_os;
    1.68  
    1.69 -    const Digraph& _digraph;
    1.70 +    const DGR& _digraph;
    1.71  
    1.72      std::string _nodes_caption;
    1.73      std::string _arcs_caption;
    1.74 @@ -451,7 +449,7 @@
    1.75      ///
    1.76      /// Construct a directed graph writer, which writes to the given
    1.77      /// output stream.
    1.78 -    DigraphWriter(const Digraph& digraph, std::ostream& os = std::cout)
    1.79 +    DigraphWriter(const DGR& digraph, std::ostream& os = std::cout)
    1.80        : _os(&os), local_os(false), _digraph(digraph),
    1.81          _skip_nodes(false), _skip_arcs(false) {}
    1.82  
    1.83 @@ -459,7 +457,7 @@
    1.84      ///
    1.85      /// Construct a directed graph writer, which writes to the given
    1.86      /// output file.
    1.87 -    DigraphWriter(const Digraph& digraph, const std::string& fn)
    1.88 +    DigraphWriter(const DGR& digraph, const std::string& fn)
    1.89        : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
    1.90          _skip_nodes(false), _skip_arcs(false) {
    1.91        if (!(*_os)) {
    1.92 @@ -472,7 +470,7 @@
    1.93      ///
    1.94      /// Construct a directed graph writer, which writes to the given
    1.95      /// output file.
    1.96 -    DigraphWriter(const Digraph& digraph, const char* fn)
    1.97 +    DigraphWriter(const DGR& digraph, const char* fn)
    1.98        : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
    1.99          _skip_nodes(false), _skip_arcs(false) {
   1.100        if (!(*_os)) {
   1.101 @@ -505,15 +503,15 @@
   1.102  
   1.103    private:
   1.104  
   1.105 -    template <typename DGR>
   1.106 -    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph, 
   1.107 -                                            std::ostream& os);
   1.108 -    template <typename DGR>
   1.109 -    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph,
   1.110 -                                            const std::string& fn);
   1.111 -    template <typename DGR>
   1.112 -    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph,
   1.113 -                                            const char *fn);
   1.114 +    template <typename TDGR>
   1.115 +    friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
   1.116 +                                             std::ostream& os);
   1.117 +    template <typename TDGR>
   1.118 +    friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
   1.119 +                                             const std::string& fn);
   1.120 +    template <typename TDGR>
   1.121 +    friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
   1.122 +                                             const char *fn);
   1.123  
   1.124      DigraphWriter(DigraphWriter& other)
   1.125        : _os(other._os), local_os(other.local_os), _digraph(other._digraph),
   1.126 @@ -538,7 +536,7 @@
   1.127  
   1.128    public:
   1.129  
   1.130 -    /// \name Writing rules
   1.131 +    /// \name Writing Rules
   1.132      /// @{
   1.133  
   1.134      /// \brief Node map writing rule
   1.135 @@ -641,7 +639,7 @@
   1.136        return *this;
   1.137      }
   1.138  
   1.139 -    /// \name Section captions
   1.140 +    /// \name Section Captions
   1.141      /// @{
   1.142  
   1.143      /// \brief Add an additional caption to the \c \@nodes section
   1.144 @@ -668,7 +666,7 @@
   1.145        return *this;
   1.146      }
   1.147  
   1.148 -    /// \name Skipping section
   1.149 +    /// \name Skipping Section
   1.150      /// @{
   1.151  
   1.152      /// \brief Skip writing the node set
   1.153 @@ -724,8 +722,8 @@
   1.154        }
   1.155  
   1.156        if (label == 0) {
   1.157 -        IdMap<Digraph, Node> id_map(_digraph);
   1.158 -        _writer_bits::MapLess<IdMap<Digraph, Node> > id_less(id_map);
   1.159 +        IdMap<DGR, Node> id_map(_digraph);
   1.160 +        _writer_bits::MapLess<IdMap<DGR, Node> > id_less(id_map);
   1.161          std::sort(nodes.begin(), nodes.end(), id_less);
   1.162        } else {
   1.163          label->sort(nodes);
   1.164 @@ -809,8 +807,8 @@
   1.165        }
   1.166  
   1.167        if (label == 0) {
   1.168 -        IdMap<Digraph, Arc> id_map(_digraph);
   1.169 -        _writer_bits::MapLess<IdMap<Digraph, Arc> > id_less(id_map);
   1.170 +        IdMap<DGR, Arc> id_map(_digraph);
   1.171 +        _writer_bits::MapLess<IdMap<DGR, Arc> > id_less(id_map);
   1.172          std::sort(arcs.begin(), arcs.end(), id_less);
   1.173        } else {
   1.174          label->sort(arcs);
   1.175 @@ -885,7 +883,7 @@
   1.176  
   1.177    public:
   1.178  
   1.179 -    /// \name Execution of the writer
   1.180 +    /// \name Execution of the Writer
   1.181      /// @{
   1.182  
   1.183      /// \brief Start the batch processing
   1.184 @@ -915,14 +913,41 @@
   1.185      /// @}
   1.186    };
   1.187  
   1.188 +  /// \ingroup lemon_io
   1.189 +  ///
   1.190    /// \brief Return a \ref DigraphWriter class
   1.191    ///
   1.192 -  /// This function just returns a \ref DigraphWriter class.
   1.193 +  /// This function just returns a \ref DigraphWriter class. 
   1.194 +  ///
   1.195 +  /// With this function a digraph can be write to a file or output
   1.196 +  /// stream in \ref lgf-format "LGF" format with several maps and
   1.197 +  /// attributes. For example, with the following code a network flow
   1.198 +  /// problem can be written to the standard output, i.e. a digraph
   1.199 +  /// with a \e capacity map on the arcs and \e source and \e target
   1.200 +  /// nodes:
   1.201 +  ///
   1.202 +  ///\code
   1.203 +  ///ListDigraph digraph;
   1.204 +  ///ListDigraph::ArcMap<int> cap(digraph);
   1.205 +  ///ListDigraph::Node src, trg;
   1.206 +  ///  // Setting the capacity map and source and target nodes
   1.207 +  ///digraphWriter(digraph, std::cout).
   1.208 +  ///  arcMap("capacity", cap).
   1.209 +  ///  node("source", src).
   1.210 +  ///  node("target", trg).
   1.211 +  ///  run();
   1.212 +  ///\endcode
   1.213 +  ///
   1.214 +  /// For a complete documentation, please see the \ref DigraphWriter
   1.215 +  /// class documentation.
   1.216 +  /// \warning Don't forget to put the \ref DigraphWriter::run() "run()"
   1.217 +  /// to the end of the parameter list.
   1.218    /// \relates DigraphWriter
   1.219 -  template <typename Digraph>
   1.220 -  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
   1.221 -                                       std::ostream& os) {
   1.222 -    DigraphWriter<Digraph> tmp(digraph, os);
   1.223 +  /// \sa digraphWriter(const TDGR& digraph, const std::string& fn)
   1.224 +  /// \sa digraphWriter(const TDGR& digraph, const char* fn)
   1.225 +  template <typename TDGR>
   1.226 +  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, std::ostream& os) {
   1.227 +    DigraphWriter<TDGR> tmp(digraph, os);
   1.228      return tmp;
   1.229    }
   1.230  
   1.231 @@ -930,10 +955,11 @@
   1.232    ///
   1.233    /// This function just returns a \ref DigraphWriter class.
   1.234    /// \relates DigraphWriter
   1.235 -  template <typename Digraph>
   1.236 -  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
   1.237 -                                       const std::string& fn) {
   1.238 -    DigraphWriter<Digraph> tmp(digraph, fn);
   1.239 +  /// \sa digraphWriter(const TDGR& digraph, std::ostream& os)
   1.240 +  template <typename TDGR>
   1.241 +  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
   1.242 +                                    const std::string& fn) {
   1.243 +    DigraphWriter<TDGR> tmp(digraph, fn);
   1.244      return tmp;
   1.245    }
   1.246  
   1.247 @@ -941,23 +967,22 @@
   1.248    ///
   1.249    /// This function just returns a \ref DigraphWriter class.
   1.250    /// \relates DigraphWriter
   1.251 -  template <typename Digraph>
   1.252 -  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
   1.253 -                                       const char* fn) {
   1.254 -    DigraphWriter<Digraph> tmp(digraph, fn);
   1.255 +  /// \sa digraphWriter(const TDGR& digraph, std::ostream& os)
   1.256 +  template <typename TDGR>
   1.257 +  DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const char* fn) {
   1.258 +    DigraphWriter<TDGR> tmp(digraph, fn);
   1.259      return tmp;
   1.260    }
   1.261  
   1.262 -  template <typename Graph>
   1.263 +  template <typename GR>
   1.264    class GraphWriter;
   1.265  
   1.266 -  template <typename Graph>
   1.267 -  GraphWriter<Graph> graphWriter(const Graph& graph,
   1.268 -                                 std::ostream& os = std::cout);
   1.269 -  template <typename Graph>
   1.270 -  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn);
   1.271 -  template <typename Graph>
   1.272 -  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn);
   1.273 +  template <typename TGR>
   1.274 +  GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os = std::cout);
   1.275 +  template <typename TGR>
   1.276 +  GraphWriter<TGR> graphWriter(const TGR& graph, const std::string& fn);
   1.277 +  template <typename TGR>
   1.278 +  GraphWriter<TGR> graphWriter(const TGR& graph, const char* fn);
   1.279  
   1.280    /// \ingroup lemon_io
   1.281    ///
   1.282 @@ -974,12 +999,12 @@
   1.283    /// '+' and \c '-'. The arcs are written into the \c \@attributes
   1.284    /// section as a \c '+' or a \c '-' prefix (depends on the direction
   1.285    /// of the arc) and the label of corresponding edge.
   1.286 -  template <typename _Graph>
   1.287 +  template <typename GR>
   1.288    class GraphWriter {
   1.289    public:
   1.290  
   1.291 -    typedef _Graph Graph;
   1.292 -    TEMPLATE_GRAPH_TYPEDEFS(Graph);
   1.293 +    typedef GR Graph;
   1.294 +    TEMPLATE_GRAPH_TYPEDEFS(GR);
   1.295  
   1.296    private:
   1.297  
   1.298 @@ -987,7 +1012,7 @@
   1.299      std::ostream* _os;
   1.300      bool local_os;
   1.301  
   1.302 -    const Graph& _graph;
   1.303 +    const GR& _graph;
   1.304  
   1.305      std::string _nodes_caption;
   1.306      std::string _edges_caption;
   1.307 @@ -1019,7 +1044,7 @@
   1.308      ///
   1.309      /// Construct a directed graph writer, which writes to the given
   1.310      /// output stream.
   1.311 -    GraphWriter(const Graph& graph, std::ostream& os = std::cout)
   1.312 +    GraphWriter(const GR& graph, std::ostream& os = std::cout)
   1.313        : _os(&os), local_os(false), _graph(graph),
   1.314          _skip_nodes(false), _skip_edges(false) {}
   1.315  
   1.316 @@ -1027,7 +1052,7 @@
   1.317      ///
   1.318      /// Construct a directed graph writer, which writes to the given
   1.319      /// output file.
   1.320 -    GraphWriter(const Graph& graph, const std::string& fn)
   1.321 +    GraphWriter(const GR& graph, const std::string& fn)
   1.322        : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
   1.323          _skip_nodes(false), _skip_edges(false) {
   1.324        if (!(*_os)) {
   1.325 @@ -1040,7 +1065,7 @@
   1.326      ///
   1.327      /// Construct a directed graph writer, which writes to the given
   1.328      /// output file.
   1.329 -    GraphWriter(const Graph& graph, const char* fn)
   1.330 +    GraphWriter(const GR& graph, const char* fn)
   1.331        : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
   1.332          _skip_nodes(false), _skip_edges(false) {
   1.333        if (!(*_os)) {
   1.334 @@ -1073,15 +1098,13 @@
   1.335  
   1.336    private:
   1.337  
   1.338 -    template <typename GR>
   1.339 -    friend GraphWriter<GR> graphWriter(const GR& graph,
   1.340 -                                       std::ostream& os);
   1.341 -    template <typename GR>
   1.342 -    friend GraphWriter<GR> graphWriter(const GR& graph,
   1.343 -                                       const std::string& fn);
   1.344 -    template <typename GR>
   1.345 -    friend GraphWriter<GR> graphWriter(const GR& graph,
   1.346 -                                       const char *fn);
   1.347 +    template <typename TGR>
   1.348 +    friend GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os);
   1.349 +    template <typename TGR>
   1.350 +    friend GraphWriter<TGR> graphWriter(const TGR& graph, 
   1.351 +                                        const std::string& fn);
   1.352 +    template <typename TGR>
   1.353 +    friend GraphWriter<TGR> graphWriter(const TGR& graph, const char *fn);
   1.354      
   1.355      GraphWriter(GraphWriter& other)
   1.356        : _os(other._os), local_os(other.local_os), _graph(other._graph),
   1.357 @@ -1106,7 +1129,7 @@
   1.358  
   1.359    public:
   1.360  
   1.361 -    /// \name Writing rules
   1.362 +    /// \name Writing Rules
   1.363      /// @{
   1.364  
   1.365      /// \brief Node map writing rule
   1.366 @@ -1168,10 +1191,10 @@
   1.367      GraphWriter& arcMap(const std::string& caption, const Map& map) {
   1.368        checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
   1.369        _writer_bits::MapStorageBase<Edge>* forward_storage =
   1.370 -        new _writer_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
   1.371 +        new _writer_bits::GraphArcMapStorage<GR, true, Map>(_graph, map);
   1.372        _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
   1.373        _writer_bits::MapStorageBase<Edge>* backward_storage =
   1.374 -        new _writer_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
   1.375 +        new _writer_bits::GraphArcMapStorage<GR, false, Map>(_graph, map);
   1.376        _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
   1.377        return *this;
   1.378      }
   1.379 @@ -1185,11 +1208,11 @@
   1.380                            const Converter& converter = Converter()) {
   1.381        checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
   1.382        _writer_bits::MapStorageBase<Edge>* forward_storage =
   1.383 -        new _writer_bits::GraphArcMapStorage<Graph, true, Map, Converter>
   1.384 +        new _writer_bits::GraphArcMapStorage<GR, true, Map, Converter>
   1.385          (_graph, map, converter);
   1.386        _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
   1.387        _writer_bits::MapStorageBase<Edge>* backward_storage =
   1.388 -        new _writer_bits::GraphArcMapStorage<Graph, false, Map, Converter>
   1.389 +        new _writer_bits::GraphArcMapStorage<GR, false, Map, Converter>
   1.390          (_graph, map, converter);
   1.391        _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
   1.392        return *this;
   1.393 @@ -1247,7 +1270,7 @@
   1.394      ///
   1.395      /// Add an arc writing rule to writer.
   1.396      GraphWriter& arc(const std::string& caption, const Arc& arc) {
   1.397 -      typedef _writer_bits::GraphArcLookUpConverter<Graph> Converter;
   1.398 +      typedef _writer_bits::GraphArcLookUpConverter<GR> Converter;
   1.399        Converter converter(_graph, _edge_index);
   1.400        _writer_bits::ValueStorageBase* storage =
   1.401          new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
   1.402 @@ -1255,7 +1278,7 @@
   1.403        return *this;
   1.404      }
   1.405  
   1.406 -    /// \name Section captions
   1.407 +    /// \name Section Captions
   1.408      /// @{
   1.409  
   1.410      /// \brief Add an additional caption to the \c \@nodes section
   1.411 @@ -1282,7 +1305,7 @@
   1.412        return *this;
   1.413      }
   1.414  
   1.415 -    /// \name Skipping section
   1.416 +    /// \name Skipping Section
   1.417      /// @{
   1.418  
   1.419      /// \brief Skip writing the node set
   1.420 @@ -1338,8 +1361,8 @@
   1.421        }
   1.422  
   1.423        if (label == 0) {
   1.424 -        IdMap<Graph, Node> id_map(_graph);
   1.425 -        _writer_bits::MapLess<IdMap<Graph, Node> > id_less(id_map);
   1.426 +        IdMap<GR, Node> id_map(_graph);
   1.427 +        _writer_bits::MapLess<IdMap<GR, Node> > id_less(id_map);
   1.428          std::sort(nodes.begin(), nodes.end(), id_less);
   1.429        } else {
   1.430          label->sort(nodes);
   1.431 @@ -1423,8 +1446,8 @@
   1.432        }
   1.433  
   1.434        if (label == 0) {
   1.435 -        IdMap<Graph, Edge> id_map(_graph);
   1.436 -        _writer_bits::MapLess<IdMap<Graph, Edge> > id_less(id_map);
   1.437 +        IdMap<GR, Edge> id_map(_graph);
   1.438 +        _writer_bits::MapLess<IdMap<GR, Edge> > id_less(id_map);
   1.439          std::sort(edges.begin(), edges.end(), id_less);
   1.440        } else {
   1.441          label->sort(edges);
   1.442 @@ -1499,7 +1522,7 @@
   1.443  
   1.444    public:
   1.445  
   1.446 -    /// \name Execution of the writer
   1.447 +    /// \name Execution of the Writer
   1.448      /// @{
   1.449  
   1.450      /// \brief Start the batch processing
   1.451 @@ -1529,14 +1552,37 @@
   1.452      /// @}
   1.453    };
   1.454  
   1.455 +  /// \ingroup lemon_io
   1.456 +  ///
   1.457    /// \brief Return a \ref GraphWriter class
   1.458    ///
   1.459 -  /// This function just returns a \ref GraphWriter class.
   1.460 +  /// This function just returns a \ref GraphWriter class. 
   1.461 +  ///
   1.462 +  /// With this function a graph can be write to a file or output
   1.463 +  /// stream in \ref lgf-format "LGF" format with several maps and
   1.464 +  /// attributes. For example, with the following code a weighted
   1.465 +  /// matching problem can be written to the standard output, i.e. a
   1.466 +  /// graph with a \e weight map on the edges:
   1.467 +  ///
   1.468 +  ///\code
   1.469 +  ///ListGraph graph;
   1.470 +  ///ListGraph::EdgeMap<int> weight(graph);
   1.471 +  ///  // Setting the weight map
   1.472 +  ///graphWriter(graph, std::cout).
   1.473 +  ///  edgeMap("weight", weight).
   1.474 +  ///  run();
   1.475 +  ///\endcode
   1.476 +  ///
   1.477 +  /// For a complete documentation, please see the \ref GraphWriter
   1.478 +  /// class documentation.
   1.479 +  /// \warning Don't forget to put the \ref GraphWriter::run() "run()"
   1.480 +  /// to the end of the parameter list.
   1.481    /// \relates GraphWriter
   1.482 -  template <typename Graph>
   1.483 -  GraphWriter<Graph> graphWriter(const Graph& graph,
   1.484 -                                 std::ostream& os) {
   1.485 -    GraphWriter<Graph> tmp(graph, os);
   1.486 +  /// \sa graphWriter(const TGR& graph, const std::string& fn)
   1.487 +  /// \sa graphWriter(const TGR& graph, const char* fn)
   1.488 +  template <typename TGR>
   1.489 +  GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os) {
   1.490 +    GraphWriter<TGR> tmp(graph, os);
   1.491      return tmp;
   1.492    }
   1.493  
   1.494 @@ -1544,9 +1590,10 @@
   1.495    ///
   1.496    /// This function just returns a \ref GraphWriter class.
   1.497    /// \relates GraphWriter
   1.498 -  template <typename Graph>
   1.499 -  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {
   1.500 -    GraphWriter<Graph> tmp(graph, fn);
   1.501 +  /// \sa graphWriter(const TGR& graph, std::ostream& os)
   1.502 +  template <typename TGR>
   1.503 +  GraphWriter<TGR> graphWriter(const TGR& graph, const std::string& fn) {
   1.504 +    GraphWriter<TGR> tmp(graph, fn);
   1.505      return tmp;
   1.506    }
   1.507  
   1.508 @@ -1554,9 +1601,10 @@
   1.509    ///
   1.510    /// This function just returns a \ref GraphWriter class.
   1.511    /// \relates GraphWriter
   1.512 -  template <typename Graph>
   1.513 -  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {
   1.514 -    GraphWriter<Graph> tmp(graph, fn);
   1.515 +  /// \sa graphWriter(const TGR& graph, std::ostream& os)
   1.516 +  template <typename TGR>
   1.517 +  GraphWriter<TGR> graphWriter(const TGR& graph, const char* fn) {
   1.518 +    GraphWriter<TGR> tmp(graph, fn);
   1.519      return tmp;
   1.520    }
   1.521  
   1.522 @@ -1651,7 +1699,7 @@
   1.523  
   1.524    public:
   1.525  
   1.526 -    /// \name Section writers
   1.527 +    /// \name Section Writers
   1.528      /// @{
   1.529  
   1.530      /// \brief Add a section writer with line oriented writing
   1.531 @@ -1718,7 +1766,7 @@
   1.532    public:
   1.533  
   1.534  
   1.535 -    /// \name Execution of the writer
   1.536 +    /// \name Execution of the Writer
   1.537      /// @{
   1.538  
   1.539      /// \brief Start the batch processing
   1.540 @@ -1746,10 +1794,18 @@
   1.541  
   1.542    };
   1.543  
   1.544 +  /// \ingroup lemon_io
   1.545 +  ///
   1.546    /// \brief Return a \ref SectionWriter class
   1.547    ///
   1.548    /// This function just returns a \ref SectionWriter class.
   1.549 +  ///
   1.550 +  /// Please see SectionWriter documentation about the custom section
   1.551 +  /// output.
   1.552 +  ///
   1.553    /// \relates SectionWriter
   1.554 +  /// \sa sectionWriter(const std::string& fn)
   1.555 +  /// \sa sectionWriter(const char *fn)
   1.556    inline SectionWriter sectionWriter(std::ostream& os) {
   1.557      SectionWriter tmp(os);
   1.558      return tmp;
   1.559 @@ -1759,6 +1815,7 @@
   1.560    ///
   1.561    /// This function just returns a \ref SectionWriter class.
   1.562    /// \relates SectionWriter
   1.563 +  /// \sa sectionWriter(std::ostream& os)
   1.564    inline SectionWriter sectionWriter(const std::string& fn) {
   1.565      SectionWriter tmp(fn);
   1.566      return tmp;
   1.567 @@ -1768,6 +1825,7 @@
   1.568    ///
   1.569    /// This function just returns a \ref SectionWriter class.
   1.570    /// \relates SectionWriter
   1.571 +  /// \sa sectionWriter(std::ostream& os)
   1.572    inline SectionWriter sectionWriter(const char* fn) {
   1.573      SectionWriter tmp(fn);
   1.574      return tmp;