1 #include "test_tools.h"
2 #include <hugo/smart_graph.h>
4 #include<hugo/skeletons/graph.h>
11 void check_Bfs_Compile()
13 typedef skeleton::StaticGraphSkeleton Graph;
15 typedef Graph::Edge Edge;
16 typedef Graph::Node Node;
17 typedef Graph::EdgeIt EdgeIt;
18 typedef Graph::NodeIt NodeIt;
20 typedef Bfs<Graph> BType;
29 BType::PredNodeMap pn(G);
37 n = bfs_test.predNode(n);
38 d = bfs_test.distMap();
39 p = bfs_test.predMap();
40 pn = bfs_test.predNodeMap();
41 b = bfs_test.reached(n);
48 typedef SmartGraph Graph;
50 typedef Graph::Edge Edge;
51 typedef Graph::Node Node;
52 typedef Graph::EdgeIt EdgeIt;
53 typedef Graph::NodeIt NodeIt;
54 typedef Graph::EdgeMap<int> LengthMap;
58 PetStruct<Graph> ps = addPetersen(G,PET_SIZE);
63 Bfs<Graph> bfs_test(G);
66 check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t));
69 for(EdgeIt e(G); e==INVALID; ++e) {
72 check( !bfs_test.reached(u) ||
73 (bfs_test.dist(v) > bfs_test.dist(u)+1),
77 for(NodeIt v(G); v==INVALID; ++v) {
78 check(bfs_test.reached(v),"Each node should be reached.");
79 if ( bfs_test.pred(v)!=INVALID ) {
80 Edge e=bfs_test.pred(v);
82 check(u==bfs_test.predNode(v),"Wrong tree.");
83 check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
84 "Wrong distance. Difference: "
85 << std::abs(bfs_test.dist(v) - bfs_test.dist(u)