diff -r 43c7b3085212 -r b86aad11f842 lemon/graph_reader.h --- a/lemon/graph_reader.h Mon Jul 04 16:11:00 2005 +0000 +++ b/lemon/graph_reader.h Mon Jul 04 16:11:33 2005 +0000 @@ -33,6 +33,13 @@ /// \brief The graph reader class. /// + /// The \c GraphReader class provides the graph input. + /// Before you read this documentation it might be useful to read the general + /// description of \ref graph-io-page "Graph Input-Output". + /// If you don't need very sophisticated + /// behaviour then you can use the versions of the public function + /// \ref readGraph() to read a graph (or a max flow instance etc). + /// /// The given file format may contain several maps and labeled nodes or /// edges. /// @@ -332,9 +339,78 @@ AttributeReader attribute_reader; }; - /// \brief Read a graph from the input. + + ///\anchor readGraph() /// - /// Read a graph from the input. + /// \brief Read a graph from an input stream. + /// + /// Read a graph from an input stream. + /// \param is The input stream. + /// \param g The graph. + template + void readGraph(std::istream& is, Graph &g) { + GraphReader reader(is, g); + reader.run(); + } + + /// \brief Read a capacitated graph instance from an input stream. + /// + /// Read a capacitated graph (graph+capacity on the + /// edges) from an input stream. + /// \param is The input stream. + /// \param g The graph. + /// \param capacity The capacity map. + template + void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) { + GraphReader reader(is, g); + reader.readEdgeMap("capacity", capacity); + reader.run(); + } + + /// \brief Read a shortest path instance from an input stream. + /// + /// Read a shortest path instance (graph+capacity on the + /// edges+designated source) from an input stream. + /// \param is The input stream. + /// \param g The graph. + /// \param capacity The capacity map. + /// \param s The source node. + template + void readGraph(std::istream& is, Graph &g, CapacityMap& capacity, + typename Graph::Node &s) { + GraphReader reader(is, g); + reader.readEdgeMap("capacity", capacity); + reader.readNode("source", s); + reader.run(); + } + + + + /// \brief Read a max flow instance from an input stream. + /// + /// Read a max flow instance (graph+capacity on the + /// edges+designated source and target) from an input stream. + /// + /// \param is The input stream. + /// \param g The graph. + /// \param capacity The capacity map. + /// \param s The source node. + /// \param t The target node. + template + void readGraph(std::istream& is, Graph &g, CapacityMap& capacity, + typename Graph::Node &s, typename Graph::Node &t) { + GraphReader reader(is, g); + reader.readEdgeMap("capacity", capacity); + reader.readNode("source", s); + reader.readNode("target", t); + reader.run(); + } + + /// \brief Read a min cost flow instance from an input stream. + /// + /// Read a min cost flow instance (graph+capacity on the edges+cost + /// function on the edges+designated source and target) from an input stream. + /// /// \param is The input stream. /// \param g The graph. /// \param capacity The capacity map. @@ -353,63 +429,6 @@ reader.run(); } - /// \brief Read a graph from the input. - /// - /// Read a graph from the input. - /// \param is The input stream. - /// \param g The graph. - /// \param capacity The capacity map. - /// \param s The source node. - /// \param t The target node. - template - void readGraph(std::istream& is, Graph &g, CapacityMap& capacity, - typename Graph::Node &s, typename Graph::Node &t) { - GraphReader reader(is, g); - reader.readEdgeMap("capacity", capacity); - reader.readNode("source", s); - reader.readNode("target", t); - reader.run(); - } - - /// \brief Read a graph from the input. - /// - /// Read a graph from the input. - /// \param is The input stream. - /// \param g The graph. - /// \param capacity The capacity map. - /// \param s The source node. - template - void readGraph(std::istream& is, Graph &g, CapacityMap& capacity, - typename Graph::Node &s) { - GraphReader reader(is, g); - reader.readEdgeMap("capacity", capacity); - reader.readNode("source", s); - reader.run(); - } - - /// \brief Read a graph from the input. - /// - /// Read a graph from the input. - /// \param is The input stream. - /// \param g The graph. - /// \param capacity The capacity map. - template - void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) { - GraphReader reader(is, g); - reader.readEdgeMap("capacity", capacity); - reader.run(); - } - - /// \brief Read a graph from the input. - /// - /// Read a graph from the input. - /// \param is The input stream. - /// \param g The graph. - template - void readGraph(std::istream& is, Graph &g) { - GraphReader reader(is, g); - reader.run(); - } /// \brief The undir graph reader class. /// @@ -779,9 +798,22 @@ AttributeReader attribute_reader; }; - /// \brief Read an undir graph from the input. + /// \brief Read an undirected graph from an input stream. /// - /// Read an undir graph from the input. + /// Read an undirected graph from an input stream. + /// \param is The input stream. + /// \param g The graph. + template + void readUndirGraph(std::istream& is, Graph &g) { + UndirGraphReader reader(is, g); + reader.run(); + } + + /// \brief Read an undirected multigraph (undirected graph + capacity + /// map on the edges) from an input stream. + /// + /// Read an undirected multigraph (undirected graph + capacity + /// map on the edges) from an input stream. /// \param is The input stream. /// \param g The graph. /// \param capacity The capacity map. @@ -792,16 +824,6 @@ reader.run(); } - /// \brief Read an undir graph from the input. - /// - /// Read an undir graph from the input. - /// \param is The input stream. - /// \param g The graph. - template - void readUndirGraph(std::istream& is, Graph &g) { - UndirGraphReader reader(is, g); - reader.run(); - } /// @} }