# HG changeset patch # User marci # Date 1082998694 0 # Node ID 54b9430639018f64a5d1144a719dc88c2624de03 # Parent a713f8a69cc343b223efe8f680bb9bf779999fa9 For working with undirected graphs, head is changed to aNode. Some dimacs doki. diff -r a713f8a69cc3 -r 54b943063901 src/include/dijkstra.h --- a/src/include/dijkstra.h Mon Apr 26 16:21:36 2004 +0000 +++ b/src/include/dijkstra.h Mon Apr 26 16:58:14 2004 +0000 @@ -167,7 +167,7 @@ OutEdgeIt e; for(G.first(e, v); G.valid(e); G.next(e)) { - Node w=G.head(e); + Node w=G.bNode(e); switch(heap.state(w)) { case heap.PRE_HEAP: 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;