lemon/path.h
branch1.1
changeset 700 989c6629d045
parent 550 c5fd2d996909
parent 697 41bdb4d6c8c3
child 702 2305167d2491
equal deleted inserted replaced
13:ba43a09e5283 15:f01d83cf07d4
  1013     return true;
  1013     return true;
  1014   }
  1014   }
  1015 
  1015 
  1016   /// \brief The source of a path
  1016   /// \brief The source of a path
  1017   ///
  1017   ///
  1018   /// This function returns the source of the given path.
  1018   /// This function returns the source node of the given path.
       
  1019   /// If the path is empty, then it returns \c INVALID.
  1019   template <typename Digraph, typename Path>
  1020   template <typename Digraph, typename Path>
  1020   typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) {
  1021   typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) {
  1021     return digraph.source(path.front());
  1022     return path.empty() ? INVALID : digraph.source(path.front());
  1022   }
  1023   }
  1023 
  1024 
  1024   /// \brief The target of a path
  1025   /// \brief The target of a path
  1025   ///
  1026   ///
  1026   /// This function returns the target of the given path.
  1027   /// This function returns the target node of the given path.
       
  1028   /// If the path is empty, then it returns \c INVALID.
  1027   template <typename Digraph, typename Path>
  1029   template <typename Digraph, typename Path>
  1028   typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) {
  1030   typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) {
  1029     return digraph.target(path.back());
  1031     return path.empty() ? INVALID : digraph.target(path.back());
  1030   }
  1032   }
  1031 
  1033 
  1032   /// \brief Class which helps to iterate through the nodes of a path
  1034   /// \brief Class which helps to iterate through the nodes of a path
  1033   ///
  1035   ///
  1034   /// In a sense, the path can be treated as a list of arcs. The
  1036   /// In a sense, the path can be treated as a list of arcs. The