# HG changeset patch # User marci # Date 1082999427 0 # Node ID fac60be3129b3045249a8c370fa35285445f607c # Parent ede61a3d229b10256ddbba09cbb4fb02b819ca78 misc diff -r ede61a3d229b -r fac60be3129b doc/Doxyfile --- a/doc/Doxyfile Mon Apr 26 17:05:22 2004 +0000 +++ b/doc/Doxyfile Mon Apr 26 17:10:27 2004 +0000 @@ -399,11 +399,12 @@ ../src/include/dijkstra.h \ ../src/include/bin_heap.h \ ../src/include/fib_heap.h \ + ../src/include/dimacs.h \ ../src/work/alpar/list_graph.h \ ../src/work/athos/xy/xy.h \ ../src/work/athos/minlengthpaths.h \ ../src/work/marci/time_measure.h \ - ../src/work/marci/graph_wrapper.h + ../src/work/marci/graph_wrapper.h # If the value of the INPUT tag contains directories, you can use the diff -r ede61a3d229b -r fac60be3129b src/include/dimacs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/include/dimacs.h Mon Apr 26 17:10:27 2004 +0000 @@ -0,0 +1,69 @@ +// -*- c++ -*- +#ifndef HUGO_DIMACS_H +#define HUGO_DIMACS_H + +#include +#include +#include + +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(); + int cap; + char d; + std::string problem; + char c; + int i, j; + std::string str; + int n, m; + typename Graph::Edge e; + std::vector nodes; + while (is>>c) { + switch (c) { + case 'c': //comment + getline(is, str); + break; + case 'p': //problem definition + is >> problem >> n >> m; + getline(is, str); + nodes.resize(n+1); + for (int k=1; k<=n; ++k) nodes[k]=g.addNode(); + break; + case 'n': //node definition + if (problem=="sp") { //shortest path problem + is >> i; + getline(is, str); + s=nodes[i]; + } + if (problem=="max") { //max flow problem + is >> i >> d; + getline(is, str); + if (d=='s') s=nodes[i]; + if (d=='t') t=nodes[i]; + } + break; + case 'a': + is >> i >> j >> cap; + getline(is, str); + e=g.addEdge(nodes[i], nodes[j]); + capacity.update(); + capacity.set(e, cap); + break; + } + } + } + +} //namespace hugo + +#endif //HUGO_DIMACS_H diff -r ede61a3d229b -r fac60be3129b src/work/marci/dimacs.h --- a/src/work/marci/dimacs.h Mon Apr 26 17:05:22 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -// -*- c++ -*- -#ifndef HUGO_DIMACS_H -#define HUGO_DIMACS_H - -#include -#include -#include - -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(); - int cap; - char d; - std::string problem; - char c; - int i, j; - std::string str; - int n, m; - typename Graph::Edge e; - std::vector nodes; - while (is>>c) { - switch (c) { - case 'c': //comment - getline(is, str); - break; - case 'p': //problem definition - is >> problem >> n >> m; - getline(is, str); - nodes.resize(n+1); - for (int k=1; k<=n; ++k) nodes[k]=g.addNode(); - break; - case 'n': //node definition - if (problem=="sp") { //shortest path problem - is >> i; - getline(is, str); - s=nodes[i]; - } - if (problem=="max") { //max flow problem - is >> i >> d; - getline(is, str); - if (d=='s') s=nodes[i]; - if (d=='t') t=nodes[i]; - } - break; - case 'a': - is >> i >> j >> cap; - getline(is, str); - e=g.addEdge(nodes[i], nodes[j]); - capacity.update(); - capacity.set(e, cap); - break; - } - } - } - -} //namespace hugo - -#endif //HUGO_DIMACS_H