... | ... |
@@ -271,65 +271,70 @@ |
271 | 271 |
bool _local_heap; |
272 | 272 |
|
273 | 273 |
typedef typename Graph::template NodeMap<typename Graph::Node> NodeList; |
274 | 274 |
NodeList *_next_rep; |
275 | 275 |
|
276 | 276 |
typedef typename Graph::template NodeMap<bool> MinCutMap; |
277 | 277 |
MinCutMap *_cut_map; |
278 | 278 |
|
279 | 279 |
void createStructures() { |
280 | 280 |
if (!_nodes) { |
281 | 281 |
_nodes = new (typename Graph::template NodeMap<NodeData>)(_graph); |
282 | 282 |
} |
283 | 283 |
if (!_capacity) { |
284 | 284 |
_local_capacity = true; |
285 | 285 |
_capacity = Traits::createCapacityMap(_graph); |
286 | 286 |
} |
287 | 287 |
if (!_heap_cross_ref) { |
288 | 288 |
_local_heap_cross_ref = true; |
289 | 289 |
_heap_cross_ref = Traits::createHeapCrossRef(_graph); |
290 | 290 |
} |
291 | 291 |
if (!_heap) { |
292 | 292 |
_local_heap = true; |
293 | 293 |
_heap = Traits::createHeap(*_heap_cross_ref); |
294 | 294 |
} |
295 | 295 |
if (!_next_rep) { |
296 | 296 |
_next_rep = new NodeList(_graph); |
297 | 297 |
} |
298 | 298 |
if (!_cut_map) { |
299 | 299 |
_cut_map = new MinCutMap(_graph); |
300 | 300 |
} |
301 | 301 |
} |
302 | 302 |
|
303 |
|
|
303 |
protected: |
|
304 |
//This is here to avoid a gcc-3.3 compilation error. |
|
305 |
//It should never be called. |
|
306 |
NagamochiIbaraki() {} |
|
307 |
|
|
308 |
public: |
|
304 | 309 |
|
305 | 310 |
typedef NagamochiIbaraki Create; |
306 | 311 |
|
307 | 312 |
|
308 | 313 |
/// \brief Constructor. |
309 | 314 |
/// |
310 | 315 |
/// \param graph The graph the algorithm runs on. |
311 | 316 |
/// \param capacity The capacity map used by the algorithm. |
312 | 317 |
NagamochiIbaraki(const Graph& graph, const CapacityMap& capacity) |
313 | 318 |
: _graph(graph), _capacity(&capacity), _local_capacity(false), |
314 | 319 |
_nodes(0), _arcs(), _edges(), _min_cut(), |
315 | 320 |
_heap_cross_ref(0), _local_heap_cross_ref(false), |
316 | 321 |
_heap(0), _local_heap(false), |
317 | 322 |
_next_rep(0), _cut_map(0) {} |
318 | 323 |
|
319 | 324 |
/// \brief Constructor. |
320 | 325 |
/// |
321 | 326 |
/// This constructor can be used only when the Traits class |
322 | 327 |
/// defines how can the local capacity map be instantiated. |
323 | 328 |
/// If the SetUnitCapacity used the algorithm automatically |
324 | 329 |
/// constructs the capacity map. |
325 | 330 |
/// |
326 | 331 |
///\param graph The graph the algorithm runs on. |
327 | 332 |
NagamochiIbaraki(const Graph& graph) |
328 | 333 |
: _graph(graph), _capacity(0), _local_capacity(false), |
329 | 334 |
_nodes(0), _arcs(), _edges(), _min_cut(), |
330 | 335 |
_heap_cross_ref(0), _local_heap_cross_ref(false), |
331 | 336 |
_heap(0), _local_heap(false), |
332 | 337 |
_next_rep(0), _cut_map(0) {} |
333 | 338 |
|
334 | 339 |
/// \brief Destructor. |
335 | 340 |
/// |
0 comments (0 inline)