src/test/dijkstra_heap_test.cc
changeset 799 3393abe30678
parent 542 69bde1d90c04
child 833 512e5fd7d38b
equal deleted inserted replaced
4:edd8ad632b12 5:fd2ce66047de
    54   
    54   
    55   int error1=0;
    55   int error1=0;
    56   int error2=0;
    56   int error2=0;
    57 
    57 
    58   EdgeIt e;
    58   EdgeIt e;
    59   for(G.first(e); G.valid(e); G.next(e)) {
    59   for(G.first(e); e!=INVALID; ++e) {
    60     Node u=G.tail(e);
    60     Node u=G.tail(e);
    61     Node v=G.head(e);
    61     Node v=G.head(e);
    62     if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) > cap[e] )
    62     if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) > cap[e] )
    63       if ( dijkstra_test.reached(u) ) {
    63       if ( dijkstra_test.reached(u) ) {
    64 	std::cout<<"Error! dist(head)-dist(tail)- edge_length= " 
    64 	std::cout<<"Error! dist(head)-dist(tail)- edge_length= " 
    67 	++error1;
    67 	++error1;
    68       }
    68       }
    69   }
    69   }
    70 
    70 
    71   NodeIt v;
    71   NodeIt v;
    72   for(G.first(v); G.valid(v); G.next(v)) {
    72   for(G.first(v); v!=INVALID; ++v) {
    73     if ( dijkstra_test.reached(v) ) {
    73     if ( dijkstra_test.reached(v) ) {
    74       Edge e=dijkstra_test.pred(v);
    74       Edge e=dijkstra_test.pred(v);
    75       Node u=G.tail(e);
    75       Node u=G.tail(e);
    76       if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) != cap[e] ) {
    76       if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) != cap[e] ) {
    77 	std::cout<<"Error in a shortest path tree edge! Difference: " 
    77 	std::cout<<"Error in a shortest path tree edge! Difference: " 
   103   std::cout << "elapsed time: " << ts << std::endl;
   103   std::cout << "elapsed time: " << ts << std::endl;
   104   
   104   
   105   error1=0;
   105   error1=0;
   106   error2=0;
   106   error2=0;
   107 
   107 
   108   for(G.first(e); G.valid(e); G.next(e)) {
   108   for(G.first(e); e!=INVALID; ++e) {
   109     Node u=G.tail(e);
   109     Node u=G.tail(e);
   110     Node v=G.head(e);
   110     Node v=G.head(e);
   111     if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) > cap[e] )
   111     if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) > cap[e] )
   112       if ( dijkstra_test2.reached(u) ) {
   112       if ( dijkstra_test2.reached(u) ) {
   113 	std::cout<<"Error! dist(head)-dist(tail)- edge_length= " 
   113 	std::cout<<"Error! dist(head)-dist(tail)- edge_length= " 
   115 	  - cap[e]<<std::endl;
   115 	  - cap[e]<<std::endl;
   116 	++error1;
   116 	++error1;
   117       }
   117       }
   118   }
   118   }
   119 
   119 
   120   for(G.first(v); G.valid(v); G.next(v)) {
   120   for(G.first(v); v!=INVALID; ++v) {
   121     if ( dijkstra_test2.reached(v) ) {
   121     if ( dijkstra_test2.reached(v) ) {
   122       Edge e=dijkstra_test2.pred(v);
   122       Edge e=dijkstra_test2.pred(v);
   123       Node u=G.tail(e);
   123       Node u=G.tail(e);
   124       if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) != cap[e] ) {
   124       if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) != cap[e] ) {
   125 	std::cout<<"Error in a shortest path tree edge! Difference: " 
   125 	std::cout<<"Error in a shortest path tree edge! Difference: "