lemon/graph_writer.h
changeset 1909 2d806130e700
parent 1901 723b2b81d900
child 1946 17eb3eaad9f8
     1.1 --- a/lemon/graph_writer.h	Thu Jan 26 06:44:22 2006 +0000
     1.2 +++ b/lemon/graph_writer.h	Thu Jan 26 15:42:13 2006 +0000
     1.3 @@ -315,39 +315,39 @@
     1.4  
     1.5    /// \brief The undirected graph writer class.
     1.6    ///
     1.7 -  /// The \c UndirGraphWriter class provides the undir graph output. To write 
     1.8 +  /// The \c UGraphWriter class provides the ugraph output. To write 
     1.9    /// a graph you should first give writing commands to the writer. You can 
    1.10 -  /// declare write command as \c NodeMap, \c EdgeMap or \c UndirEdgeMap 
    1.11 -  /// writing and labeled Node, Edge or UndirEdge writing.
    1.12 +  /// declare write command as \c NodeMap, \c EdgeMap or \c UEdgeMap 
    1.13 +  /// writing and labeled Node, Edge or UEdge writing.
    1.14    ///
    1.15    /// \code
    1.16 -  /// UndirGraphWriter<UndirListGraph> writer(std::cout, graph);
    1.17 +  /// UGraphWriter<ListUGraph> writer(std::cout, graph);
    1.18    /// \endcode
    1.19    ///
    1.20    /// The \c writeNodeMap() function declares a \c NodeMap writing 
    1.21 -  /// command in the \c UndirGraphWriter. You should give as parameter 
    1.22 +  /// command in the \c UGraphWriter. You should give as parameter 
    1.23    /// the name of the map and the map object. The NodeMap writing 
    1.24    /// command with name "label" should write a unique map because it 
    1.25    /// is regarded as label map.
    1.26    ///
    1.27    /// \code
    1.28 -  /// IdMap<UndirListGraph, Node> nodeLabelMap;
    1.29 +  /// IdMap<ListUGraph, Node> nodeLabelMap;
    1.30    /// writer.writeNodeMap("label", nodeLabelMap);
    1.31    ///
    1.32    /// writer.writeNodeMap("coords", coords);
    1.33    /// writer.writeNodeMap("color", colorMap);
    1.34    /// \endcode
    1.35    ///
    1.36 -  /// With the \c writeUndirEdgeMap() member function you can give an 
    1.37 +  /// With the \c writeUEdgeMap() member function you can give an 
    1.38    /// undirected edge map writing command similar to the NodeMaps.
    1.39    ///
    1.40    /// \code
    1.41    /// DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > 
    1.42    ///   edgeDescMap(graph);
    1.43 -  /// writer.writeUndirEdgeMap("descriptor", edgeDescMap);
    1.44 +  /// writer.writeUEdgeMap("descriptor", edgeDescMap);
    1.45    ///
    1.46 -  /// writer.writeUndirEdgeMap("weight", weightMap);
    1.47 -  /// writer.writeUndirEdgeMap("label", labelMap);
    1.48 +  /// writer.writeUEdgeMap("weight", weightMap);
    1.49 +  /// writer.writeUEdgeMap("label", labelMap);
    1.50    /// \endcode
    1.51    /// 
    1.52    /// The EdgeMap handling is just a syntactical sugar. It writes
    1.53 @@ -358,7 +358,7 @@
    1.54    /// \endcode
    1.55    ///
    1.56    ///
    1.57 -  /// With \c writeNode() and \c writeUndirEdge() functions you can 
    1.58 +  /// With \c writeNode() and \c writeUEdge() functions you can 
    1.59    /// designate nodes and undirected edges in the graph. For example, you can 
    1.60    /// write out the source and target of the graph.
    1.61    ///
    1.62 @@ -366,7 +366,7 @@
    1.63    /// writer.writeNode("source", sourceNode);
    1.64    /// writer.writeNode("target", targetNode);
    1.65    ///
    1.66 -  /// writer.writeUndirEdge("observed", undirEdge);
    1.67 +  /// writer.writeUEdge("observed", uEdge);
    1.68    /// \endcode
    1.69    ///
    1.70    /// After you give all write commands you must call the \c run() member
    1.71 @@ -384,56 +384,56 @@
    1.72    /// \see \ref graph-io-page
    1.73    /// \author Balazs Dezso
    1.74    template <typename _Graph, typename _WriterTraits = DefaultWriterTraits> 
    1.75 -  class UndirGraphWriter {
    1.76 +  class UGraphWriter {
    1.77    public:
    1.78      
    1.79      typedef _Graph Graph;
    1.80      typedef typename Graph::Node Node;
    1.81      typedef typename Graph::Edge Edge;
    1.82 -    typedef typename Graph::UndirEdge UndirEdge;
    1.83 +    typedef typename Graph::UEdge UEdge;
    1.84  
    1.85      typedef _WriterTraits WriterTraits;
    1.86  
    1.87 -    /// \brief Construct a new UndirGraphWriter.
    1.88 +    /// \brief Construct a new UGraphWriter.
    1.89      ///
    1.90 -    /// Construct a new UndirGraphWriter. It writes the given graph
    1.91 +    /// Construct a new UGraphWriter. It writes the given graph
    1.92      /// to the given stream.
    1.93 -    UndirGraphWriter(std::ostream& _os, const Graph& _graph) 
    1.94 +    UGraphWriter(std::ostream& _os, const Graph& _graph) 
    1.95        : writer(new LemonWriter(_os)), own_writer(true), 
    1.96  	nodeset_writer(*writer, _graph, std::string()),
    1.97 -	undir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),
    1.98 +	u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),
    1.99  	node_writer(*writer, nodeset_writer, std::string()),
   1.100 -	undir_edge_writer(*writer, undir_edgeset_writer, std::string()),
   1.101 +	u_edge_writer(*writer, u_edgeset_writer, std::string()),
   1.102  	attribute_writer(*writer, std::string()) {}
   1.103  
   1.104 -    /// \brief Construct a new UndirGraphWriter.
   1.105 +    /// \brief Construct a new UGraphWriter.
   1.106      ///
   1.107 -    /// Construct a new UndirGraphWriter. It writes the given graph
   1.108 +    /// Construct a new UGraphWriter. It writes the given graph
   1.109      /// to the given file.
   1.110 -    UndirGraphWriter(const std::string& _filename, const Graph& _graph) 
   1.111 +    UGraphWriter(const std::string& _filename, const Graph& _graph) 
   1.112        : writer(new LemonWriter(_filename)), own_writer(true), 
   1.113  	nodeset_writer(*writer, _graph, std::string()),
   1.114 -	undir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),
   1.115 +	u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),
   1.116  	node_writer(*writer, nodeset_writer, std::string()),
   1.117 -	undir_edge_writer(*writer, undir_edgeset_writer, std::string()),
   1.118 +	u_edge_writer(*writer, u_edgeset_writer, std::string()),
   1.119  	attribute_writer(*writer, std::string()) {}
   1.120  
   1.121 -    /// \brief Construct a new UndirGraphWriter.
   1.122 +    /// \brief Construct a new UGraphWriter.
   1.123      ///
   1.124 -    /// Construct a new UndirGraphWriter. It writes the given graph
   1.125 +    /// Construct a new UGraphWriter. It writes the given graph
   1.126      /// to given LemonReader.
   1.127 -    UndirGraphWriter(LemonWriter& _writer, const Graph& _graph)
   1.128 +    UGraphWriter(LemonWriter& _writer, const Graph& _graph)
   1.129        : writer(_writer), own_writer(false), 
   1.130  	nodeset_writer(*writer, _graph, std::string()),
   1.131 -	undir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),
   1.132 +	u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),
   1.133  	node_writer(*writer, nodeset_writer, std::string()),
   1.134 -	undir_edge_writer(*writer, undir_edgeset_writer, std::string()),
   1.135 +	u_edge_writer(*writer, u_edgeset_writer, std::string()),
   1.136  	attribute_writer(*writer, std::string()) {}
   1.137  
   1.138      /// \brief Destruct the graph writer.
   1.139      ///
   1.140      /// Destruct the graph writer.
   1.141 -    ~UndirGraphWriter() {
   1.142 +    ~UGraphWriter() {
   1.143        if (own_writer) 
   1.144  	delete writer;
   1.145      }
   1.146 @@ -442,7 +442,7 @@
   1.147      ///
   1.148     /// This function issues a new <i> node map writing command</i> to the writer.
   1.149      template <typename Map>
   1.150 -    UndirGraphWriter& writeNodeMap(std::string name, const Map& map) {
   1.151 +    UGraphWriter& writeNodeMap(std::string name, const Map& map) {
   1.152        nodeset_writer.writeNodeMap(name, map);
   1.153        return *this;
   1.154      }
   1.155 @@ -451,7 +451,7 @@
   1.156      ///
   1.157     /// This function issues a new <i> node map writing command</i> to the writer.
   1.158      template <typename Writer, typename Map>
   1.159 -    UndirGraphWriter& writeNodeMap(std::string name, const Map& map, 
   1.160 +    UGraphWriter& writeNodeMap(std::string name, const Map& map, 
   1.161  			      const Writer& writer = Writer()) {
   1.162        nodeset_writer.writeNodeMap(name, map, writer);
   1.163        return *this;
   1.164 @@ -461,8 +461,8 @@
   1.165      ///
   1.166     /// This function issues a new <i> edge map writing command</i> to the writer.
   1.167      template <typename Map>
   1.168 -    UndirGraphWriter& writeEdgeMap(std::string name, const Map& map) { 
   1.169 -      undir_edgeset_writer.writeEdgeMap(name, map);
   1.170 +    UGraphWriter& writeEdgeMap(std::string name, const Map& map) { 
   1.171 +      u_edgeset_writer.writeEdgeMap(name, map);
   1.172        return *this;
   1.173      }
   1.174  
   1.175 @@ -470,9 +470,9 @@
   1.176      ///
   1.177     /// This function issues a new <i> edge map writing command</i> to the writer.
   1.178      template <typename Writer, typename Map>
   1.179 -    UndirGraphWriter& writeEdgeMap(std::string name, const Map& map,
   1.180 +    UGraphWriter& writeEdgeMap(std::string name, const Map& map,
   1.181  				   const Writer& writer = Writer()) {
   1.182 -      undir_edgeset_writer.writeEdgeMap(name, map, writer);
   1.183 +      u_edgeset_writer.writeEdgeMap(name, map, writer);
   1.184        return *this;
   1.185      }
   1.186  
   1.187 @@ -481,8 +481,8 @@
   1.188      /// This function issues a new <i> undirected edge map writing
   1.189      /// command</i> to the writer.
   1.190      template <typename Map>
   1.191 -    UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map) { 
   1.192 -      undir_edgeset_writer.writeUndirEdgeMap(name, map);
   1.193 +    UGraphWriter& writeUEdgeMap(std::string name, const Map& map) { 
   1.194 +      u_edgeset_writer.writeUEdgeMap(name, map);
   1.195        return *this;
   1.196      }
   1.197  
   1.198 @@ -491,9 +491,9 @@
   1.199      /// This function issues a new <i> undirected edge map writing
   1.200      /// command</i> to the writer.
   1.201     template <typename Writer, typename Map>
   1.202 -    UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map,
   1.203 +    UGraphWriter& writeUEdgeMap(std::string name, const Map& map,
   1.204  					const Writer& writer = Writer()) {
   1.205 -      undir_edgeset_writer.writeUndirEdgeMap(name, map, writer);
   1.206 +      u_edgeset_writer.writeUEdgeMap(name, map, writer);
   1.207        return *this;
   1.208      }
   1.209  
   1.210 @@ -501,7 +501,7 @@
   1.211      ///
   1.212      /// This function issues a new <i> labeled node writing
   1.213      /// command</i> to the writer.
   1.214 -    UndirGraphWriter& writeNode(std::string name, const Node& node) {
   1.215 +    UGraphWriter& writeNode(std::string name, const Node& node) {
   1.216        node_writer.writeNode(name, node);
   1.217        return *this;
   1.218      }
   1.219 @@ -510,8 +510,8 @@
   1.220      ///
   1.221      /// This function issues a new <i> labeled edge writing
   1.222      /// command</i> to the writer.
   1.223 -    UndirGraphWriter& writeEdge(std::string name, const Edge& edge) {
   1.224 -      undir_edge_writer.writeEdge(name, edge);
   1.225 +    UGraphWriter& writeEdge(std::string name, const Edge& edge) {
   1.226 +      u_edge_writer.writeEdge(name, edge);
   1.227      }
   1.228  
   1.229      /// \brief Issue a new labeled undirected edge writing command to
   1.230 @@ -519,8 +519,8 @@
   1.231      ///
   1.232      /// Issue a new <i>labeled undirected edge writing command</i> to
   1.233      /// the writer.
   1.234 -    UndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) {
   1.235 -      undir_edge_writer.writeUndirEdge(name, edge);
   1.236 +    UGraphWriter& writeUEdge(std::string name, const UEdge& edge) {
   1.237 +      u_edge_writer.writeUEdge(name, edge);
   1.238      }
   1.239  
   1.240      /// \brief Issue a new attribute writing command.
   1.241 @@ -528,7 +528,7 @@
   1.242      /// This function issues a new <i> attribute writing
   1.243      /// command</i> to the writer.
   1.244      template <typename Value>
   1.245 -    UndirGraphWriter& writeAttribute(std::string name, const Value& value) {
   1.246 +    UGraphWriter& writeAttribute(std::string name, const Value& value) {
   1.247        attribute_writer.writeAttribute(name, value);
   1.248        return *this;
   1.249      }
   1.250 @@ -538,7 +538,7 @@
   1.251      /// This function issues a new <i> attribute writing
   1.252      /// command</i> to the writer.
   1.253      template <typename Writer, typename Value>
   1.254 -    UndirGraphWriter& writeAttribute(std::string name, const Value& value, 
   1.255 +    UGraphWriter& writeAttribute(std::string name, const Value& value, 
   1.256  			       const Writer& writer) {
   1.257        attribute_writer.writeAttribute<Writer>(name, value, writer);
   1.258        return *this;
   1.259 @@ -574,7 +574,7 @@
   1.260      /// It writes the label of the given edge. If there was written an "label"
   1.261      /// named edge map then it will write the map value belonging to the edge.
   1.262      void writeLabel(std::ostream& os, const Edge& item) const {
   1.263 -      undir_edgeset_writer.writeLabel(os, item);
   1.264 +      u_edgeset_writer.writeLabel(os, item);
   1.265      } 
   1.266  
   1.267      /// \brief Write the label of the given undirected edge.
   1.268 @@ -582,8 +582,8 @@
   1.269      /// It writes the label of the given undirected edge. If there was written 
   1.270      /// an "label" named edge map then it will write the map value belonging to 
   1.271      /// the edge.
   1.272 -    void writeLabel(std::ostream& os, const UndirEdge& item) const {
   1.273 -      undir_edgeset_writer.writeLabel(os, item);
   1.274 +    void writeLabel(std::ostream& os, const UEdge& item) const {
   1.275 +      u_edgeset_writer.writeLabel(os, item);
   1.276      } 
   1.277  
   1.278  
   1.279 @@ -593,10 +593,10 @@
   1.280      bool own_writer;
   1.281  
   1.282      NodeSetWriter<Graph, WriterTraits> nodeset_writer;
   1.283 -    UndirEdgeSetWriter<Graph, WriterTraits> undir_edgeset_writer;
   1.284 +    UEdgeSetWriter<Graph, WriterTraits> u_edgeset_writer;
   1.285  
   1.286      NodeWriter<Graph> node_writer;
   1.287 -    UndirEdgeWriter<Graph> undir_edge_writer;
   1.288 +    UEdgeWriter<Graph> u_edge_writer;
   1.289      
   1.290      AttributeWriter<WriterTraits> attribute_writer;
   1.291    };
   1.292 @@ -604,21 +604,21 @@
   1.293    /// \brief Write an undirected graph to the output.
   1.294    ///
   1.295    /// It is a helper function to write an undirected graph to the given output
   1.296 -  /// stream. It gives back an UndirGraphWriter object and this object
   1.297 +  /// stream. It gives back an UGraphWriter object and this object
   1.298    /// can write more maps, labeled nodes and edges and attributes.
   1.299    /// \warning Do not forget to call the \c run() function.
   1.300    ///
   1.301    /// \param os The output stream.
   1.302    /// \param g The graph.
   1.303    template <typename Graph>
   1.304 -  UndirGraphWriter<Graph> undirGraphWriter(std::ostream& os, const Graph &g) {
   1.305 -    return UndirGraphWriter<Graph>(os, g);
   1.306 +  UGraphWriter<Graph> uGraphWriter(std::ostream& os, const Graph &g) {
   1.307 +    return UGraphWriter<Graph>(os, g);
   1.308    }
   1.309  
   1.310    /// \brief Write an undirected graph to the output.
   1.311    ///
   1.312    /// It is a helper function to write an undirected graph to the given output
   1.313 -  /// file. It gives back an UndirGraphWriter object and this object
   1.314 +  /// file. It gives back an UGraphWriter object and this object
   1.315    /// can write more maps, labeled nodes, edges, undirected edges and 
   1.316    /// attributes.
   1.317    ///
   1.318 @@ -627,9 +627,9 @@
   1.319    /// \param fn The output file.
   1.320    /// \param g The graph.
   1.321    template <typename Graph>
   1.322 -  UndirGraphWriter<Graph> undirGraphWriter(const std::string& fn, 
   1.323 +  UGraphWriter<Graph> uGraphWriter(const std::string& fn, 
   1.324  					   const Graph &g) {
   1.325 -    return UndirGraphWriter<Graph>(fn, g);
   1.326 +    return UGraphWriter<Graph>(fn, g);
   1.327    }
   1.328  
   1.329    /// @}