157 } |
157 } |
158 |
158 |
159 if (typeName == "mincostflow") { |
159 if (typeName == "mincostflow") { |
160 Graph graph; |
160 Graph graph; |
161 Node s, t; |
161 Node s, t; |
162 StringMap cost(graph), capacity(graph); |
162 DoubleMap cost(graph), capacity(graph); |
163 readDimacs(is, graph, capacity, s, t, cost); |
163 readDimacs(is, graph, capacity, s, t, cost); |
164 GraphWriter<Graph>(os, graph). |
164 GraphWriter<Graph>(os, graph). |
165 writeEdgeMap("capacity", capacity). |
165 writeEdgeMap("capacity", capacity). |
166 writeNode("source", s). |
166 writeNode("source", s). |
167 writeNode("target", t). |
167 writeNode("target", t). |
168 writeEdgeMap("cost", cost). |
168 writeEdgeMap("cost", cost). |
169 run(); |
169 run(); |
170 } else if (typeName == "maxflow") { |
170 } else if (typeName == "maxflow") { |
171 Graph graph; |
171 Graph graph; |
172 Node s, t; |
172 Node s, t; |
173 StringMap capacity(graph); |
173 DoubleMap capacity(graph); |
174 readDimacs(is, graph, capacity, s, t); |
174 readDimacs(is, graph, capacity, s, t); |
175 GraphWriter<Graph>(os, graph). |
175 GraphWriter<Graph>(os, graph). |
176 writeEdgeMap("capacity", capacity). |
176 writeEdgeMap("capacity", capacity). |
177 writeNode("source", s). |
177 writeNode("source", s). |
178 writeNode("target", t). |
178 writeNode("target", t). |
179 run(); |
179 run(); |
180 } else if (typeName == "shortestpath") { |
180 } else if (typeName == "shortestpath") { |
181 Graph graph; |
181 Graph graph; |
182 Node s; |
182 Node s; |
183 StringMap capacity(graph); |
183 DoubleMap capacity(graph); |
184 readDimacs(is, graph, capacity, s); |
184 readDimacs(is, graph, capacity, s); |
185 GraphWriter<Graph>(os, graph). |
185 GraphWriter<Graph>(os, graph). |
186 writeEdgeMap("capacity", capacity). |
186 writeEdgeMap("capacity", capacity). |
187 writeNode("source", s). |
187 writeNode("source", s). |
188 run(); |
188 run(); |
189 } else if (typeName == "capacitated") { |
189 } else if (typeName == "capacitated") { |
190 Graph graph; |
190 Graph graph; |
191 StringMap capacity(graph); |
191 DoubleMap capacity(graph); |
192 readDimacs(is, graph, capacity); |
192 readDimacs(is, graph, capacity); |
193 GraphWriter<Graph>(os, graph). |
193 GraphWriter<Graph>(os, graph). |
194 writeEdgeMap("capacity", capacity). |
194 writeEdgeMap("capacity", capacity). |
195 run(); |
195 run(); |
196 } else if (typeName == "plain") { |
196 } else if (typeName == "plain") { |