test/dijkstra_test.cc
changeset 1810 474d093466a5
parent 1435 8e85e6bbefdf
child 1875 98698b69a902
equal deleted inserted replaced
0:c34989b0e729 1:602cb45ff7db
    52   DType dijkstra_test(G,cap);
    52   DType dijkstra_test(G,cap);
    53 
    53 
    54   dijkstra_test.run(n);
    54   dijkstra_test.run(n);
    55 
    55 
    56   l  = dijkstra_test.dist(n);
    56   l  = dijkstra_test.dist(n);
    57   e  = dijkstra_test.pred(n);
    57   e  = dijkstra_test.predEdge(n);
    58   n  = dijkstra_test.predNode(n);
    58   n  = dijkstra_test.predNode(n);
    59   d  = dijkstra_test.distMap();
    59   d  = dijkstra_test.distMap();
    60   p  = dijkstra_test.predMap();
    60   p  = dijkstra_test.predMap();
    61   //  pn = dijkstra_test.predNodeMap();
    61   //  pn = dijkstra_test.predNodeMap();
    62   b  = dijkstra_test.reached(n);
    62   b  = dijkstra_test.reached(n);
   133   }
   133   }
   134 
   134 
   135   ///\bug This works only for integer lengths
   135   ///\bug This works only for integer lengths
   136   for(NodeIt v(G); v!=INVALID; ++v){
   136   for(NodeIt v(G); v!=INVALID; ++v){
   137     check(dijkstra_test.reached(v),"Each node should be reached.");
   137     check(dijkstra_test.reached(v),"Each node should be reached.");
   138     if ( dijkstra_test.pred(v)!=INVALID ) {
   138     if ( dijkstra_test.predEdge(v)!=INVALID ) {
   139       Edge e=dijkstra_test.pred(v);
   139       Edge e=dijkstra_test.predEdge(v);
   140       Node u=G.source(e);
   140       Node u=G.source(e);
   141       check(u==dijkstra_test.predNode(v),"Wrong tree.");
   141       check(u==dijkstra_test.predNode(v),"Wrong tree.");
   142       check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == cap[e],
   142       check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == cap[e],
   143 	    "Wrong distance! Difference: " 
   143 	    "Wrong distance! Difference: " 
   144 	    << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) 
   144 	    << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u)