[Lemon-commits] [lemon_svn] athos: r2026 - in hugo/trunk: demo doc lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:36 CET 2006
Author: athos
Date: Mon Jul 4 18:11:33 2005
New Revision: 2026
Modified:
hugo/trunk/demo/reader_writer_demo.cc
hugo/trunk/doc/quicktour.dox
hugo/trunk/lemon/graph_reader.h
hugo/trunk/lemon/graph_writer.h
Log:
Doc.
Modified: hugo/trunk/demo/reader_writer_demo.cc
==============================================================================
--- hugo/trunk/demo/reader_writer_demo.cc (original)
+++ hugo/trunk/demo/reader_writer_demo.cc Mon Jul 4 18:11:33 2005
@@ -24,8 +24,6 @@
GraphWriter<SmartGraph> writer(std::cout, graph);
writer.writeEdgeMap("multiplicity", cap);
-// writer.writeNode("source", s);
-// writer.writeNode("target", t);
writer.run();
} catch (DataFormatError& error) {
Modified: hugo/trunk/doc/quicktour.dox
==============================================================================
--- hugo/trunk/doc/quicktour.dox (original)
+++ hugo/trunk/doc/quicktour.dox Mon Jul 4 18:11:33 2005
@@ -38,7 +38,7 @@
read a graph (and perhaps maps on it) from a stream (e.g. a file). Of course
we also have routines that write a graph (and perhaps maps) to a stream
(file): this will also be shown. LEMON supports the DIMACS file formats to
-store network optimization problems, but more importantly we also have our own
+read network optimization problems, but more importantly we also have our own
file format that gives a more flexible way to store data related to network
optimization.
@@ -86,9 +86,8 @@
One can also store network (graph+capacity on the edges) instances and
other things (minimum cost flow instances etc.) in DIMACS format and
-use these in LEMON: to see the details read the documentation of the
-\ref dimacs.h "Dimacs file format reader". There you will also find
-the details about the output routines into files of the DIMACS format.
+read these in LEMON: to see the details read the documentation of the
+\ref dimacs.h "Dimacs file format reader".
</ol>
<li> If you want to solve some transportation problems in a network then
Modified: hugo/trunk/lemon/graph_reader.h
==============================================================================
--- hugo/trunk/lemon/graph_reader.h (original)
+++ hugo/trunk/lemon/graph_reader.h Mon Jul 4 18:11:33 2005
@@ -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,48 +339,38 @@
AttributeReader<ReaderTraits> attribute_reader;
};
- /// \brief Read a graph from the input.
+
+ ///\anchor readGraph()
+ ///
+ /// \brief Read a graph from an input stream.
///
- /// Read a graph from the input.
+ /// Read a graph 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.
- /// \param cost The cost map.
- template<typename Graph, typename CapacityMap, typename CostMap>
- void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
- typename Graph::Node &s, typename Graph::Node &t,
- CostMap& cost) {
+ template<typename Graph>
+ void readGraph(std::istream& is, Graph &g) {
GraphReader<Graph> reader(is, g);
- reader.readEdgeMap("capacity", capacity);
- reader.readEdgeMap("cost", cost);
- reader.readNode("source", s);
- reader.readNode("target", t);
reader.run();
}
- /// \brief Read a graph from the input.
- ///
- /// Read a graph from the input.
+ /// \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.
- /// \param s The source node.
- /// \param t The target node.
template<typename Graph, typename CapacityMap>
- void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
- typename Graph::Node &s, typename Graph::Node &t) {
+ void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
GraphReader<Graph> 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.
+ /// \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.
@@ -387,30 +384,52 @@
reader.run();
}
- /// \brief Read a graph from the input.
+
+
+ /// \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.
///
- /// 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<typename Graph, typename CapacityMap>
- void readGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
+ void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
+ typename Graph::Node &s, typename Graph::Node &t) {
GraphReader<Graph> reader(is, g);
reader.readEdgeMap("capacity", capacity);
+ reader.readNode("source", s);
+ reader.readNode("target", t);
reader.run();
}
- /// \brief Read a graph from the input.
+ /// \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.
///
- /// Read a graph from the input.
/// \param is The input stream.
/// \param g The graph.
- template<typename Graph>
- void readGraph(std::istream& is, Graph &g) {
+ /// \param capacity The capacity map.
+ /// \param s The source node.
+ /// \param t The target node.
+ /// \param cost The cost map.
+ template<typename Graph, typename CapacityMap, typename CostMap>
+ void readGraph(std::istream& is, Graph &g, CapacityMap& capacity,
+ typename Graph::Node &s, typename Graph::Node &t,
+ CostMap& cost) {
GraphReader<Graph> reader(is, g);
+ reader.readEdgeMap("capacity", capacity);
+ reader.readEdgeMap("cost", cost);
+ reader.readNode("source", s);
+ reader.readNode("target", t);
reader.run();
}
+
/// \brief The undir graph reader class.
///
/// The given file format may contain several maps and labeled nodes or
@@ -779,30 +798,33 @@
AttributeReader<ReaderTraits> 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.
- /// \param capacity The capacity map.
- template<typename Graph, typename CapacityMap>
- void readUndirGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
+ template<typename Graph>
+ void readUndirGraph(std::istream& is, Graph &g) {
UndirGraphReader<Graph> reader(is, g);
- reader.readUndirEdgeMap("capacity", capacity);
reader.run();
}
- /// \brief Read an undir graph from the input.
+ /// \brief Read an undirected multigraph (undirected graph + capacity
+ /// map on the edges) from an input stream.
///
- /// Read an undir graph from the input.
+ /// Read an undirected multigraph (undirected graph + capacity
+ /// map on the edges) from an input stream.
/// \param is The input stream.
/// \param g The graph.
- template<typename Graph>
- void readUndirGraph(std::istream& is, Graph &g) {
+ /// \param capacity The capacity map.
+ template<typename Graph, typename CapacityMap>
+ void readUndirGraph(std::istream& is, Graph &g, CapacityMap& capacity) {
UndirGraphReader<Graph> reader(is, g);
+ reader.readUndirEdgeMap("capacity", capacity);
reader.run();
}
+
/// @}
}
Modified: hugo/trunk/lemon/graph_writer.h
==============================================================================
--- hugo/trunk/lemon/graph_writer.h (original)
+++ hugo/trunk/lemon/graph_writer.h Mon Jul 4 18:11:33 2005
@@ -17,6 +17,7 @@
///\ingroup io_group
///\file
///\brief Lemon Graph Format writer.
+///
#ifndef LEMON_GRAPH_WRITER_H
#define LEMON_GRAPH_WRITER_H
@@ -36,6 +37,10 @@
/// The \c GraphWriter class provides the graph output.
/// 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 writeGraph() to output a graph (or a max flow instance etc).
+ ///
/// To write a graph
/// you should first give writing commands to the writer. You can declare
/// write commands as \c NodeMap or \c EdgeMap writing and labeled Node and
@@ -276,57 +281,46 @@
};
+ ///\anchor writeGraph()
+ ///
/// \brief Write a graph to the output.
///
/// Write a graph to the output.
/// \param os The output stream.
/// \param g The graph.
- /// \param capacity The capacity map.
- /// \param s The source node.
- /// \param t The target node.
- /// \param cost The cost map.
- template<typename Graph, typename CapacityMap, typename CostMap>
- void writeGraph(std::ostream& os, const Graph &g,
- const CapacityMap& capacity, const typename Graph::Node &s,
- const typename Graph::Node &t, const CostMap& cost) {
+ template<typename Graph>
+ void writeGraph(std::ostream& os, const Graph &g) {
GraphWriter<Graph> writer(os, g);
IdMap<Graph, typename Graph::Node> nodeIdMap(g);
writer.writeNodeMap("id", nodeIdMap);
IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
writer.writeEdgeMap("id", edgeIdMap);
- writer.writeEdgeMap("capacity", capacity);
- writer.writeEdgeMap("cost", cost);
- writer.writeNode("source", s);
- writer.writeNode("target", t);
writer.run();
}
- /// \brief Write a graph to the output.
- ///
- /// Write a graph to the output.
+ /// \brief Write a capacitated graph instance to the output.
+ ///
+ /// Write a capacitated graph (graph+capacity on the
+ /// edges) to the output.
/// \param os The output stream.
/// \param g The graph.
/// \param capacity The capacity map.
- /// \param s The source node.
- /// \param t The target node.
template<typename Graph, typename CapacityMap>
void writeGraph(std::ostream& os, const Graph &g,
- const CapacityMap& capacity, const typename Graph::Node &s,
- const typename Graph::Node &t) {
+ const CapacityMap& capacity) {
GraphWriter<Graph> writer(os, g);
IdMap<Graph, typename Graph::Node> nodeIdMap(g);
writer.writeNodeMap("id", nodeIdMap);
IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
writer.writeEdgeMap("id", edgeIdMap);
writer.writeEdgeMap("capacity", capacity);
- writer.writeNode("source", s);
- writer.writeNode("target", t);
writer.run();
}
- /// \brief Write a graph to the output.
- ///
- /// Write a graph to the output.
+ /// \brief Write a shortest path instance to the output.
+ ///
+ /// Write a shortest path instance (graph+capacity on the
+ /// edges+designated source) to the output.
/// \param os The output stream.
/// \param g The graph.
/// \param capacity The capacity map.
@@ -344,36 +338,56 @@
writer.run();
}
- /// \brief Write a graph to the output.
+
+ /// \brief Write a max flow instance to the output.
+ ///
+ /// Write a max flow instance (graph+capacity on the
+ /// edges+designated source and target) to the output.
///
- /// Write a graph to the output.
/// \param os The output stream.
/// \param g The graph.
/// \param capacity The capacity map.
+ /// \param s The source node.
+ /// \param t The target node.
template<typename Graph, typename CapacityMap>
void writeGraph(std::ostream& os, const Graph &g,
- const CapacityMap& capacity) {
+ const CapacityMap& capacity, const typename Graph::Node &s,
+ const typename Graph::Node &t) {
GraphWriter<Graph> writer(os, g);
IdMap<Graph, typename Graph::Node> nodeIdMap(g);
writer.writeNodeMap("id", nodeIdMap);
IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
writer.writeEdgeMap("id", edgeIdMap);
writer.writeEdgeMap("capacity", capacity);
+ writer.writeNode("source", s);
+ writer.writeNode("target", t);
writer.run();
}
- /// \brief Write a graph to the output.
+ /// \brief Write a min cost flow instance to the output.
+ ///
+ /// Write a min cost flow instance (graph+capacity on the edges+cost
+ /// function on the edges+designated source and target) to the output.
///
- /// Write a graph to the output.
/// \param os The output stream.
/// \param g The graph.
- template<typename Graph>
- void writeGraph(std::ostream& os, const Graph &g) {
+ /// \param capacity The capacity map.
+ /// \param s The source node.
+ /// \param t The target node.
+ /// \param cost The cost map.
+ template<typename Graph, typename CapacityMap, typename CostMap>
+ void writeGraph(std::ostream& os, const Graph &g,
+ const CapacityMap& capacity, const typename Graph::Node &s,
+ const typename Graph::Node &t, const CostMap& cost) {
GraphWriter<Graph> writer(os, g);
IdMap<Graph, typename Graph::Node> nodeIdMap(g);
writer.writeNodeMap("id", nodeIdMap);
IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
writer.writeEdgeMap("id", edgeIdMap);
+ writer.writeEdgeMap("capacity", capacity);
+ writer.writeEdgeMap("cost", cost);
+ writer.writeNode("source", s);
+ writer.writeNode("target", t);
writer.run();
}
@@ -665,6 +679,16 @@
AttributeWriter<WriterTraits> attribute_writer;
};
+ /// \brief Write an undirected graph to the output.
+ ///
+ /// Write an undirected graph to the output.
+ /// \param os The output stream.
+ /// \param g The graph.
+ template<typename Graph>
+ void writeUndirGraph(std::ostream& os, const Graph &g) {
+ UndirGraphWriter<Graph> writer(os, g);
+ writer.run();
+ }
/// \brief Write an undirected multigraph (undirected graph + capacity
/// map on the edges) to the output.
@@ -682,16 +706,6 @@
writer.run();
}
- /// \brief Write an undirected graph to the output.
- ///
- /// Write an undirected graph to the output.
- /// \param os The output stream.
- /// \param g The graph.
- template<typename Graph>
- void writeUndirGraph(std::ostream& os, const Graph &g) {
- UndirGraphWriter<Graph> writer(os, g);
- writer.run();
- }
/// @}
More information about the Lemon-commits
mailing list