1.1 --- a/lemon/dimacs.h Thu Nov 27 22:04:46 2008 +0000
1.2 +++ b/lemon/dimacs.h Thu Nov 27 22:05:35 2008 +0000
1.3 @@ -54,7 +54,7 @@
1.4 template <typename Digraph, typename LowerMap,
1.5 typename CapacityMap, typename CostMap,
1.6 typename SupplyMap>
1.7 - void readDimacs( std::istream& is,
1.8 + void readDimacsMin( std::istream& is,
1.9 Digraph &g,
1.10 LowerMap& lower,
1.11 CapacityMap& capacity,
1.12 @@ -118,7 +118,7 @@
1.13 /// capacities are written to \c capacity and \c s and \c t are
1.14 /// set to the source and the target nodes.
1.15 template<typename Digraph, typename CapacityMap>
1.16 - void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity,
1.17 + void readDimacsMax(std::istream& is, Digraph &g, CapacityMap& capacity,
1.18 typename Digraph::Node &s, typename Digraph::Node &t) {
1.19 g.clear();
1.20 std::vector<typename Digraph::Node> nodes;
1.21 @@ -181,9 +181,10 @@
1.22 /// capacities are written to \c capacity and \c s is set to the
1.23 /// source node.
1.24 template<typename Digraph, typename CapacityMap>
1.25 - void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity,
1.26 + void readDimacsSp(std::istream& is, Digraph &g, CapacityMap& capacity,
1.27 typename Digraph::Node &s) {
1.28 - readDimacs(is, g, capacity, s, s);
1.29 + typename Digraph::Node t;
1.30 + readDimacsMax(is, g, capacity, s, t);
1.31 }
1.32
1.33 /// DIMACS capacitated digraph reader function.
1.34 @@ -192,9 +193,9 @@
1.35 /// DIMACS format. At the beginning \c g is cleared by \c g.clear()
1.36 /// and the arc capacities are written to \c capacity.
1.37 template<typename Digraph, typename CapacityMap>
1.38 - void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity) {
1.39 - typename Digraph::Node u;
1.40 - readDimacs(is, g, capacity, u, u);
1.41 + void readDimacsMax(std::istream& is, Digraph &g, CapacityMap& capacity) {
1.42 + typename Digraph::Node u,v;
1.43 + readDimacsMax(is, g, capacity, u, v);
1.44 }
1.45
1.46 /// DIMACS plain digraph reader function.
1.47 @@ -207,10 +208,10 @@
1.48 /// \endcode
1.49 /// At the beginning \c g is cleared by \c g.clear().
1.50 template<typename Digraph>
1.51 - void readDimacs(std::istream& is, Digraph &g) {
1.52 - typename Digraph::Node u;
1.53 + void readDimacsMat(std::istream& is, Digraph &g) {
1.54 + typename Digraph::Node u,v;
1.55 NullMap<typename Digraph::Arc, int> n;
1.56 - readDimacs(is, g, n, u, u);
1.57 + readDimacsMax(is, g, n, u, v);
1.58 }
1.59
1.60 /// DIMACS plain digraph writer function.
1.61 @@ -222,7 +223,7 @@
1.62 /// p mat
1.63 /// \endcode
1.64 template<typename Digraph>
1.65 - void writeDimacs(std::ostream& os, const Digraph &g) {
1.66 + void writeDimacsMat(std::ostream& os, const Digraph &g) {
1.67 typedef typename Digraph::NodeIt NodeIt;
1.68 typedef typename Digraph::ArcIt ArcIt;
1.69
2.1 --- a/tools/dimacs-to-lgf.cc Thu Nov 27 22:04:46 2008 +0000
2.2 +++ b/tools/dimacs-to-lgf.cc Thu Nov 27 22:05:35 2008 +0000
2.3 @@ -123,7 +123,7 @@
2.4 Digraph digraph;
2.5 DoubleArcMap lower(digraph), capacity(digraph), cost(digraph);
2.6 DoubleNodeMap supply(digraph);
2.7 - readDimacs(is, digraph, lower, capacity, cost, supply);
2.8 + readDimacsMin(is, digraph, lower, capacity, cost, supply);
2.9 DigraphWriter<Digraph>(digraph, os).
2.10 nodeMap("supply", supply).
2.11 arcMap("lower", lower).
2.12 @@ -134,7 +134,7 @@
2.13 Digraph digraph;
2.14 Node s, t;
2.15 DoubleArcMap capacity(digraph);
2.16 - readDimacs(is, digraph, capacity, s, t);
2.17 + readDimacsMax(is, digraph, capacity, s, t);
2.18 DigraphWriter<Digraph>(digraph, os).
2.19 arcMap("capacity", capacity).
2.20 node("source", s).
2.21 @@ -144,7 +144,7 @@
2.22 Digraph digraph;
2.23 Node s;
2.24 DoubleArcMap capacity(digraph);
2.25 - readDimacs(is, digraph, capacity, s);
2.26 + readDimacsSp(is, digraph, capacity, s);
2.27 DigraphWriter<Digraph>(digraph, os).
2.28 arcMap("capacity", capacity).
2.29 node("source", s).
2.30 @@ -152,13 +152,13 @@
2.31 } else if (capacitated) {
2.32 Digraph digraph;
2.33 DoubleArcMap capacity(digraph);
2.34 - readDimacs(is, digraph, capacity);
2.35 + readDimacsMax(is, digraph, capacity);
2.36 DigraphWriter<Digraph>(digraph, os).
2.37 arcMap("capacity", capacity).
2.38 run();
2.39 } else if (plain) {
2.40 Digraph digraph;
2.41 - readDimacs(is, digraph);
2.42 + readDimacsMat(is, digraph);
2.43 DigraphWriter<Digraph>(digraph, os).run();
2.44 } else {
2.45 cerr << "Invalid type error" << endl;