COIN-OR::LEMON - Graph Library

Changeset 1534:b86aad11f842 in lemon-0.x for lemon


Ignore:
Timestamp:
07/04/05 18:11:33 (15 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2026
Message:

Doc.

Location:
lemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/graph_reader.h

    r1476 r1534  
    3434  /// \brief The graph reader class.
    3535  ///
     36  /// The \c GraphReader class provides the graph input.
     37  /// Before you read this documentation it might be useful to read the general
     38  /// description of  \ref graph-io-page "Graph Input-Output".
     39  /// If you don't need very sophisticated
     40  /// behaviour then you can use the versions of the public function
     41  /// \ref readGraph() to read a graph (or a max flow instance etc).
     42  ///
    3643  /// The given file format may contain several maps and labeled nodes or
    3744  /// edges.
     
    333340  };
    334341
    335   /// \brief Read a graph from the input.
    336   ///
    337   /// Read a graph from the input.
     342
     343  ///\anchor readGraph()
     344  ///
     345  /// \brief Read a graph from an input stream.
     346  ///
     347  /// Read a graph from an input stream.
     348  /// \param is The input stream.
     349  /// \param g The graph.
     350  template<typename Graph>
     351  void readGraph(std::istream& is, Graph &g) {
     352    GraphReader<Graph> reader(is, g);
     353    reader.run();
     354  }
     355
     356  /// \brief Read a capacitated graph instance from an input stream.
     357  ///
     358  /// Read a capacitated graph (graph+capacity on the
     359  /// edges) from an input stream.
     360  /// \param is The input stream.
     361  /// \param g The graph.
     362  /// \param capacity The capacity map.
     363  template<typename Graph, typename CapacityMap>
     364  void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
     365    GraphReader<Graph> reader(is, g);
     366    reader.readEdgeMap("capacity", capacity);
     367    reader.run();
     368  }
     369
     370  /// \brief Read a shortest path instance from an input stream.
     371  ///
     372  /// Read a shortest path instance (graph+capacity on the
     373  /// edges+designated source) from an input stream.
     374  /// \param is The input stream.
     375  /// \param g The graph.
     376  /// \param capacity The capacity map.
     377  /// \param s The source node.
     378  template<typename Graph, typename CapacityMap>
     379  void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
     380                  typename Graph::Node &s) {
     381    GraphReader<Graph> reader(is, g);
     382    reader.readEdgeMap("capacity", capacity);
     383    reader.readNode("source", s);
     384    reader.run();
     385  }
     386
     387
     388
     389  /// \brief Read a max flow instance from an input stream.
     390  ///
     391  /// Read a max flow instance (graph+capacity on the
     392  /// edges+designated source and target) from an input stream.
     393  ///
     394  /// \param is The input stream.
     395  /// \param g The graph.
     396  /// \param capacity The capacity map.
     397  /// \param s The source node.
     398  /// \param t The target node.
     399  template<typename Graph, typename CapacityMap>
     400  void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
     401                  typename Graph::Node &s, typename Graph::Node &t) {
     402    GraphReader<Graph> reader(is, g);
     403    reader.readEdgeMap("capacity", capacity);
     404    reader.readNode("source", s);
     405    reader.readNode("target", t);
     406    reader.run();
     407  }
     408
     409  /// \brief Read a min cost flow instance from an input stream.
     410  ///
     411  /// Read a min cost flow instance (graph+capacity on the edges+cost
     412  /// function on the edges+designated source and target) from an input stream.
     413  ///
    338414  /// \param is The input stream.
    339415  /// \param g The graph.
     
    354430  }
    355431
    356   /// \brief Read a graph from the input.
    357   ///
    358   /// Read a graph from the input.
    359   /// \param is The input stream.
    360   /// \param g The graph.
    361   /// \param capacity The capacity map.
    362   /// \param s The source node.
    363   /// \param t The target node.
    364   template<typename Graph, typename CapacityMap>
    365   void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
    366                   typename Graph::Node &s, typename Graph::Node &t) {
    367     GraphReader<Graph> reader(is, g);
    368     reader.readEdgeMap("capacity", capacity);
    369     reader.readNode("source", s);
    370     reader.readNode("target", t);
    371     reader.run();
    372   }
    373 
    374   /// \brief Read a graph from the input.
    375   ///
    376   /// Read a graph from the input.
    377   /// \param is The input stream.
    378   /// \param g The graph.
    379   /// \param capacity The capacity map.
    380   /// \param s The source node.
    381   template<typename Graph, typename CapacityMap>
    382   void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
    383                   typename Graph::Node &s) {
    384     GraphReader<Graph> reader(is, g);
    385     reader.readEdgeMap("capacity", capacity);
    386     reader.readNode("source", s);
    387     reader.run();
    388   }
    389 
    390   /// \brief Read a graph from the input.
    391   ///
    392   /// Read a graph from the input.
    393   /// \param is The input stream.
    394   /// \param g The graph.
    395   /// \param capacity The capacity map.
    396   template<typename Graph, typename CapacityMap>
    397   void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
    398     GraphReader<Graph> reader(is, g);
    399     reader.readEdgeMap("capacity", capacity);
    400     reader.run();
    401   }
    402 
    403   /// \brief Read a graph from the input.
    404   ///
    405   /// Read a graph from the input.
    406   /// \param is The input stream.
    407   /// \param g The graph.
    408   template<typename Graph>
    409   void readGraph(std::istream& is, Graph &g) {
    410     GraphReader<Graph> reader(is, g);
    411     reader.run();
    412   }
    413432
    414433  /// \brief The undir graph reader class.
     
    780799  };
    781800
    782   /// \brief Read an undir graph from the input.
    783   ///
    784   /// Read an undir graph from the input.
     801  /// \brief Read an undirected graph from an input stream.
     802  ///
     803  /// Read an undirected graph from an input stream.
     804  /// \param is The input stream.
     805  /// \param g The graph.
     806  template<typename Graph>
     807  void readUndirGraph(std::istream& is, Graph &g) {
     808    UndirGraphReader<Graph> reader(is, g);
     809    reader.run();
     810  }
     811
     812  /// \brief Read an undirected multigraph (undirected graph + capacity
     813  /// map on the edges) from an input stream.
     814  ///
     815  /// Read an undirected multigraph (undirected graph + capacity
     816  /// map on the edges) from an input stream.
    785817  /// \param is The input stream.
    786818  /// \param g The graph.
     
    793825  }
    794826
    795   /// \brief Read an undir graph from the input.
    796   ///
    797   /// Read an undir graph from the input.
    798   /// \param is The input stream.
    799   /// \param g The graph.
    800   template<typename Graph>
    801   void readUndirGraph(std::istream& is, Graph &g) {
    802     UndirGraphReader<Graph> reader(is, g);
    803     reader.run();
    804   }
    805827
    806828  /// @}
  • lemon/graph_writer.h

    r1526 r1534  
    1818///\file
    1919///\brief Lemon Graph Format writer.
     20///
    2021
    2122#ifndef LEMON_GRAPH_WRITER_H
     
    3738  /// Before you read this documentation it might be useful to read the general
    3839  /// description of  \ref graph-io-page "Graph Input-Output".
     40  /// If you don't need very sophisticated
     41  /// behaviour then you can use the versions of the public function
     42  /// \ref writeGraph() to output a graph (or a max flow instance etc).
     43  ///
    3944  /// To write a graph
    4045  /// you should first give writing commands to the writer. You can declare
     
    277282
    278283
     284  ///\anchor writeGraph()
     285  ///
    279286  /// \brief Write a graph to the output.
    280287  ///
    281288  /// Write a graph to the output.
     289  /// \param os The output stream.
     290  /// \param g The graph.
     291  template<typename Graph>
     292  void writeGraph(std::ostream& os, const Graph &g) {
     293    GraphWriter<Graph> writer(os, g);
     294    IdMap<Graph, typename Graph::Node> nodeIdMap(g);
     295    writer.writeNodeMap("id", nodeIdMap);
     296    IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
     297    writer.writeEdgeMap("id", edgeIdMap);
     298    writer.run();
     299  }
     300
     301  /// \brief Write a capacitated graph instance to the output.
     302  ///
     303  /// Write a capacitated graph (graph+capacity on the
     304  /// edges) to the output.
     305  /// \param os The output stream.
     306  /// \param g The graph.
     307  /// \param capacity The capacity map.
     308  template<typename Graph, typename CapacityMap>
     309  void writeGraph(std::ostream& os, const Graph &g,
     310                  const CapacityMap& capacity) {
     311    GraphWriter<Graph> writer(os, g);
     312    IdMap<Graph, typename Graph::Node> nodeIdMap(g);
     313    writer.writeNodeMap("id", nodeIdMap);
     314    IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
     315    writer.writeEdgeMap("id", edgeIdMap);
     316    writer.writeEdgeMap("capacity", capacity);
     317    writer.run();
     318  }
     319
     320  /// \brief Write a shortest path instance to the output.
     321  ///
     322  /// Write a shortest path instance (graph+capacity on the
     323  /// edges+designated source) to the output.
     324  /// \param os The output stream.
     325  /// \param g The graph.
     326  /// \param capacity The capacity map.
     327  /// \param s The source node.
     328  template<typename Graph, typename CapacityMap>
     329  void writeGraph(std::ostream& os, const Graph &g,
     330                  const CapacityMap& capacity, const typename Graph::Node &s) {
     331    GraphWriter<Graph> writer(os, g);
     332    IdMap<Graph, typename Graph::Node> nodeIdMap(g);
     333    writer.writeNodeMap("id", nodeIdMap);
     334    IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
     335    writer.writeEdgeMap("id", edgeIdMap);
     336    writer.writeEdgeMap("capacity", capacity);
     337    writer.writeNode("source", s);
     338    writer.run();
     339  }
     340
     341
     342  /// \brief Write a max flow instance to the output.
     343  ///
     344  /// Write a max flow instance (graph+capacity on the
     345  /// edges+designated source and target) to the output.
     346  ///
     347  /// \param os The output stream.
     348  /// \param g The graph.
     349  /// \param capacity The capacity map.
     350  /// \param s The source node.
     351  /// \param t The target node.
     352  template<typename Graph, typename CapacityMap>
     353  void writeGraph(std::ostream& os, const Graph &g,
     354                  const CapacityMap& capacity, const typename Graph::Node &s,
     355                  const typename Graph::Node &t) {
     356    GraphWriter<Graph> writer(os, g);
     357    IdMap<Graph, typename Graph::Node> nodeIdMap(g);
     358    writer.writeNodeMap("id", nodeIdMap);
     359    IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
     360    writer.writeEdgeMap("id", edgeIdMap);
     361    writer.writeEdgeMap("capacity", capacity);
     362    writer.writeNode("source", s);
     363    writer.writeNode("target", t);
     364    writer.run();
     365  }
     366
     367  /// \brief Write a min cost flow instance to the output.
     368  ///
     369  /// Write a min cost flow instance (graph+capacity on the edges+cost
     370  /// function on the edges+designated source and target) to the output.
     371  ///
    282372  /// \param os The output stream.
    283373  /// \param g The graph.
     
    302392  }
    303393
    304   /// \brief Write a graph to the output.
    305   ///
    306   /// Write a graph to the output.
    307   /// \param os The output stream.
    308   /// \param g The graph.
    309   /// \param capacity The capacity map.
    310   /// \param s The source node.
    311   /// \param t The target node.
    312   template<typename Graph, typename CapacityMap>
    313   void writeGraph(std::ostream& os, const Graph &g,
    314                   const CapacityMap& capacity, const typename Graph::Node &s,
    315                   const typename Graph::Node &t) {
    316     GraphWriter<Graph> writer(os, g);
    317     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    318     writer.writeNodeMap("id", nodeIdMap);
    319     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    320     writer.writeEdgeMap("id", edgeIdMap);
    321     writer.writeEdgeMap("capacity", capacity);
    322     writer.writeNode("source", s);
    323     writer.writeNode("target", t);
    324     writer.run();
    325   }
    326 
    327   /// \brief Write a graph to the output.
    328   ///
    329   /// Write a graph to the output.
    330   /// \param os The output stream.
    331   /// \param g The graph.
    332   /// \param capacity The capacity map.
    333   /// \param s The source node.
    334   template<typename Graph, typename CapacityMap>
    335   void writeGraph(std::ostream& os, const Graph &g,
    336                   const CapacityMap& capacity, const typename Graph::Node &s) {
    337     GraphWriter<Graph> writer(os, g);
    338     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    339     writer.writeNodeMap("id", nodeIdMap);
    340     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    341     writer.writeEdgeMap("id", edgeIdMap);
    342     writer.writeEdgeMap("capacity", capacity);
    343     writer.writeNode("source", s);
    344     writer.run();
    345   }
    346 
    347   /// \brief Write a graph to the output.
    348   ///
    349   /// Write a graph to the output.
    350   /// \param os The output stream.
    351   /// \param g The graph.
    352   /// \param capacity The capacity map.
    353   template<typename Graph, typename CapacityMap>
    354   void writeGraph(std::ostream& os, const Graph &g,
    355                   const CapacityMap& capacity) {
    356     GraphWriter<Graph> writer(os, g);
    357     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    358     writer.writeNodeMap("id", nodeIdMap);
    359     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    360     writer.writeEdgeMap("id", edgeIdMap);
    361     writer.writeEdgeMap("capacity", capacity);
    362     writer.run();
    363   }
    364 
    365   /// \brief Write a graph to the output.
    366   ///
    367   /// Write a graph to the output.
    368   /// \param os The output stream.
    369   /// \param g The graph.
    370   template<typename Graph>
    371   void writeGraph(std::ostream& os, const Graph &g) {
    372     GraphWriter<Graph> writer(os, g);
    373     IdMap<Graph, typename Graph::Node> nodeIdMap(g);
    374     writer.writeNodeMap("id", nodeIdMap);
    375     IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
    376     writer.writeEdgeMap("id", edgeIdMap);
    377     writer.run();
    378   }
    379 
    380394  /// \brief The undirected graph writer class.
    381395  ///
     
    666680  };
    667681
     682  /// \brief Write an undirected graph to the output.
     683  ///
     684  /// Write an undirected graph to the output.
     685  /// \param os The output stream.
     686  /// \param g The graph.
     687  template<typename Graph>
     688  void writeUndirGraph(std::ostream& os, const Graph &g) {
     689    UndirGraphWriter<Graph> writer(os, g);
     690    writer.run();
     691  }
    668692
    669693  /// \brief Write an undirected multigraph (undirected graph + capacity
     
    683707  }
    684708
    685   /// \brief Write an undirected graph to the output.
    686   ///
    687   /// Write an undirected graph to the output.
    688   /// \param os The output stream.
    689   /// \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();
    694   }
    695709
    696710  /// @}
Note: See TracChangeset for help on using the changeset viewer.