lemon/graph_writer.h
changeset 1526 8c14aa8f27a2
parent 1435 8e85e6bbefdf
child 1534 b86aad11f842
     1.1 --- a/lemon/graph_writer.h	Wed Jun 29 19:44:30 2005 +0000
     1.2 +++ b/lemon/graph_writer.h	Thu Jun 30 16:13:30 2005 +0000
     1.3 @@ -33,9 +33,12 @@
     1.4  
     1.5    /// \brief The graph writer class.
     1.6    ///
     1.7 -  /// The \c GraphWriter class provides the graph output. To write a graph
     1.8 -  /// you should first give writing commands for the writer. You can declare
     1.9 -  /// write command as \c NodeMap or \c EdgeMap writing and labeled Node and
    1.10 +  /// The \c GraphWriter class provides the graph output. 
    1.11 +  /// Before you read this documentation it might be useful to read the general
    1.12 +  /// description of  \ref graph-io-page "Graph Input-Output".
    1.13 +  /// To write a graph
    1.14 +  /// you should first give writing commands to the writer. You can declare
    1.15 +  /// write commands as \c NodeMap or \c EdgeMap writing and labeled Node and
    1.16    /// Edge writing.
    1.17    ///
    1.18    /// \code
    1.19 @@ -46,7 +49,7 @@
    1.20    /// command in the \c GraphWriter. You should give as parameter 
    1.21    /// the name of the map and the map object. The NodeMap writing 
    1.22    /// command with name "id" should write a unique map because it 
    1.23 -  /// is regarded as ID map.
    1.24 +  /// is regarded as ID map (such a map is essential if the graph has edges).
    1.25    ///
    1.26    /// \code
    1.27    /// IdMap<ListGraph, Node> nodeIdMap;
    1.28 @@ -69,8 +72,8 @@
    1.29    /// \endcode
    1.30    ///
    1.31    /// With \c writeNode() and \c writeEdge() functions you can 
    1.32 -  /// point out Nodes and Edges in the graph. By example, you can 
    1.33 -  /// write out the source and target of the graph.
    1.34 +  /// point out Nodes and Edges in the graph. For example, you can 
    1.35 +  /// write out the source and target of a maximum flow instance.
    1.36    ///
    1.37    /// \code
    1.38    /// writer.writeNode("source", sourceNode);
    1.39 @@ -80,7 +83,7 @@
    1.40    /// \endcode
    1.41    ///
    1.42    /// After you give all write commands you must call the \c run() member
    1.43 -  /// function, which execute all the writer commands.
    1.44 +  /// function, which executes all the writing commands.
    1.45    ///
    1.46    /// \code
    1.47    /// writer.run();
    1.48 @@ -105,7 +108,7 @@
    1.49  
    1.50      /// \brief Construct a new GraphWriter.
    1.51      ///
    1.52 -    /// Construct a new GraphWriter. It writes the given graph
    1.53 +    /// This function constructs a new GraphWriter to write the given graph
    1.54      /// to the given stream.
    1.55      GraphWriter(std::ostream& _os, const Graph& _graph) 
    1.56        : writer(new LemonWriter(_os)), own_writer(true), 
    1.57 @@ -117,7 +120,7 @@
    1.58  
    1.59      /// \brief Construct a new GraphWriter.
    1.60      ///
    1.61 -    /// Construct a new GraphWriter. It writes into the given graph
    1.62 +    /// This function constructs a new GraphWriter to write the given graph
    1.63      /// to the given file.
    1.64      GraphWriter(const std::string& _filename, const Graph& _graph) 
    1.65        : writer(new LemonWriter(_filename)), own_writer(true), 
    1.66 @@ -129,8 +132,8 @@
    1.67  
    1.68      /// \brief Construct a new GraphWriter.
    1.69      ///
    1.70 -    /// Construct a new GraphWriter. It writes into the given graph
    1.71 -    /// to given LemonReader.
    1.72 +    /// This function constructs a new GraphWriter to write the given graph
    1.73 +    /// to the given LemonReader.
    1.74      GraphWriter(LemonWriter& _writer, const Graph& _graph)
    1.75        : writer(_writer), own_writer(false), 
    1.76  	nodeset_writer(*writer, _graph, std::string()),
    1.77 @@ -141,24 +144,24 @@
    1.78  
    1.79      /// \brief Destruct the graph writer.
    1.80      ///
    1.81 -    /// Destruct the graph writer.
    1.82 +    /// This function destructs the graph writer.
    1.83      ~GraphWriter() {
    1.84        if (own_writer) 
    1.85  	delete writer;
    1.86      }
    1.87  
    1.88 -    /// \brief Add a new node map writer command for the writer.
    1.89 +    /// \brief Issue a new node map writing command for the writer.
    1.90      ///
    1.91 -    /// Add a new node map writer command for the writer.
    1.92 +   /// This function issues a new <i> node map writing command</i> to the writer.
    1.93      template <typename Map>
    1.94      GraphWriter& writeNodeMap(std::string name, const Map& map) {
    1.95        nodeset_writer.writeNodeMap(name, map);
    1.96        return *this;
    1.97      }
    1.98  
    1.99 -    /// \brief Add a new node map writer command for the writer.
   1.100 +    /// \brief Issue a new node map writing command for the writer.
   1.101      ///
   1.102 -    /// Add a new node map writer command for the writer.
   1.103 +   /// This function issues a new <i> node map writing command</i> to the writer.
   1.104      template <typename Writer, typename Map>
   1.105      GraphWriter& writeNodeMap(std::string name, const Map& map, 
   1.106  			      const Writer& writer = Writer()) {
   1.107 @@ -167,9 +170,9 @@
   1.108      }
   1.109  
   1.110  
   1.111 -    /// \brief Add a new edge map writer command for the writer.
   1.112 +    /// \brief Issue a new edge map writing command for the writer.
   1.113      ///
   1.114 -    /// Add a new edge map writer command for the writer.
   1.115 +   /// This function issues a new <i> edge map writing command</i> to the writer.
   1.116      template <typename Map>
   1.117      GraphWriter& writeEdgeMap(std::string name, const Map& map) { 
   1.118        edgeset_writer.writeEdgeMap(name, map);
   1.119 @@ -177,9 +180,9 @@
   1.120      }
   1.121  
   1.122  
   1.123 -    /// \brief Add a new edge map writer command for the writer.
   1.124 +    /// \brief Issue a new edge map writing command for the writer.
   1.125      ///
   1.126 -    /// Add a new edge map writer command for the writer.
   1.127 +   /// This function issues a new <i> edge map writing command</i> to the writer.
   1.128      template <typename Writer, typename Map>
   1.129      GraphWriter& writeEdgeMap(std::string name, const Map& map,
   1.130  			      const Writer& writer = Writer()) {
   1.131 @@ -187,33 +190,37 @@
   1.132        return *this;
   1.133      }
   1.134  
   1.135 -    /// \brief Add a new labeled node writer for the writer.
   1.136 +    /// \brief Issue a new labeled node writing command to the writer.
   1.137      ///
   1.138 -    /// Add a new labeled node writer for the writer.
   1.139 +    /// This function issues a new <i> labeled node writing command</i> 
   1.140 +    /// to the writer.
   1.141      GraphWriter& writeNode(std::string name, const Node& node) {
   1.142        node_writer.writeNode(name, node);
   1.143        return *this;
   1.144      }
   1.145  
   1.146 -    /// \brief Add a new labeled edge writer for the writer.
   1.147 +    /// \brief Issue a new labeled edge writing command to the writer.
   1.148      ///
   1.149 -    /// Add a new labeled edge writer for the writer.
   1.150 +    /// This function issues a new <i> labeled edge writing command</i> 
   1.151 +    /// to the writer.
   1.152      GraphWriter& writeEdge(std::string name, const Edge& edge) {
   1.153        edge_writer.writeEdge(name, edge);
   1.154      }
   1.155  
   1.156 -    /// \brief Add a new attribute writer command.
   1.157 +    /// \brief Issue a new attribute writing command.
   1.158      ///
   1.159 -    ///  Add a new attribute writer command.
   1.160 +    /// This function issues a new <i> attribute writing command</i> 
   1.161 +    /// to the writer.
   1.162      template <typename Value>
   1.163      GraphWriter& writeAttribute(std::string name, const Value& value) {
   1.164        attribute_writer.writeAttribute(name, value);
   1.165        return *this;
   1.166      }
   1.167      
   1.168 -    /// \brief Add a new attribute writer command.
   1.169 +    /// \brief Issue a new attribute writing command.
   1.170      ///
   1.171 -    ///  Add a new attribute writer command.
   1.172 +    /// This function issues a new <i> attribute writing command</i> 
   1.173 +    /// to the writer.
   1.174      template <typename Writer, typename Value>
   1.175      GraphWriter& writeAttribute(std::string name, const Value& value, 
   1.176  			       const Writer& writer) {
   1.177 @@ -223,7 +230,7 @@
   1.178  
   1.179      /// \brief Conversion operator to LemonWriter.
   1.180      ///
   1.181 -    /// Conversion operator to LemonWriter. It make possible
   1.182 +    /// Conversion operator to LemonWriter. It makes possible
   1.183      /// to access the encapsulated \e LemonWriter, this way
   1.184      /// you can attach to this writer new instances of 
   1.185      /// \e LemonWriter::SectionWriter.
   1.186 @@ -231,9 +238,9 @@
   1.187        return *writer;
   1.188      }
   1.189  
   1.190 -    /// \brief Executes the writer commands.
   1.191 +    /// \brief Executes the writing commands.
   1.192      ///
   1.193 -    /// Executes the writer commands.
   1.194 +    /// Executes the writing commands.
   1.195      void run() {
   1.196        writer->run();
   1.197      }
   1.198 @@ -241,7 +248,7 @@
   1.199      /// \brief Write the id of the given node.
   1.200      ///
   1.201      /// It writes the id of the given node. If there was written an "id"
   1.202 -    /// named node map then it will write the map value belongs to the node.
   1.203 +    /// named node map then it will write the map value belonging to the node.
   1.204      void writeId(std::ostream& os, const Node& item) const {
   1.205        nodeset_writer.writeId(os, item);
   1.206      } 
   1.207 @@ -249,7 +256,7 @@
   1.208      /// \brief Write the id of the given edge.
   1.209      ///
   1.210      /// It writes the id of the given edge. If there was written an "id"
   1.211 -    /// named edge map then it will write the map value belongs to the edge.
   1.212 +    /// named edge map then it will write the map value belonging to the edge.
   1.213      void writeId(std::ostream& os, const Edge& item) const {
   1.214        edgeset_writer.writeId(os, item);
   1.215      } 
   1.216 @@ -373,7 +380,7 @@
   1.217    /// \brief The undirected graph writer class.
   1.218    ///
   1.219    /// The \c UndirGraphWriter class provides the undir graph output. To write 
   1.220 -  /// a graph you should first give writing commands for the writer. You can 
   1.221 +  /// a graph you should first give writing commands to the writer. You can 
   1.222    /// declare write command as \c NodeMap, \c EdgeMap or \c UndirEdgeMap 
   1.223    /// writing and labeled Node, Edge or UndirEdge writing.
   1.224    ///
   1.225 @@ -416,7 +423,7 @@
   1.226    ///
   1.227    ///
   1.228    /// With \c writeNode() and \c writeUndirEdge() functions you can 
   1.229 -  /// point out nodes and undirected edges in the graph. By example, you can 
   1.230 +  /// designate nodes and undirected edges in the graph. For example, you can 
   1.231    /// write out the source and target of the graph.
   1.232    ///
   1.233    /// \code
   1.234 @@ -427,7 +434,7 @@
   1.235    /// \endcode
   1.236    ///
   1.237    /// After you give all write commands you must call the \c run() member
   1.238 -  /// function, which execute all the writer commands.
   1.239 +  /// function, which executes all the writing commands.
   1.240    ///
   1.241    /// \code
   1.242    /// writer.run();
   1.243 @@ -465,7 +472,7 @@
   1.244  
   1.245      /// \brief Construct a new UndirGraphWriter.
   1.246      ///
   1.247 -    /// Construct a new UndirGraphWriter. It writes into the given graph
   1.248 +    /// Construct a new UndirGraphWriter. It writes the given graph
   1.249      /// to the given file.
   1.250      UndirGraphWriter(const std::string& _filename, const Graph& _graph) 
   1.251        : writer(new LemonWriter(_filename)), own_writer(true), 
   1.252 @@ -477,7 +484,7 @@
   1.253  
   1.254      /// \brief Construct a new UndirGraphWriter.
   1.255      ///
   1.256 -    /// Construct a new UndirGraphWriter. It writes into the given graph
   1.257 +    /// Construct a new UndirGraphWriter. It writes the given graph
   1.258      /// to given LemonReader.
   1.259      UndirGraphWriter(LemonWriter& _writer, const Graph& _graph)
   1.260        : writer(_writer), own_writer(false), 
   1.261 @@ -495,18 +502,18 @@
   1.262  	delete writer;
   1.263      }
   1.264  
   1.265 -    /// \brief Add a new node map writer command for the writer.
   1.266 +    /// \brief Issue a new node map writing command to the writer.
   1.267      ///
   1.268 -    /// Add a new node map writer command for the writer.
   1.269 +   /// This function issues a new <i> node map writing command</i> to the writer.
   1.270      template <typename Map>
   1.271      UndirGraphWriter& writeNodeMap(std::string name, const Map& map) {
   1.272        nodeset_writer.writeNodeMap(name, map);
   1.273        return *this;
   1.274      }
   1.275  
   1.276 -    /// \brief Add a new node map writer command for the writer.
   1.277 +    /// \brief Issue a new node map writing command to the writer.
   1.278      ///
   1.279 -    /// Add a new node map writer command for the writer.
   1.280 +   /// This function issues a new <i> node map writing command</i> to the writer.
   1.281      template <typename Writer, typename Map>
   1.282      UndirGraphWriter& writeNodeMap(std::string name, const Map& map, 
   1.283  			      const Writer& writer = Writer()) {
   1.284 @@ -514,18 +521,18 @@
   1.285        return *this;
   1.286      }
   1.287  
   1.288 -    /// \brief Add a new edge map writer command for the writer.
   1.289 +    /// \brief Issue a new edge map writing command to the writer.
   1.290      ///
   1.291 -    /// Add a new edge map writer command for the writer.
   1.292 +   /// This function issues a new <i> edge map writing command</i> to the writer.
   1.293      template <typename Map>
   1.294      UndirGraphWriter& writeEdgeMap(std::string name, const Map& map) { 
   1.295        undir_edgeset_writer.writeEdgeMap(name, map);
   1.296        return *this;
   1.297      }
   1.298  
   1.299 -    /// \brief Add a new edge map writer command for the writer.
   1.300 +    /// \brief Issue a new edge map writing command to the writer.
   1.301      ///
   1.302 -    /// Add a new edge map writer command for the writer.
   1.303 +   /// This function issues a new <i> edge map writing command</i> to the writer.
   1.304      template <typename Writer, typename Map>
   1.305      UndirGraphWriter& writeEdgeMap(std::string name, const Map& map,
   1.306  				   const Writer& writer = Writer()) {
   1.307 @@ -533,18 +540,20 @@
   1.308        return *this;
   1.309      }
   1.310  
   1.311 -    /// \brief Add a new undirected edge map writer command for the writer.
   1.312 +    /// \brief Issue a new undirected edge map writing command to the writer.
   1.313      ///
   1.314 -    /// Add a new undirected edge map writer command for the writer.
   1.315 +    /// This function issues a new <i> undirected edge map writing
   1.316 +    /// command</i> to the writer.
   1.317      template <typename Map>
   1.318      UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map) { 
   1.319        undir_edgeset_writer.writeUndirEdgeMap(name, map);
   1.320        return *this;
   1.321      }
   1.322  
   1.323 -    /// \brief Add a new undirected edge map writer command for the writer.
   1.324 +    /// \brief Issue a new undirected edge map writing command to the writer.
   1.325      ///
   1.326 -    /// Add a new edge undirected map writer command for the writer.
   1.327 +    /// This function issues a new <i> undirected edge map writing
   1.328 +    /// command</i> to the writer.
   1.329      template <typename Writer, typename Map>
   1.330      UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map,
   1.331  					const Writer& writer = Writer()) {
   1.332 @@ -552,40 +561,46 @@
   1.333        return *this;
   1.334      }
   1.335  
   1.336 -    /// \brief Add a new labeled node writer for the writer.
   1.337 +    /// \brief Issue a new labeled node writer to the writer.
   1.338      ///
   1.339 -    /// Add a new labeled node writer for the writer.
   1.340 +    /// This function issues a new <i> labeled node writing
   1.341 +    /// command</i> to the writer.
   1.342      UndirGraphWriter& writeNode(std::string name, const Node& node) {
   1.343        node_writer.writeNode(name, node);
   1.344        return *this;
   1.345      }
   1.346  
   1.347 -    /// \brief Add a new labeled edge writer for the writer.
   1.348 +    /// \brief Issue a new labeled edge writer to the writer.
   1.349      ///
   1.350 -    /// Add a new labeled edge writer for the writer.
   1.351 +    /// This function issues a new <i> labeled edge writing
   1.352 +    /// command</i> to the writer.
   1.353      UndirGraphWriter& writeEdge(std::string name, const Edge& edge) {
   1.354        undir_edge_writer.writeEdge(name, edge);
   1.355      }
   1.356  
   1.357 -    /// \brief Add a new labeled undirected edge writer for the writer.
   1.358 +    /// \brief Issue a new labeled undirected edge writing command to
   1.359 +    /// the writer.
   1.360      ///
   1.361 -    /// Add a new labeled undirected edge writer for the writer.
   1.362 +    /// Issue a new <i>labeled undirected edge writing command</i> to
   1.363 +    /// the writer.
   1.364      UndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) {
   1.365        undir_edge_writer.writeUndirEdge(name, edge);
   1.366      }
   1.367  
   1.368 -    /// \brief Add a new attribute writer command.
   1.369 +    /// \brief Issue a new attribute writing command.
   1.370      ///
   1.371 -    ///  Add a new attribute writer command.
   1.372 +    /// This function issues a new <i> attribute writing
   1.373 +    /// command</i> to the writer.
   1.374      template <typename Value>
   1.375      UndirGraphWriter& writeAttribute(std::string name, const Value& value) {
   1.376        attribute_writer.writeAttribute(name, value);
   1.377        return *this;
   1.378      }
   1.379      
   1.380 -    /// \brief Add a new attribute writer command.
   1.381 +    /// \brief Issue a new attribute writing command.
   1.382      ///
   1.383 -    ///  Add a new attribute writer command.
   1.384 +    /// This function issues a new <i> attribute writing
   1.385 +    /// command</i> to the writer.
   1.386      template <typename Writer, typename Value>
   1.387      UndirGraphWriter& writeAttribute(std::string name, const Value& value, 
   1.388  			       const Writer& writer) {
   1.389 @@ -595,7 +610,7 @@
   1.390  
   1.391      /// \brief Conversion operator to LemonWriter.
   1.392      ///
   1.393 -    /// Conversion operator to LemonWriter. It make possible
   1.394 +    /// Conversion operator to LemonWriter. It makes possible
   1.395      /// to access the encapsulated \e LemonWriter, this way
   1.396      /// you can attach to this writer new instances of 
   1.397      /// \e LemonWriter::SectionWriter.
   1.398 @@ -603,9 +618,9 @@
   1.399        return *writer;
   1.400      }
   1.401  
   1.402 -    /// \brief Executes the writer commands.
   1.403 +    /// \brief Executes the writing commands.
   1.404      ///
   1.405 -    /// Executes the writer commands.
   1.406 +    /// Executes the writing commands.
   1.407      void run() {
   1.408        writer->run();
   1.409      }
   1.410 @@ -613,7 +628,7 @@
   1.411      /// \brief Write the id of the given node.
   1.412      ///
   1.413      /// It writes the id of the given node. If there was written an "id"
   1.414 -    /// named node map then it will write the map value belongs to the node.
   1.415 +    /// named node map then it will write the map value belonging to the node.
   1.416      void writeId(std::ostream& os, const Node& item) const {
   1.417        nodeset_writer.writeId(os, item);
   1.418      } 
   1.419 @@ -621,7 +636,7 @@
   1.420      /// \brief Write the id of the given edge.
   1.421      ///
   1.422      /// It writes the id of the given edge. If there was written an "id"
   1.423 -    /// named edge map then it will write the map value belongs to the edge.
   1.424 +    /// named edge map then it will write the map value belonging to the edge.
   1.425      void writeId(std::ostream& os, const Edge& item) const {
   1.426        undir_edgeset_writer.writeId(os, item);
   1.427      } 
   1.428 @@ -629,7 +644,7 @@
   1.429      /// \brief Write the id of the given undirected edge.
   1.430      ///
   1.431      /// It writes the id of the given undirected edge. If there was written 
   1.432 -    /// an "id" named edge map then it will write the map value belongs to 
   1.433 +    /// an "id" named edge map then it will write the map value belonging to 
   1.434      /// the edge.
   1.435      void writeId(std::ostream& os, const UndirEdge& item) const {
   1.436        undir_edgeset_writer.writeId(os, item);
   1.437 @@ -651,9 +666,11 @@
   1.438    };
   1.439  
   1.440  
   1.441 -  /// \brief Write an undirected graph to the output.
   1.442 +  /// \brief Write an undirected multigraph (undirected graph + capacity
   1.443 +  /// map on the edges) to the output.
   1.444    ///
   1.445 -  /// Write an undirected graph to the output.
   1.446 +  /// Write an undirected multigraph (undirected graph + capacity
   1.447 +  /// map on the edges) to the output.
   1.448    /// \param os The output stream.
   1.449    /// \param g The graph.
   1.450    /// \param capacity The capacity undirected map.