COIN-OR::LEMON - Graph Library

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


Ignore:
Timestamp:
10/26/05 13:09:29 (18 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_reader.h

    r1705 r1744  
    340340
    341341
    342   ///\anchor readGraph()
    343   ///
    344   /// \brief Read a graph from an input stream.
    345   ///
    346   /// Read a graph from an input stream.
     342  /// \brief Read a graph from the input.
     343  ///
     344  /// It is a helper function to read a graph from the given input
     345  /// stream. It gives back an GraphReader object and this object
     346  /// can read more maps, labeled nodes, edges and attributes.
     347  ///
     348  /// \warning Do not forget to call the \c run() function.
     349  ///
    347350  /// \param is The input stream.
    348351  /// \param g The graph.
    349352  template<typename Graph>
    350   void readGraph(std::istream& is, Graph &g) {
    351     GraphReader<Graph> reader(is, g);
    352     reader.run();
     353  GraphReader<Graph> graphReader(std::istream& is, Graph &g) {
     354    return GraphReader<Graph>(is, g);
    353355  }
    354356
    355   /// \brief Read a capacitated graph instance from an input stream.
    356   ///
    357   /// Read a capacitated graph (graph+capacity on the
    358   /// edges) from an input stream.
    359   /// \param is The input stream.
     357  /// \brief Read a graph from the input.
     358  ///
     359  /// It is a helper function to read a graph from the given input
     360  /// file. It gives back an GraphReader object and this object
     361  /// can read more maps, labeled nodes, edges and attributes.
     362  ///
     363  /// \warning Do not forget to call the \c run() function.
     364  ///
     365  /// \param fn The input filename.
    360366  /// \param g The graph.
    361   /// \param capacity The capacity map.
    362   template<typename Graph, typename CapacityMap>
    363   void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
    364     GraphReader<Graph> reader(is, g);
    365     reader.readEdgeMap("capacity", capacity);
    366     reader.run();
     367  template<typename Graph>
     368  GraphReader<Graph> graphReader(const std::string& fn, Graph &g) {
     369    return GraphReader<Graph>(fn, g);
    367370  }
    368371
    369   /// \brief Read a shortest path instance from an input stream.
    370   ///
    371   /// Read a shortest path instance (graph+capacity on the
    372   /// edges+designated source) from an input stream.
    373   /// \param is The input stream.
    374   /// \param g The graph.
    375   /// \param capacity The capacity map.
    376   /// \param s The source node.
    377   template<typename Graph, typename CapacityMap>
    378   void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
    379                   typename Graph::Node &s) {
    380     GraphReader<Graph> reader(is, g);
    381     reader.readEdgeMap("capacity", capacity);
    382     reader.readNode("source", s);
    383     reader.run();
    384   }
    385 
    386 
    387 
    388   /// \brief Read a max flow instance from an input stream.
    389   ///
    390   /// Read a max flow instance (graph+capacity on the
    391   /// edges+designated source and target) from an input stream.
    392   ///
    393   /// \param is The input stream.
    394   /// \param g The graph.
    395   /// \param capacity The capacity map.
    396   /// \param s The source node.
    397   /// \param t The target node.
    398   template<typename Graph, typename CapacityMap>
    399   void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
    400                   typename Graph::Node &s, typename Graph::Node &t) {
    401     GraphReader<Graph> reader(is, g);
    402     reader.readEdgeMap("capacity", capacity);
    403     reader.readNode("source", s);
    404     reader.readNode("target", t);
    405     reader.run();
    406   }
    407 
    408   /// \brief Read a min cost flow instance from an input stream.
    409   ///
    410   /// Read a min cost flow instance (graph+capacity on the edges+cost
    411   /// function on the edges+designated source and target) from an input stream.
    412   ///
    413   /// \param is The input stream.
    414   /// \param g The graph.
    415   /// \param capacity The capacity map.
    416   /// \param s The source node.
    417   /// \param t The target node.
    418   /// \param cost The cost map.
    419   template<typename Graph, typename CapacityMap, typename CostMap>
    420   void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
    421                   typename Graph::Node &s, typename Graph::Node &t,
    422                   CostMap& cost) {
    423     GraphReader<Graph> reader(is, g);
    424     reader.readEdgeMap("capacity", capacity);
    425     reader.readEdgeMap("cost", cost);
    426     reader.readNode("source", s);
    427     reader.readNode("target", t);
    428     reader.run();
    429   }
    430 
    431 
    432   /// \brief The undir graph reader class.
     372  /// \brief The undirected graph reader class.
    433373  ///
    434374  /// The \c UndirGraphReader class provides the graph input.
     
    807747  };
    808748
    809   /// \brief Read an undirected graph from an input stream.
    810   ///
    811   /// Read an undirected graph from an input stream.
     749  /// \brief Read an undirected graph from the input.
     750  ///
     751  /// It is a helper function to read an undirected graph from the given input
     752  /// stream. It gives back an UndirGraphReader object and this object
     753  /// can read more maps, labeled nodes, edges, undirected edges and
     754  /// attributes.
     755  ///
     756  /// \warning Do not forget to call the \c run() function.
     757  ///
    812758  /// \param is The input stream.
    813759  /// \param g The graph.
    814760  template<typename Graph>
    815   void readUndirGraph(std::istream& is, Graph &g) {
    816     UndirGraphReader<Graph> reader(is, g);
    817     reader.run();
     761  UndirGraphReader<Graph> undirGraphReader(std::istream& is, Graph &g) {
     762    return GraphReader<Graph>(is, g);
    818763  }
    819764
    820   /// \brief Read an undirected multigraph (undirected graph + capacity
    821   /// map on the edges) from an input stream.
    822   ///
    823   /// Read an undirected multigraph (undirected graph + capacity
    824   /// map on the edges) from an input stream.
    825   /// \param is The input stream.
     765  /// \brief Read an undirected graph from the input.
     766  ///
     767  /// It is a helper function to read an undirected graph from the given input
     768  /// file. It gives back an UndirGraphReader object and this object
     769  /// can read more maps, labeled nodes, edges, undirected edges and
     770  /// attributes.
     771  ///
     772  /// \warning Do not forget to call the \c run() function.
     773  ///
     774  /// \param fn The input filename.
    826775  /// \param g The graph.
    827   /// \param capacity The capacity map.
    828   template<typename Graph, typename CapacityMap>
    829   void readUndirGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
    830     UndirGraphReader<Graph> reader(is, g);
    831     reader.readUndirEdgeMap("capacity", capacity);
    832     reader.run();
     776  template<typename Graph>
     777  UndirGraphReader<Graph> undirGraphReader(const std::string& fn, Graph &g) {
     778    return GraphReader<Graph>(fn, g);
    833779  }
    834 
    835780
    836781  /// @}
Note: See TracChangeset for help on using the changeset viewer.