The source node is reported to be reaches but it has no previous node/edge.
authoralpar
Fri, 04 Mar 2005 23:12:10 +0000
changeset 11954d07dd56fa9a
parent 1194 7bce0ef61d6b
child 1196 4bebc22ab77c
The source node is reported to be reaches but it has no previous node/edge.
src/test/dijkstra_heap_test.cc
     1.1 --- a/src/test/dijkstra_heap_test.cc	Fri Mar 04 17:20:11 2005 +0000
     1.2 +++ b/src/test/dijkstra_heap_test.cc	Fri Mar 04 23:12:10 2005 +0000
     1.3 @@ -119,16 +119,18 @@
     1.4    for(NodeIt v(graph); v!=INVALID; ++v) {
     1.5      if ( dijkstra_test.reached(v) ) {
     1.6        Edge e=dijkstra_test.pred(v);
     1.7 -      Node u=graph.source(e);
     1.8 -      if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) != cap[e] ) {
     1.9 -	std::cout<<"Error in a shortest path tree edge! Difference: " 
    1.10 -		 <<std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) 
    1.11 -			    - cap[e])<<std::endl;
    1.12 -	++error2;
    1.13 +      if(e!=INVALID) {
    1.14 +	Node u=graph.source(e);
    1.15 +	if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) != cap[e] ) {
    1.16 +	  std::cout<<"Error in a shortest path tree edge! Difference: " 
    1.17 +		   <<std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) 
    1.18 +			      - cap[e])<<std::endl;
    1.19 +	  ++error2;
    1.20 +	}
    1.21        }
    1.22      }
    1.23    }
    1.24 -
    1.25 +  
    1.26  
    1.27    
    1.28    std::cout << error1 << " non-tree and " << error2 
    1.29 @@ -168,16 +170,18 @@
    1.30    for(NodeIt n(graph); v!=INVALID; ++v) {
    1.31      if ( dijkstra_test2.reached(v) ) {
    1.32        Edge e=dijkstra_test2.pred(v);
    1.33 -      Node u=graph.source(e);
    1.34 -      if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) != cap[e] ) {
    1.35 -	std::cout<<"Error in a shortest path tree edge! Difference: " 
    1.36 -		 <<std::abs(dijkstra_test2.dist(v) - dijkstra_test2.dist(u) 
    1.37 -			    - cap[e])<<std::endl;
    1.38 -	++error2;
    1.39 +      if(e!=INVALID) {
    1.40 +	Node u=graph.source(e);
    1.41 +	if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) != cap[e] ) {
    1.42 +	  std::cout<<"Error in a shortest path tree edge! Difference: " 
    1.43 +		   <<std::abs(dijkstra_test2.dist(v) - dijkstra_test2.dist(u) 
    1.44 +			      - cap[e])<<std::endl;
    1.45 +	  ++error2;
    1.46 +	}
    1.47        }
    1.48      }
    1.49    }
    1.50 -
    1.51 +  
    1.52  
    1.53    std::cout << error1 << " non-tree and " << error2 
    1.54  	    << " shortest path tree edge is erroneous."<<std::endl;
    1.55 @@ -215,16 +219,18 @@
    1.56    for(NodeIt n(graph); v!=INVALID; ++v) {
    1.57      if ( dijkstra_test3.reached(v) ) {
    1.58        Edge e=dijkstra_test3.pred(v);
    1.59 -      Node u=graph.source(e);
    1.60 -      if ( dijkstra_test3.dist(v) - dijkstra_test3.dist(u) != cap[e] ) {
    1.61 -	std::cout<<"Error in a shortest path tree edge! Difference: " 
    1.62 -		 <<std::abs(dijkstra_test3.dist(v) - dijkstra_test3.dist(u) 
    1.63 -			    - cap[e])<<std::endl;
    1.64 -	++error2;
    1.65 +      if(e!=INVALID) {
    1.66 +	Node u=graph.source(e);
    1.67 +	if ( dijkstra_test3.dist(v) - dijkstra_test3.dist(u) != cap[e] ) {
    1.68 +	  std::cout<<"Error in a shortest path tree edge! Difference: " 
    1.69 +		   <<std::abs(dijkstra_test3.dist(v) - dijkstra_test3.dist(u) 
    1.70 +			      - cap[e])<<std::endl;
    1.71 +	  ++error2;
    1.72 +	}
    1.73        }
    1.74      }
    1.75    }
    1.76 -
    1.77 +  
    1.78  
    1.79    std::cout << error1 << " non-tree and " << error2 
    1.80  	    << " shortest path tree edge is erroneous."<<std::endl;