Changeset 278:931190050520 in lemon for test/bfs_test.cc
- Timestamp:
- 09/22/08 15:33:23 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/bfs_test.cc
r228 r278 63 63 BType::DistMap d(G); 64 64 BType::PredMap p(G); 65 // BType::PredNodeMap pn(G);66 65 67 66 BType bfs_test(G); … … 73 72 n = bfs_test.predNode(n); 74 73 d = bfs_test.distMap(); 75 76 74 p = bfs_test.predMap(); 77 // pn = bfs_test.predNodeMap();78 75 b = bfs_test.reached(n); 79 76 … … 89 86 90 87 Digraph g; 91 bfs(g,Node()).run(); 92 bfs(g).source(Node()).run(); 88 bool b; 89 bfs(g).run(Node()); 90 b=bfs(g).run(Node(),Node()); 91 bfs(g).run(); 93 92 bfs(g) 94 .predMap(concepts:: WriteMap<Node,Arc>())95 .distMap(concepts:: WriteMap<Node,VType>())93 .predMap(concepts::ReadWriteMap<Node,Arc>()) 94 .distMap(concepts::ReadWriteMap<Node,VType>()) 96 95 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 97 96 .processedMap(concepts::WriteMap<Node,bool>()) 98 97 .run(Node()); 98 b=bfs(g) 99 .predMap(concepts::ReadWriteMap<Node,Arc>()) 100 .distMap(concepts::ReadWriteMap<Node,VType>()) 101 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 102 .processedMap(concepts::WriteMap<Node,bool>()) 103 .path(concepts::Path<Digraph>()) 104 .dist(VType()) 105 .run(Node(),Node()); 106 bfs(g) 107 .predMap(concepts::ReadWriteMap<Node,Arc>()) 108 .distMap(concepts::ReadWriteMap<Node,VType>()) 109 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 110 .processedMap(concepts::WriteMap<Node,bool>()) 111 .run(); 99 112 } 100 113 … … 115 128 bfs_test.run(s); 116 129 117 check(bfs_test.dist(t)==2,"Bfs found a wrong path." << bfs_test.dist(t));130 check(bfs_test.dist(t)==2,"Bfs found a wrong path."); 118 131 119 132 Path<Digraph> p = bfs_test.path(t); … … 129 142 check( !bfs_test.reached(u) || 130 143 (bfs_test.dist(v) <= bfs_test.dist(u)+1), 131 "Wrong output. " << G.id(v) << ' ' << G.id(u));144 "Wrong output. " << G.id(u) << "->" << G.id(v)); 132 145 } 133 146 … … 141 154 check(bfs_test.dist(v) - bfs_test.dist(u) == 1, 142 155 "Wrong distance. Difference: " 143 << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 144 - 1)); 156 << std::abs(bfs_test.dist(v) - bfs_test.dist(u) - 1)); 145 157 } 146 158 } 159 } 160 161 { 162 NullMap<Node,Arc> myPredMap; 163 bfs(G).predMap(myPredMap).run(s); 147 164 } 148 165 }
Note: See TracChangeset
for help on using the changeset viewer.