Changeset 877:141f9c0db4a3 in lemon-main for test/bellman_ford_test.cc
- Timestamp:
- 03/06/10 15:35:12 (14 years ago)
- Branch:
- default
- Children:
- 879:38213abd2911, 931:f112c18bc304
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/bellman_ford_test.cc
r844 r877 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 98 98 pp = const_bf_test.path(t); 99 99 pp = const_bf_test.negativeCycle(); 100 100 101 101 for (BF::ActiveIt it(const_bf_test); it != INVALID; ++it) {} 102 102 } … … 111 111 concepts::ReadWriteMap<Node,Arc> pred_map; 112 112 concepts::ReadWriteMap<Node,Value> dist_map; 113 113 114 114 bf_test 115 115 .lengthMap(length_map) … … 190 190 check(pathSource(gr, p) == s, "path() found a wrong path."); 191 191 check(pathTarget(gr, p) == t, "path() found a wrong path."); 192 192 193 193 ListPath<Digraph> path; 194 194 Value dist; … … 229 229 SmartDigraph gr; 230 230 IntArcMap length(gr); 231 231 232 232 Node n1 = gr.addNode(); 233 233 Node n2 = gr.addNode(); 234 234 Node n3 = gr.addNode(); 235 235 Node n4 = gr.addNode(); 236 236 237 237 Arc a1 = gr.addArc(n1, n2); 238 238 Arc a2 = gr.addArc(n2, n2); 239 239 240 240 length[a1] = 2; 241 241 length[a2] = -1; 242 242 243 243 { 244 244 BellmanFord<SmartDigraph, IntArcMap> bf(gr, length); … … 248 248 "Wrong negative cycle."); 249 249 } 250 250 251 251 length[a2] = 0; 252 252 253 253 { 254 254 BellmanFord<SmartDigraph, IntArcMap> bf(gr, length); … … 257 257 "Negative cycle should not be found."); 258 258 } 259 259 260 260 length[gr.addArc(n1, n3)] = 5; 261 261 length[gr.addArc(n4, n3)] = 1; 262 262 length[gr.addArc(n2, n4)] = 2; 263 263 length[gr.addArc(n3, n2)] = -4; 264 264 265 265 { 266 266 BellmanFord<SmartDigraph, IntArcMap> bf(gr, length);
Note: See TracChangeset
for help on using the changeset viewer.