... | ... |
@@ -228,25 +228,27 @@ |
228 | 228 |
std::vector<Node> _process; |
229 | 229 |
|
230 | 230 |
// Creates the maps if necessary. |
231 | 231 |
void create_maps() { |
232 | 232 |
if(!_pred) { |
233 | 233 |
_local_pred = true; |
234 | 234 |
_pred = Traits::createPredMap(*_gr); |
235 | 235 |
} |
236 | 236 |
if(!_dist) { |
237 | 237 |
_local_dist = true; |
238 | 238 |
_dist = Traits::createDistMap(*_gr); |
239 | 239 |
} |
240 |
_mask |
|
240 |
if(!_mask) { |
|
241 |
_mask = new MaskMap(*_gr); |
|
242 |
} |
|
241 | 243 |
} |
242 | 244 |
|
243 | 245 |
public : |
244 | 246 |
|
245 | 247 |
typedef BellmanFord Create; |
246 | 248 |
|
247 | 249 |
/// \name Named Template Parameters |
248 | 250 |
|
249 | 251 |
///@{ |
250 | 252 |
|
251 | 253 |
template <class T> |
252 | 254 |
struct SetPredMapTraits : public Traits { |
... | ... |
@@ -395,24 +397,28 @@ |
395 | 397 |
void init(const Value value = OperationTraits::infinity()) { |
396 | 398 |
create_maps(); |
397 | 399 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
398 | 400 |
_pred->set(it, INVALID); |
399 | 401 |
_dist->set(it, value); |
400 | 402 |
} |
401 | 403 |
_process.clear(); |
402 | 404 |
if (OperationTraits::less(value, OperationTraits::infinity())) { |
403 | 405 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
404 | 406 |
_process.push_back(it); |
405 | 407 |
_mask->set(it, true); |
406 | 408 |
} |
409 |
} else { |
|
410 |
for (NodeIt it(*_gr); it != INVALID; ++it) { |
|
411 |
_mask->set(it, false); |
|
412 |
} |
|
407 | 413 |
} |
408 | 414 |
} |
409 | 415 |
|
410 | 416 |
/// \brief Adds a new source node. |
411 | 417 |
/// |
412 | 418 |
/// This function adds a new source node. The optional second parameter |
413 | 419 |
/// is the initial distance of the node. |
414 | 420 |
void addSource(Node source, Value dst = OperationTraits::zero()) { |
415 | 421 |
_dist->set(source, dst); |
416 | 422 |
if (!(*_mask)[source]) { |
417 | 423 |
_process.push_back(source); |
418 | 424 |
_mask->set(source, true); |
0 comments (0 inline)