# HG changeset patch # User Alpar Juttner # Date 1227823535 0 # Node ID 9d1faab5e0f121da58cbcbf592a54622930f4e34 # Parent 50d96f2166d770692e9e1d8e3cab7ecebbcb53c1 Give different names to the different DIMACS readers diff -r 50d96f2166d7 -r 9d1faab5e0f1 lemon/dimacs.h --- a/lemon/dimacs.h Thu Nov 27 22:04:46 2008 +0000 +++ b/lemon/dimacs.h Thu Nov 27 22:05:35 2008 +0000 @@ -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 -r 50d96f2166d7 -r 9d1faab5e0f1 tools/dimacs-to-lgf.cc --- a/tools/dimacs-to-lgf.cc Thu Nov 27 22:04:46 2008 +0000 +++ b/tools/dimacs-to-lgf.cc Thu Nov 27 22:05:35 2008 +0000 @@ -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;