COIN-OR::LEMON - Graph Library

Ticket #250: 250-fix-e2cb320ed082.patch

File 250-fix-e2cb320ed082.patch, 1.3 KB (added by Peter Kovacs, 10 years ago)
  • lemon/path.h

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1255347675 -7200
    # Node ID e2cb320ed082c9c526f7fef105d5553ba3f4c9da
    # Parent  257e91516e09d8d6be58236c587e3e0199770412
    Fix in pathSource() and pathTarget() (#250)
    and extend the doc.
    
    diff --git a/lemon/path.h b/lemon/path.h
    a b  
    10151015
    10161016  /// \brief The source of a path
    10171017  ///
    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.
    10191020  template <typename Digraph, typename Path>
    10201021  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());
    10221023  }
    10231024
    10241025  /// \brief The target of a path
    10251026  ///
    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.
    10271029  template <typename Digraph, typename Path>
    10281030  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());
    10301032  }
    10311033
    10321034  /// \brief Class which helps to iterate through the nodes of a path