Ticket #7728: patchfile.patch

File patchfile.patch, 2.4 KB (added by Alex Fix <afix@…>, 10 years ago)
  • boykov_kolmogorov_max_flow.hpp

     
    442442              for(boost::tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){
    443443                edge_descriptor in_edge = get(m_rev_edge_map, *ei);
    444444                vertex_descriptor other_node = source(in_edge, m_g);
    445                 if(get_tree(other_node) == tColorTraits::black() && has_parent(other_node)){
     445                if(get_tree(other_node) == tColorTraits::black() && other_node != m_source){
    446446                  if(get(m_res_cap_map, in_edge) > 0){
    447447                    add_active_node(other_node);
    448448                  }
    449                   if(source(get_edge_to_parent(other_node), m_g) == current_node){
     449                  if(has_parent(other_node) && source(get_edge_to_parent(other_node), m_g) == current_node){
    450450                    //we are the parent of that node
    451451                    //it has to find a new parent, too
    452452                    set_no_parent(other_node);
     
    483483              for(boost::tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){
    484484                const edge_descriptor out_edge = *ei;
    485485                const vertex_descriptor other_node = target(out_edge, m_g);
    486                 if(get_tree(other_node) == tColorTraits::white() && has_parent(other_node)){
     486                if(get_tree(other_node) == tColorTraits::white() && other_node != m_sink){
    487487                  if(get(m_res_cap_map, out_edge) > 0){
    488488                    add_active_node(other_node);
    489489                  }
    490                   if(target(get_edge_to_parent(other_node), m_g) == current_node){
     490                  if(has_parent(other_node) && target(get_edge_to_parent(other_node), m_g) == current_node){
    491491                    //we were it's parent, so it has to find a new one, too
    492492                    set_no_parent(other_node);
    493493                    m_child_orphans.push(other_node);
     
    526526      inline void add_active_node(vertex_descriptor v){
    527527        BOOST_ASSERT(get_tree(v) != tColorTraits::gray());
    528528        if(get(m_in_active_list_map, v)){
     529          if (m_last_grow_vertex == v) {
     530              m_last_grow_vertex = graph_traits<Graph>::null_vertex();
     531          }
    529532          return;
    530533        } else{
    531534          put(m_in_active_list_map, v, true);