Changeset 1270:dceba191c00d in lemon for lemon/nagamochi_ibaraki.h
 Timestamp:
 08/09/13 11:28:17 (6 years ago)
 Branch:
 default
 Children:
 1271:fb1c7da561ce, 1381:e0ccc1f0268f
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/nagamochi_ibaraki.h
r1130 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003201 05 * Copyright (C) 20032013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 304 304 //This is here to avoid a gcc3.3 compilation error. 305 305 //It should never be called. 306 NagamochiIbaraki() {} 307 306 NagamochiIbaraki() {} 307 308 308 public: 309 309 … … 415 415 for (typename Graph::OutArcIt a(_graph, n); a != INVALID; ++a) { 416 416 typename Graph::Node m = _graph.target(a); 417 417 418 418 if (!(n < m)) continue; 419 419 420 420 (*_nodes)[n].sum += (*_capacity)[a]; 421 421 (*_nodes)[m].sum += (*_capacity)[a]; 422 422 423 423 int c = (*_nodes)[m].curr_arc; 424 424 if (c != 1 && _arcs[c ^ 1].target == n) { … … 426 426 } else { 427 427 _edges[index].capacity = (*_capacity)[a]; 428 428 429 429 _arcs[index << 1].prev = 1; 430 430 if ((*_nodes)[n].first_arc != 1) { … … 436 436 437 437 (*_nodes)[m].curr_arc = (index << 1); 438 438 439 439 _arcs[(index << 1)  1].prev = 1; 440 440 if ((*_nodes)[m].first_arc != 1) { … … 444 444 (*_nodes)[m].first_arc = ((index << 1)  1); 445 445 _arcs[(index << 1)  1].target = n; 446 446 447 447 ++index; 448 448 } … … 453 453 _min_cut = std::numeric_limits<Value>::max(); 454 454 455 for (typename Graph::Node n = _first_node; 455 for (typename Graph::Node n = _first_node; 456 456 n != INVALID; n = (*_nodes)[n].next) { 457 457 if ((*_nodes)[n].sum < _min_cut) { … … 478 478 479 479 _heap>clear(); 480 for (typename Graph::Node n = _first_node; 480 for (typename Graph::Node n = _first_node; 481 481 n != INVALID; n = (*_nodes)[n].next) { 482 482 (*_heap_cross_ref)[n] = Heap::PRE_HEAP; … … 498 498 for (int a = (*_nodes)[n].first_arc; a != 1; a = _arcs[a].next) { 499 499 switch (_heap>state(_arcs[a].target)) { 500 case Heap::PRE_HEAP: 500 case Heap::PRE_HEAP: 501 501 { 502 502 Value nv = _edges[a >> 1].capacity; … … 564 564 if (!merged) { 565 565 for (int b = (*_nodes)[n].first_arc; b != 1; b = _arcs[b].next) { 566 (*_nodes)[_arcs[b].target].curr_arc = b; 566 (*_nodes)[_arcs[b].target].curr_arc = b; 567 567 } 568 568 merged = true; … … 574 574 if ((b ^ a) == 1) continue; 575 575 typename Graph::Node o = _arcs[b].target; 576 int c = (*_nodes)[o].curr_arc; 576 int c = (*_nodes)[o].curr_arc; 577 577 if (c != 1 && _arcs[c ^ 1].target == n) { 578 578 _edges[c >> 1].capacity += _edges[b >> 1].capacity; … … 607 607 } else { 608 608 (*_nodes)[n].first_arc = _arcs[a].next; 609 } 609 } 610 610 if (_arcs[a].next != 1) { 611 611 _arcs[_arcs[a].next].prev = _arcs[a].prev; … … 615 615 (*_next_rep)[(*_nodes)[n].last_rep] = m; 616 616 (*_nodes)[n].last_rep = (*_nodes)[m].last_rep; 617 617 618 618 if ((*_nodes)[m].prev != INVALID) { 619 619 (*_nodes)[(*_nodes)[m].prev].next = (*_nodes)[m].next;
Note: See TracChangeset
for help on using the changeset viewer.