[Lemon-commits] Alpar Juttner: Merge #184
Lemon HG
hg at lemon.cs.elte.hu
Thu Nov 5 06:29:29 CET 2009
details: http://lemon.cs.elte.hu/hg/lemon/rev/9fbbd802020f
changeset: 817:9fbbd802020f
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Thu Nov 05 06:26:18 2009 +0100
description:
Merge #184
diffstat:
Makefile.am | 1 +
lemon/path.h | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diffs (39 lines):
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,6 +17,7 @@
cmake/FindCPLEX.cmake \
cmake/FindGLPK.cmake \
cmake/FindCOIN.cmake \
+ cmake/LEMONConfig.cmake.in \
cmake/version.cmake.in \
cmake/version.cmake \
cmake/nsis/lemon.ico \
diff --git a/lemon/path.h b/lemon/path.h
--- a/lemon/path.h
+++ b/lemon/path.h
@@ -1015,18 +1015,20 @@
/// \brief The source of a path
///
- /// This function returns the source of the given path.
+ /// This function returns the source node of the given path.
+ /// If the path is empty, then it returns \c INVALID.
template <typename Digraph, typename Path>
typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) {
- return digraph.source(path.front());
+ return path.empty() ? INVALID : digraph.source(path.front());
}
/// \brief The target of a path
///
- /// This function returns the target of the given path.
+ /// This function returns the target node of the given path.
+ /// If the path is empty, then it returns \c INVALID.
template <typename Digraph, typename Path>
typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) {
- return digraph.target(path.back());
+ return path.empty() ? INVALID : digraph.target(path.back());
}
/// \brief Class which helps to iterate through the nodes of a path
More information about the Lemon-commits
mailing list