# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1227619306 0
# Node ID a6bc90e888ff4d0ecfba4c9dce06f9bf31812f8a
# Parent c052e6718a958fb724f783c90f55f551973204f7
Give different names to the different DIMACS readers
diff --git a/lemon/dimacs.h b/lemon/dimacs.h
a
|
b
|
|
56 | 56 | template <typename Digraph, typename LowerMap, |
57 | 57 | typename CapacityMap, typename CostMap, |
58 | 58 | typename SupplyMap> |
59 | | void readDimacs( std::istream& is, |
| 59 | void readDimacsMin( std::istream& is, |
60 | 60 | Digraph &g, |
61 | 61 | LowerMap& lower, |
62 | 62 | CapacityMap& capacity, |
… |
… |
|
122 | 122 | /// |
123 | 123 | /// \author Marton Makai |
124 | 124 | template<typename Digraph, typename CapacityMap> |
125 | | void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity, |
| 125 | void readDimacsMax(std::istream& is, Digraph &g, CapacityMap& capacity, |
126 | 126 | typename Digraph::Node &s, typename Digraph::Node &t) { |
127 | 127 | g.clear(); |
128 | 128 | std::vector<typename Digraph::Node> nodes; |
… |
… |
|
187 | 187 | /// |
188 | 188 | /// \author Marton Makai |
189 | 189 | template<typename Digraph, typename CapacityMap> |
190 | | void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity, |
| 190 | void readDimacsSp(std::istream& is, Digraph &g, CapacityMap& capacity, |
191 | 191 | typename Digraph::Node &s) { |
192 | | readDimacs(is, g, capacity, s, s); |
| 192 | typename Digraph::Node t; |
| 193 | readDimacsMax(is, g, capacity, s, t); |
193 | 194 | } |
194 | 195 | |
195 | 196 | /// DIMACS capacitated digraph reader function. |
… |
… |
|
200 | 201 | /// |
201 | 202 | /// \author Marton Makai |
202 | 203 | template<typename Digraph, typename CapacityMap> |
203 | | void readDimacs(std::istream& is, Digraph &g, CapacityMap& capacity) { |
204 | | typename Digraph::Node u; |
205 | | readDimacs(is, g, capacity, u, u); |
| 204 | void readDimacsMax(std::istream& is, Digraph &g, CapacityMap& capacity) { |
| 205 | typename Digraph::Node u,v; |
| 206 | readDimacsMax(is, g, capacity, u, v); |
206 | 207 | } |
207 | 208 | |
208 | 209 | /// DIMACS plain digraph reader function. |
… |
… |
|
217 | 218 | /// |
218 | 219 | /// \author Marton Makai |
219 | 220 | template<typename Digraph> |
220 | | void readDimacs(std::istream& is, Digraph &g) { |
221 | | typename Digraph::Node u; |
| 221 | void readDimacsMat(std::istream& is, Digraph &g) { |
| 222 | typename Digraph::Node u,v; |
222 | 223 | NullMap<typename Digraph::Arc, int> n; |
223 | | readDimacs(is, g, n, u, u); |
| 224 | readDimacsMax(is, g, n, u, v); |
224 | 225 | } |
225 | 226 | |
226 | 227 | /// DIMACS plain digraph writer function. |
… |
… |
|
234 | 235 | /// |
235 | 236 | /// \author Marton Makai |
236 | 237 | template<typename Digraph> |
237 | | void writeDimacs(std::ostream& os, const Digraph &g) { |
| 238 | void writeDimacsMat(std::ostream& os, const Digraph &g) { |
238 | 239 | typedef typename Digraph::NodeIt NodeIt; |
239 | 240 | typedef typename Digraph::ArcIt ArcIt; |
240 | 241 | |
diff --git a/tools/dimacs-to-lgf.cc b/tools/dimacs-to-lgf.cc
a
|
b
|
|
123 | 123 | Digraph digraph; |
124 | 124 | DoubleArcMap lower(digraph), capacity(digraph), cost(digraph); |
125 | 125 | DoubleNodeMap supply(digraph); |
126 | | readDimacs(is, digraph, lower, capacity, cost, supply); |
| 126 | readDimacsMin(is, digraph, lower, capacity, cost, supply); |
127 | 127 | DigraphWriter<Digraph>(digraph, os). |
128 | 128 | nodeMap("supply", supply). |
129 | 129 | arcMap("lower", lower). |
… |
… |
|
134 | 134 | Digraph digraph; |
135 | 135 | Node s, t; |
136 | 136 | DoubleArcMap capacity(digraph); |
137 | | readDimacs(is, digraph, capacity, s, t); |
| 137 | readDimacsMax(is, digraph, capacity, s, t); |
138 | 138 | DigraphWriter<Digraph>(digraph, os). |
139 | 139 | arcMap("capacity", capacity). |
140 | 140 | node("source", s). |
… |
… |
|
144 | 144 | Digraph digraph; |
145 | 145 | Node s; |
146 | 146 | DoubleArcMap capacity(digraph); |
147 | | readDimacs(is, digraph, capacity, s); |
| 147 | readDimacsSp(is, digraph, capacity, s); |
148 | 148 | DigraphWriter<Digraph>(digraph, os). |
149 | 149 | arcMap("capacity", capacity). |
150 | 150 | node("source", s). |
… |
… |
|
152 | 152 | } else if (capacitated) { |
153 | 153 | Digraph digraph; |
154 | 154 | DoubleArcMap capacity(digraph); |
155 | | readDimacs(is, digraph, capacity); |
| 155 | readDimacsMax(is, digraph, capacity); |
156 | 156 | DigraphWriter<Digraph>(digraph, os). |
157 | 157 | arcMap("capacity", capacity). |
158 | 158 | run(); |
159 | 159 | } else if (plain) { |
160 | 160 | Digraph digraph; |
161 | | readDimacs(is, digraph); |
| 161 | readDimacsMat(is, digraph); |
162 | 162 | DigraphWriter<Digraph>(digraph, os).run(); |
163 | 163 | } else { |
164 | 164 | cerr << "Invalid type error" << endl; |