gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge #184
0 2 0
merge default
0 files changed with 7 insertions and 4 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
1 1
ACLOCAL_AMFLAGS = -I m4
2 2

	
3 3
AM_CXXFLAGS = $(WARNINGCXXFLAGS)
4 4

	
5 5
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
6 6
LDADD = $(top_builddir)/lemon/libemon.la
7 7

	
8 8
EXTRA_DIST = \
9 9
	AUTHORS \
10 10
	LICENSE \
11 11
	m4/lx_check_cplex.m4 \
12 12
	m4/lx_check_glpk.m4 \
13 13
	m4/lx_check_soplex.m4 \
14 14
	m4/lx_check_coin.m4 \
15 15
	CMakeLists.txt \
16 16
	cmake/FindGhostscript.cmake \
17 17
	cmake/FindCPLEX.cmake \
18 18
	cmake/FindGLPK.cmake \
19 19
	cmake/FindCOIN.cmake \
20
	cmake/LEMONConfig.cmake.in \
20 21
	cmake/version.cmake.in \
21 22
	cmake/version.cmake \
22 23
	cmake/nsis/lemon.ico \
23 24
	cmake/nsis/uninstall.ico
24 25

	
25 26
pkgconfigdir = $(libdir)/pkgconfig
26 27
lemondir = $(pkgincludedir)
27 28
bitsdir = $(lemondir)/bits
28 29
conceptdir = $(lemondir)/concepts
29 30
pkgconfig_DATA =
30 31
lib_LTLIBRARIES =
31 32
lemon_HEADERS =
32 33
bits_HEADERS =
33 34
concept_HEADERS =
34 35
noinst_HEADERS =
35 36
noinst_PROGRAMS =
36 37
bin_PROGRAMS =
37 38
check_PROGRAMS =
38 39
dist_bin_SCRIPTS =
39 40
TESTS =
40 41
XFAIL_TESTS =
41 42

	
42 43
include lemon/Makefile.am
43 44
include test/Makefile.am
Ignore white space 48 line context
... ...
@@ -994,60 +994,62 @@
994 994
    _path_bits::PathCopySelector<Target, Source>::copy(target, source);
995 995
  }
996 996

	
997 997
  /// \brief Check the consistency of a path.
998 998
  ///
999 999
  /// This function checks that the target of each arc is the same
1000 1000
  /// as the source of the next one.
1001 1001
  ///
1002 1002
  template <typename Digraph, typename Path>
1003 1003
  bool checkPath(const Digraph& digraph, const Path& path) {
1004 1004
    typename Path::ArcIt it(path);
1005 1005
    if (it == INVALID) return true;
1006 1006
    typename Digraph::Node node = digraph.target(it);
1007 1007
    ++it;
1008 1008
    while (it != INVALID) {
1009 1009
      if (digraph.source(it) != node) return false;
1010 1010
      node = digraph.target(it);
1011 1011
      ++it;
1012 1012
    }
1013 1013
    return true;
1014 1014
  }
1015 1015

	
1016 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 1020
  template <typename Digraph, typename Path>
1020 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 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 1029
  template <typename Digraph, typename Path>
1028 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 1034
  /// \brief Class which helps to iterate through the nodes of a path
1033 1035
  ///
1034 1036
  /// In a sense, the path can be treated as a list of arcs. The
1035 1037
  /// lemon path type stores only this list. As a consequence, it
1036 1038
  /// cannot enumerate the nodes in the path and the zero length paths
1037 1039
  /// cannot have a source node.
1038 1040
  ///
1039 1041
  /// This class implements the node iterator of a path structure. To
1040 1042
  /// provide this feature, the underlying digraph should be passed to
1041 1043
  /// the constructor of the iterator.
1042 1044
  template <typename Path>
1043 1045
  class PathNodeIt {
1044 1046
  private:
1045 1047
    const typename Path::Digraph *_digraph;
1046 1048
    typename Path::ArcIt _it;
1047 1049
    typename Path::Digraph::Node _nd;
1048 1050

	
1049 1051
  public:
1050 1052

	
1051 1053
    typedef typename Path::Digraph Digraph;
1052 1054
    typedef typename Digraph::Node Node;
1053 1055

	
0 comments (0 inline)