Changeset 944:4f064aff855e in lemon-0.x for src/work/marci/bfs_mm_test.cc
- Timestamp:
- 10/16/04 02:20:13 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1293
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/bfs_mm_test.cc
r921 r944 15 15 */ 16 16 17 #include "test_tools.h"17 #include <test/test_tools.h> 18 18 #include <lemon/smart_graph.h> 19 #include < lemon/bfs.h>20 #include <lemon/skeletons/graph.h>19 #include <bfs_mm.h> 20 #include <lemon/skeletons/graph.h> 21 21 22 22 using namespace lemon; … … 34 34 typedef Graph::NodeIt NodeIt; 35 35 36 typedef Bfs<Graph> BType;36 typedef marci::Bfs<Graph> BType; 37 37 38 38 Graph G; … … 44 44 BType::PredMap p(G); 45 45 BType::PredNodeMap pn(G); 46 47 BType bfs_test(G); 46 47 Graph::NodeMap<bool> reached(G); 48 Graph::NodeMap<Edge> pred(G); 49 Graph::NodeMap<Node> pred_node(G); 50 Graph::NodeMap<int> dist(G); 51 BType bfs_test(G, reached, pred, pred_node, dist); 48 52 49 53 bfs_test.run(n); … … 77 81 t=ps.inner[0]; 78 82 79 Bfs<Graph> bfs_test(G); 83 Graph::NodeMap<bool> reached(G); 84 Graph::NodeMap<Edge> pred(G); 85 Graph::NodeMap<Node> pred_node(G); 86 Graph::NodeMap<int> dist(G); 87 marci::Bfs<Graph> bfs_test(G, reached, pred, pred_node, dist); 80 88 bfs_test.run(s); 81 89 82 check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t));90 // check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t)); 83 91 84 92 85 for(EdgeIt e(G); e==INVALID; ++e) {86 Node u=G.tail(e);87 Node v=G.head(e);88 check( !bfs_test.reached(u) ||89 (bfs_test.dist(v) > bfs_test.dist(u)+1),90 "Wrong output.");91 }93 // for(EdgeIt e(G); e==INVALID; ++e) { 94 // Node u=G.tail(e); 95 // Node v=G.head(e); 96 // check( !bfs_test.reached(u) || 97 // (bfs_test.dist(v) > bfs_test.dist(u)+1), 98 // "Wrong output."); 99 // } 92 100 93 for(NodeIt v(G); v==INVALID; ++v) {94 check(bfs_test.reached(v),"Each node should be reached.");95 if ( bfs_test.pred(v)!=INVALID ) {96 Edge e=bfs_test.pred(v);97 Node u=G.tail(e);98 check(u==bfs_test.predNode(v),"Wrong tree.");99 check(bfs_test.dist(v) - bfs_test.dist(u) == 1,100 "Wrong distance. Difference: "101 << std::abs(bfs_test.dist(v) - bfs_test.dist(u)102 - 1));103 }104 }101 // for(NodeIt v(G); v==INVALID; ++v) { 102 // check(bfs_test.reached(v),"Each node should be reached."); 103 // if ( bfs_test.pred(v)!=INVALID ) { 104 // Edge e=bfs_test.pred(v); 105 // Node u=G.tail(e); 106 // check(u==bfs_test.predNode(v),"Wrong tree."); 107 // check(bfs_test.dist(v) - bfs_test.dist(u) == 1, 108 // "Wrong distance. Difference: " 109 // << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 110 // - 1)); 111 // } 112 // } 105 113 } 106 114
Note: See TracChangeset
for help on using the changeset viewer.