src/work/marci/dimacs.h
changeset 421 54b943063901
parent 259 509ba9f136d2
     1.1 --- a/src/work/marci/dimacs.h	Mon Apr 26 16:21:36 2004 +0000
     1.2 +++ b/src/work/marci/dimacs.h	Mon Apr 26 16:58:14 2004 +0000
     1.3 @@ -8,9 +8,18 @@
     1.4  
     1.5  namespace hugo {
     1.6  
     1.7 +  /// Dimacs flow files.
     1.8 +
     1.9 +  /// This function reads a flow instance from dimacs flow format.
    1.10 +  /// At the beginning \c g is destroyed by \c g.clear().
    1.11 +  /// If the data coming from \c is is a max flow innstance, then 
    1.12 +  /// \c s and \t will be respectively the source and target nodes 
    1.13 +  /// and \c capacity will contain the edge capacities.
    1.14 +  /// If the data is a shortest path problem then \c s will be the 
    1.15 +  /// source node and \capacity will contain the edge lengths.
    1.16    template<typename Graph, typename CapacityMap>
    1.17 -  void readDimacsMaxFlow(std::istream& is, Graph &G, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) {
    1.18 -    G.clear();
    1.19 +  void readDimacsMaxFlow(std::istream& is, Graph &g, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) {
    1.20 +    g.clear();
    1.21      int cap;
    1.22      char d;
    1.23      std::string problem;
    1.24 @@ -29,7 +38,7 @@
    1.25  	is >> problem >> n >> m;
    1.26  	getline(is, str);
    1.27  	nodes.resize(n+1);
    1.28 -	for (int k=1; k<=n; ++k) nodes[k]=G.addNode();
    1.29 +	for (int k=1; k<=n; ++k) nodes[k]=g.addNode();
    1.30  	break;
    1.31        case 'n': //node definition
    1.32  	if (problem=="sp") { //shortest path problem
    1.33 @@ -47,7 +56,7 @@
    1.34        case 'a':
    1.35  	is >> i >> j >> cap;
    1.36  	getline(is, str);
    1.37 -	e=G.addEdge(nodes[i], nodes[j]);
    1.38 +	e=g.addEdge(nodes[i], nodes[j]);
    1.39  	capacity.update();
    1.40  	capacity.set(e, cap);
    1.41  	break;