diff --git a/lemon/dimacs.h b/lemon/dimacs.h --- a/lemon/dimacs.h +++ b/lemon/dimacs.h @@ -54,7 +54,7 @@ template - void readDimacs( std::istream& is, + void readDimacsMin( std::istream& is, Digraph &g, LowerMap& lower, CapacityMap& capacity, @@ -118,7 +118,7 @@ /// capacities are written to \c capacity and \c s and \c t are /// set to the source and the target nodes. template - void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity, + void readDimacsMax(std::istream& is, Digraph &g, CapacityMap& capacity, typename Digraph::Node &s, typename Digraph::Node &t) { g.clear(); std::vector nodes; @@ -181,9 +181,10 @@ /// capacities are written to \c capacity and \c s is set to the /// source node. template - void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity, + void readDimacsSp(std::istream& is, Digraph &g, CapacityMap& capacity, typename Digraph::Node &s) { - readDimacs(is, g, capacity, s, s); + typename Digraph::Node t; + readDimacsMax(is, g, capacity, s, t); } /// DIMACS capacitated digraph reader function. @@ -192,9 +193,9 @@ /// DIMACS format. At the beginning \c g is cleared by \c g.clear() /// and the arc capacities are written to \c capacity. template - void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity) { - typename Digraph::Node u; - readDimacs(is, g, capacity, u, u); + void readDimacsMax(std::istream& is, Digraph &g, CapacityMap& capacity) { + typename Digraph::Node u,v; + readDimacsMax(is, g, capacity, u, v); } /// DIMACS plain digraph reader function. @@ -207,10 +208,10 @@ /// \endcode /// At the beginning \c g is cleared by \c g.clear(). template - void readDimacs(std::istream& is, Digraph &g) { - typename Digraph::Node u; + void readDimacsMat(std::istream& is, Digraph &g) { + typename Digraph::Node u,v; NullMap n; - readDimacs(is, g, n, u, u); + readDimacsMax(is, g, n, u, v); } /// DIMACS plain digraph writer function. @@ -222,7 +223,7 @@ /// p mat /// \endcode template - void writeDimacs(std::ostream& os, const Digraph &g) { + void writeDimacsMat(std::ostream& os, const Digraph &g) { typedef typename Digraph::NodeIt NodeIt; typedef typename Digraph::ArcIt ArcIt; diff --git a/tools/dimacs-to-lgf.cc b/tools/dimacs-to-lgf.cc --- a/tools/dimacs-to-lgf.cc +++ b/tools/dimacs-to-lgf.cc @@ -123,7 +123,7 @@ Digraph digraph; DoubleArcMap lower(digraph), capacity(digraph), cost(digraph); DoubleNodeMap supply(digraph); - readDimacs(is, digraph, lower, capacity, cost, supply); + readDimacsMin(is, digraph, lower, capacity, cost, supply); DigraphWriter(digraph, os). nodeMap("supply", supply). arcMap("lower", lower). @@ -134,7 +134,7 @@ Digraph digraph; Node s, t; DoubleArcMap capacity(digraph); - readDimacs(is, digraph, capacity, s, t); + readDimacsMax(is, digraph, capacity, s, t); DigraphWriter(digraph, os). arcMap("capacity", capacity). node("source", s). @@ -144,7 +144,7 @@ Digraph digraph; Node s; DoubleArcMap capacity(digraph); - readDimacs(is, digraph, capacity, s); + readDimacsSp(is, digraph, capacity, s); DigraphWriter(digraph, os). arcMap("capacity", capacity). node("source", s). @@ -152,13 +152,13 @@ } else if (capacitated) { Digraph digraph; DoubleArcMap capacity(digraph); - readDimacs(is, digraph, capacity); + readDimacsMax(is, digraph, capacity); DigraphWriter(digraph, os). arcMap("capacity", capacity). run(); } else if (plain) { Digraph digraph; - readDimacs(is, digraph); + readDimacsMat(is, digraph); DigraphWriter(digraph, os).run(); } else { cerr << "Invalid type error" << endl;