src/test/dijkstra_heap_test.cc
changeset 1150 c20bcf71efe3
parent 986 e997802b855c
child 1164 80bb73097736
equal deleted inserted replaced
9:ac6275607b61 10:f4a6f022d566
    69   std::cout << "elapsed time: " << ts << std::endl;
    69   std::cout << "elapsed time: " << ts << std::endl;
    70   
    70   
    71   int error1=0;
    71   int error1=0;
    72   int error2=0;
    72   int error2=0;
    73 
    73 
    74   EdgeIt e;
    74   for(EdgeIt e(G); e!=INVALID; ++e) {
    75   for(G.first(e); e!=INVALID; ++e) {
       
    76     Node u=G.source(e);
    75     Node u=G.source(e);
    77     Node v=G.target(e);
    76     Node v=G.target(e);
    78     if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) > cap[e] )
    77     if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) > cap[e] )
    79       if ( dijkstra_test.reached(u) ) {
    78       if ( dijkstra_test.reached(u) ) {
    80 	std::cout<<"Error! dist(target)-dist(source)- edge_length= " 
    79 	std::cout<<"Error! dist(target)-dist(source)- edge_length= " 
    83 	++error1;
    82 	++error1;
    84       }
    83       }
    85   }
    84   }
    86 
    85 
    87   NodeIt v;
    86   NodeIt v;
    88   for(G.first(v); v!=INVALID; ++v) {
    87   for(NodeIt v(G); v!=INVALID; ++v) {
    89     if ( dijkstra_test.reached(v) ) {
    88     if ( dijkstra_test.reached(v) ) {
    90       Edge e=dijkstra_test.pred(v);
    89       Edge e=dijkstra_test.pred(v);
    91       Node u=G.source(e);
    90       Node u=G.source(e);
    92       if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) != cap[e] ) {
    91       if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) != cap[e] ) {
    93 	std::cout<<"Error in a shortest path tree edge! Difference: " 
    92 	std::cout<<"Error in a shortest path tree edge! Difference: " 
   119   std::cout << "elapsed time: " << ts << std::endl;
   118   std::cout << "elapsed time: " << ts << std::endl;
   120   
   119   
   121   error1=0;
   120   error1=0;
   122   error2=0;
   121   error2=0;
   123 
   122 
   124   for(G.first(e); e!=INVALID; ++e) {
   123   for(EdgeIt e(G); e!=INVALID; ++e) {
   125     Node u=G.source(e);
   124     Node u=G.source(e);
   126     Node v=G.target(e);
   125     Node v=G.target(e);
   127     if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) > cap[e] )
   126     if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) > cap[e] )
   128       if ( dijkstra_test2.reached(u) ) {
   127       if ( dijkstra_test2.reached(u) ) {
   129 	std::cout<<"Error! dist(target)-dist(source)- edge_length= " 
   128 	std::cout<<"Error! dist(target)-dist(source)- edge_length= " 
   131 	  - cap[e]<<std::endl;
   130 	  - cap[e]<<std::endl;
   132 	++error1;
   131 	++error1;
   133       }
   132       }
   134   }
   133   }
   135 
   134 
   136   for(G.first(v); v!=INVALID; ++v) {
   135   for(NodeIt n(G); v!=INVALID; ++v) {
   137     if ( dijkstra_test2.reached(v) ) {
   136     if ( dijkstra_test2.reached(v) ) {
   138       Edge e=dijkstra_test2.pred(v);
   137       Edge e=dijkstra_test2.pred(v);
   139       Node u=G.source(e);
   138       Node u=G.source(e);
   140       if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) != cap[e] ) {
   139       if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) != cap[e] ) {
   141 	std::cout<<"Error in a shortest path tree edge! Difference: " 
   140 	std::cout<<"Error in a shortest path tree edge! Difference: "