COIN-OR::LEMON - Graph Library

Changeset 1744:51d5d41e15b1 in lemon-0.x for lemon/graph_writer.h


Ignore:
Timestamp:
10/26/05 13:09:29 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2272
Message:

Removing old input/output functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/graph_writer.h

    r1540 r1744  
    285285
    286286
    287   ///\anchor writeGraph()
    288   ///
     287
    289288  /// \brief Write a graph to the output.
    290289  ///
    291   /// Write a graph to the output.
     290  /// It is a helper function to write a graph to the given output
     291  /// stream. It gives back a GraphWriter object and this object
     292  /// can write more maps, labeled nodes and edges and attributes.
     293  /// \warning Do not forget to call the \c run() function.
     294  ///
    292295  /// \param os The output stream.
    293296  /// \param g The graph.
    294   template<typename Graph>
    295   void writeGraph(std::ostream& os, const Graph &g) {
    296     GraphWriter<Graph> writer(os, g);
    297     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    298     writer.writeNodeMap("id", nodeIdMap);
    299     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    300     writer.writeEdgeMap("id", edgeIdMap);
    301     writer.run();
     297  template <typename Graph>
     298  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph &g) {
     299    return GraphWriter<Graph>(os, g);
    302300  }
    303301
    304   /// \brief Write a capacitated graph instance to the output.
    305   ///
    306   /// Write a capacitated graph (graph+capacity on the
    307   /// edges) to the output.
    308   /// \param os The output stream.
     302  /// \brief Write a graph to the output.
     303  ///
     304  /// It is a helper function to write a graph to the given output
     305  /// file. It gives back a GraphWriter object and this object
     306  /// can write more maps, labeled nodes and edges and attributes.
     307  /// \warning Do not forget to call the \c run() function.
     308  ///
     309  /// \param fn The filename.
    309310  /// \param g The graph.
    310   /// \param capacity The capacity map.
    311   template<typename Graph, typename CapacityMap>
    312   void writeGraph(std::ostream& os, const Graph &g,
    313                   const CapacityMap& capacity) {
    314     GraphWriter<Graph> writer(os, g);
    315     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    316     writer.writeNodeMap("id", nodeIdMap);
    317     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    318     writer.writeEdgeMap("id", edgeIdMap);
    319     writer.writeEdgeMap("capacity", capacity);
    320     writer.run();
    321   }
    322 
    323   /// \brief Write a shortest path instance to the output.
    324   ///
    325   /// Write a shortest path instance (graph+capacity on the
    326   /// edges+designated source) to the output.
    327   /// \param os The output stream.
    328   /// \param g The graph.
    329   /// \param capacity The capacity map.
    330   /// \param s The source node.
    331   template<typename Graph, typename CapacityMap>
    332   void writeGraph(std::ostream& os, const Graph &g,
    333                   const CapacityMap& capacity, const typename Graph::Node &s) {
    334     GraphWriter<Graph> writer(os, g);
    335     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    336     writer.writeNodeMap("id", nodeIdMap);
    337     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    338     writer.writeEdgeMap("id", edgeIdMap);
    339     writer.writeEdgeMap("capacity", capacity);
    340     writer.writeNode("source", s);
    341     writer.run();
    342   }
    343 
    344 
    345   /// \brief Write a max flow instance to the output.
    346   ///
    347   /// Write a max flow instance (graph+capacity on the
    348   /// edges+designated source and target) to the output.
    349   ///
    350   /// \param os The output stream.
    351   /// \param g The graph.
    352   /// \param capacity The capacity map.
    353   /// \param s The source node.
    354   /// \param t The target node.
    355   template<typename Graph, typename CapacityMap>
    356   void writeGraph(std::ostream& os, const Graph &g,
    357                   const CapacityMap& capacity, const typename Graph::Node &s,
    358                   const typename Graph::Node &t) {
    359     GraphWriter<Graph> writer(os, g);
    360     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    361     writer.writeNodeMap("id", nodeIdMap);
    362     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    363     writer.writeEdgeMap("id", edgeIdMap);
    364     writer.writeEdgeMap("capacity", capacity);
    365     writer.writeNode("source", s);
    366     writer.writeNode("target", t);
    367     writer.run();
    368   }
    369 
    370   /// \brief Write a min cost flow instance to the output.
    371   ///
    372   /// Write a min cost flow instance (graph+capacity on the edges+cost
    373   /// function on the edges+designated source and target) to the output.
    374   ///
    375   /// \param os The output stream.
    376   /// \param g The graph.
    377   /// \param capacity The capacity map.
    378   /// \param s The source node.
    379   /// \param t The target node.
    380   /// \param cost The cost map.
    381   template<typename Graph, typename CapacityMap, typename CostMap>
    382   void writeGraph(std::ostream& os, const Graph &g,
    383                   const CapacityMap& capacity, const typename Graph::Node &s,
    384                   const typename Graph::Node &t, const CostMap& cost) {
    385     GraphWriter<Graph> writer(os, g);
    386     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    387     writer.writeNodeMap("id", nodeIdMap);
    388     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    389     writer.writeEdgeMap("id", edgeIdMap);
    390     writer.writeEdgeMap("capacity", capacity);
    391     writer.writeEdgeMap("cost", cost);
    392     writer.writeNode("source", s);
    393     writer.writeNode("target", t);
    394     writer.run();
     311  template <typename Graph>
     312  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph &g) {
     313    return GraphWriter<Graph>(fn, g);
    395314  }
    396315
     
    685604  /// \brief Write an undirected graph to the output.
    686605  ///
    687   /// Write an undirected graph to the output.
     606  /// It is a helper function to write an undirected graph to the given output
     607  /// stream. It gives back an UndirGraphWriter object and this object
     608  /// can write more maps, labeled nodes and edges and attributes.
     609  /// \warning Do not forget to call the \c run() function.
     610  ///
    688611  /// \param os The output stream.
    689612  /// \param g The graph.
    690   template<typename Graph>
    691   void writeUndirGraph(std::ostream& os, const Graph &g) {
    692     UndirGraphWriter<Graph> writer(os, g);
    693     writer.run();
     613  template <typename Graph>
     614  UndirGraphWriter<Graph> undirGraphWriter(std::ostream& os, const Graph &g) {
     615    return UndirGraphWriter<Graph>(os, g);
    694616  }
    695617
    696   /// \brief Write an undirected multigraph (undirected graph + capacity
    697   /// map on the edges) to the output.
    698   ///
    699   /// Write an undirected multigraph (undirected graph + capacity
    700   /// map on the edges) to the output.
    701   /// \param os The output stream.
     618  /// \brief Write an undirected graph to the output.
     619  ///
     620  /// It is a helper function to write an undirected graph to the given output
     621  /// file. It gives back an UndirGraphWriter object and this object
     622  /// can write more maps, labeled nodes, edges, undirected edges and
     623  /// attributes.
     624  ///
     625  /// \warning Do not forget to call the \c run() function.
     626  ///
     627  /// \param fn The output file.
    702628  /// \param g The graph.
    703   /// \param capacity The capacity undirected map.
    704   template<typename Graph, typename CapacityMap>
    705   void writeUndirGraph(std::ostream& os, const Graph &g,
    706                        const CapacityMap& capacity) {
    707     UndirGraphWriter<Graph> writer(os, g);
    708     writer.writeUndirEdgeMap("capacity", capacity);
    709     writer.run();
     629  template <typename Graph>
     630  UndirGraphWriter<Graph> undirGraphWriter(const std::string& fn,
     631                                           const Graph &g) {
     632    return UndirGraphWriter<Graph>(fn, g);
    710633  }
    711634
    712 
    713635  /// @}
    714636
Note: See TracChangeset for help on using the changeset viewer.