Modifying the interface.
authordeba
Wed, 27 Apr 2005 10:44:58 +0000
changeset 1394f0c48d7fa73d
parent 1393 2edd8cd06eaf
child 1395 746db68ca035
Modifying the interface.
add -> read, write
doc/graph_io.dox
src/demo/lp_maxflow_demo.cc
src/demo/min_route.cc
src/lemon/graph_reader.h
src/lemon/graph_writer.h
     1.1 --- a/doc/graph_io.dox	Wed Apr 27 10:42:58 2005 +0000
     1.2 +++ b/doc/graph_io.dox	Wed Apr 27 10:44:58 2005 +0000
     1.3 @@ -89,7 +89,7 @@
     1.4  GraphWriter<ListGraph> writer(std::cout, graph);
     1.5  \endcode
     1.6  
     1.7 -The \c addNodeMap() function declares a \c NodeMap writing command in the
     1.8 +The \c writeNodeMap() function declares a \c NodeMap writing command in the
     1.9  \c GraphWriter. You should give as parameter the name of the map and the map
    1.10  object. The NodeMap writing command with name "id" should write a 
    1.11  unique map because it is regarded as ID map.
    1.12 @@ -98,34 +98,34 @@
    1.13  
    1.14  \code
    1.15  IdMap<ListGraph, Node> nodeIdMap;
    1.16 -writer.addNodeMap("id", nodeIdMap);
    1.17 +writer.writeNodeMap("id", nodeIdMap);
    1.18  
    1.19 -writer.addNodeMap("x-coord", xCoordMap);
    1.20 -writer.addNodeMap("y-coord", yCoordMap);
    1.21 -writer.addNodeMap("color", colorMap);
    1.22 +writer.writeNodeMap("x-coord", xCoordMap);
    1.23 +writer.writeNodeMap("y-coord", yCoordMap);
    1.24 +writer.writeNodeMap("color", colorMap);
    1.25  \endcode
    1.26  
    1.27 -With the \c addEdgeMap() member function you can give an edge map
    1.28 +With the \c writeEdgeMap() member function you can give an edge map
    1.29  writing command similar to the NodeMaps.
    1.30  
    1.31  \see IdMap, DescriptorMap  
    1.32  \code
    1.33  DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > edgeDescMap(graph);
    1.34 -writer.addEdgeMap("descriptor", edgeDescMap);
    1.35 +writer.writeEdgeMap("descriptor", edgeDescMap);
    1.36  
    1.37 -writer.addEdgeMap("weight", weightMap);
    1.38 -writer.addEdgeMap("label", labelMap);
    1.39 +writer.writeEdgeMap("weight", weightMap);
    1.40 +writer.writeEdgeMap("label", labelMap);
    1.41  \endcode
    1.42  
    1.43 -With \c addNode() and \c addEdge() functions you can point out Nodes and
    1.44 +With \c writeNode() and \c writeEdge() functions you can point out Nodes and
    1.45  Edges in the graph. By example, you can write out the source and target
    1.46  of the graph.
    1.47  
    1.48  \code
    1.49 -writer.addNode("source", sourceNode);
    1.50 -writer.addNode("target", targetNode);
    1.51 +writer.writeNode("source", sourceNode);
    1.52 +writer.writeNode("target", targetNode);
    1.53  
    1.54 -writer.addEdge("observed", edge);
    1.55 +writer.writeEdge("observed", edge);
    1.56  \endcode
    1.57  
    1.58  After you give all write commands you must call the \c run() member
    1.59 @@ -151,38 +151,38 @@
    1.60  GraphReader<ListGraph> reader(std::cin, graph);
    1.61  \endcode
    1.62  
    1.63 -The \c addNodeMap() function reads a map from the \c \@nodeset section.
    1.64 +The \c readNodeMap() function reads a map from the \c \@nodeset section.
    1.65  If there is a map that you do not want to read from the file and there is
    1.66  whitespace in the string represenation of the values then you should
    1.67  call the \c skipNodeMap() template member function with proper parameters.
    1.68  
    1.69  \see QuotedStringReader
    1.70  \code
    1.71 -reader.addNodeMap("x-coord", xCoordMap);
    1.72 -reader.addNodeMap("y-coord", yCoordMap);
    1.73 +reader.readNodeMap("x-coord", xCoordMap);
    1.74 +reader.readNodeMap("y-coord", yCoordMap);
    1.75  
    1.76 -reader.addNodeMap<QuotedStringReader>("label", labelMap);
    1.77 +reader.readNodeMap<QuotedStringReader>("label", labelMap);
    1.78  reader.skipNodeMap<QuotedStringReader>("description");
    1.79  
    1.80 -reader.addNodeMap("color", colorMap);
    1.81 +reader.readNodeMap("color", colorMap);
    1.82  \endcode
    1.83  
    1.84 -With the \c addEdgeMap() member function you can give an edge map
    1.85 +With the \c readEdgeMap() member function you can give an edge map
    1.86  reading command similar to the NodeMaps. 
    1.87  
    1.88  \code
    1.89 -reader.addEdgeMap("weight", weightMap);
    1.90 -reader.addEdgeMap("label", labelMap);
    1.91 +reader.readEdgeMap("weight", weightMap);
    1.92 +reader.readEdgeMap("label", labelMap);
    1.93  \endcode
    1.94  
    1.95 -With \c addNode() and \c addEdge() functions you can read labeled Nodes and
    1.96 +With \c readNode() and \c readEdge() functions you can read labeled Nodes and
    1.97  Edges.
    1.98  
    1.99  \code
   1.100 -reader.addNode("source", sourceNode);
   1.101 -reader.addNode("target", targetNode);
   1.102 +reader.readNode("source", sourceNode);
   1.103 +reader.readNode("target", targetNode);
   1.104  
   1.105 -reader.addEdge("observed", edge);
   1.106 +reader.readEdge("observed", edge);
   1.107  \endcode
   1.108  
   1.109  After you give all read commands you must call the \c run() member
   1.110 @@ -230,7 +230,7 @@
   1.111    }
   1.112  };
   1.113  ...
   1.114 -reader.addNodeMap<LengthReader>("strings", lengthMap);
   1.115 +reader.readNodeMap<LengthReader>("strings", lengthMap);
   1.116  \endcode  
   1.117  
   1.118  The global functionality of the reader class can be changed by giving a
     2.1 --- a/src/demo/lp_maxflow_demo.cc	Wed Apr 27 10:42:58 2005 +0000
     2.2 +++ b/src/demo/lp_maxflow_demo.cc	Wed Apr 27 10:44:58 2005 +0000
     2.3 @@ -75,8 +75,8 @@
     2.4    ListGraph::EdgeMap<double> cap(g);
     2.5    
     2.6    GraphReader<ListGraph> reader(std::cin,g);
     2.7 -  reader.addNode("source",s).addNode("target",t)
     2.8 -    .addEdgeMap("capacity",cap).run();
     2.9 +  reader.readNode("source",s).readNode("target",t)
    2.10 +    .readEdgeMap("capacity",cap).run();
    2.11    
    2.12    // std::ifstream file("../test/preflow_");
    2.13  //   readDimacs(file, g, cap, s, t);
     3.1 --- a/src/demo/min_route.cc	Wed Apr 27 10:42:58 2005 +0000
     3.2 +++ b/src/demo/min_route.cc	Wed Apr 27 10:44:58 2005 +0000
     3.3 @@ -69,16 +69,16 @@
     3.4    
     3.5    CoordMap coord(graph);
     3.6    XMap<CoordMap> xcoord = xMap(coord);
     3.7 -  reader.addNodeMap("coordinates_x", xcoord);
     3.8 +  reader.readNodeMap("coordinates_x", xcoord);
     3.9    YMap<CoordMap> ycoord = yMap(coord);
    3.10 -  reader.addNodeMap("coordinates_y", ycoord);
    3.11 +  reader.readNodeMap("coordinates_y", ycoord);
    3.12  
    3.13    LengthMap length(graph);
    3.14 -  reader.addEdgeMap("length", length);
    3.15 +  reader.readEdgeMap("length", length);
    3.16  
    3.17    Node source, target;
    3.18 -  reader.addNode("source", source);
    3.19 -  reader.addNode("target", target);
    3.20 +  reader.readNode("source", source);
    3.21 +  reader.readNode("target", target);
    3.22  
    3.23    reader.run();
    3.24  
     4.1 --- a/src/lemon/graph_reader.h	Wed Apr 27 10:42:58 2005 +0000
     4.2 +++ b/src/lemon/graph_reader.h	Wed Apr 27 10:44:58 2005 +0000
     4.3 @@ -200,38 +200,38 @@
     4.4    /// GraphReader<ListGraph> reader(std::cin, graph);
     4.5    /// \endcode
     4.6    ///
     4.7 -  /// The \c addNodeMap() function reads a map from the \c \@nodeset section.
     4.8 +  /// The \c readNodeMap() function reads a map from the \c \@nodeset section.
     4.9    /// If there is a map that you do not want to read from the file and there is
    4.10    /// whitespace in the string represenation of the values then you should
    4.11    /// call the \c skipNodeMap() template member function with proper 
    4.12    /// parameters.
    4.13    ///
    4.14    /// \code
    4.15 -  /// reader.addNodeMap("x-coord", xCoordMap);
    4.16 -  /// reader.addNodeMap("y-coord", yCoordMap);
    4.17 +  /// reader.readNodeMap("x-coord", xCoordMap);
    4.18 +  /// reader.readNodeMap("y-coord", yCoordMap);
    4.19    ///
    4.20 -  /// reader.addNodeMap<QuotedStringReader>("label", labelMap);
    4.21 +  /// reader.readNodeMap<QuotedStringReader>("label", labelMap);
    4.22    /// reader.skipNodeMap<QuotedStringReader>("description");
    4.23    ///
    4.24 -  /// reader.addNodeMap("color", colorMap);
    4.25 +  /// reader.readNodeMap("color", colorMap);
    4.26    /// \endcode
    4.27    ///
    4.28 -  /// With the \c addEdgeMap() member function you can give an edge map
    4.29 +  /// With the \c readEdgeMap() member function you can give an edge map
    4.30    /// reading command similar to the NodeMaps. 
    4.31    ///
    4.32    /// \code
    4.33 -  /// reader.addEdgeMap("weight", weightMap);
    4.34 -  /// reader.addEdgeMap("label", labelMap);
    4.35 +  /// reader.readEdgeMap("weight", weightMap);
    4.36 +  /// reader.readEdgeMap("label", labelMap);
    4.37    /// \endcode
    4.38    ///
    4.39 -  /// With \c addNode() and \c addEdge() functions you can read labeled Nodes 
    4.40 +  /// With \c readNode() and \c readEdge() functions you can read labeled Nodes 
    4.41    /// and Edges.
    4.42    ///
    4.43    /// \code
    4.44 -  /// reader.addNode("source", sourceNode);
    4.45 -  /// reader.addNode("target", targetNode);
    4.46 +  /// reader.readNode("source", sourceNode);
    4.47 +  /// reader.readNode("target", targetNode);
    4.48    ///
    4.49 -  /// reader.addEdge("observed", edge);
    4.50 +  /// reader.readEdge("observed", edge);
    4.51    /// \endcode
    4.52    ///
    4.53    /// After you give all read commands you must call the \c run() member
    4.54 @@ -285,8 +285,8 @@
    4.55      ///
    4.56      /// Add a new node map reader command for the reader.
    4.57      template <typename Map>
    4.58 -    GraphReader& addNodeMap(std::string name, Map& map) {
    4.59 -      return addNodeMap<typename ReaderTraits::template 
    4.60 +    GraphReader& readNodeMap(std::string name, Map& map) {
    4.61 +      return readNodeMap<typename ReaderTraits::template 
    4.62  	Reader<typename Map::Value>, Map>(name, map);
    4.63      }
    4.64  
    4.65 @@ -294,7 +294,7 @@
    4.66      ///
    4.67      /// Add a new node map reader command for the reader.
    4.68      template <typename Reader, typename Map>
    4.69 -    GraphReader& addNodeMap(std::string name, Map& map, 
    4.70 +    GraphReader& readNodeMap(std::string name, Map& map, 
    4.71  			     const Reader& reader = Reader()) {
    4.72        if (node_map_readers.find(name) != node_map_readers.end()) {
    4.73  	ErrorMessage msg;
    4.74 @@ -326,8 +326,8 @@
    4.75      ///
    4.76      /// Add a new edge map reader command for the reader.
    4.77      template <typename Map>
    4.78 -    GraphReader& addEdgeMap(std::string name, Map& map) { 
    4.79 -      return addEdgeMap<typename ReaderTraits::template
    4.80 +    GraphReader& readEdgeMap(std::string name, Map& map) { 
    4.81 +      return readEdgeMap<typename ReaderTraits::template
    4.82  	Reader<typename Map::Value>, Map>(name, map);
    4.83      }
    4.84  
    4.85 @@ -336,7 +336,7 @@
    4.86      ///
    4.87      /// Add a new edge map reader command for the reader.
    4.88      template <typename Reader, typename Map>
    4.89 -    GraphReader& addEdgeMap(std::string name, Map& map,
    4.90 +    GraphReader& readEdgeMap(std::string name, Map& map,
    4.91  			     const Reader& reader = Reader()) {
    4.92        if (edge_map_readers.find(name) != edge_map_readers.end()) {
    4.93  	ErrorMessage msg;
    4.94 @@ -367,7 +367,7 @@
    4.95      /// \brief Add a new labeled node reader for the reader.
    4.96      ///
    4.97      /// Add a new labeled node reader for the reader.
    4.98 -    GraphReader& addNode(std::string name, Node& node) {
    4.99 +    GraphReader& readNode(std::string name, Node& node) {
   4.100        if (node_readers.find(name) != node_readers.end()) {
   4.101  	ErrorMessage msg;
   4.102  	msg << "Multiple read rule for node: " << name;
   4.103 @@ -380,7 +380,7 @@
   4.104      /// \brief Add a new labeled edge reader for the reader.
   4.105      ///
   4.106      /// Add a new labeled edge reader for the reader.
   4.107 -    GraphReader& addEdge(std::string name, Edge& edge) {
   4.108 +    GraphReader& readEdge(std::string name, Edge& edge) {
   4.109        if (edge_readers.find(name) != edge_readers.end()) {
   4.110  	ErrorMessage msg;
   4.111  	msg << "Multiple read rule for edge: " << name;
   4.112 @@ -754,10 +754,10 @@
   4.113  		  typename Graph::Node &s, typename Graph::Node &t, 
   4.114  		  CostMap& cost) {
   4.115      GraphReader<Graph> reader(is, g);
   4.116 -    reader.addEdgeMap("capacity", capacity);
   4.117 -    reader.addEdgeMap("cost", cost);
   4.118 -    reader.addNode("source", s);
   4.119 -    reader.addNode("target", t);
   4.120 +    reader.readEdgeMap("capacity", capacity);
   4.121 +    reader.readEdgeMap("cost", cost);
   4.122 +    reader.readNode("source", s);
   4.123 +    reader.readNode("target", t);
   4.124      reader.run();
   4.125    }
   4.126  
   4.127 @@ -773,9 +773,9 @@
   4.128    void readGraph(std::istream& is, Graph &g, CapacityMap& capacity, 
   4.129  		  typename Graph::Node &s, typename Graph::Node &t) {
   4.130      GraphReader<Graph> reader(is, g);
   4.131 -    reader.addEdgeMap("capacity", capacity);
   4.132 -    reader.addNode("source", s);
   4.133 -    reader.addNode("target", t);
   4.134 +    reader.readEdgeMap("capacity", capacity);
   4.135 +    reader.readNode("source", s);
   4.136 +    reader.readNode("target", t);
   4.137      reader.run();
   4.138    }
   4.139  
   4.140 @@ -790,8 +790,8 @@
   4.141    void readGraph(std::istream& is, Graph &g, CapacityMap& capacity, 
   4.142  		  typename Graph::Node &s) {
   4.143      GraphReader<Graph> reader(is, g);
   4.144 -    reader.addEdgeMap("capacity", capacity);
   4.145 -    reader.addNode("source", s);
   4.146 +    reader.readEdgeMap("capacity", capacity);
   4.147 +    reader.readNode("source", s);
   4.148      reader.run();
   4.149    }
   4.150  
   4.151 @@ -804,7 +804,7 @@
   4.152    template<typename Graph, typename CapacityMap>
   4.153    void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
   4.154      GraphReader<Graph> reader(is, g);
   4.155 -    reader.addEdgeMap("capacity", capacity);
   4.156 +    reader.readEdgeMap("capacity", capacity);
   4.157      reader.run();
   4.158    }
   4.159  
     5.1 --- a/src/lemon/graph_writer.h	Wed Apr 27 10:42:58 2005 +0000
     5.2 +++ b/src/lemon/graph_writer.h	Wed Apr 27 10:44:58 2005 +0000
     5.3 @@ -168,41 +168,42 @@
     5.4    /// GraphWriter<ListGraph> writer(std::cout, graph);
     5.5    /// \endcode
     5.6    ///
     5.7 -  /// The \c addNodeMap() function declares a \c NodeMap writing command in the
     5.8 -  /// \c GraphWriter. You should give as parameter the name of the map and the
     5.9 -  /// map object. The NodeMap writing command with name "id" should write a 
    5.10 -  /// unique map because it is regarded as ID map.
    5.11 +  /// The \c writeNodeMap() function declares a \c NodeMap writing 
    5.12 +  /// command in the \c GraphWriter. You should give as parameter 
    5.13 +  /// the name of the map and the map object. The NodeMap writing 
    5.14 +  /// command with name "id" should write a unique map because it 
    5.15 +  /// is regarded as ID map.
    5.16    ///
    5.17    /// \code
    5.18    /// IdMap<ListGraph, Node> nodeIdMap;
    5.19 -  /// writer.addNodeMap("id", nodeIdMap);
    5.20 +  /// writer.writeNodeMap("id", nodeIdMap);
    5.21    ///
    5.22 -  /// writer.addNodeMap("x-coord", xCoordMap);
    5.23 -  /// writer.addNodeMap("y-coord", yCoordMap);
    5.24 -  /// writer.addNodeMap("color", colorMap);
    5.25 +  /// writer.writeNodeMap("x-coord", xCoordMap);
    5.26 +  /// writer.writeNodeMap("y-coord", yCoordMap);
    5.27 +  /// writer.writeNodeMap("color", colorMap);
    5.28    /// \endcode
    5.29    ///
    5.30 -  /// With the \c addEdgeMap() member function you can give an edge map
    5.31 +  /// With the \c writeEdgeMap() member function you can give an edge map
    5.32    /// writing command similar to the NodeMaps.
    5.33    ///
    5.34    /// \code
    5.35    /// DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > 
    5.36    ///   edgeDescMap(graph);
    5.37 -  /// writer.addEdgeMap("descriptor", edgeDescMap);
    5.38 +  /// writer.writeEdgeMap("descriptor", edgeDescMap);
    5.39    ///
    5.40 -  /// writer.addEdgeMap("weight", weightMap);
    5.41 -  /// writer.addEdgeMap("label", labelMap);
    5.42 +  /// writer.writeEdgeMap("weight", weightMap);
    5.43 +  /// writer.writeEdgeMap("label", labelMap);
    5.44    /// \endcode
    5.45    ///
    5.46 -  /// With \c addNode() and \c addEdge() functions you can point out Nodes and
    5.47 -  /// Edges in the graph. By example, you can write out the source and target
    5.48 -  /// of the graph.
    5.49 +  /// With \c writeNode() and \c writeEdge() functions you can 
    5.50 +  /// point out Nodes and Edges in the graph. By example, you can 
    5.51 +  /// write out the source and target of the graph.
    5.52    ///
    5.53    /// \code
    5.54 -  /// writer.addNode("source", sourceNode);
    5.55 -  /// writer.addNode("target", targetNode);
    5.56 +  /// writer.writeNode("source", sourceNode);
    5.57 +  /// writer.writeNode("target", targetNode);
    5.58    ///
    5.59 -  /// writer.addEdge("observed", edge);
    5.60 +  /// writer.writeEdge("observed", edge);
    5.61    /// \endcode
    5.62    ///
    5.63    /// After you give all write commands you must call the \c run() member
    5.64 @@ -216,7 +217,7 @@
    5.65    /// \see QuotedStringWriter
    5.66    /// \see IdMap
    5.67    /// \see DescriptorMap
    5.68 -  /// \see \ref GraphReader
    5.69 +  /// \see \ref GraphWriter
    5.70    /// \see \ref graph-io-page
    5.71    /// \author Balazs Dezso
    5.72    template <typename _Graph, typename _WriterTraits = DefaultWriterTraits> 
    5.73 @@ -262,8 +263,8 @@
    5.74      ///
    5.75      /// Add a new node map writer command for the writer.
    5.76      template <typename Map>
    5.77 -    GraphWriter& addNodeMap(std::string name, const Map& map) {
    5.78 -      return addNodeMap<typename WriterTraits::template Writer<
    5.79 +    GraphWriter& writeNodeMap(std::string name, const Map& map) {
    5.80 +      return writeNodeMap<typename WriterTraits::template Writer<
    5.81  	typename Map::Value>, Map>(name, map);
    5.82      }
    5.83  
    5.84 @@ -271,7 +272,7 @@
    5.85      ///
    5.86      /// Add a new node map writer command for the writer.
    5.87      template <typename Writer, typename Map>
    5.88 -    GraphWriter& addNodeMap(std::string name, const Map& map, 
    5.89 +    GraphWriter& writeNodeMap(std::string name, const Map& map, 
    5.90  			      const Writer& writer = Writer()) {
    5.91        node_map_writers.push_back(
    5.92          make_pair(name, new MapWriter<Node, Map, Writer>(map, writer)));
    5.93 @@ -284,8 +285,8 @@
    5.94      ///
    5.95      /// Add a new edge map writer command for the writer.
    5.96      template <typename Map>
    5.97 -    GraphWriter& addEdgeMap(std::string name, const Map& map) { 
    5.98 -      return addEdgeMap<typename WriterTraits::template Writer<
    5.99 +    GraphWriter& writeEdgeMap(std::string name, const Map& map) { 
   5.100 +      return writeEdgeMap<typename WriterTraits::template Writer<
   5.101          typename Map::Value>, Map>(name, map);
   5.102      }
   5.103  
   5.104 @@ -294,7 +295,7 @@
   5.105      ///
   5.106      /// Add a new edge map writer command for the writer.
   5.107      template <typename Writer, typename Map>
   5.108 -    GraphWriter& addEdgeMap(std::string name, 
   5.109 +    GraphWriter& writeEdgeMap(std::string name, 
   5.110  			    const Map& map, const Writer& writer = Writer()) {
   5.111        edge_map_writers.push_back(make_pair(name, 
   5.112  	new MapWriter<Edge, Map, Writer>(map, writer)));
   5.113 @@ -304,7 +305,7 @@
   5.114      /// \brief Add a new labeled node writer for the writer.
   5.115      ///
   5.116      /// Add a new labeled node writer for the writer.
   5.117 -    GraphWriter& addNode(std::string name, const Node& node) {
   5.118 +    GraphWriter& writeNode(std::string name, const Node& node) {
   5.119        node_writers.push_back(make_pair(name, node));
   5.120        return *this;
   5.121      }
   5.122 @@ -312,7 +313,7 @@
   5.123      /// \brief Add a new labeled edge writer for the writer.
   5.124      ///
   5.125      /// Add a new labeled edge writer for the writer.
   5.126 -    GraphWriter& addEdge(std::string name, const Edge& edge) {
   5.127 +    GraphWriter& writeEdge(std::string name, const Edge& edge) {
   5.128        edge_writers.push_back(make_pair(name, edge));
   5.129        return *this;
   5.130      }
   5.131 @@ -467,16 +468,16 @@
   5.132    void writeGraph(std::ostream& os, const Graph &g, 
   5.133  		  const CapacityMap& capacity, const typename Graph::Node &s,
   5.134  		  const typename Graph::Node &t, const CostMap& cost) {
   5.135 -    GraphWriter<Graph> reader(os, g);
   5.136 +    GraphWriter<Graph> writer(os, g);
   5.137      IdMap<Graph, typename Graph::Node> nodeIdMap(g);
   5.138 -    reader.addNodeMap("id", nodeIdMap);
   5.139 +    writer.writeNodeMap("id", nodeIdMap);
   5.140      IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
   5.141 -    reader.addEdgeMap("id", edgeIdMap);
   5.142 -    reader.addEdgeMap("capacity", capacity);
   5.143 -    reader.addEdgeMap("cost", cost);
   5.144 -    reader.addNode("source", s);
   5.145 -    reader.addNode("target", t);
   5.146 -    reader.run();
   5.147 +    writer.writeEdgeMap("id", edgeIdMap);
   5.148 +    writer.writeEdgeMap("capacity", capacity);
   5.149 +    writer.writeEdgeMap("cost", cost);
   5.150 +    writer.writeNode("source", s);
   5.151 +    writer.writeNode("target", t);
   5.152 +    writer.run();
   5.153    }
   5.154  
   5.155    /// \brief Write a graph to the output.
   5.156 @@ -491,15 +492,15 @@
   5.157    void writeGraph(std::ostream& os, const Graph &g, 
   5.158  		  const CapacityMap& capacity, const typename Graph::Node &s,
   5.159  		  const typename Graph::Node &t) {
   5.160 -    GraphWriter<Graph> reader(os, g);
   5.161 +    GraphWriter<Graph> writer(os, g);
   5.162      IdMap<Graph, typename Graph::Node> nodeIdMap(g);
   5.163 -    reader.addNodeMap("id", nodeIdMap);
   5.164 +    writer.writeNodeMap("id", nodeIdMap);
   5.165      IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
   5.166 -    reader.addEdgeMap("id", edgeIdMap);
   5.167 -    reader.addEdgeMap("capacity", capacity);
   5.168 -    reader.addNode("source", s);
   5.169 -    reader.addNode("target", t);
   5.170 -    reader.run();
   5.171 +    writer.writeEdgeMap("id", edgeIdMap);
   5.172 +    writer.writeEdgeMap("capacity", capacity);
   5.173 +    writer.writeNode("source", s);
   5.174 +    writer.writeNode("target", t);
   5.175 +    writer.run();
   5.176    }
   5.177  
   5.178    /// \brief Write a graph to the output.
   5.179 @@ -512,14 +513,14 @@
   5.180    template<typename Graph, typename CapacityMap>
   5.181    void writeGraph(std::ostream& os, const Graph &g, 
   5.182  		  const CapacityMap& capacity, const typename Graph::Node &s) {
   5.183 -    GraphWriter<Graph> reader(os, g);
   5.184 +    GraphWriter<Graph> writer(os, g);
   5.185      IdMap<Graph, typename Graph::Node> nodeIdMap(g);
   5.186 -    reader.addNodeMap("id", nodeIdMap);
   5.187 +    writer.writeNodeMap("id", nodeIdMap);
   5.188      IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
   5.189 -    reader.addEdgeMap("id", edgeIdMap);
   5.190 -    reader.addEdgeMap("capacity", capacity);
   5.191 -    reader.addNode("source", s);
   5.192 -    reader.run();
   5.193 +    writer.writeEdgeMap("id", edgeIdMap);
   5.194 +    writer.writeEdgeMap("capacity", capacity);
   5.195 +    writer.writeNode("source", s);
   5.196 +    writer.run();
   5.197    }
   5.198  
   5.199    /// \brief Write a graph to the output.
   5.200 @@ -531,13 +532,13 @@
   5.201    template<typename Graph, typename CapacityMap>
   5.202    void writeGraph(std::ostream& os, const Graph &g, 
   5.203  		  const CapacityMap& capacity) {
   5.204 -    GraphWriter<Graph> reader(os, g);
   5.205 +    GraphWriter<Graph> writer(os, g);
   5.206      IdMap<Graph, typename Graph::Node> nodeIdMap(g);
   5.207 -    reader.addNodeMap("id", nodeIdMap);
   5.208 +    writer.writeNodeMap("id", nodeIdMap);
   5.209      IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
   5.210 -    reader.addEdgeMap("id", edgeIdMap);
   5.211 -    reader.addEdgeMap("capacity", capacity);
   5.212 -    reader.run();
   5.213 +    writer.writeEdgeMap("id", edgeIdMap);
   5.214 +    writer.writeEdgeMap("capacity", capacity);
   5.215 +    writer.run();
   5.216    }
   5.217  
   5.218    /// \brief Write a graph to the output.
   5.219 @@ -547,12 +548,12 @@
   5.220    /// \param g The graph.
   5.221    template<typename Graph>
   5.222    void writeGraph(std::ostream& os, const Graph &g) {
   5.223 -    GraphWriter<Graph> reader(os, g);
   5.224 +    GraphWriter<Graph> writer(os, g);
   5.225      IdMap<Graph, typename Graph::Node> nodeIdMap(g);
   5.226 -    reader.addNodeMap("id", nodeIdMap);
   5.227 +    writer.writeNodeMap("id", nodeIdMap);
   5.228      IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
   5.229 -    reader.addEdgeMap("id", edgeIdMap);
   5.230 -    reader.run();
   5.231 +    writer.writeEdgeMap("id", edgeIdMap);
   5.232 +    writer.run();
   5.233    }
   5.234  
   5.235    /// @}