src/lemon/path.h
changeset 986 e997802b855c
parent 959 c80ef5912903
child 1151 b217fc69f913
     1.1 --- a/src/lemon/path.h	Sat Nov 13 12:24:01 2004 +0000
     1.2 +++ b/src/lemon/path.h	Sat Nov 13 12:53:28 2004 +0000
     1.3 @@ -111,15 +111,15 @@
     1.4      ///
     1.5      /// Starting point of the path.
     1.6      /// Returns INVALID if the path is empty.
     1.7 -    GraphNode tail() const {
     1.8 -      return empty() ? INVALID : gr->tail(edges[0]);
     1.9 +    GraphNode source() const {
    1.10 +      return empty() ? INVALID : gr->source(edges[0]);
    1.11      }
    1.12      /// \brief End point of the path.
    1.13      ///
    1.14      /// End point of the path.
    1.15      /// Returns INVALID if the path is empty.
    1.16 -    GraphNode head() const {
    1.17 -      return empty() ? INVALID : gr->head(edges[length()-1]);
    1.18 +    GraphNode target() const {
    1.19 +      return empty() ? INVALID : gr->target(edges[length()-1]);
    1.20      }
    1.21  
    1.22      /// \brief Initializes node or edge iterator to point to the first
    1.23 @@ -139,15 +139,15 @@
    1.24        return i=EdgeIt(*this, n);
    1.25      }
    1.26  
    1.27 -    /// \brief Returns node iterator pointing to the head node of the
    1.28 +    /// \brief Returns node iterator pointing to the target node of the
    1.29      /// given edge iterator.
    1.30 -    NodeIt head(const EdgeIt& e) const {
    1.31 +    NodeIt target(const EdgeIt& e) const {
    1.32        return NodeIt(*this, e.idx+1);
    1.33      }
    1.34  
    1.35 -    /// \brief Returns node iterator pointing to the tail node of the
    1.36 +    /// \brief Returns node iterator pointing to the source node of the
    1.37      /// given edge iterator.
    1.38 -    NodeIt tail(const EdgeIt& e) const {
    1.39 +    NodeIt source(const EdgeIt& e) const {
    1.40        return NodeIt(*this, e.idx);
    1.41      }
    1.42  
    1.43 @@ -230,9 +230,9 @@
    1.44        ///Conversion to Graph::Node
    1.45        operator const GraphNode& () const {
    1.46  	if(idx >= p->length())
    1.47 -	  return p->head();
    1.48 +	  return p->target();
    1.49  	else if(idx >= 0)
    1.50 -	  return p->gr->tail(p->edges[idx]);
    1.51 +	  return p->gr->source(p->edges[idx]);
    1.52  	else
    1.53  	  return INVALID;
    1.54        }
    1.55 @@ -335,23 +335,23 @@
    1.56  	return front.empty() && back.empty() && P.empty();
    1.57        }
    1.58  
    1.59 -      GraphNode tail() const {
    1.60 +      GraphNode source() const {
    1.61  	if( ! front.empty() )
    1.62 -	  return P.gr->tail(front[front.size()-1]);
    1.63 +	  return P.gr->source(front[front.size()-1]);
    1.64  	else if( ! P.empty() )
    1.65 -	  return P.gr->tail(P.edges[0]);
    1.66 +	  return P.gr->source(P.edges[0]);
    1.67  	else if( ! back.empty() )
    1.68 -	  return P.gr->tail(back[0]);
    1.69 +	  return P.gr->source(back[0]);
    1.70  	else
    1.71  	  return INVALID;
    1.72        }
    1.73 -      GraphNode head() const {
    1.74 +      GraphNode target() const {
    1.75  	if( ! back.empty() )
    1.76 -	  return P.gr->head(back[back.size()-1]);
    1.77 +	  return P.gr->target(back[back.size()-1]);
    1.78  	else if( ! P.empty() )
    1.79 -	  return P.gr->head(P.edges[P.length()-1]);
    1.80 +	  return P.gr->target(P.edges[P.length()-1]);
    1.81  	else if( ! front.empty() )
    1.82 -	  return P.gr->head(front[0]);
    1.83 +	  return P.gr->target(front[0]);
    1.84  	else
    1.85  	  return INVALID;
    1.86        }
    1.87 @@ -437,15 +437,15 @@
    1.88      ///
    1.89      /// Starting point of the path.
    1.90      /// Returns INVALID if the path is empty.
    1.91 -    GraphNode tail() const {
    1.92 -      return empty() ? INVALID : gr->tail(edges[0]);
    1.93 +    GraphNode source() const {
    1.94 +      return empty() ? INVALID : gr->source(edges[0]);
    1.95      }
    1.96      /// \brief End point of the path.
    1.97      ///
    1.98      /// End point of the path.
    1.99      /// Returns INVALID if the path is empty.
   1.100 -    GraphNode head() const {
   1.101 -      return empty() ? INVALID : gr->head(edges[length()-1]);
   1.102 +    GraphNode target() const {
   1.103 +      return empty() ? INVALID : gr->target(edges[length()-1]);
   1.104      }
   1.105  
   1.106      /// \brief Initializes node or edge iterator to point to the first
   1.107 @@ -477,15 +477,15 @@
   1.108        return ++e;
   1.109      }
   1.110  
   1.111 -    /// \brief Returns node iterator pointing to the head node of the
   1.112 +    /// \brief Returns node iterator pointing to the target node of the
   1.113      /// given edge iterator.
   1.114 -    NodeIt head(const EdgeIt& e) const {
   1.115 +    NodeIt target(const EdgeIt& e) const {
   1.116        return NodeIt(*this, e.idx+1);
   1.117      }
   1.118  
   1.119 -    /// \brief Returns node iterator pointing to the tail node of the
   1.120 +    /// \brief Returns node iterator pointing to the source node of the
   1.121      /// given edge iterator.
   1.122 -    NodeIt tail(const EdgeIt& e) const {
   1.123 +    NodeIt source(const EdgeIt& e) const {
   1.124        return NodeIt(*this, e.idx);
   1.125      }
   1.126  
   1.127 @@ -570,9 +570,9 @@
   1.128        ///Conversion to Graph::Node
   1.129        operator const GraphNode& () const {
   1.130  	if(idx >= p->length())
   1.131 -	  return p->head();
   1.132 +	  return p->target();
   1.133  	else if(idx >= 0)
   1.134 -	  return p->gr->tail(p->edges[idx]);
   1.135 +	  return p->gr->source(p->edges[idx]);
   1.136  	else
   1.137  	  return INVALID;
   1.138        }
   1.139 @@ -676,23 +676,23 @@
   1.140  	return front.empty() && back.empty() && P.empty();
   1.141        }
   1.142  
   1.143 -      GraphNode tail() const {
   1.144 +      GraphNode source() const {
   1.145  	if( ! front.empty() )
   1.146 -	  return P.gr->tail(front[front.size()-1]);
   1.147 +	  return P.gr->source(front[front.size()-1]);
   1.148  	else if( ! P.empty() )
   1.149 -	  return P.gr->tail(P.edges[0]);
   1.150 +	  return P.gr->source(P.edges[0]);
   1.151  	else if( ! back.empty() )
   1.152 -	  return P.gr->tail(back[0]);
   1.153 +	  return P.gr->source(back[0]);
   1.154  	else
   1.155  	  return INVALID;
   1.156        }
   1.157 -      GraphNode head() const {
   1.158 +      GraphNode target() const {
   1.159  	if( ! back.empty() )
   1.160 -	  return P.gr->head(back[back.size()-1]);
   1.161 +	  return P.gr->target(back[back.size()-1]);
   1.162  	else if( ! P.empty() )
   1.163 -	  return P.gr->head(P.edges[P.length()-1]);
   1.164 +	  return P.gr->target(P.edges[P.length()-1]);
   1.165  	else if( ! front.empty() )
   1.166 -	  return P.gr->head(front[0]);
   1.167 +	  return P.gr->target(front[0]);
   1.168  	else
   1.169  	  return INVALID;
   1.170        }