[Lemon-commits] [lemon_svn] marci: r561 - in hugo/trunk/src: include work/marci
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:40:13 CET 2006
Author: marci
Date: Mon Apr 26 18:58:14 2004
New Revision: 561
Modified:
hugo/trunk/src/include/dijkstra.h
hugo/trunk/src/work/marci/dimacs.h
Log:
For working with undirected graphs, head is changed to aNode.
Some dimacs doki.
Modified: hugo/trunk/src/include/dijkstra.h
==============================================================================
--- hugo/trunk/src/include/dijkstra.h (original)
+++ hugo/trunk/src/include/dijkstra.h Mon Apr 26 18:58:14 2004
@@ -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:
Modified: hugo/trunk/src/work/marci/dimacs.h
==============================================================================
--- hugo/trunk/src/work/marci/dimacs.h (original)
+++ hugo/trunk/src/work/marci/dimacs.h Mon Apr 26 18:58:14 2004
@@ -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<typename Graph, typename CapacityMap>
- 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;
More information about the Lemon-commits
mailing list