4 |
4 |
5 #include <iostream> |
5 #include <iostream> |
6 #include <string> |
6 #include <string> |
7 #include <vector> |
7 #include <vector> |
8 |
8 |
|
9 /// \file \brief Dimacs file format reader. |
|
10 |
9 namespace hugo { |
11 namespace hugo { |
10 |
12 |
11 /// Dimacs flow files. |
13 /// Dimacs flow file format reader function. |
12 |
14 |
13 /// This function reads a flow instance from dimacs flow format. |
15 /// This function reads a flow instance from dimacs flow format. |
14 /// At the beginning \c g is destroyed by \c g.clear(). |
16 /// At the beginning \c g is cleared by \c g.clear(). |
15 /// If the data coming from \c is is a max flow innstance, then |
17 /// If the data coming from \c is is a max flow problem instance, then |
16 /// \c s and \t will be respectively the source and target nodes |
18 /// \c s and \c t will be respectively the source and target nodes |
17 /// and \c capacity will contain the edge capacities. |
19 /// and \c capacity will contain the edge capacities. |
18 /// If the data is a shortest path problem then \c s will be the |
20 /// If the data is a shortest path problem instance then \c s will be the |
19 /// source node and \capacity will contain the edge lengths. |
21 /// source node and \c capacity will contain the edge lengths. |
20 template<typename Graph, typename CapacityMap> |
22 template<typename Graph, typename CapacityMap> |
21 void readDimacsMaxFlow(std::istream& is, Graph &g, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) { |
23 void readDimacsMaxFlow(std::istream& is, Graph &g, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) { |
22 g.clear(); |
24 g.clear(); |
23 int cap; |
25 int cap; |
24 char d; |
26 char d; |