For working with undirected graphs, head is changed to aNode.
authormarci
Mon, 26 Apr 2004 16:58:14 +0000
changeset 42154b943063901
parent 420 a713f8a69cc3
child 422 ede61a3d229b
For working with undirected graphs, head is changed to aNode.
Some dimacs doki.
src/include/dijkstra.h
src/work/marci/dimacs.h
     1.1 --- a/src/include/dijkstra.h	Mon Apr 26 16:21:36 2004 +0000
     1.2 +++ b/src/include/dijkstra.h	Mon Apr 26 16:58:14 2004 +0000
     1.3 @@ -167,7 +167,7 @@
     1.4  	  OutEdgeIt e;
     1.5  	for(G.first(e, v);
     1.6  	    G.valid(e); G.next(e)) {
     1.7 -	  Node w=G.head(e); 
     1.8 +	  Node w=G.bNode(e); 
     1.9  	  
    1.10  	  switch(heap.state(w)) {
    1.11  	  case heap.PRE_HEAP:
     2.1 --- a/src/work/marci/dimacs.h	Mon Apr 26 16:21:36 2004 +0000
     2.2 +++ b/src/work/marci/dimacs.h	Mon Apr 26 16:58:14 2004 +0000
     2.3 @@ -8,9 +8,18 @@
     2.4  
     2.5  namespace hugo {
     2.6  
     2.7 +  /// Dimacs flow files.
     2.8 +
     2.9 +  /// This function reads a flow instance from dimacs flow format.
    2.10 +  /// At the beginning \c g is destroyed by \c g.clear().
    2.11 +  /// If the data coming from \c is is a max flow innstance, then 
    2.12 +  /// \c s and \t will be respectively the source and target nodes 
    2.13 +  /// and \c capacity will contain the edge capacities.
    2.14 +  /// If the data is a shortest path problem then \c s will be the 
    2.15 +  /// source node and \capacity will contain the edge lengths.
    2.16    template<typename Graph, typename CapacityMap>
    2.17 -  void readDimacsMaxFlow(std::istream& is, Graph &G, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) {
    2.18 -    G.clear();
    2.19 +  void readDimacsMaxFlow(std::istream& is, Graph &g, typename Graph::Node &s, typename Graph::Node &t, CapacityMap& capacity) {
    2.20 +    g.clear();
    2.21      int cap;
    2.22      char d;
    2.23      std::string problem;
    2.24 @@ -29,7 +38,7 @@
    2.25  	is >> problem >> n >> m;
    2.26  	getline(is, str);
    2.27  	nodes.resize(n+1);
    2.28 -	for (int k=1; k<=n; ++k) nodes[k]=G.addNode();
    2.29 +	for (int k=1; k<=n; ++k) nodes[k]=g.addNode();
    2.30  	break;
    2.31        case 'n': //node definition
    2.32  	if (problem=="sp") { //shortest path problem
    2.33 @@ -47,7 +56,7 @@
    2.34        case 'a':
    2.35  	is >> i >> j >> cap;
    2.36  	getline(is, str);
    2.37 -	e=G.addEdge(nodes[i], nodes[j]);
    2.38 +	e=g.addEdge(nodes[i], nodes[j]);
    2.39  	capacity.update();
    2.40  	capacity.set(e, cap);
    2.41  	break;