COIN-OR::LEMON - Graph Library

Changeset 986:e997802b855c in lemon-0.x for src/lemon/list_graph.h


Ignore:
Timestamp:
11/13/04 13:53:28 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1376
Message:

Naming changes:

  • head -> target
  • tail -> source
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/list_graph.h

    r980 r986  
    4444 
    4545    struct EdgeT {
    46       int head, tail;
     46      int target, source;
    4747      int prev_in, prev_out;
    4848      int next_in, next_out;
     
    112112    int maxId(Edge = INVALID) const { return edges.size()-1; }
    113113
    114     Node tail(Edge e) const { return edges[e.id].tail; }
    115     Node head(Edge e) const { return edges[e.id].head; }
     114    Node source(Edge e) const { return edges[e.id].source; }
     115    Node target(Edge e) const { return edges[e.id].target; }
    116116
    117117
     
    138138      } else {
    139139        int n;
    140         for(n = nodes[edges[edge.id].head].next;
     140        for(n = nodes[edges[edge.id].target].next;
    141141          n!=-1 && nodes[n].first_in == -1;
    142142          n = nodes[n].next);
     
    199199      }
    200200     
    201       edges[n].tail = u.id;
    202       edges[n].head = v.id;
     201      edges[n].source = u.id;
     202      edges[n].target = v.id;
    203203
    204204      edges[n].next_out = nodes[u.id].first_out;
     
    247247        edges[edges[n].prev_in].next_in = edges[n].next_in;
    248248      } else {
    249         nodes[edges[n].head].first_in = edges[n].next_in;
     249        nodes[edges[n].target].first_in = edges[n].next_in;
    250250      }
    251251
     
    258258        edges[edges[n].prev_out].next_out = edges[n].next_out;
    259259      } else {
    260         nodes[edges[n].tail].first_out = edges[n].next_out;
     260        nodes[edges[n].source].first_out = edges[n].next_out;
    261261      }
    262262     
     
    273273
    274274  protected:
    275     void _moveHead(Edge e, Node n)
     275    void _moveTarget(Edge e, Node n)
    276276    {
    277277      if(edges[e.id].next_in != -1)
     
    279279      if(edges[e.id].prev_in != -1)
    280280        edges[edges[e.id].prev_in].next_in = edges[e.id].next_in;
    281       else nodes[edges[e.id].head].first_in = edges[e.id].next_in;
    282       edges[e.id].head = n.id;
     281      else nodes[edges[e.id].target].first_in = edges[e.id].next_in;
     282      edges[e.id].target = n.id;
    283283      edges[e.id].prev_in = -1;
    284284      edges[e.id].next_in = nodes[n.id].first_in;
    285285      nodes[n.id].first_in = e.id;
    286286    }
    287     void _moveTail(Edge e, Node n)
     287    void _moveSource(Edge e, Node n)
    288288    {
    289289      if(edges[e.id].next_out != -1)
     
    291291      if(edges[e.id].prev_out != -1)
    292292        edges[edges[e.id].prev_out].next_out = edges[e.id].next_out;
    293       else nodes[edges[e.id].tail].first_out = edges[e.id].next_out;
    294       edges[e.id].tail = n.id;
     293      else nodes[edges[e.id].source].first_out = edges[e.id].next_out;
     294      edges[e.id].source = n.id;
    295295      edges[e.id].prev_out = -1;
    296296      edges[e.id].next_out = nodes[n.id].first_out;
     
    321321  {
    322322  public:
    323     /// Moves the head of \c e to \c n
    324 
    325     /// Moves the head of \c e to \c n
     323    /// Moves the target of \c e to \c n
     324
     325    /// Moves the target of \c e to \c n
    326326    ///
    327     void moveHead(Edge e, Node n) { _moveHead(e,n); }
    328     /// Moves the tail of \c e to \c n
    329 
    330     /// Moves the tail of \c e to \c n
     327    void moveTarget(Edge e, Node n) { _moveTarget(e,n); }
     328    /// Moves the source of \c e to \c n
     329
     330    /// Moves the source of \c e to \c n
    331331    ///
    332     void moveTail(Edge e, Node n) { _moveTail(e,n); }
     332    void moveSource(Edge e, Node n) { _moveSource(e,n); }
    333333
    334334    ///Using this it possible to avoid the superfluous memory allocation.
Note: See TracChangeset for help on using the changeset viewer.