1.1 --- a/demo/lgf_demo.cc Fri Jul 04 16:12:31 2008 +0200
1.2 +++ b/demo/lgf_demo.cc Sat Jul 05 00:14:27 2008 +0200
1.3 @@ -34,8 +34,6 @@
1.4 #include <lemon/smart_graph.h>
1.5 #include <lemon/lgf_reader.h>
1.6 #include <lemon/lgf_writer.h>
1.7 -#include <lemon/random.h>
1.8 -
1.9
1.10 using namespace lemon;
1.11
1.12 @@ -44,13 +42,13 @@
1.13 SmartDigraph::ArcMap<int> cap(g);
1.14 SmartDigraph::Node s, t;
1.15
1.16 - digraphReader("digraph.lgf", g). // read the directeg graph into g
1.17 + digraphReader("digraph.lgf", g). // read the directed graph into g
1.18 arcMap("capacity", cap). // read the 'capacity' arc map into cap
1.19 node("source", s). // read 'source' node to s
1.20 node("target", t). // read 'target' node to t
1.21 run();
1.22
1.23 - std::cout << "Digraph read from 'digraph.lgf'" << std::endl;
1.24 + std::cout << "A digraph is read from 'digraph.lgf'." << std::endl;
1.25 std::cout << "Number of nodes: " << countNodes(g) << std::endl;
1.26 std::cout << "Number of arcs: " << countArcs(g) << std::endl;
1.27
2.1 --- a/doc/groups.dox Fri Jul 04 16:12:31 2008 +0200
2.2 +++ b/doc/groups.dox Sat Jul 05 00:14:27 2008 +0200
2.3 @@ -475,11 +475,9 @@
2.4 /**
2.5 @defgroup lemon_io Lemon Input-Output
2.6 @ingroup io_group
2.7 -\brief Reading and writing LEMON format
2.8 +\brief Reading and writing \ref lgf-format "Lemon Graph Format".
2.9
2.10 -This group describes methods for reading and writing LEMON format.
2.11 -You can find more about this format on the \ref graph-io-page "Graph Input-Output"
2.12 -tutorial pages.
2.13 +This group describes methods for reading and writing \ref lgf-format "Lemon Graph Format".
2.14 */
2.15
2.16 /**
3.1 --- a/doc/lgf.dox Fri Jul 04 16:12:31 2008 +0200
3.2 +++ b/doc/lgf.dox Sat Jul 05 00:14:27 2008 +0200
3.3 @@ -46,7 +46,7 @@
3.4 contain whitespaces and escape sequences.
3.5
3.6 The \c \@nodes section describes a set of nodes and associated
3.7 -maps. The first is a header line, it columns are the names of the
3.8 +maps. The first is a header line, its columns are the names of the
3.9 maps appearing in the following lines.
3.10 One of the maps must be called \c
3.11 "label", which plays special role in the file.
3.12 @@ -64,7 +64,7 @@
3.13 \endcode
3.14
3.15 The \c \@arcs section is very similar to the \c \@nodes section,
3.16 -it again starts with a header line describing the names of the arc,
3.17 +it again starts with a header line describing the names of the maps,
3.18 but the \c "label" map is not obligatory here. The following lines
3.19 describe the arcs. The first two tokens of each line are
3.20 the source and the target node of the arc, respectively, then come the map
4.1 --- a/lemon/lgf_reader.h Fri Jul 04 16:12:31 2008 +0200
4.2 +++ b/lemon/lgf_reader.h Sat Jul 05 00:14:27 2008 +0200
4.3 @@ -18,7 +18,7 @@
4.4
4.5 ///\ingroup lemon_io
4.6 ///\file
4.7 -///\brief Lemon Graph Format reader.
4.8 +///\brief \ref lgf-format "Lemon Graph Format" reader.
4.9
4.10
4.11 #ifndef LEMON_LGF_READER_H
4.12 @@ -400,7 +400,7 @@
4.13
4.14 /// \ingroup lemon_io
4.15 ///
4.16 - /// \brief LGF reader for directed graphs
4.17 + /// \brief \ref lgf-format "LGF" reader for directed graphs
4.18 ///
4.19 /// This utility reads an \ref lgf-format "LGF" file.
4.20 ///
4.21 @@ -410,22 +410,22 @@
4.22 /// member function. A map reading rule can be added to the reader
4.23 /// with the \c nodeMap() or \c arcMap() members. An optional
4.24 /// converter parameter can also be added as a standard functor
4.25 - /// converting from std::string to the value type of the map. If it
4.26 + /// converting from \c std::string to the value type of the map. If it
4.27 /// is set, it will determine how the tokens in the file should be
4.28 - /// is converted to the map's value type. If the functor is not set,
4.29 + /// converted to the value type of the map. If the functor is not set,
4.30 /// then a default conversion will be used. One map can be read into
4.31 /// multiple map objects at the same time. The \c attribute(), \c
4.32 /// node() and \c arc() functions are used to add attribute reading
4.33 /// rules.
4.34 ///
4.35 ///\code
4.36 - /// DigraphReader<Digraph>(std::cin, digraph).
4.37 - /// nodeMap("coordinates", coord_map).
4.38 - /// arcMap("capacity", cap_map).
4.39 - /// node("source", src).
4.40 - /// node("target", trg).
4.41 - /// attribute("caption", caption).
4.42 - /// run();
4.43 + /// DigraphReader<Digraph>(std::cin, digraph).
4.44 + /// nodeMap("coordinates", coord_map).
4.45 + /// arcMap("capacity", cap_map).
4.46 + /// node("source", src).
4.47 + /// node("target", trg).
4.48 + /// attribute("caption", caption).
4.49 + /// run();
4.50 ///\endcode
4.51 ///
4.52 /// By default the reader uses the first section in the file of the
4.53 @@ -437,14 +437,14 @@
4.54 /// that the nodes or arcs should not be constructed (added to the
4.55 /// graph) during the reading, but instead the label map of the items
4.56 /// are given as a parameter of these functions. An
4.57 - /// application of these function is multipass reading, which is
4.58 - /// important if two \e \@arcs sections must be read from the
4.59 - /// file. In this example the first phase would read the node set and one
4.60 + /// application of these functions is multipass reading, which is
4.61 + /// important if two \c \@arcs sections must be read from the
4.62 + /// file. In this case the first phase would read the node set and one
4.63 /// of the arc sets, while the second phase would read the second arc
4.64 /// set into an \e ArcSet class (\c SmartArcSet or \c ListArcSet).
4.65 /// The previously read label node map should be passed to the \c
4.66 /// useNodes() functions. Another application of multipass reading when
4.67 - /// paths are given as a node map or an arc map. It is impossible read this in
4.68 + /// paths are given as a node map or an arc map. It is impossible to read this in
4.69 /// a single pass, because the arcs are not constructed when the node
4.70 /// maps are read.
4.71 template <typename _Digraph>
4.72 @@ -735,7 +735,7 @@
4.73 ///
4.74 /// Use previously constructed node set, and specify the node
4.75 /// label map and a functor which converts the label map values to
4.76 - /// std::string.
4.77 + /// \c std::string.
4.78 template <typename Map, typename Converter>
4.79 DigraphReader& useNodes(const Map& map,
4.80 const Converter& converter = Converter()) {
4.81 @@ -768,7 +768,7 @@
4.82 ///
4.83 /// Use previously constructed arc set, and specify the arc
4.84 /// label map and a functor which converts the label map values to
4.85 - /// std::string.
4.86 + /// \c std::string.
4.87 template <typename Map, typename Converter>
4.88 DigraphReader& useArcs(const Map& map,
4.89 const Converter& converter = Converter()) {
4.90 @@ -784,12 +784,11 @@
4.91 /// \brief Skips the reading of node section
4.92 ///
4.93 /// Omit the reading of the node section. This implies that each node
4.94 - /// map reading rule will be abanoned, and the nodes of the graph
4.95 + /// map reading rule will be abandoned, and the nodes of the graph
4.96 /// will not be constructed, which usually cause that the arc set
4.97 - /// could not be read due to lack of node name
4.98 - /// resolving. Therefore, the \c skipArcs() should be used too, or
4.99 - /// the useNodes() member function should be used to specify the
4.100 - /// label of the nodes.
4.101 + /// could not be read due to lack of node name resolving.
4.102 + /// Therefore \c skipArcs() function should also be used, or
4.103 + /// \c useNodes() should be used to specify the label of the nodes.
4.104 DigraphReader& skipNodes() {
4.105 LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
4.106 _skip_nodes = true;
4.107 @@ -799,7 +798,7 @@
4.108 /// \brief Skips the reading of arc section
4.109 ///
4.110 /// Omit the reading of the arc section. This implies that each arc
4.111 - /// map reading rule will be abanoned, and the arcs of the graph
4.112 + /// map reading rule will be abandoned, and the arcs of the graph
4.113 /// will not be constructed.
4.114 DigraphReader& skipArcs() {
4.115 LEMON_ASSERT(!_skip_arcs, "Skip arcs already set");
4.116 @@ -1175,6 +1174,9 @@
4.117
4.118 };
4.119
4.120 + /// \brief Return a \ref DigraphReader class
4.121 + ///
4.122 + /// This function just returns a \ref DigraphReader class.
4.123 /// \relates DigraphReader
4.124 template <typename Digraph>
4.125 DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
4.126 @@ -1182,6 +1184,9 @@
4.127 return tmp;
4.128 }
4.129
4.130 + /// \brief Return a \ref DigraphReader class
4.131 + ///
4.132 + /// This function just returns a \ref DigraphReader class.
4.133 /// \relates DigraphReader
4.134 template <typename Digraph>
4.135 DigraphReader<Digraph> digraphReader(const std::string& fn,
4.136 @@ -1190,6 +1195,9 @@
4.137 return tmp;
4.138 }
4.139
4.140 + /// \brief Return a \ref DigraphReader class
4.141 + ///
4.142 + /// This function just returns a \ref DigraphReader class.
4.143 /// \relates DigraphReader
4.144 template <typename Digraph>
4.145 DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
4.146 @@ -1211,9 +1219,13 @@
4.147
4.148 /// \ingroup lemon_io
4.149 ///
4.150 - /// \brief LGF reader for undirected graphs
4.151 + /// \brief \ref lgf-format "LGF" reader for undirected graphs
4.152 ///
4.153 /// This utility reads an \ref lgf-format "LGF" file.
4.154 + ///
4.155 + /// It can be used almost the same way as \c DigraphReader.
4.156 + /// The only difference is that this class can handle edges and
4.157 + /// edge maps as well as arcs and arc maps.
4.158 template <typename _Graph>
4.159 class GraphReader {
4.160 public:
4.161 @@ -1262,7 +1274,7 @@
4.162
4.163 /// \brief Constructor
4.164 ///
4.165 - /// Construct a undirected graph reader, which reads from the given
4.166 + /// Construct an undirected graph reader, which reads from the given
4.167 /// input stream.
4.168 GraphReader(std::istream& is, Graph& graph)
4.169 : _is(&is), local_is(false), _graph(graph),
4.170 @@ -1271,7 +1283,7 @@
4.171
4.172 /// \brief Constructor
4.173 ///
4.174 - /// Construct a undirected graph reader, which reads from the given
4.175 + /// Construct an undirected graph reader, which reads from the given
4.176 /// file.
4.177 GraphReader(const std::string& fn, Graph& graph)
4.178 : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph),
4.179 @@ -1280,7 +1292,7 @@
4.180
4.181 /// \brief Constructor
4.182 ///
4.183 - /// Construct a undirected graph reader, which reads from the given
4.184 + /// Construct an undirected graph reader, which reads from the given
4.185 /// file.
4.186 GraphReader(const char* fn, Graph& graph)
4.187 : _is(new std::ifstream(fn)), local_is(true), _graph(graph),
4.188 @@ -1497,7 +1509,7 @@
4.189
4.190 /// \brief Set \c \@nodes section to be read
4.191 ///
4.192 - /// Set \c \@nodes section to be read
4.193 + /// Set \c \@nodes section to be read.
4.194 GraphReader& nodes(const std::string& caption) {
4.195 _nodes_caption = caption;
4.196 return *this;
4.197 @@ -1505,7 +1517,7 @@
4.198
4.199 /// \brief Set \c \@edges section to be read
4.200 ///
4.201 - /// Set \c \@edges section to be read
4.202 + /// Set \c \@edges section to be read.
4.203 GraphReader& edges(const std::string& caption) {
4.204 _edges_caption = caption;
4.205 return *this;
4.206 @@ -1513,7 +1525,7 @@
4.207
4.208 /// \brief Set \c \@attributes section to be read
4.209 ///
4.210 - /// Set \c \@attributes section to be read
4.211 + /// Set \c \@attributes section to be read.
4.212 GraphReader& attributes(const std::string& caption) {
4.213 _attributes_caption = caption;
4.214 return *this;
4.215 @@ -1544,7 +1556,7 @@
4.216 ///
4.217 /// Use previously constructed node set, and specify the node
4.218 /// label map and a functor which converts the label map values to
4.219 - /// std::string.
4.220 + /// \c std::string.
4.221 template <typename Map, typename Converter>
4.222 GraphReader& useNodes(const Map& map,
4.223 const Converter& converter = Converter()) {
4.224 @@ -1577,7 +1589,7 @@
4.225 ///
4.226 /// Use previously constructed edge set, and specify the edge
4.227 /// label map and a functor which converts the label map values to
4.228 - /// std::string.
4.229 + /// \c std::string.
4.230 template <typename Map, typename Converter>
4.231 GraphReader& useEdges(const Map& map,
4.232 const Converter& converter = Converter()) {
4.233 @@ -1590,25 +1602,25 @@
4.234 return *this;
4.235 }
4.236
4.237 - /// \brief Skips the reading of node section
4.238 + /// \brief Skip the reading of node section
4.239 ///
4.240 /// Omit the reading of the node section. This implies that each node
4.241 - /// map reading rule will be abanoned, and the nodes of the graph
4.242 + /// map reading rule will be abandoned, and the nodes of the graph
4.243 /// will not be constructed, which usually cause that the edge set
4.244 /// could not be read due to lack of node name
4.245 - /// resolving. Therefore, the \c skipEdges() should be used too, or
4.246 - /// the useNodes() member function should be used to specify the
4.247 - /// label of the nodes.
4.248 + /// could not be read due to lack of node name resolving.
4.249 + /// Therefore \c skipEdges() function should also be used, or
4.250 + /// \c useNodes() should be used to specify the label of the nodes.
4.251 GraphReader& skipNodes() {
4.252 LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
4.253 _skip_nodes = true;
4.254 return *this;
4.255 }
4.256
4.257 - /// \brief Skips the reading of edge section
4.258 + /// \brief Skip the reading of edge section
4.259 ///
4.260 /// Omit the reading of the edge section. This implies that each edge
4.261 - /// map reading rule will be abanoned, and the edges of the graph
4.262 + /// map reading rule will be abandoned, and the edges of the graph
4.263 /// will not be constructed.
4.264 GraphReader& skipEdges() {
4.265 LEMON_ASSERT(!_skip_edges, "Skip edges already set");
4.266 @@ -1982,6 +1994,9 @@
4.267
4.268 };
4.269
4.270 + /// \brief Return a \ref GraphReader class
4.271 + ///
4.272 + /// This function just returns a \ref GraphReader class.
4.273 /// \relates GraphReader
4.274 template <typename Graph>
4.275 GraphReader<Graph> graphReader(std::istream& is, Graph& graph) {
4.276 @@ -1989,6 +2004,9 @@
4.277 return tmp;
4.278 }
4.279
4.280 + /// \brief Return a \ref GraphReader class
4.281 + ///
4.282 + /// This function just returns a \ref GraphReader class.
4.283 /// \relates GraphReader
4.284 template <typename Graph>
4.285 GraphReader<Graph> graphReader(const std::string& fn,
4.286 @@ -1997,6 +2015,9 @@
4.287 return tmp;
4.288 }
4.289
4.290 + /// \brief Return a \ref GraphReader class
4.291 + ///
4.292 + /// This function just returns a \ref GraphReader class.
4.293 /// \relates GraphReader
4.294 template <typename Graph>
4.295 GraphReader<Graph> graphReader(const char* fn, Graph& graph) {
4.296 @@ -2010,13 +2031,15 @@
4.297 SectionReader sectionReader(const std::string& fn);
4.298 SectionReader sectionReader(const char* fn);
4.299
4.300 + /// \ingroup lemon_io
4.301 + ///
4.302 /// \brief Section reader class
4.303 ///
4.304 - /// In the \e LGF file extra sections can be placed, which contain
4.305 - /// any data in arbitrary format. Such sections can be read with
4.306 - /// this class. A reading rule can be added with two different
4.307 - /// functions, with the \c sectionLines() function a functor can
4.308 - /// process the section line-by-line. While with the \c
4.309 + /// In the \ref lgf-format "LGF" file extra sections can be placed,
4.310 + /// which contain any data in arbitrary format. Such sections can be
4.311 + /// read with this class. A reading rule can be added to the class
4.312 + /// with two different functions. With the \c sectionLines() function a
4.313 + /// functor can process the section line-by-line, while with the \c
4.314 /// sectionStream() member the section can be read from an input
4.315 /// stream.
4.316 class SectionReader {
4.317 @@ -2105,7 +2128,7 @@
4.318 /// 23 6
4.319 ///\endcode
4.320 ///
4.321 - /// The functor is implemented as an struct:
4.322 + /// The functor is implemented as a struct:
4.323 ///\code
4.324 /// struct NumberSection {
4.325 /// std::vector<int>& _data;
4.326 @@ -2123,7 +2146,7 @@
4.327 ///\endcode
4.328 template <typename Functor>
4.329 SectionReader& sectionLines(const std::string& type, Functor functor) {
4.330 - LEMON_ASSERT(!type.empty(), "Type is not empty.");
4.331 + LEMON_ASSERT(!type.empty(), "Type is empty.");
4.332 LEMON_ASSERT(_sections.find(type) == _sections.end(),
4.333 "Multiple reading of section.");
4.334 _sections.insert(std::make_pair(type,
4.335 @@ -2135,13 +2158,13 @@
4.336 /// \brief Add a section processor with stream oriented reading
4.337 ///
4.338 /// The first parameter is the type of the section, the second is
4.339 - /// a functor, which takes an \c std::istream& and an int&
4.340 + /// a functor, which takes an \c std::istream& and an \c int&
4.341 /// parameter, the latter regard to the line number of stream. The
4.342 /// functor can read the input while the section go on, and the
4.343 /// line number should be modified accordingly.
4.344 template <typename Functor>
4.345 SectionReader& sectionStream(const std::string& type, Functor functor) {
4.346 - LEMON_ASSERT(!type.empty(), "Type is not empty.");
4.347 + LEMON_ASSERT(!type.empty(), "Type is empty.");
4.348 LEMON_ASSERT(_sections.find(type) == _sections.end(),
4.349 "Multiple reading of section.");
4.350 _sections.insert(std::make_pair(type,
4.351 @@ -2186,7 +2209,7 @@
4.352
4.353 /// \brief Start the batch processing
4.354 ///
4.355 - /// This function starts the batch processing
4.356 + /// This function starts the batch processing.
4.357 void run() {
4.358
4.359 LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
4.360 @@ -2239,18 +2262,27 @@
4.361
4.362 };
4.363
4.364 + /// \brief Return a \ref SectionReader class
4.365 + ///
4.366 + /// This function just returns a \ref SectionReader class.
4.367 /// \relates SectionReader
4.368 inline SectionReader sectionReader(std::istream& is) {
4.369 SectionReader tmp(is);
4.370 return tmp;
4.371 }
4.372
4.373 + /// \brief Return a \ref SectionReader class
4.374 + ///
4.375 + /// This function just returns a \ref SectionReader class.
4.376 /// \relates SectionReader
4.377 inline SectionReader sectionReader(const std::string& fn) {
4.378 SectionReader tmp(fn);
4.379 return tmp;
4.380 }
4.381
4.382 + /// \brief Return a \ref SectionReader class
4.383 + ///
4.384 + /// This function just returns a \ref SectionReader class.
4.385 /// \relates SectionReader
4.386 inline SectionReader sectionReader(const char* fn) {
4.387 SectionReader tmp(fn);
4.388 @@ -2269,19 +2301,20 @@
4.389 /// reads the graph and stores the appropriate information for
4.390 /// reading the graph.
4.391 ///
4.392 - ///\code LgfContents contents("graph.lgf");
4.393 + ///\code
4.394 + /// LgfContents contents("graph.lgf");
4.395 /// contents.run();
4.396 ///
4.397 - /// // does it contain any node section and arc section
4.398 + /// // Does it contain any node section and arc section?
4.399 /// if (contents.nodeSectionNum() == 0 || contents.arcSectionNum()) {
4.400 - /// std::cerr << "Failure, cannot find graph" << std::endl;
4.401 + /// std::cerr << "Failure, cannot find graph." << std::endl;
4.402 /// return -1;
4.403 /// }
4.404 - /// std::cout << "The name of the default node section : "
4.405 + /// std::cout << "The name of the default node section: "
4.406 /// << contents.nodeSection(0) << std::endl;
4.407 - /// std::cout << "The number of the arc maps : "
4.408 + /// std::cout << "The number of the arc maps: "
4.409 /// << contents.arcMaps(0).size() << std::endl;
4.410 - /// std::cout << "The name of second arc map : "
4.411 + /// std::cout << "The name of second arc map: "
4.412 /// << contents.arcMaps(0)[1] << std::endl;
4.413 ///\endcode
4.414 class LgfContents {
4.415 @@ -2352,9 +2385,9 @@
4.416 return _node_sections.size();
4.417 }
4.418
4.419 - /// \brief Returns the section name at the given position.
4.420 + /// \brief Returns the node section name at the given position.
4.421 ///
4.422 - /// Returns the section name at the given position.
4.423 + /// Returns the node section name at the given position.
4.424 const std::string& nodeSection(int i) const {
4.425 return _node_sections[i];
4.426 }
4.427 @@ -2379,9 +2412,9 @@
4.428 return _edge_sections.size();
4.429 }
4.430
4.431 - /// \brief Returns the section name at the given position.
4.432 + /// \brief Returns the arc/edge section name at the given position.
4.433 ///
4.434 - /// Returns the section name at the given position.
4.435 + /// Returns the arc/edge section name at the given position.
4.436 /// \note It is synonym of \c edgeSection().
4.437 const std::string& arcSection(int i) const {
4.438 return _edge_sections[i];
4.439 @@ -2436,9 +2469,9 @@
4.440 return _attribute_sections.size();
4.441 }
4.442
4.443 - /// \brief Returns the section name at the given position.
4.444 + /// \brief Returns the attribute section name at the given position.
4.445 ///
4.446 - /// Returns the section name at the given position.
4.447 + /// Returns the attribute section name at the given position.
4.448 const std::string& attributeSectionNames(int i) const {
4.449 return _attribute_sections[i];
4.450 }
4.451 @@ -2529,9 +2562,9 @@
4.452 /// \name Execution of the contents reader
4.453 /// @{
4.454
4.455 - /// \brief Start the reading
4.456 + /// \brief Starts the reading
4.457 ///
4.458 - /// This function starts the reading
4.459 + /// This function starts the reading.
4.460 void run() {
4.461
4.462 readLine();
5.1 --- a/lemon/lgf_writer.h Fri Jul 04 16:12:31 2008 +0200
5.2 +++ b/lemon/lgf_writer.h Sat Jul 05 00:14:27 2008 +0200
5.3 @@ -18,7 +18,7 @@
5.4
5.5 ///\ingroup lemon_io
5.6 ///\file
5.7 -///\brief Lemon Graph Format writer.
5.8 +///\brief \ref lgf-format "Lemon Graph Format" writer.
5.9
5.10
5.11 #ifndef LEMON_LGF_WRITER_H
5.12 @@ -322,7 +322,7 @@
5.13
5.14 /// \ingroup lemon_io
5.15 ///
5.16 - /// \brief LGF writer for directed graphs
5.17 + /// \brief \ref lgf-format "LGF" writer for directed graphs
5.18 ///
5.19 /// This utility writes an \ref lgf-format "LGF" file.
5.20 ///
5.21 @@ -332,22 +332,22 @@
5.22 /// member function. A map writing rule can be added to the writer
5.23 /// with the \c nodeMap() or \c arcMap() members. An optional
5.24 /// converter parameter can also be added as a standard functor
5.25 - /// converting from the value type of the map to std::string. If it
5.26 - /// is set, it will determine how the map's value type is written to
5.27 + /// converting from the value type of the map to \c std::string. If it
5.28 + /// is set, it will determine how the value type of the map is written to
5.29 /// the output stream. If the functor is not set, then a default
5.30 /// conversion will be used. The \c attribute(), \c node() and \c
5.31 /// arc() functions are used to add attribute writing rules.
5.32 ///
5.33 ///\code
5.34 - /// DigraphWriter<Digraph>(std::cout, digraph).
5.35 - /// nodeMap("coordinates", coord_map).
5.36 - /// nodeMap("size", size).
5.37 - /// nodeMap("title", title).
5.38 - /// arcMap("capacity", cap_map).
5.39 - /// node("source", src).
5.40 - /// node("target", trg).
5.41 - /// attribute("caption", caption).
5.42 - /// run();
5.43 + /// DigraphWriter<Digraph>(std::cout, digraph).
5.44 + /// nodeMap("coordinates", coord_map).
5.45 + /// nodeMap("size", size).
5.46 + /// nodeMap("title", title).
5.47 + /// arcMap("capacity", cap_map).
5.48 + /// node("source", src).
5.49 + /// node("target", trg).
5.50 + /// attribute("caption", caption).
5.51 + /// run();
5.52 ///\endcode
5.53 ///
5.54 ///
5.55 @@ -486,9 +486,9 @@
5.56 /// \name Writing rules
5.57 /// @{
5.58
5.59 - /// \brief Node map reading rule
5.60 + /// \brief Node map writing rule
5.61 ///
5.62 - /// Add a node map reading rule to the writer.
5.63 + /// Add a node map writing rule to the writer.
5.64 template <typename Map>
5.65 DigraphWriter& nodeMap(const std::string& caption, const Map& map) {
5.66 checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
5.67 @@ -586,28 +586,28 @@
5.68 return *this;
5.69 }
5.70
5.71 - /// \name Select section by name
5.72 + /// \name Section captions
5.73 /// @{
5.74
5.75 - /// \brief Set \c \@nodes section to be read
5.76 + /// \brief Add an additional caption to the \c \@nodes section
5.77 ///
5.78 - /// Set \c \@nodes section to be read
5.79 + /// Add an additional caption to the \c \@nodes section.
5.80 DigraphWriter& nodes(const std::string& caption) {
5.81 _nodes_caption = caption;
5.82 return *this;
5.83 }
5.84
5.85 - /// \brief Set \c \@arcs section to be read
5.86 + /// \brief Add an additional caption to the \c \@arcs section
5.87 ///
5.88 - /// Set \c \@arcs section to be read
5.89 + /// Add an additional caption to the \c \@arcs section.
5.90 DigraphWriter& arcs(const std::string& caption) {
5.91 _arcs_caption = caption;
5.92 return *this;
5.93 }
5.94
5.95 - /// \brief Set \c \@attributes section to be read
5.96 + /// \brief Add an additional caption to the \c \@attributes section
5.97 ///
5.98 - /// Set \c \@attributes section to be read
5.99 + /// Add an additional caption to the \c \@attributes section.
5.100 DigraphWriter& attributes(const std::string& caption) {
5.101 _attributes_caption = caption;
5.102 return *this;
5.103 @@ -618,7 +618,7 @@
5.104
5.105 /// \brief Skip writing the node set
5.106 ///
5.107 - /// The \c \@nodes section will be not written to the stream.
5.108 + /// The \c \@nodes section will not be written to the stream.
5.109 DigraphWriter& skipNodes() {
5.110 LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
5.111 _skip_nodes = true;
5.112 @@ -627,7 +627,7 @@
5.113
5.114 /// \brief Skip writing arc set
5.115 ///
5.116 - /// The \c \@arcs section will be not written to the stream.
5.117 + /// The \c \@arcs section will not be written to the stream.
5.118 DigraphWriter& skipArcs() {
5.119 LEMON_ASSERT(!_skip_arcs, "Multiple usage of skipArcs() member");
5.120 _skip_arcs = true;
5.121 @@ -835,7 +835,7 @@
5.122
5.123 /// \brief Start the batch processing
5.124 ///
5.125 - /// This function starts the batch processing
5.126 + /// This function starts the batch processing.
5.127 void run() {
5.128 if (!_skip_nodes) {
5.129 writeNodes();
5.130 @@ -850,9 +850,9 @@
5.131 writeAttributes();
5.132 }
5.133
5.134 - /// \brief Gives back the stream of the writer
5.135 + /// \brief Give back the stream of the writer
5.136 ///
5.137 - /// Gives back the stream of the writer
5.138 + /// Give back the stream of the writer.
5.139 std::ostream& ostream() {
5.140 return *_os;
5.141 }
5.142 @@ -860,6 +860,9 @@
5.143 /// @}
5.144 };
5.145
5.146 + /// \brief Return a \ref DigraphWriter class
5.147 + ///
5.148 + /// This function just returns a \ref DigraphWriter class.
5.149 /// \relates DigraphWriter
5.150 template <typename Digraph>
5.151 DigraphWriter<Digraph> digraphWriter(std::ostream& os,
5.152 @@ -868,6 +871,9 @@
5.153 return tmp;
5.154 }
5.155
5.156 + /// \brief Return a \ref DigraphWriter class
5.157 + ///
5.158 + /// This function just returns a \ref DigraphWriter class.
5.159 /// \relates DigraphWriter
5.160 template <typename Digraph>
5.161 DigraphWriter<Digraph> digraphWriter(const std::string& fn,
5.162 @@ -876,6 +882,9 @@
5.163 return tmp;
5.164 }
5.165
5.166 + /// \brief Return a \ref DigraphWriter class
5.167 + ///
5.168 + /// This function just returns a \ref DigraphWriter class.
5.169 /// \relates DigraphWriter
5.170 template <typename Digraph>
5.171 DigraphWriter<Digraph> digraphWriter(const char* fn,
5.172 @@ -898,9 +907,13 @@
5.173
5.174 /// \ingroup lemon_io
5.175 ///
5.176 - /// \brief LGF writer for directed graphs
5.177 + /// \brief \ref lgf-format "LGF" writer for directed graphs
5.178 ///
5.179 /// This utility writes an \ref lgf-format "LGF" file.
5.180 + ///
5.181 + /// It can be used almost the same way as \c DigraphWriter.
5.182 + /// The only difference is that this class can handle edges and
5.183 + /// edge maps as well as arcs and arc maps.
5.184 template <typename _Graph>
5.185 class GraphWriter {
5.186 public:
5.187 @@ -1023,9 +1036,9 @@
5.188 /// \name Writing rules
5.189 /// @{
5.190
5.191 - /// \brief Node map reading rule
5.192 + /// \brief Node map writing rule
5.193 ///
5.194 - /// Add a node map reading rule to the writer.
5.195 + /// Add a node map writing rule to the writer.
5.196 template <typename Map>
5.197 GraphWriter& nodeMap(const std::string& caption, const Map& map) {
5.198 checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
5.199 @@ -1169,28 +1182,28 @@
5.200 return *this;
5.201 }
5.202
5.203 - /// \name Select section by name
5.204 + /// \name Section captions
5.205 /// @{
5.206
5.207 - /// \brief Set \c \@nodes section to be read
5.208 + /// \brief Add an additional caption to the \c \@nodes section
5.209 ///
5.210 - /// Set \c \@nodes section to be read
5.211 + /// Add an additional caption to the \c \@nodes section.
5.212 GraphWriter& nodes(const std::string& caption) {
5.213 _nodes_caption = caption;
5.214 return *this;
5.215 }
5.216
5.217 - /// \brief Set \c \@edges section to be read
5.218 + /// \brief Add an additional caption to the \c \@arcs section
5.219 ///
5.220 - /// Set \c \@edges section to be read
5.221 + /// Add an additional caption to the \c \@arcs section.
5.222 GraphWriter& edges(const std::string& caption) {
5.223 _edges_caption = caption;
5.224 return *this;
5.225 }
5.226
5.227 - /// \brief Set \c \@attributes section to be read
5.228 + /// \brief Add an additional caption to the \c \@attributes section
5.229 ///
5.230 - /// Set \c \@attributes section to be read
5.231 + /// Add an additional caption to the \c \@attributes section.
5.232 GraphWriter& attributes(const std::string& caption) {
5.233 _attributes_caption = caption;
5.234 return *this;
5.235 @@ -1201,7 +1214,7 @@
5.236
5.237 /// \brief Skip writing the node set
5.238 ///
5.239 - /// The \c \@nodes section will be not written to the stream.
5.240 + /// The \c \@nodes section will not be written to the stream.
5.241 GraphWriter& skipNodes() {
5.242 LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
5.243 _skip_nodes = true;
5.244 @@ -1210,7 +1223,7 @@
5.245
5.246 /// \brief Skip writing edge set
5.247 ///
5.248 - /// The \c \@edges section will be not written to the stream.
5.249 + /// The \c \@edges section will not be written to the stream.
5.250 GraphWriter& skipEdges() {
5.251 LEMON_ASSERT(!_skip_edges, "Multiple usage of skipEdges() member");
5.252 _skip_edges = true;
5.253 @@ -1418,7 +1431,7 @@
5.254
5.255 /// \brief Start the batch processing
5.256 ///
5.257 - /// This function starts the batch processing
5.258 + /// This function starts the batch processing.
5.259 void run() {
5.260 if (!_skip_nodes) {
5.261 writeNodes();
5.262 @@ -1433,9 +1446,9 @@
5.263 writeAttributes();
5.264 }
5.265
5.266 - /// \brief Gives back the stream of the writer
5.267 + /// \brief Give back the stream of the writer
5.268 ///
5.269 - /// Gives back the stream of the writer
5.270 + /// Give back the stream of the writer
5.271 std::ostream& ostream() {
5.272 return *_os;
5.273 }
5.274 @@ -1443,6 +1456,9 @@
5.275 /// @}
5.276 };
5.277
5.278 + /// \brief Return a \ref GraphWriter class
5.279 + ///
5.280 + /// This function just returns a \ref GraphWriter class.
5.281 /// \relates GraphWriter
5.282 template <typename Graph>
5.283 GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph) {
5.284 @@ -1450,6 +1466,9 @@
5.285 return tmp;
5.286 }
5.287
5.288 + /// \brief Return a \ref GraphWriter class
5.289 + ///
5.290 + /// This function just returns a \ref GraphWriter class.
5.291 /// \relates GraphWriter
5.292 template <typename Graph>
5.293 GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph) {
5.294 @@ -1457,6 +1476,9 @@
5.295 return tmp;
5.296 }
5.297
5.298 + /// \brief Return a \ref GraphWriter class
5.299 + ///
5.300 + /// This function just returns a \ref GraphWriter class.
5.301 /// \relates GraphWriter
5.302 template <typename Graph>
5.303 GraphWriter<Graph> graphWriter(const char* fn, const Graph& graph) {