diff -r a713f8a69cc3 -r 54b943063901 src/work/marci/dimacs.h --- a/src/work/marci/dimacs.h Mon Apr 26 16:21:36 2004 +0000 +++ b/src/work/marci/dimacs.h Mon Apr 26 16:58:14 2004 +0000 @@ -8,9 +8,18 @@ namespace hugo { + /// Dimacs flow files. + + /// This function reads a flow instance from dimacs flow format. + /// At the beginning \c g is destroyed by \c g.clear(). + /// If the data coming from \c is is a max flow innstance, then + /// \c s and \t will be respectively the source and target nodes + /// and \c capacity will contain the edge capacities. + /// If the data is a shortest path problem then \c s will be the + /// source node and \capacity will contain the edge lengths. template - void readDimacsMaxFlow(std::istream& is, Graph &G, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) { - G.clear(); + void readDimacsMaxFlow(std::istream& is, Graph &g, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) { + g.clear(); int cap; char d; std::string problem; @@ -29,7 +38,7 @@ is >> problem >> n >> m; getline(is, str); nodes.resize(n+1); - for (int k=1; k<=n; ++k) nodes[k]=G.addNode(); + for (int k=1; k<=n; ++k) nodes[k]=g.addNode(); break; case 'n': //node definition if (problem=="sp") { //shortest path problem @@ -47,7 +56,7 @@ case 'a': is >> i >> j >> cap; getline(is, str); - e=G.addEdge(nodes[i], nodes[j]); + e=g.addEdge(nodes[i], nodes[j]); capacity.update(); capacity.set(e, cap); break;