Changeset 780:e06d0d16595f in lemon0.x
 Timestamp:
 09/01/04 17:08:41 (19 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1073
 Location:
 src
 Files:

 2 added
 5 edited
Legend:
 Unmodified
 Added
 Removed

src/hugo/bfs.h
r774 r780 281 281 ///\pre \ref run() must be called before using this function. 282 282 /// 283 bool reached(Node v) { return v==source  (*predecessor)[v] ==INVALID; }283 bool reached(Node v) { return v==source  (*predecessor)[v]!=INVALID; } 284 284 285 285 }; 
src/hugo/dijkstra.h
r776 r780 280 280 ///\ref predNode(Node v). \pre \ref run() must be called before using 281 281 ///this function. 282 ///\todo predEdge could be a better name. 282 283 Edge pred(Node v) const { return (*predecessor)[v]; } 283 284 … … 318 319 ///\pre \ref run() must be called before using this function. 319 320 /// 320 bool reached(Node v) { return v==source  (*predecessor)[v] ==INVALID; }321 bool reached(Node v) { return v==source  (*predecessor)[v]!=INVALID; } 321 322 322 323 }; 
src/test/Makefile.am
r774 r780 3 3 noinst_HEADERS = test_tools.h 4 4 5 check_PROGRAMS = graph_test dijkstra_test bfs_test time_measure_test \5 check_PROGRAMS = graph_test dijkstra_test bfs_test dfs_test time_measure_test \ 6 6 error_test xy_test \ 7 7 unionfind_test test_tools_pass test_tools_fail … … 13 13 dijkstra_test_SOURCES = dijkstra_test.cc 14 14 bfs_test_SOURCES = bfs_test.cc 15 dfs_test_SOURCES = dfs_test.cc 15 16 unionfind_test_SOURCES = unionfind_test.cc 16 17 time_measure_test_SOURCES = time_measure_test.cc 
src/test/bfs_test.cc
r774 r780 77 77 } 78 78 79 ///\bug This works only for integer lengths80 for(NodeIt v(G); v==INVALID; ++v)81 if ( bfs_test. reached(v)) {79 for(NodeIt v(G); v==INVALID; ++v) { 80 check(bfs_test.reached(v),"Each node should be reached."); 81 if ( bfs_test.pred(v)!=INVALID ) { 82 82 Edge e=bfs_test.pred(v); 83 83 Node u=G.tail(e); 84 check(u==bfs_test.predNode(v),"Wrong tree."); 84 85 check(bfs_test.dist(v)  bfs_test.dist(u) == 1, 85 " Bad shortest path tree edge!Difference: "86 "Wrong distance. Difference: " 86 87 << std::abs(bfs_test.dist(v)  bfs_test.dist(u) 87 88  1)); 88 89 } 90 } 89 91 } 92 
src/test/dijkstra_test.cc
r776 r780 87 87 88 88 ///\bug This works only for integer lengths 89 for(NodeIt v(G); v!=INVALID; ++v) 90 if ( dijkstra_test.reached(v) ) { 89 for(NodeIt v(G); v!=INVALID; ++v){ 90 check(dijkstra_test.reached(v),"Each node should be reached."); 91 if ( dijkstra_test.pred(v)!=INVALID ) { 91 92 Edge e=dijkstra_test.pred(v); 92 93 Node u=G.tail(e); 94 check(u==dijkstra_test.predNode(v),"Wrong tree."); 93 95 check(dijkstra_test.dist(v)  dijkstra_test.dist(u) == cap[e], 94 " Bad shortest path tree edge! Difference: "96 "Wrong distance! Difference: " 95 97 << std::abs(dijkstra_test.dist(v)  dijkstra_test.dist(u) 96 98  cap[e])); 97 99 } 100 } 98 101 } 102
Note: See TracChangeset
for help on using the changeset viewer.