COIN-OR::LEMON - Graph Library

Changeset 949:b16a10926781 in lemon-0.x


Ignore:
Timestamp:
10/30/04 20:30:29 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1329
Message:

ListGraph? compilation bug fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/list_graph.h

    r948 r949  
    3939  class ListGraphBase {
    4040
     41  protected:
    4142    struct NodeT {
    4243      int first_in,first_out;
     
    101102
    102103   
    103     ///Using this it possible to avoid the superfluous memory allocation.
    104     ///\todo more docs...
    105     ///\todo It should be defined in ListGraph.
    106     void reserveEdge(int n) { edges.reserve(n); };
    107    
    108104    /// Maximum node ID.
    109105   
     
    276272      nodes.clear();
    277273      first_node = first_free_node = first_free_edge = -1;
     274    }
     275
     276  protected:
     277    void _moveHead(Edge e, Node n)
     278    {
     279      if(edges[e.id].next_in != -1)
     280        edges[edges[e.id].next_in].prev_in = edges[e.id].prev_in;
     281      if(edges[e.id].prev_in != -1)
     282        edges[edges[e.id].prev_in].next_in = edges[e.id].next_in;
     283      else nodes[edges[e.id].head].first_in = edges[e.id].next_in;
     284      edges[e.id].head = n.id;
     285      edges[e.id].prev_in = -1;
     286      edges[e.id].next_in = nodes[n.id].first_in;
     287      nodes[n.id].first_in = e.id;
     288    }
     289    void _moveTail(Edge e, Node n)
     290    {
     291      if(edges[e.id].next_out != -1)
     292        edges[edges[e.id].next_out].prev_out = edges[e.id].prev_out;
     293      if(edges[e.id].prev_out != -1)
     294        edges[edges[e.id].prev_out].next_out = edges[e.id].next_out;
     295      else nodes[edges[e.id].tail].first_out = edges[e.id].next_out;
     296      edges[e.id].tail = n.id;
     297      edges[e.id].prev_out = -1;
     298      edges[e.id].next_out = nodes[n.id].first_out;
     299      nodes[n.id].first_out = e.id;
    278300    }
    279301
     
    306328    /// Moves the head of \c e to \c n
    307329    ///
    308     void moveHead(Edge e, Node n)
    309     {
    310       if(edges[e.n].next_in != -1)
    311         edges[edges[e.n].next_in].prev_in = edges[e.n].prev_in;
    312       if(edges[e.n].prev_in != -1)
    313         edges[edges[e.n].prev_in].next_in = edges[e.n].next_in;
    314       else nodes[edges[e.n].head].first_in = edges[e.n].next_in;
    315       edges[e.n].head = n.n;
    316       edges[e.n].prev_in = -1;
    317       edges[e.n].next_in = nodes[n.n].first_in;
    318       nodes[n.n].first_in = e.n;
    319     }
     330    void moveHead(Edge e, Node n) { _moveHead(e,n); }
    320331    /// Moves the tail of \c e to \c n
    321332
    322333    /// Moves the tail of \c e to \c n
    323334    ///
    324     void moveTail(Edge e, Node n)
    325     {
    326       if(edges[e.n].next_out != -1)
    327         edges[edges[e.n].next_out].prev_out = edges[e.n].prev_out;
    328       if(edges[e.n].prev_out != -1)
    329         edges[edges[e.n].prev_out].next_out = edges[e.n].next_out;
    330       else nodes[edges[e.n].tail].first_out = edges[e.n].next_out;
    331       edges[e.n].tail = n.n;
    332       edges[e.n].prev_out = -1;
    333       edges[e.n].next_out = nodes[n.n].first_out;
    334       nodes[n.n].first_out = e.n;
    335     }
    336   }
     335    void moveTail(Edge e, Node n) { _moveTail(e,n); }
     336
     337    ///Using this it possible to avoid the superfluous memory allocation.
     338    ///\todo more docs...
     339    void reserveEdge(int n) { edges.reserve(n); };
     340   
     341  };
     342 
    337343  /// @} 
    338344} //namespace lemon
Note: See TracChangeset for help on using the changeset viewer.