Changes in doc. (New module name for array/vector maps added.)
1 #include "test_tools.h"
2 #include <hugo/smart_graph.h>
10 void check_Bfs_SmartGraph_Compile()
13 typedef SmartGraph Graph;
15 typedef Graph::Edge Edge;
16 typedef Graph::Node Node;
17 typedef Graph::EdgeIt EdgeIt;
18 typedef Graph::NodeIt NodeIt;
19 typedef Graph::EdgeMap<VType> LengthMap;
21 typedef Bfs<Graph> BType;
30 BType::PredNodeMap pn(G);
39 n = bfs_test.predNode(n);
40 d = bfs_test.distMap();
41 p = bfs_test.predMap();
42 pn = bfs_test.predNodeMap();
43 b = bfs_test.reached(n);
50 typedef SmartGraph Graph;
52 typedef Graph::Edge Edge;
53 typedef Graph::Node Node;
54 typedef Graph::EdgeIt EdgeIt;
55 typedef Graph::NodeIt NodeIt;
56 typedef Graph::EdgeMap<int> LengthMap;
60 PetStruct<Graph> ps = addPetersen(G,PET_SIZE);
65 Bfs<Graph> bfs_test(G);
68 check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t));
71 for(EdgeIt e(G); e==INVALID; ++e) {
74 check( !bfs_test.reached(u) ||
75 (bfs_test.dist(v) > bfs_test.dist(u)+1),
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 Edge e=bfs_test.pred(v);
84 check(u==bfs_test.predNode(v),"Wrong tree.");
85 check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
86 "Wrong distance. Difference: "
87 << std::abs(bfs_test.dist(v) - bfs_test.dist(u)