diff -r 72143568cadc -r 325c9430723e src/work/athos/minlengthpaths.h --- a/src/work/athos/minlengthpaths.h Mon May 03 10:04:27 2004 +0000 +++ b/src/work/athos/minlengthpaths.h Mon May 03 10:27:20 2004 +0000 @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace hugo { @@ -31,20 +31,19 @@ class MinLengthPaths { typedef typename LengthMap::ValueType Length; - + typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Edge Edge; typedef typename Graph::OutEdgeIt OutEdgeIt; - typedef typename Graph::EdgeMap EdgeIntMap; + typedef typename Graph::template EdgeMap EdgeIntMap; typedef ConstMap ConstMap; typedef ResGraphWrapper ResGraphType; - class ModLengthMap { - typedef typename ResGraphType::NodeMap NodeMap; + typedef typename ResGraphType::template NodeMap NodeMap; const ResGraphType& G; const EdgeIntMap& rev; const LengthMap &ol; @@ -52,18 +51,20 @@ public : typedef typename LengthMap::KeyType KeyType; typedef typename LengthMap::ValueType ValueType; - + ValueType operator[](typename ResGraphType::Edge e) const { //if ( (1-2*rev[e])*ol[e]-(pot[G.head(e)]-pot[G.tail(e)] ) <0 ){ // std::cout<<"Negative length!!"< > paths; + //typedef DirPath DPath; + //DPath paths; + + + Length total_length; public : @@ -94,11 +100,12 @@ int run(Node s, Node t, int k) { ConstMap const1map(1); + //We need a residual graph, in which some of the edges are reversed ResGraphType res_graph(G, const1map, reversed); //Initialize the copy of the Dijkstra potential to zero - typename ResGraphType::NodeMap dijkstra_dist(res_graph); + typename ResGraphType::template NodeMap dijkstra_dist(res_graph); ModLengthMap mod_length(res_graph, reversed, length, dijkstra_dist); Dijkstra dijkstra(res_graph, mod_length); @@ -133,10 +140,14 @@ } //Let's find the paths - //We put the paths into vectors (just for now). In the meantime we lose - //the information stored in 'reversed' + //We put the paths into stl vectors (as an inner representation). + //In the meantime we lose the information stored in 'reversed'. //We suppose the lengths to be positive now. + + //Meanwhile we put the total length of the found paths + //in the member variable total_length paths.clear(); + total_length=0; paths.resize(k); for (int j=0; j + void getPath(DirPath& p, int j){ + p.clear(); + typename DirPath::Builder B(p); + for(typename std::vector::iterator i=paths[j].begin(); + i!=paths[j].end(); ++i ){ + B.pushBack(*j); + } + + B.commit(); + } }; //class MinLengthPaths