xy.h went to src/include.
9 /// \file \brief Dimacs file format reader.
13 /// Dimacs flow file format reader function.
15 /// This function reads a flow instance from dimacs flow format.
16 /// At the beginning \c g is cleared by \c g.clear().
17 /// If the data coming from \c is is a max flow problem instance, then
18 /// \c s and \c t will be respectively the source and target nodes
19 /// and \c capacity will contain the edge capacities.
20 /// If the data is a shortest path problem instance then \c s will be the
21 /// source node and \c capacity will contain the edge lengths.
22 template<typename Graph, typename CapacityMap>
23 void readDimacsMaxFlow(std::istream& is, Graph &g, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) {
32 typename Graph::Edge e;
33 std::vector<typename Graph::Node> nodes;
39 case 'p': //problem definition
40 is >> problem >> n >> m;
43 for (int k=1; k<=n; ++k) nodes[k]=g.addNode();
45 case 'n': //node definition
46 if (problem=="sp") { //shortest path problem
51 if (problem=="max") { //max flow problem
54 if (d=='s') s=nodes[i];
55 if (d=='t') t=nodes[i];
61 e=g.addEdge(nodes[i], nodes[j]);
71 #endif //HUGO_DIMACS_H