diff --git a/lemon/bellman_ford.h b/lemon/bellman_ford.h --- a/lemon/bellman_ford.h +++ b/lemon/bellman_ford.h @@ -237,7 +237,9 @@ _local_dist = true; _dist = Traits::createDistMap(*_gr); } - _mask = new MaskMap(*_gr, false); + if(!_mask) { + _mask = new MaskMap(*_gr); + } } public : @@ -404,6 +406,10 @@ _process.push_back(it); _mask->set(it, true); } + } else { + for (NodeIt it(*_gr); it != INVALID; ++it) { + _mask->set(it, false); + } } }