COIN-OR::LEMON - Graph Library

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


Ignore:
Timestamp:
11/13/04 13:53:28 (20 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/path.h

    r959 r986  
    112112    /// Starting point of the path.
    113113    /// Returns INVALID if the path is empty.
    114     GraphNode tail() const {
    115       return empty() ? INVALID : gr->tail(edges[0]);
     114    GraphNode source() const {
     115      return empty() ? INVALID : gr->source(edges[0]);
    116116    }
    117117    /// \brief End point of the path.
     
    119119    /// End point of the path.
    120120    /// Returns INVALID if the path is empty.
    121     GraphNode head() const {
    122       return empty() ? INVALID : gr->head(edges[length()-1]);
     121    GraphNode target() const {
     122      return empty() ? INVALID : gr->target(edges[length()-1]);
    123123    }
    124124
     
    140140    }
    141141
    142     /// \brief Returns node iterator pointing to the head node of the
     142    /// \brief Returns node iterator pointing to the target node of the
    143143    /// given edge iterator.
    144     NodeIt head(const EdgeIt& e) const {
     144    NodeIt target(const EdgeIt& e) const {
    145145      return NodeIt(*this, e.idx+1);
    146146    }
    147147
    148     /// \brief Returns node iterator pointing to the tail node of the
     148    /// \brief Returns node iterator pointing to the source node of the
    149149    /// given edge iterator.
    150     NodeIt tail(const EdgeIt& e) const {
     150    NodeIt source(const EdgeIt& e) const {
    151151      return NodeIt(*this, e.idx);
    152152    }
     
    231231      operator const GraphNode& () const {
    232232        if(idx >= p->length())
    233           return p->head();
     233          return p->target();
    234234        else if(idx >= 0)
    235           return p->gr->tail(p->edges[idx]);
     235          return p->gr->source(p->edges[idx]);
    236236        else
    237237          return INVALID;
     
    336336      }
    337337
    338       GraphNode tail() const {
     338      GraphNode source() const {
    339339        if( ! front.empty() )
    340           return P.gr->tail(front[front.size()-1]);
     340          return P.gr->source(front[front.size()-1]);
    341341        else if( ! P.empty() )
    342           return P.gr->tail(P.edges[0]);
     342          return P.gr->source(P.edges[0]);
    343343        else if( ! back.empty() )
    344           return P.gr->tail(back[0]);
     344          return P.gr->source(back[0]);
    345345        else
    346346          return INVALID;
    347347      }
    348       GraphNode head() const {
     348      GraphNode target() const {
    349349        if( ! back.empty() )
    350           return P.gr->head(back[back.size()-1]);
     350          return P.gr->target(back[back.size()-1]);
    351351        else if( ! P.empty() )
    352           return P.gr->head(P.edges[P.length()-1]);
     352          return P.gr->target(P.edges[P.length()-1]);
    353353        else if( ! front.empty() )
    354           return P.gr->head(front[0]);
     354          return P.gr->target(front[0]);
    355355        else
    356356          return INVALID;
     
    438438    /// Starting point of the path.
    439439    /// Returns INVALID if the path is empty.
    440     GraphNode tail() const {
    441       return empty() ? INVALID : gr->tail(edges[0]);
     440    GraphNode source() const {
     441      return empty() ? INVALID : gr->source(edges[0]);
    442442    }
    443443    /// \brief End point of the path.
     
    445445    /// End point of the path.
    446446    /// Returns INVALID if the path is empty.
    447     GraphNode head() const {
    448       return empty() ? INVALID : gr->head(edges[length()-1]);
     447    GraphNode target() const {
     448      return empty() ? INVALID : gr->target(edges[length()-1]);
    449449    }
    450450
     
    478478    }
    479479
    480     /// \brief Returns node iterator pointing to the head node of the
     480    /// \brief Returns node iterator pointing to the target node of the
    481481    /// given edge iterator.
    482     NodeIt head(const EdgeIt& e) const {
     482    NodeIt target(const EdgeIt& e) const {
    483483      return NodeIt(*this, e.idx+1);
    484484    }
    485485
    486     /// \brief Returns node iterator pointing to the tail node of the
     486    /// \brief Returns node iterator pointing to the source node of the
    487487    /// given edge iterator.
    488     NodeIt tail(const EdgeIt& e) const {
     488    NodeIt source(const EdgeIt& e) const {
    489489      return NodeIt(*this, e.idx);
    490490    }
     
    571571      operator const GraphNode& () const {
    572572        if(idx >= p->length())
    573           return p->head();
     573          return p->target();
    574574        else if(idx >= 0)
    575           return p->gr->tail(p->edges[idx]);
     575          return p->gr->source(p->edges[idx]);
    576576        else
    577577          return INVALID;
     
    677677      }
    678678
    679       GraphNode tail() const {
     679      GraphNode source() const {
    680680        if( ! front.empty() )
    681           return P.gr->tail(front[front.size()-1]);
     681          return P.gr->source(front[front.size()-1]);
    682682        else if( ! P.empty() )
    683           return P.gr->tail(P.edges[0]);
     683          return P.gr->source(P.edges[0]);
    684684        else if( ! back.empty() )
    685           return P.gr->tail(back[0]);
     685          return P.gr->source(back[0]);
    686686        else
    687687          return INVALID;
    688688      }
    689       GraphNode head() const {
     689      GraphNode target() const {
    690690        if( ! back.empty() )
    691           return P.gr->head(back[back.size()-1]);
     691          return P.gr->target(back[back.size()-1]);
    692692        else if( ! P.empty() )
    693           return P.gr->head(P.edges[P.length()-1]);
     693          return P.gr->target(P.edges[P.length()-1]);
    694694        else if( ! front.empty() )
    695           return P.gr->head(front[0]);
     695          return P.gr->target(front[0]);
    696696        else
    697697          return INVALID;
Note: See TracChangeset for help on using the changeset viewer.