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