[med-svn] [cufflinks] 01/02: Imported Upstream version 2.2.1
Andreas Tille
tille at debian.org
Tue Aug 16 14:14:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository cufflinks.
commit 909ee183d5e91e46cc1c6557b3669c40baef7fc1
Author: Andreas Tille <tille at debian.org>
Date: Tue Aug 16 13:41:16 2016 +0200
Imported Upstream version 2.2.1
---
Makefile.in | 624 ++
aclocal.m4 | 1031 +++
build-aux/config.guess | 1463 ++++
build-aux/config.sub | 1579 +++++
build-aux/depcomp | 530 ++
build-aux/install-sh | 323 +
build-aux/missing | 360 +
config.h.in | 112 +
configure | 10836 ++++++++++++++++++++++++++++++
src/Makefile.in | 1624 +++++
src/lemon/bfs.h | 1597 +++++
src/lemon/bin_heap.h | 346 +
src/lemon/bipartite_matching.h | 1732 +++++
src/lemon/bits/alteration_notifier.h | 485 ++
src/lemon/bits/array_map.h | 346 +
src/lemon/bits/base_extender.h | 495 ++
src/lemon/bits/debug_map.h | 382 ++
src/lemon/bits/default_map.h | 181 +
src/lemon/bits/graph_adaptor_extender.h | 742 ++
src/lemon/bits/graph_extender.h | 1397 ++++
src/lemon/bits/invalid.h | 54 +
src/lemon/bits/map_extender.h | 321 +
src/lemon/bits/path_dump.h | 174 +
src/lemon/bits/traits.h | 346 +
src/lemon/bits/utility.h | 140 +
src/lemon/bits/variant.h | 508 ++
src/lemon/bits/vector_map.h | 243 +
src/lemon/bucket_heap.h | 831 +++
src/lemon/concept_check.h | 105 +
src/lemon/concepts/bpugraph.h | 1004 +++
src/lemon/concepts/graph.h | 453 ++
src/lemon/concepts/graph_components.h | 2093 ++++++
src/lemon/concepts/heap.h | 226 +
src/lemon/concepts/maps.h | 208 +
src/lemon/concepts/matrix_maps.h | 207 +
src/lemon/concepts/path.h | 307 +
src/lemon/concepts/ugraph.h | 702 ++
src/lemon/dfs.h | 1543 +++++
src/lemon/error.h | 683 ++
src/lemon/fib_heap.h | 464 ++
src/lemon/graph_adaptor.h | 2720 ++++++++
src/lemon/graph_utils.h | 3179 +++++++++
src/lemon/list_graph.h | 2249 +++++++
src/lemon/maps.h | 1633 +++++
src/lemon/math.h | 63 +
src/lemon/smart_graph.h | 1163 ++++
src/lemon/tolerance.h | 454 ++
src/lemon/topology.h | 1590 +++++
48 files changed, 49848 insertions(+)
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..96c9e1a
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,624 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(top_srcdir)/configure AUTHORS build-aux/config.guess \
+ build-aux/config.sub build-aux/depcomp build-aux/install-sh \
+ build-aux/missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/ax_boost_base.m4 \
+ $(top_srcdir)/ax_boost_thread.m4 \
+ $(top_srcdir)/ax_boost_system.m4 \
+ $(top_srcdir)/ax_boost_serialization.m4 \
+ $(top_srcdir)/ax_bam.m4 $(top_srcdir)/ax_check_zlib.m4 \
+ $(top_srcdir)/ax_check_eigen.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BAM_CPPFLAGS = @BAM_CPPFLAGS@
+BAM_LDFLAGS = @BAM_LDFLAGS@
+BAM_LIB = @BAM_LIB@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SERIALIZATION_LIB = @BOOST_SERIALIZATION_LIB@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
+BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EIGEN_CPPFLAGS = @EIGEN_CPPFLAGS@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZLIB = @ZLIB@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+ALWAYS_BUILT = src
+SUBDIRS = $(ALWAYS_BUILT)
+DIST_SUBDIRS = $(ALWAYS_BUILT)
+EXTRA_DIST = LICENSE
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/build-aux
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -755 -exec chmod a+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-generic \
+ distclean-hdr distclean-recursive distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am
+
+
+.PHONY: FORCE
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..7f99a5a
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,1031 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# ---------------------------------------------------------------------------
+# Adds support for distributing Python modules and packages. To
+# install modules, copy them to $(pythondir), using the python_PYTHON
+# automake variable. To install a package with the same name as the
+# automake package, install to $(pkgpythondir), or use the
+# pkgpython_PYTHON automake variable.
+#
+# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
+# locations to install python extension modules (shared libraries).
+# Another macro is required to find the appropriate flags to compile
+# extension modules.
+#
+# If your package is configured with a different prefix to python,
+# users will have to add the install directory to the PYTHONPATH
+# environment variable, or create a .pth file (see the python
+# documentation for details).
+#
+# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement. MINIMUM-VERSION should consist of
+# numbers and dots only.
+AC_DEFUN([AM_PATH_PYTHON],
+ [
+ dnl Find a Python interpreter. Python versions prior to 1.5 are not
+ dnl supported because the default installation locations changed from
+ dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
+ dnl in 1.5.
+ m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
+ [python python2 python2.5 python2.4 python2.3 python2.2 dnl
+python2.1 python2.0 python1.6 python1.5])
+
+ m4_if([$1],[],[
+ dnl No version check is needed.
+ # Find any Python interpreter.
+ if test -z "$PYTHON"; then
+ AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
+ fi
+ am_display_PYTHON=python
+ ], [
+ dnl A version check is needed.
+ if test -n "$PYTHON"; then
+ # If the user set $PYTHON, use it and don't search something else.
+ AC_MSG_CHECKING([whether $PYTHON version >= $1])
+ AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_ERROR(too old)])
+ am_display_PYTHON=$PYTHON
+ else
+ # Otherwise, try each interpreter until we find one that satisfies
+ # VERSION.
+ AC_CACHE_CHECK([for a Python interpreter with version >= $1],
+ [am_cv_pathless_PYTHON],[
+ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
+ test "$am_cv_pathless_PYTHON" = none && break
+ AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
+ done])
+ # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+ if test "$am_cv_pathless_PYTHON" = none; then
+ PYTHON=:
+ else
+ AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
+ fi
+ am_display_PYTHON=$am_cv_pathless_PYTHON
+ fi
+ ])
+
+ if test "$PYTHON" = :; then
+ dnl Run any user-specified action, or abort.
+ m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
+ else
+
+ dnl Query Python for its version number. Getting [:3] seems to be
+ dnl the best way to do this; it's what "site.py" does in the standard
+ dnl library.
+
+ AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
+ [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
+ AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
+
+ dnl Use the values of $prefix and $exec_prefix for the corresponding
+ dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
+ dnl distinct variables so they can be overridden if need be. However,
+ dnl general consensus is that you shouldn't need this ability.
+
+ AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
+ AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
+
+ dnl At times (like when building shared libraries) you may want
+ dnl to know which OS platform Python thinks this is.
+
+ AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
+ [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
+ AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
+
+
+ dnl Set up 4 directories:
+
+ dnl pythondir -- where to install python scripts. This is the
+ dnl site-packages directory, not the python standard library
+ dnl directory like in previous automake betas. This behavior
+ dnl is more consistent with lispdir.m4 for example.
+ dnl Query distutils for this directory. distutils does not exist in
+ dnl Python 1.5, so we fall back to the hardcoded directory if it
+ dnl doesn't work.
+ AC_CACHE_CHECK([for $am_display_PYTHON script directory],
+ [am_cv_python_pythondir],
+ [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+ echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
+ AC_SUBST([pythondir], [$am_cv_python_pythondir])
+
+ dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
+ dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
+ dnl more consistent with the rest of automake.
+
+ AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
+
+ dnl pyexecdir -- directory for installing python extension modules
+ dnl (shared libraries)
+ dnl Query distutils for this directory. distutils does not exist in
+ dnl Python 1.5, so we fall back to the hardcoded directory if it
+ dnl doesn't work.
+ AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
+ [am_cv_python_pyexecdir],
+ [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
+ echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
+ AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
+
+ dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
+
+ AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+ dnl Run any user-specified action.
+ $2
+ fi
+
+])
+
+
+# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# ---------------------------------------------------------------------------
+# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
+# Run ACTION-IF-FALSE otherwise.
+# This test uses sys.hexversion instead of the string equivalent (first
+# word of sys.version), in order to cope with versions such as 2.2c1.
+# hexversion has been introduced in Python 1.5.2; it's probably not
+# worth to support older versions (1.5.1 was released on October 31, 1998).
+AC_DEFUN([AM_PYTHON_CHECK_VERSION],
+ [prog="import sys, string
+# split strings by '.' and convert to numeric. Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(sys.hexversion < minverhex)"
+ AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+ ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/build-aux/config.guess b/build-aux/config.guess
new file mode 100755
index 0000000..917bbc5
--- /dev/null
+++ b/build-aux/config.guess
@@ -0,0 +1,1463 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ x86:Interix*:[34]*)
+ echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+ exit ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel at ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes at openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf at swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green at stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green at stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ *86) UNAME_PROCESSOR=i686 ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build-aux/config.sub b/build-aux/config.sub
new file mode 100755
index 0000000..1c366df
--- /dev/null
+++ b/build-aux/config.sub
@@ -0,0 +1,1579 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | ms1 \
+ | msp430 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | ms1-* \
+ | msp430-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ m32c-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build-aux/depcomp b/build-aux/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/build-aux/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+ stat=$?
+
+ if test -f "$tmpdepfile"; then :
+ else
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
+ tmpdepfile="$stripped.u"
+ fi
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ outname="$stripped.o"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/build-aux/install-sh b/build-aux/install-sh
new file mode 100755
index 0000000..4d4a951
--- /dev/null
+++ b/build-aux/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c (ignored)
+-d create directories instead of installing files.
+-g GROUP $chgrpprog installed files to GROUP.
+-m MODE $chmodprog installed files to MODE.
+-o USER $chownprog installed files to USER.
+-s $stripprog installed files.
+-t DIRECTORY install into DIRECTORY.
+-T report an error if DSTFILE is a directory.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
+
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
+done
+
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ mkdircmd=:
+ chmodcmd=
+ else
+ mkdircmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ shift
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp"
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test -d "$pathcomp" || exit
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $mkdircmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ dstfile=`basename "$dst"`
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Copy the file name to the temp name.
+ $doit $cpprog "$src" "$dsttmp" &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit 1
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
+ fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+ (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/build-aux/missing b/build-aux/missing
new file mode 100755
index 0000000..894e786
--- /dev/null
+++ b/build-aux/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake at gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..71a19ef
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,112 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* define if the BAM library is available */
+#undef HAVE_BAM
+
+/* define if the Boost library is available */
+#undef HAVE_BOOST
+
+/* define if the Boost::Serialization library is available */
+#undef HAVE_BOOST_SERIALIZATION
+
+/* define if the Boost::System library is available */
+#undef HAVE_BOOST_SYSTEM
+
+/* define if the Boost::Thread library is available */
+#undef HAVE_BOOST_THREAD
+
+/* Define to 1 if you have the declaration of `CTL_HW', and to 0 if you don't.
+ */
+#undef HAVE_DECL_CTL_HW
+
+/* Define to 1 if you have the declaration of `HW_PHYSMEM', and to 0 if you
+ don't. */
+#undef HAVE_DECL_HW_PHYSMEM
+
+/* Define to 1 if you have the declaration of `sysctl', and to 0 if you don't.
+ */
+#undef HAVE_DECL_SYSCTL
+
+/* define if the EIGEN library is available */
+#undef HAVE_EIGEN
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if the system has the type `ptrdiff_t'. */
+#undef HAVE_PTRDIFF_T
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if `totalram' is member of `struct sysinfo'. */
+#undef HAVE_STRUCT_SYSINFO_TOTALRAM
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* SVN Revision */
+#undef SVN_REVISION
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
diff --git a/configure b/configure
new file mode 100755
index 0000000..b9cb412
--- /dev/null
+++ b/configure
@@ -0,0 +1,10836 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.63 for cufflinks 2.2.1.
+#
+# Report bugs to <cole at cs.umd.edu>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell bug-autoconf at gnu.org about your system,
+ echo including any error possibly output before this message.
+ echo This can help us improve future autoconf versions.
+ echo Configuration will now proceed without shell functions.
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='cufflinks'
+PACKAGE_TARNAME='cufflinks'
+PACKAGE_VERSION='2.2.1'
+PACKAGE_STRING='cufflinks 2.2.1'
+PACKAGE_BUGREPORT='cole at cs.umd.edu'
+
+ac_unique_file="config.h.in"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+host_os
+host_vendor
+host_cpu
+host
+EIGEN_CPPFLAGS
+ZLIB
+EGREP
+GREP
+CPP
+BOOST_THREAD_LIB
+BOOST_SERIALIZATION_LIB
+BOOST_SYSTEM_LIB
+build_os
+build_vendor
+build_cpu
+build
+BAM_LIB
+BAM_LDFLAGS
+BAM_CPPFLAGS
+BOOST_LDFLAGS
+BOOST_CPPFLAGS
+pkgpyexecdir
+pyexecdir
+pkgpythondir
+pythondir
+PYTHON_PLATFORM
+PYTHON_EXEC_PREFIX
+PYTHON_PREFIX
+PYTHON_VERSION
+RANLIB
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+ac_ct_CC
+CFLAGS
+CC
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CXX
+CPPFLAGS
+LDFLAGS
+CXXFLAGS
+CXX
+PYTHON
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+with_boost
+with_boost_libdir
+with_bam
+with_bam_libdir
+with_boost_system
+with_boost_serialization
+with_boost_thread
+with_zlib
+with_eigen
+enable_vectorize
+enable_intel64
+enable_debug
+enable_optim
+enable_profiling
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+PYTHON
+CXX
+CXXFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CCC
+CC
+CFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { $as_echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
+ { (exit 1); exit 1; }; } ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { $as_echo "$as_me: error: working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures cufflinks 2.2.1 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/cufflinks]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of cufflinks 2.2.1:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-vectorize Enable GCC auto-vectorization
+ --enable-intel64 optimize for Intel64 CPU such as Xeon and Core2
+ --enable-debug enable debugging info (default is no)
+ --enable-optim[=0|1|2|3]
+ set optimization level (default is 3)
+ --enable-profiling enable profiling with google-perftools
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-boost[=DIR] use boost (default is yes) - it is possible to
+ specify the root directory for boost (optional)
+ --with-boost-libdir=LIB_DIR
+ Force given directory for boost libraries. Note that
+ this will overwrite library path detection, so use
+ this parameter only if default library detection
+ fails and you know exactly where your boost
+ libraries are located.
+ --with-bam[=DIR] use BAM libraries (default is yes) - it is possible
+ to specify the root directory for BAM (optional)
+ --with-bam-libdir=LIB_DIR
+ Force given directory for bam libraries. Note that
+ this will overwrite library path detection, so use
+ this parameter only if default library detection
+ fails and you know exactly where your bam libraries
+ are located.
+ --with-boost-system[=special-lib]
+ use the System library from boost - it is possible
+ to specify a certain library for the linker e.g.
+ --with-boost-system=boost_system-gcc-mt
+ --with-boost-serialization[=special-lib]
+ use the Serialization library from boost - it is
+ possible to specify a certain library for the linker
+ e.g.
+ --with-boost-serialization=boost_serialization-gcc-mt
+ --with-boost-thread[=special-lib]
+ use the Thread library from boost - it is possible
+ to specify a certain library for the linker e.g.
+ --with-boost-thread=boost_thread-gcc-mt
+ --with-zlib=DIR root directory path of zlib installation defaults to
+ /usr/local or /usr if not found in /usr/local
+ --without-zlib to disable zlib usage completely
+ --with-eigen[=DIR] use EIGEN libraries (default is yes) - it is
+ possible to specify the root directory for EIGEN
+ (optional)
+
+Some influential environment variables:
+ PYTHON python program
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CC C compiler command
+ CFLAGS C compiler flags
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <cole at cs.umd.edu>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+cufflinks configure 2.2.1
+generated by GNU Autoconf 2.63
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by cufflinks $as_me 2.2.1, which was
+generated by GNU Autoconf 2.63. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test -r "$ac_site_file"; then
+ { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define SVN_REVISION "4237"
+_ACEOF
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+ac_aux_dir=
+for ac_dir in build-aux "$srcdir"/build-aux; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in build-aux \"$srcdir\"/build-aux" >&5
+$as_echo "$as_me: error: cannot find install-sh or install.sh in build-aux \"$srcdir\"/build-aux" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+am__api_version="1.9"
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+$as_echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='cufflinks'
+ VERSION='2.2.1'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+#AM_PATH_CPPUNIT(1.10.2)
+
+
+
+ # Make sure CXXFLAGS is defined so that AC_PROG_CXX doesn't set it.
+CXXFLAGS="$CXXFLAGS"
+CFLAGS="$CFLAGS"
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Checks for programs.
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:$LINENO: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5
+$as_echo_n "checking for C++ compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5
+$as_echo_n "checking whether the C++ compiler works... " >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CXXFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CXX" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:$LINENO: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+
+
+
+
+ if test -n "$PYTHON"; then
+ # If the user set $PYTHON, use it and don't search something else.
+ { $as_echo "$as_me:$LINENO: checking whether $PYTHON version >= 2.4" >&5
+$as_echo_n "checking whether $PYTHON version >= 2.4... " >&6; }
+ prog="import sys, string
+# split strings by '.' and convert to numeric. Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('2.4', '.')) + [0, 0, 0]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+ if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5
+ ($PYTHON -c "$prog") >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { { $as_echo "$as_me:$LINENO: error: too old" >&5
+$as_echo "$as_me: error: too old" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ am_display_PYTHON=$PYTHON
+ else
+ # Otherwise, try each interpreter until we find one that satisfies
+ # VERSION.
+ { $as_echo "$as_me:$LINENO: checking for a Python interpreter with version >= 2.4" >&5
+$as_echo_n "checking for a Python interpreter with version >= 2.4... " >&6; }
+if test "${am_cv_pathless_PYTHON+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+
+ for am_cv_pathless_PYTHON in python python2 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 none; do
+ test "$am_cv_pathless_PYTHON" = none && break
+ prog="import sys, string
+# split strings by '.' and convert to numeric. Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('2.4', '.')) + [0, 0, 0]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+ if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5
+ ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ break
+fi
+
+ done
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_pathless_PYTHON" >&5
+$as_echo "$am_cv_pathless_PYTHON" >&6; }
+ # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+ if test "$am_cv_pathless_PYTHON" = none; then
+ PYTHON=:
+ else
+ # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args.
+set dummy $am_cv_pathless_PYTHON; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PYTHON+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $PYTHON in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+ { $as_echo "$as_me:$LINENO: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+ am_display_PYTHON=$am_cv_pathless_PYTHON
+ fi
+
+
+ if test "$PYTHON" = :; then
+ { { $as_echo "$as_me:$LINENO: error: no suitable Python interpreter found" >&5
+$as_echo "$as_me: error: no suitable Python interpreter found" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+
+
+ { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5
+$as_echo_n "checking for $am_display_PYTHON version... " >&6; }
+if test "${am_cv_python_version+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_python_version" >&5
+$as_echo "$am_cv_python_version" >&6; }
+ PYTHON_VERSION=$am_cv_python_version
+
+
+
+ PYTHON_PREFIX='${prefix}'
+
+ PYTHON_EXEC_PREFIX='${exec_prefix}'
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON platform" >&5
+$as_echo_n "checking for $am_display_PYTHON platform... " >&6; }
+if test "${am_cv_python_platform+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_python_platform" >&5
+$as_echo "$am_cv_python_platform" >&6; }
+ PYTHON_PLATFORM=$am_cv_python_platform
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5
+$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; }
+if test "${am_cv_python_pythondir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+ echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_python_pythondir" >&5
+$as_echo "$am_cv_python_pythondir" >&6; }
+ pythondir=$am_cv_python_pythondir
+
+
+
+ pkgpythondir=\${pythondir}/$PACKAGE
+
+
+ { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON extension module directory" >&5
+$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; }
+if test "${am_cv_python_pyexecdir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
+ echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_python_pyexecdir" >&5
+$as_echo "$am_cv_python_pyexecdir" >&6; }
+ pyexecdir=$am_cv_python_pyexecdir
+
+
+
+ pkgpyexecdir=\${pyexecdir}/$PACKAGE
+
+
+
+ fi
+
+
+
+
+
+# Check whether --with-boost was given.
+if test "${with_boost+set}" = set; then
+ withval=$with_boost;
+ if test "$withval" = "no"; then
+ want_boost="no"
+ elif test "$withval" = "yes"; then
+ want_boost="yes"
+ ac_boost_path=""
+ else
+ want_boost="yes"
+ ac_boost_path="$withval"
+ fi
+
+else
+ want_boost="yes"
+fi
+
+
+
+
+# Check whether --with-boost-libdir was given.
+if test "${with_boost_libdir+set}" = set; then
+ withval=$with_boost_libdir;
+ if test -d $withval
+ then
+ ac_boost_lib_path="$withval"
+ else
+ { { $as_echo "$as_me:$LINENO: error: --with-boost-libdir expected directory name" >&5
+$as_echo "$as_me: error: --with-boost-libdir expected directory name" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+else
+ ac_boost_lib_path=""
+
+fi
+
+
+if test "x$want_boost" = "xyes"; then
+ boost_lib_version_req=1.47.0
+ boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([0-9]*\.[0-9]*\)'`
+ boost_lib_version_req_major=`expr $boost_lib_version_req : '\([0-9]*\)'`
+ boost_lib_version_req_minor=`expr $boost_lib_version_req : '[0-9]*\.\([0-9]*\)'`
+ boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+ if test "x$boost_lib_version_req_sub_minor" = "x" ; then
+ boost_lib_version_req_sub_minor="0"
+ fi
+ WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
+ { $as_echo "$as_me:$LINENO: checking for boostlib >= $boost_lib_version_req" >&5
+$as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; }
+ succeeded=no
+
+ if test "$ac_boost_path" != ""; then
+ BOOST_LDFLAGS="-L$ac_boost_path/lib"
+ BOOST_CPPFLAGS="-I$ac_boost_path/include"
+ else
+ for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+ if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
+ BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
+ BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+ break;
+ fi
+ done
+ fi
+
+ if test "$ac_boost_lib_path" != ""; then
+ BOOST_LDFLAGS="-L$ac_boost_lib_path"
+ fi
+
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <boost/version.hpp>
+
+int
+main ()
+{
+
+ #if BOOST_VERSION >= $WANT_BOOST_VERSION
+ // Everything is okay
+ #else
+ # error Boost version is too old
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ succeeded=yes
+ found_system=yes
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+ if test "x$succeeded" != "xyes"; then
+ _version=0
+ if test "$ac_boost_path" != ""; then
+ if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+ for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "$V_CHECK" = "1" ; then
+ _version=$_version_tmp
+ fi
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+ done
+ fi
+ else
+ for ac_boost_path in /usr /usr/local /opt /opt/local ; do
+ if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+ for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "$V_CHECK" = "1" ; then
+ _version=$_version_tmp
+ best_path=$ac_boost_path
+ fi
+ done
+ fi
+ done
+
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+ if test "$ac_boost_lib_path" = ""
+ then
+ BOOST_LDFLAGS="-L$best_path/lib"
+ fi
+
+ if test "x$BOOST_ROOT" != "x"; then
+ if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
+ version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+ stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+ stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
+ V_CHECK=`expr $stage_version_shorten \>\= $_version`
+ if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+ { $as_echo "$as_me:$LINENO: We will use a staged boost library from $BOOST_ROOT" >&5
+$as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;}
+ BOOST_CPPFLAGS="-I$BOOST_ROOT"
+ BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
+ fi
+ fi
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <boost/version.hpp>
+
+int
+main ()
+{
+
+ #if BOOST_VERSION >= $WANT_BOOST_VERSION
+ // Everything is okay
+ #else
+ # error Boost version is too old
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ succeeded=yes
+ found_system=yes
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ fi
+
+ if test "$succeeded" != "yes" ; then
+ if test "$_version" = "0" ; then
+ { { $as_echo "$as_me:$LINENO: error: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
+$as_echo "$as_me: error: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ { $as_echo "$as_me:$LINENO: Your boost libraries seems to old (version $_version)." >&5
+$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
+ fi
+ else
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BOOST /**/
+_ACEOF
+
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+fi
+
+
+
+
+# Check whether --with-bam was given.
+if test "${with_bam+set}" = set; then
+ withval=$with_bam;
+ if test "$withval" = "no"; then
+ want_bam="no"
+ elif test "$withval" = "yes"; then
+ want_bam="yes"
+ ac_bam_path=""
+ else
+ want_bam="yes"
+ ac_bam_path="$withval"
+ fi
+
+else
+ want_bam="yes"
+fi
+
+
+
+
+# Check whether --with-bam-libdir was given.
+if test "${with_bam_libdir+set}" = set; then
+ withval=$with_bam_libdir;
+ if test -d $withval
+ then
+ ac_bam_lib_path="$withval"
+ else
+ { { $as_echo "$as_me:$LINENO: error: --with-bam-libdir expected directory name" >&5
+$as_echo "$as_me: error: --with-bam-libdir expected directory name" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+else
+ ac_bam_lib_path=""
+
+fi
+
+
+if test "x$want_bam" = "xyes"; then
+# bam_lib_version_req=ifelse([], ,1.20.0,)
+# bam_lib_version_req_shorten=`expr $bam_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
+# bam_lib_version_req_major=`expr $bam_lib_version_req : '\([[0-9]]*\)'`
+# bam_lib_version_req_minor=`expr $bam_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+# bam_lib_version_req_sub_minor=`expr $bam_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+# if test "x$bam_lib_version_req_sub_minor" = "x" ; then
+# bam_lib_version_req_sub_minor="0"
+# fi
+# WANT_BAM_VERSION=`expr $bam_lib_version_req_major \* 100000 \+ $bam_lib_version_req_minor \* 100 \+ $bam_lib_version_req_sub_minor`
+ { $as_echo "$as_me:$LINENO: checking for bamlib" >&5
+$as_echo_n "checking for bamlib... " >&6; }
+ succeeded=no
+
+ if test "$ac_bam_path" != ""; then
+ BAM_LDFLAGS="-L$ac_bam_path/lib"
+ BAM_CPPFLAGS="-I$ac_bam_path/include"
+ else
+ for ac_bam_path_tmp in /usr /usr/local /opt /opt/local ; do
+ if test -d "$ac_bam_path_tmp/include/bam" && test -r "$ac_bam_path_tmp/include/bam"; then
+ BAM_LDFLAGS="-L$ac_bam_path_tmp/lib"
+ BAM_CPPFLAGS="-I$ac_bam_path_tmp/include"
+ break;
+ fi
+ done
+ fi
+
+ if test "$ac_bam_lib_path" != ""; then
+ BAM_LDFLAGS="-L$ac_bam_lib_path"
+ fi
+
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BAM_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BAM_LDFLAGS"
+ export LDFLAGS
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <bam/bam.h>
+
+int
+main ()
+{
+
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ succeeded=yes
+ found_system=yes
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ if test "x$succeeded" != "xyes"; then
+ _version=0
+ if test "$ac_bam_path" != ""; then
+ if test -d "$ac_bam_path" && test -r "$ac_bam_path"; then
+ for i in `ls -d $ac_bam_path/include/bam-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$ac_bam_path##" | sed 's/\/include\/bam-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "$V_CHECK" = "1" ; then
+ _version=$_version_tmp
+ fi
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BAM_CPPFLAGS="-I$ac_bam_path/include/bam-$VERSION_UNDERSCORE"
+ done
+ fi
+ else
+ for ac_bam_path in /usr /usr/local /opt /opt/local ; do
+ if test -d "$ac_bam_path" && test -r "$ac_bam_path"; then
+ for i in `ls -d $ac_bam_path/include/bam-* 2>/dev/null`; do
+ _version_tmp=`echo $i | sed "s#$ac_bam_path##" | sed 's/\/include\/bam-//' | sed 's/_/./'`
+ V_CHECK=`expr $_version_tmp \> $_version`
+ if test "$V_CHECK" = "1" ; then
+ _version=$_version_tmp
+ best_path=$ac_bam_path
+ fi
+ done
+ fi
+ done
+
+ VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+ BAM_CPPFLAGS="-I$best_path/include/bam-$VERSION_UNDERSCORE"
+ if test "$ac_bam_lib_path" = ""
+ then
+ BAM_LDFLAGS="-L$best_path/lib"
+ fi
+
+ if test "x$BAM_ROOT" != "x"; then
+ if test -d "$BAM_ROOT" && test -r "$BAM_ROOT" && test -d "$BAM_ROOT/stage/lib" && test -r "$BAM_ROOT/stage/lib"; then
+ version_dir=`expr //$BAM_ROOT : '.*/\(.*\)'`
+ stage_version=`echo $version_dir | sed 's/bam_//' | sed 's/_/./g'`
+ stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
+ V_CHECK=`expr $stage_version_shorten \>\= $_version`
+ if test "$V_CHECK" = "1" -a "$ac_bam_lib_path" = "" ; then
+ { $as_echo "$as_me:$LINENO: We will use a staged bam library from $BAM_ROOT" >&5
+$as_echo "$as_me: We will use a staged bam library from $BAM_ROOT" >&6;}
+ BAM_CPPFLAGS="-I$BAM_ROOT"
+ BAM_LDFLAGS="-L$BAM_ROOT/stage/lib"
+ fi
+ fi
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS $BAM_CPPFLAGS"
+ export CPPFLAGS
+ LDFLAGS="$LDFLAGS $BAM_LDFLAGS"
+ export LDFLAGS
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <bam/version.hpp>
+
+int
+main ()
+{
+
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ succeeded=yes
+ found_system=yes
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ fi
+
+ if test "$succeeded" != "yes" ; then
+ if test "$_version" = "0" ; then
+ { { $as_echo "$as_me:$LINENO: error: We could not detect the bam libraries (version $bam_lib_version_req_shorten or higher). If you have a staged bam library (still not installed) please specify \$BAM_ROOT in your environment and do not give a PATH to --with-bam option. If you are sure you have bam installed, then check your version number looking in <bam/version.hpp>. See http://randspringer.de/bam for more documentation." >&5
+$as_echo "$as_me: error: We could not detect the bam libraries (version $bam_lib_version_req_shorten or higher). If you have a staged bam library (still not installed) please specify \$BAM_ROOT in your environment and do not give a PATH to --with-bam option. If you are sure you have bam installed, then check your version number looking in <bam/version.hpp>. See http://randspringer.de/bam for more documentation." >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ { $as_echo "$as_me:$LINENO: Your bam libraries seem too old (version $_version)." >&5
+$as_echo "$as_me: Your bam libraries seem too old (version $_version)." >&6;}
+ fi
+ else
+ BAM_LIB="-lbam"
+
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BAM /**/
+_ACEOF
+
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+fi
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+
+
+
+# Check whether --with-boost-system was given.
+if test "${with_boost_system+set}" = set; then
+ withval=$with_boost_system;
+ if test "$withval" = "no"; then
+ want_boost="no"
+ elif test "$withval" = "yes"; then
+ want_boost="yes"
+ ax_boost_user_system_lib=""
+ ax_booth_user_system_lib=""
+ else
+ want_boost="yes"
+ echo "using $withval"
+ ax_boost_user_system_lib="$withval"
+ fi
+
+else
+ want_boost="yes"
+
+fi
+
+
+ if test "x$want_boost" = "xyes"; then
+
+
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ { $as_echo "$as_me:$LINENO: checking whether the Boost::System library is available" >&5
+$as_echo_n "checking whether the Boost::System library is available... " >&6; }
+if test "${ax_cv_boost_system+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ CXXFLAGS_SAVE=$CXXFLAGS
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <boost/system/system_error.hpp>
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ax_cv_boost_system=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ax_cv_boost_system=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CXXFLAGS=$CXXFLAGS_SAVE
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ax_cv_boost_system" >&5
+$as_echo "$ax_cv_boost_system" >&6; }
+ if test "x$ax_cv_boost_system" = "xyes"; then
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BOOST_SYSTEM /**/
+_ACEOF
+
+ BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+
+ LDFLAGS_SAVE=$LDFLAGS
+
+ if test "x$ax_boost_user_system_lib" = "x"; then
+ for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.a*$;\1;'`; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break
+else
+ link_system="no"
+fi
+
+ done
+ if test "x$link_system" != "xyes"; then
+ for libextension in `ls $BOOSTLIBDIR/boost_system*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break
+else
+ link_system="no"
+fi
+
+ done
+ fi
+
+ else
+ BOOST_SYSTEM_LIB="$ax_boost_user_system_lib";
+
+ link_system="yes";
+
+
+ fi
+
+ if test "x$ax_boost_user_system_lib" = "x"; then
+ for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.a*$;\1;'`; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break
+else
+ link_system="no"
+fi
+
+ done
+ if test "x$link_system" != "xyes"; then
+ for libextension in `ls $BOOSTLIBDIR/boost_system*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break
+else
+ link_system="no"
+fi
+
+ done
+ fi
+
+ else
+ BOOST_SYSTEM_LIB="$ax_boost_user_system_lib";
+
+ link_system="yes";
+
+
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+ fi
+
+
+
+# Check whether --with-boost-serialization was given.
+if test "${with_boost_serialization+set}" = set; then
+ withval=$with_boost_serialization;
+ if test "$withval" = "no"; then
+ want_boost="no"
+ elif test "$withval" = "yes"; then
+ want_boost="yes"
+ ax_boost_user_serialization_lib=""
+ ax_booth_user_serialization_lib=""
+ else
+ want_boost="yes"
+ echo "using $withval"
+ ax_boost_user_serialization_lib="$withval"
+ fi
+
+else
+ want_boost="yes"
+
+fi
+
+
+ if test "x$want_boost" = "xyes"; then
+
+
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ { $as_echo "$as_me:$LINENO: checking whether the Boost::Serialization library is available" >&5
+$as_echo_n "checking whether the Boost::Serialization library is available... " >&6; }
+if test "${ax_cv_boost_serialization+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ CXXFLAGS_SAVE=$CXXFLAGS
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <boost/serialization/utility.hpp>
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ax_cv_boost_serialization=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ax_cv_boost_serialization=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CXXFLAGS=$CXXFLAGS_SAVE
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ax_cv_boost_serialization" >&5
+$as_echo "$ax_cv_boost_serialization" >&6; }
+ if test "x$ax_cv_boost_serialization" = "xyes"; then
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BOOST_SERIALIZATION /**/
+_ACEOF
+
+ BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+
+ LDFLAGS_SAVE=$LDFLAGS
+
+ if test "x$ax_boost_user_serialization_lib" = "x"; then
+ for libextension in `ls $BOOSTLIBDIR/libboost_serialization*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_serialization.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_serialization.*\)\.a*$;\1;'`; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SERIALIZATION_LIB="-l$ax_lib"; link_serialization="yes"; break
+else
+ link_serialization="no"
+fi
+
+ done
+ if test "x$link_serialization" != "xyes"; then
+ for libextension in `ls $BOOSTLIBDIR/boost_serialization*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_serialization.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/libboost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_serialization.*\)\.a*$;\1;'` ; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SERIALIZATION_LIB="-l$ax_lib"; link_serialization="yes"; break
+else
+ link_serialization="no"
+fi
+
+ done
+ fi
+
+ else
+ BOOST_SERIALIZATION_LIB="$ax_boost_user_serialization_lib";
+
+ link_serialization="yes";
+
+
+ fi
+
+ if test "x$ax_boost_user_serialization_lib" = "x"; then
+ for libextension in `ls $BOOSTLIBDIR/libboost_serialization*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_serialization.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_serialization.*\)\.a*$;\1;'`; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SERIALIZATION_LIB="-l$ax_lib"; link_serialization="yes"; break
+else
+ link_serialization="no"
+fi
+
+ done
+ if test "x$link_serialization" != "xyes"; then
+ for libextension in `ls $BOOSTLIBDIR/boost_serialization*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_serialization.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/libboost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_serialization.*\)\.a*$;\1;'` ; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SERIALIZATION_LIB="-l$ax_lib"; link_serialization="yes"; break
+else
+ link_serialization="no"
+fi
+
+ done
+ fi
+
+ else
+ BOOST_SERIALIZATION_LIB="$ax_boost_user_serialization_lib";
+
+ link_serialization="yes";
+
+
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+ fi
+
+
+
+# Check whether --with-boost-thread was given.
+if test "${with_boost_thread+set}" = set; then
+ withval=$with_boost_thread;
+ if test "$withval" = "no"; then
+ want_boost="no"
+ elif test "$withval" = "yes"; then
+ want_boost="yes"
+ ax_boost_user_thread_lib=""
+ ax_booth_user_system_lib=""
+ else
+ want_boost="yes"
+ echo "using $withval"
+ ax_boost_user_thread_lib="$withval"
+ fi
+
+else
+ want_boost="yes"
+
+fi
+
+
+ if test "x$want_boost" = "xyes"; then
+
+
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ { $as_echo "$as_me:$LINENO: checking whether the Boost::Thread library is available" >&5
+$as_echo_n "checking whether the Boost::Thread library is available... " >&6; }
+if test "${ax_cv_boost_thread+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ CXXFLAGS_SAVE=$CXXFLAGS
+
+ if test "x$build_os" = "xsolaris" ; then
+ CXXFLAGS="-pthreads $CXXFLAGS"
+ elif test "x$build_os" = "xming32" ; then
+ CXXFLAGS="-mthreads $CXXFLAGS"
+ else
+ CXXFLAGS="-pthread $CXXFLAGS"
+ fi
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <boost/thread/thread.hpp>
+int
+main ()
+{
+boost::thread_group thrds;
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ax_cv_boost_thread=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ax_cv_boost_thread=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CXXFLAGS=$CXXFLAGS_SAVE
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ax_cv_boost_thread" >&5
+$as_echo "$ax_cv_boost_thread" >&6; }
+ if test "x$ax_cv_boost_thread" = "xyes"; then
+ if test "x$build_os" = "xsolaris" ; then
+ BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
+ elif test "x$build_os" = "xming32" ; then
+ BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
+ else
+ BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
+ fi
+
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BOOST_THREAD /**/
+_ACEOF
+
+ BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+
+ LDFLAGS_SAVE=$LDFLAGS
+ case "x$build_os" in
+ *bsd* )
+ LDFLAGS="-pthread $LDFLAGS"
+ break;
+ ;;
+ esac
+ if test "x$ax_boost_user_thread_lib" = "x"; then
+ for libextension in `ls $BOOSTLIBDIR/libboost_thread*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.a*$;\1;'`; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_THREAD_LIB="-l$ax_lib"; link_thread="yes"; break
+else
+ link_thread="no"
+fi
+
+ done
+ if test "x$link_thread" != "xyes"; then
+ for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_THREAD_LIB="-l$ax_lib"; link_thread="yes"; break
+else
+ link_thread="no"
+fi
+
+ done
+ fi
+
+ else
+ BOOST_THREAD_LIB="$ax_boost_user_thread_lib";
+
+ link_thread="yes";
+
+
+ fi
+ if test "x$link_thread" = "xno"; then
+ { { $as_echo "$as_me:$LINENO: error: Could not link against $ax_lib !" >&5
+$as_echo "$as_me: error: Could not link against $ax_lib !" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ case "x$build_os" in
+ *bsd* )
+ BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
+ break;
+ ;;
+ esac
+
+ fi
+
+ if test "x$ax_boost_user_system_lib" = "x"; then
+ for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.a*$;\1;'`; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break
+else
+ link_system="no"
+fi
+
+ done
+ if test "x$link_system" != "xyes"; then
+ for libextension in `ls $BOOSTLIBDIR/boost_system*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
+ ax_lib=${libextension}
+ as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
+int
+main ()
+{
+return exit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_Lib=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Lib'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ BOOST_SYSTEM_LIB="-l$ax_lib"; link_system="yes"; break
+else
+ link_system="no"
+fi
+
+ done
+ fi
+
+ else
+ BOOST_SYSTEM_LIB="$ax_boost_user_system_lib";
+
+ link_system="yes";
+
+
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+ fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+#
+# Handle user hints
+#
+{ $as_echo "$as_me:$LINENO: checking if zlib is wanted" >&5
+$as_echo_n "checking if zlib is wanted... " >&6; }
+
+# Check whether --with-zlib was given.
+if test "${with_zlib+set}" = set; then
+ withval=$with_zlib; if test "$withval" != no ; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ if test -d "$withval"
+ then
+ ZLIB_HOME="$withval"
+ else
+ { $as_echo "$as_me:$LINENO: WARNING: Sorry, $withval does not exist, checking usual places" >&5
+$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}
+ fi
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+
+
+ZLIB_HOME=/usr/local
+if test ! -f "${ZLIB_HOME}/include/zlib.h"
+then
+ ZLIB_HOME=/usr
+fi
+
+#
+# Locate zlib, if wanted
+#
+if test -n "${ZLIB_HOME}"
+then
+ ZLIB_OLD_LDFLAGS=$LDFLAGS
+ ZLIB_OLD_CPPFLAGS=$LDFLAGS
+ LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
+ CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ { $as_echo "$as_me:$LINENO: checking for inflateEnd in -lz" >&5
+$as_echo_n "checking for inflateEnd in -lz... " >&6; }
+if test "${ac_cv_lib_z_inflateEnd+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char inflateEnd ();
+int
+main ()
+{
+return inflateEnd ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_z_inflateEnd=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_z_inflateEnd=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateEnd" >&5
+$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }
+if test "x$ac_cv_lib_z_inflateEnd" = x""yes; then
+ zlib_cv_libz=yes
+else
+ zlib_cv_libz=no
+fi
+
+ if test "${ac_cv_header_zlib_h+set}" = set; then
+ { $as_echo "$as_me:$LINENO: checking for zlib.h" >&5
+$as_echo_n "checking for zlib.h... " >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+$as_echo "$ac_cv_header_zlib_h" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking zlib.h usability" >&5
+$as_echo_n "checking zlib.h usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <zlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking zlib.h presence" >&5
+$as_echo_n "checking zlib.h presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <zlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------ ##
+## Report this to cole at cs.umd.edu ##
+## ------------------------------ ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for zlib.h" >&5
+$as_echo_n "checking for zlib.h... " >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_header_zlib_h=$ac_header_preproc
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+$as_echo "$ac_cv_header_zlib_h" >&6; }
+
+fi
+if test "x$ac_cv_header_zlib_h" = x""yes; then
+ zlib_cv_zlib_h=yes
+else
+ zlib_cv_zlib_h=no
+fi
+
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
+ then
+ #
+ # If both library and header were found, use them
+ #
+
+{ $as_echo "$as_me:$LINENO: checking for inflateEnd in -lz" >&5
+$as_echo_n "checking for inflateEnd in -lz... " >&6; }
+if test "${ac_cv_lib_z_inflateEnd+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char inflateEnd ();
+int
+main ()
+{
+return inflateEnd ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_z_inflateEnd=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_z_inflateEnd=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateEnd" >&5
+$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }
+if test "x$ac_cv_lib_z_inflateEnd" = x""yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+ LIBS="-lz $LIBS"
+
+fi
+
+ { $as_echo "$as_me:$LINENO: checking zlib in ${ZLIB_HOME}" >&5
+$as_echo_n "checking zlib in ${ZLIB_HOME}... " >&6; }
+ { $as_echo "$as_me:$LINENO: result: ok" >&5
+$as_echo "ok" >&6; }
+ ZLIB="-lz"
+
+ else
+ #
+ # If either header or library was not found, revert and bomb
+ #
+ { $as_echo "$as_me:$LINENO: checking zlib in ${ZLIB_HOME}" >&5
+$as_echo_n "checking zlib in ${ZLIB_HOME}... " >&6; }
+ LDFLAGS="$ZLIB_OLD_LDFLAGS"
+ CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
+ { $as_echo "$as_me:$LINENO: result: failed" >&5
+$as_echo "failed" >&6; }
+ { { $as_echo "$as_me:$LINENO: error: either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib" >&5
+$as_echo "$as_me: error: either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+
+
+
+# Check whether --with-eigen was given.
+if test "${with_eigen+set}" = set; then
+ withval=$with_eigen;
+if test "$withval" = "no"; then
+want_eigen="no"
+elif test "$withval" = "yes"; then
+want_eigen="yes"
+ac_eigen_path=""
+else
+want_eigen="yes"
+ac_eigen_path="$withval"
+fi
+
+else
+ want_eigen="yes"
+fi
+
+
+if test "x$want_eigen" = "xyes"; then
+{ $as_echo "$as_me:$LINENO: checking for eigenlib" >&5
+$as_echo_n "checking for eigenlib... " >&6; }
+succeeded=no
+
+if test "$ac_eigen_path" != ""; then
+EIGEN_CPPFLAGS="-I$ac_eigen_path/include"
+else
+for ac_eigen_path_tmp in /usr /usr/local /opt /opt/local ; do
+if test -d "$ac_eigen_path_tmp/include/eigen" && test -r "$ac_eigen_path_tmp/include/eigen"; then
+EIGEN_CPPFLAGS="-I$ac_eigen_path_tmp/include"
+break;
+fi
+done
+fi
+
+CPPFLAGS_SAVED="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $EIGEN_CPPFLAGS"
+export EIGEN_CPPFLAGS
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <Eigen/Dense>
+
+int
+main ()
+{
+
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+succeeded=yes
+found_system=yes
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+CPPFLAGS="$CPPFLAGS $EIGEN_CPPFLAGS"
+export CPPFLAGS
+LDFLAGS="$LDFLAGS $EIGEN_LDFLAGS"
+export LDFLAGS
+export EIGEN_CPPFLAGS
+
+if test "$succeeded" == "yes" ; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_EIGEN /**/
+_ACEOF
+
+fi
+
+CPPFLAGS="$CPPFLAGS_SAVED"
+LDFLAGS="$LDFLAGS_SAVED"
+fi
+
+
+# Checks for header files.
+
+
+
+for ac_header in stdlib.h string.h unistd.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------ ##
+## Report this to cole at cs.umd.edu ##
+## ------------------------------ ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+as_val=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ if test "x$as_val" = x""yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdbool.h>
+#ifndef bool
+ "error: bool is not defined"
+#endif
+#ifndef false
+ "error: false is not defined"
+#endif
+#if false
+ "error: false is not 0"
+#endif
+#ifndef true
+ "error: true is not defined"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+#ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ bool e = &s;
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+# if defined __xlc__ || defined __GNUC__
+ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+ reported by James Lemley on 2005-10-05; see
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ This test is not quite right, since xlc is allowed to
+ reject this program, as the initializer for xlcbug is
+ not one of the forms that C requires support for.
+ However, doing the test right would require a runtime
+ test, and that would make cross-compilation harder.
+ Let us hope that IBM fixes the xlc bug, and also adds
+ support for this kind of constant expression. In the
+ meantime, this test will reject xlc, which is OK, since
+ our stdbool.h substitute should suffice. We also test
+ this with GCC, where it should work, to detect more
+ quickly whether someone messes up the test in the
+ future. */
+ char digs[] = "0123456789";
+ int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+# endif
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+
+int
+main ()
+{
+
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdbool_h=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdbool_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for _Bool" >&5
+$as_echo_n "checking for _Bool... " >&6; }
+if test "${ac_cv_type__Bool+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type__Bool=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (_Bool))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((_Bool)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type__Bool=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
+$as_echo "$ac_cv_type__Bool" >&6; }
+if test "x$ac_cv_type__Bool" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STDBOOL_H 1
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if test "${ac_cv_c_inline+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_c_inline=$ac_kw
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
+$as_echo_n "checking for pid_t... " >&6; }
+if test "${ac_cv_type_pid_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_pid_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (pid_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((pid_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_pid_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+$as_echo "$ac_cv_type_pid_t" >&6; }
+if test "x$ac_cv_type_pid_t" = x""yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
+$as_echo_n "checking for size_t... " >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_size_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((size_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_size_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+$as_echo "$ac_cv_type_size_t" >&6; }
+if test "x$ac_cv_type_size_t" = x""yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
+$as_echo_n "checking for ptrdiff_t... " >&6; }
+if test "${ac_cv_type_ptrdiff_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_ptrdiff_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (ptrdiff_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((ptrdiff_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_ptrdiff_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
+$as_echo "$ac_cv_type_ptrdiff_t" >&6; }
+if test "x$ac_cv_type_ptrdiff_t" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PTRDIFF_T 1
+_ACEOF
+
+
+fi
+
+
+
+# Checks for library functions.
+#AC_FUNC_FORK
+#AC_CHECK_FUNCS([floor memmove pow regcomp sqrt strchr strcspn strspn strstr])
+
+# check the platform
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+# set CFLAGS and CXXFLAGS
+user_CFLAGS=${CFLAGS}
+generic_CFLAGS="-Wall -Wno-strict-aliasing -g -gdwarf-2 -Wunused -Wuninitialized -ftemplate-depth-1024"
+ext_CFLAGS=""
+debug_CFLAGS=""
+#echo "${host_cpu}-${host_os}"
+case "${host_cpu}-${host_os}" in
+ i*86-*linux*)
+ ext_CFLAGS="-march=i686";;
+ i*86-darwin*)
+ CFLAGS="-m64"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ext_CFLAGS="-arch x86_64"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext;;
+ *)
+ { $as_echo "$as_me:$LINENO: checking if gcc accepts -m64" >&5
+$as_echo_n "checking if gcc accepts -m64... " >&6; }
+ CFLAGS="-m64"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ext_CFLAGS="-m64"; { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ext_CFLAGS="-D_FILE_OFFSET_BITS=64"; { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext;;
+esac
+
+# Check whether --enable-vectorize was given.
+if test "${enable_vectorize+set}" = set; then
+ enableval=$enable_vectorize; ext_CFLAGS="${ext_CFLAGS} -ftree-vectorize -msse3 -ffast-math -ftree-vectorizer-verbose=99"
+fi
+
+
+# Check whether --enable-intel64 was given.
+if test "${enable_intel64+set}" = set; then
+ enableval=$enable_intel64; ext_CFLAGS="${ext_CFLAGS} -march=nocona"
+fi
+
+
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval=$enable_debug;
+else
+ enable_debug=no
+fi
+
+
+
+# Check whether --enable-optim was given.
+if test "${enable_optim+set}" = set; then
+ enableval=$enable_optim; if test "x$enable_optim" = xyes; then enable_optim=3; fi
+else
+ enable_optim=3
+fi
+
+
+if test "x$enable_optim" != xno; then
+ ext_CFLAGS="$ext_CFLAGS -O$enable_optim"
+fi
+
+
+if test "x$enable_debug" = xyes; then
+ debug_CFLAGS="-DDEBUG"
+else
+ debug_CFLAGS="-DNDEBUG"
+fi
+
+
+# Check whether --enable-profiling was given.
+if test "${enable_profiling+set}" = set; then
+ enableval=$enable_profiling; ext_LDFLAGS="-lprofiler -ltcmalloc"
+fi
+
+
+CFLAGS="${generic_CFLAGS} ${ext_CFLAGS} ${user_CFLAGS} ${debug_CFLAGS} ${OPENMP_CFLAGS}"
+CXXFLAGS="$CFLAGS"
+CXXFLAGS="${CXXFLAGS} ${BOOST_CPPFLAGS} ${BAM_CPPFLAGS} ${EIGEN_CPPFLAGS}"
+user_LDFLAGS="$LDFLAGS"
+LDFLAGS="${ext_LDFLAGS} ${user_LDFLAGS}"
+
+# Checks for structures/functions that can be used to determine system memory
+{ $as_echo "$as_me:$LINENO: checking for struct sysinfo.totalram" >&5
+$as_echo_n "checking for struct sysinfo.totalram... " >&6; }
+if test "${ac_cv_member_struct_sysinfo_totalram+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sysinfo.h>
+
+int
+main ()
+{
+static struct sysinfo ac_aggr;
+if (ac_aggr.totalram)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_sysinfo_totalram=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sysinfo.h>
+
+int
+main ()
+{
+static struct sysinfo ac_aggr;
+if (sizeof ac_aggr.totalram)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_sysinfo_totalram=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_sysinfo_totalram=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_sysinfo_totalram" >&5
+$as_echo "$ac_cv_member_struct_sysinfo_totalram" >&6; }
+if test "x$ac_cv_member_struct_sysinfo_totalram" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_SYSINFO_TOTALRAM 1
+_ACEOF
+
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether sysctl is declared" >&5
+$as_echo_n "checking whether sysctl is declared... " >&6; }
+if test "${ac_cv_have_decl_sysctl+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sysctl.h>
+
+int
+main ()
+{
+#ifndef sysctl
+ (void) sysctl;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_sysctl=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_sysctl=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_sysctl" >&5
+$as_echo "$ac_cv_have_decl_sysctl" >&6; }
+if test "x$ac_cv_have_decl_sysctl" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYSCTL 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYSCTL 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether CTL_HW is declared" >&5
+$as_echo_n "checking whether CTL_HW is declared... " >&6; }
+if test "${ac_cv_have_decl_CTL_HW+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sysctl.h>
+
+int
+main ()
+{
+#ifndef CTL_HW
+ (void) CTL_HW;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_CTL_HW=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_CTL_HW=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_CTL_HW" >&5
+$as_echo "$ac_cv_have_decl_CTL_HW" >&6; }
+if test "x$ac_cv_have_decl_CTL_HW" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_CTL_HW 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_CTL_HW 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether HW_PHYSMEM is declared" >&5
+$as_echo_n "checking whether HW_PHYSMEM is declared... " >&6; }
+if test "${ac_cv_have_decl_HW_PHYSMEM+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sysctl.h>
+
+int
+main ()
+{
+#ifndef HW_PHYSMEM
+ (void) HW_PHYSMEM;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_HW_PHYSMEM=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_HW_PHYSMEM=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_HW_PHYSMEM" >&5
+$as_echo "$ac_cv_have_decl_HW_PHYSMEM" >&6; }
+if test "x$ac_cv_have_decl_HW_PHYSMEM" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_HW_PHYSMEM 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_HW_PHYSMEM 0
+_ACEOF
+
+
+fi
+
+
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='cufflinks'
+ VERSION='2.2.1'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+
+{ $as_echo "$as_me:$LINENO: checking how to create a pax tar archive" >&5
+$as_echo_n "checking how to create a pax tar archive... " >&6; }
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar pax cpio none'
+_am_tools=${am_cv_prog_tar_pax-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ { echo "$as_me:$LINENO: $_am_tar --version" >&5
+ ($_am_tar --version) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && break
+ done
+ am__tar="$_am_tar --format=posix -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=posix -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x pax -w "$$tardir"'
+ am__tar_='pax -L -x pax -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H pax -L'
+ am__tar_='find "$tardir" -print | cpio -o -H pax -L'
+ am__untar='cpio -i -H pax -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_pax}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
+ (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ { echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
+ ($am__untar <conftest.tar) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+if test "${am_cv_prog_tar_pax+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ am_cv_prog_tar_pax=$_am_tool
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $am_cv_prog_tar_pax" >&5
+$as_echo "$am_cv_prog_tar_pax" >&6; }
+
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+depcc="$CXX" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+
+
+ac_config_files="$ac_config_files Makefile src/Makefile"
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by cufflinks $as_me 2.2.1, which was
+generated by GNU Autoconf 2.63. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTION]... [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf at gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+cufflinks config.status 2.2.1
+configured by $0, generated by GNU Autoconf 2.63,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { $as_echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+
+ *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ $as_echo "$as_me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr='
'
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+ { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_t"; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
+$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
+ { (exit 1); exit 1; }; }
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ ac_file_inputs="$ac_file_inputs '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+ } >"$tmp/config.h" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$tmp/config.h" "$ac_file" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
+$as_echo "$as_me: error: could not create -" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ "$ac_file" | "$ac_file":* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for "$ac_file"" >`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir=$dirpart/$fdir
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+
+ esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+# dump some configuration confirmations
+echo \
+"
+-- ${PACKAGE_STRING} Configuration Results --
+ C++ compiler: ${CXX} ${CXXFLAGS} ${LDFLAGS}"
+
+if test x"${GCC}" = x"yes" ; then
+ gcc_version=`${CC} --version | head -n 1`
+ echo " GCC version: ${gcc_version}"
+else
+ gcc_version=''
+fi
+
+echo \
+" Host System type: ${host}
+ Install prefix: ${prefix}
+ Install eprefix: ${exec_prefix}
+
+ See config.h for further configuration information.
+ Email <${PACKAGE_BUGREPORT}> with questions and bug reports.
+"
+
+if test x"${PYTHON}" = x":" || ! test -x "${PYTHON}"; then
+ echo "WARNING! python was not found and is required to run some utility scripts"
+ echo " We recommend installing python and pointing configure to the installed location"
+fi
+
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..b20c0fb
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,1624 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#include $(top_srcdir)/build-aux/cufflinks.mk
+
+
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = cufflinks$(EXEEXT) cuffcompare$(EXEEXT) \
+ cuffdiff$(EXEEXT) gtf_to_sam$(EXEEXT) compress_gtf$(EXEEXT) \
+ gffread$(EXEEXT) cuffquant$(EXEEXT) cuffnorm$(EXEEXT)
+subdir = src
+DIST_COMMON = $(dist_bin_SCRIPTS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/ax_boost_base.m4 \
+ $(top_srcdir)/ax_boost_thread.m4 \
+ $(top_srcdir)/ax_boost_system.m4 \
+ $(top_srcdir)/ax_boost_serialization.m4 \
+ $(top_srcdir)/ax_bam.m4 $(top_srcdir)/ax_check_zlib.m4 \
+ $(top_srcdir)/ax_check_eigen.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libcufflinks_a_AR = $(AR) $(ARFLAGS)
+libcufflinks_a_LIBADD =
+am_libcufflinks_a_OBJECTS = clustering.$(OBJEXT) \
+ differential.$(OBJEXT) common.$(OBJEXT) assemble.$(OBJEXT) \
+ tokenize.$(OBJEXT) abundances.$(OBJEXT) scaffolds.$(OBJEXT) \
+ hits.$(OBJEXT) genes.$(OBJEXT) bundles.$(OBJEXT) \
+ filters.$(OBJEXT) scaffold_graph.$(OBJEXT) \
+ matching_merge.$(OBJEXT) graph_optimize.$(OBJEXT) \
+ biascorrection.$(OBJEXT) sampling.$(OBJEXT) adap.$(OBJEXT) \
+ ar_funs.$(OBJEXT) arith.$(OBJEXT) band.$(OBJEXT) \
+ c_args.$(OBJEXT) c_plot.$(OBJEXT) cmd.$(OBJEXT) \
+ dens_haz.$(OBJEXT) dens_int.$(OBJEXT) dens_odi.$(OBJEXT) \
+ density.$(OBJEXT) dist.$(OBJEXT) ev_atree.$(OBJEXT) \
+ ev_interp.$(OBJEXT) ev_kdtre.$(OBJEXT) ev_main.$(OBJEXT) \
+ ev_trian.$(OBJEXT) family.$(OBJEXT) fitted.$(OBJEXT) \
+ frend.$(OBJEXT) help.$(OBJEXT) lf_dercor.$(OBJEXT) \
+ lf_fitfun.$(OBJEXT) lf_robust.$(OBJEXT) lf_vari.$(OBJEXT) \
+ lfd.$(OBJEXT) lfstr.$(OBJEXT) linalg.$(OBJEXT) \
+ locfit.$(OBJEXT) m_chol.$(OBJEXT) m_eigen.$(OBJEXT) \
+ m_jacob.$(OBJEXT) m_max.$(OBJEXT) makecmd.$(OBJEXT) \
+ math.$(OBJEXT) minmax.$(OBJEXT) nbhd.$(OBJEXT) pcomp.$(OBJEXT) \
+ pout.$(OBJEXT) preplot.$(OBJEXT) random.$(OBJEXT) \
+ readfile.$(OBJEXT) scb.$(OBJEXT) scb_cons.$(OBJEXT) \
+ simul.$(OBJEXT) solve.$(OBJEXT) startlf.$(OBJEXT) \
+ strings.$(OBJEXT) vari.$(OBJEXT) wdiag.$(OBJEXT) \
+ weight.$(OBJEXT) replicates.$(OBJEXT) multireads.$(OBJEXT) \
+ jensen_shannon.$(OBJEXT) tracking.$(OBJEXT)
+libcufflinks_a_OBJECTS = $(am_libcufflinks_a_OBJECTS)
+libgc_a_AR = $(AR) $(ARFLAGS)
+libgc_a_LIBADD =
+am_libgc_a_OBJECTS = codons.$(OBJEXT) GArgs.$(OBJEXT) GBase.$(OBJEXT) \
+ gdna.$(OBJEXT) GStr.$(OBJEXT) GFaSeqGet.$(OBJEXT) \
+ GFastaIndex.$(OBJEXT) gff.$(OBJEXT) gff_utils.$(OBJEXT) \
+ gtf_tracking.$(OBJEXT)
+libgc_a_OBJECTS = $(am_libgc_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_compress_gtf_OBJECTS = compress_gtf.$(OBJEXT)
+compress_gtf_OBJECTS = $(am_compress_gtf_OBJECTS)
+am__DEPENDENCIES_1 =
+compress_gtf_DEPENDENCIES = libcufflinks.a libgc.a \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_cuffcompare_OBJECTS = cuffcompare.$(OBJEXT)
+cuffcompare_OBJECTS = $(am_cuffcompare_OBJECTS)
+cuffcompare_DEPENDENCIES = libgc.a
+am_cuffdiff_OBJECTS = cuffdiff.$(OBJEXT)
+cuffdiff_OBJECTS = $(am_cuffdiff_OBJECTS)
+cuffdiff_DEPENDENCIES = libcufflinks.a libgc.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_cufflinks_OBJECTS = cufflinks.$(OBJEXT)
+cufflinks_OBJECTS = $(am_cufflinks_OBJECTS)
+cufflinks_DEPENDENCIES = libcufflinks.a libgc.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_cuffnorm_OBJECTS = cuffnorm.$(OBJEXT)
+cuffnorm_OBJECTS = $(am_cuffnorm_OBJECTS)
+cuffnorm_DEPENDENCIES = libcufflinks.a libgc.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_cuffquant_OBJECTS = cuffquant.$(OBJEXT)
+cuffquant_OBJECTS = $(am_cuffquant_OBJECTS)
+cuffquant_DEPENDENCIES = libcufflinks.a libgc.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_gffread_OBJECTS = gffread.$(OBJEXT)
+gffread_OBJECTS = $(am_gffread_OBJECTS)
+gffread_DEPENDENCIES = libgc.a
+am_gtf_to_sam_OBJECTS = gtf_to_sam.$(OBJEXT)
+gtf_to_sam_OBJECTS = $(am_gtf_to_sam_OBJECTS)
+gtf_to_sam_DEPENDENCIES = libcufflinks.a libgc.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+dist_binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libcufflinks_a_SOURCES) $(libgc_a_SOURCES) \
+ $(compress_gtf_SOURCES) $(cuffcompare_SOURCES) \
+ $(cuffdiff_SOURCES) $(cufflinks_SOURCES) $(cuffnorm_SOURCES) \
+ $(cuffquant_SOURCES) $(gffread_SOURCES) $(gtf_to_sam_SOURCES)
+DIST_SOURCES = $(libcufflinks_a_SOURCES) $(libgc_a_SOURCES) \
+ $(compress_gtf_SOURCES) $(cuffcompare_SOURCES) \
+ $(cuffdiff_SOURCES) $(cufflinks_SOURCES) $(cuffnorm_SOURCES) \
+ $(cuffquant_SOURCES) $(gffread_SOURCES) $(gtf_to_sam_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BAM_CPPFLAGS = @BAM_CPPFLAGS@
+BAM_LDFLAGS = @BAM_LDFLAGS@
+BAM_LIB = @BAM_LIB@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_SERIALIZATION_LIB = @BOOST_SERIALIZATION_LIB@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
+BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EIGEN_CPPFLAGS = @EIGEN_CPPFLAGS@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZLIB = @ZLIB@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AM_CPPFLAGS = -I$(top_srcdir)/src
+EXTRA_DIST = \
+ $(top_srcdir)/AUTHORS $(top_srcdir)/make_bin.sh
+
+AM_CXXFLAGS =
+# cuffcluster
+# gtf_reads
+noinst_HEADERS = \
+ update_check.h \
+ biascorrection.h \
+ codons.h \
+ clustering.h \
+ differential.h \
+ GArgs.h \
+ GBase.h \
+ gdna.h \
+ GFaSeqGet.h \
+ GFastaIndex.h \
+ gff.h \
+ GHash.hh \
+ GVec.hh \
+ GList.hh \
+ GStr.h \
+ assemble.h \
+ bundles.h \
+ filters.h \
+ hits.h \
+ tokenize.h \
+ scaffolds.h \
+ abundances.h \
+ genes.h \
+ transitive_closure.h \
+ transitive_reduction.h \
+ gff_utils.h \
+ gtf_tracking.h \
+ progressbar.h \
+ bundles.h \
+ scaffold_graph.h \
+ matching_merge.h \
+ graph_optimize.h \
+ jensen_shannon.h \
+ sampling.h \
+ lemon/maps.h \
+ lemon/bin_heap.h \
+ lemon/fib_heap.h \
+ lemon/bipartite_matching.h \
+ lemon/topology.h \
+ lemon/bucket_heap.h \
+ lemon/smart_graph.h \
+ lemon/list_graph.h \
+ lemon/error.h \
+ lemon/graph_utils.h \
+ lemon/bfs.h \
+ lemon/dfs.h \
+ lemon/math.h \
+ lemon/tolerance.h \
+ lemon/graph_adaptor.h \
+ lemon/concept_check.h \
+ lemon/bits/default_map.h \
+ lemon/bits/array_map.h \
+ lemon/bits/vector_map.h \
+ lemon/bits/debug_map.h \
+ lemon/bits/map_extender.h \
+ lemon/bits/base_extender.h \
+ lemon/bits/graph_adaptor_extender.h \
+ lemon/bits/graph_extender.h \
+ lemon/bits/invalid.h \
+ lemon/bits/path_dump.h \
+ lemon/bits/traits.h \
+ lemon/bits/utility.h \
+ lemon/bits/alteration_notifier.h \
+ lemon/bits/variant.h \
+ lemon/concepts/graph.h \
+ lemon/concepts/bpugraph.h \
+ lemon/concepts/graph_components.h \
+ lemon/concepts/ugraph.h \
+ lemon/concepts/heap.h \
+ lemon/concepts/maps.h \
+ lemon/concepts/path.h \
+ lemon/concepts/matrix_maps.h \
+ locfit/design.h \
+ locfit/lfcons.h \
+ locfit/lfstruc.h \
+ locfit/local.h \
+ locfit/imatlb.h \
+ locfit/lffuns.h \
+ locfit/lfwin.h \
+ locfit/mutil.h \
+ locfit/vari.hpp \
+ replicates.h \
+ multireads.h \
+ rounding.h \
+ negative_binomial_distribution.h \
+ tracking.h \
+ common.h
+
+noinst_LIBRARIES = libcufflinks.a libgc.a
+libcufflinks_a_SOURCES = \
+ clustering.cpp \
+ differential.cpp \
+ common.cpp \
+ assemble.cpp \
+ tokenize.cpp \
+ abundances.cpp \
+ scaffolds.cpp \
+ hits.cpp \
+ genes.cpp \
+ bundles.cpp \
+ filters.cpp \
+ scaffold_graph.cpp \
+ matching_merge.cpp \
+ graph_optimize.cpp \
+ biascorrection.cpp \
+ sampling.cpp \
+ locfit/adap.c \
+ locfit/ar_funs.c \
+ locfit/arith.c \
+ locfit/band.c \
+ locfit/c_args.c \
+ locfit/c_plot.c \
+ locfit/cmd.c \
+ locfit/dens_haz.c \
+ locfit/dens_int.c \
+ locfit/dens_odi.c \
+ locfit/density.c \
+ locfit/dist.c \
+ locfit/ev_atree.c \
+ locfit/ev_interp.c \
+ locfit/ev_kdtre.c \
+ locfit/ev_main.c \
+ locfit/ev_trian.c \
+ locfit/family.c \
+ locfit/fitted.c \
+ locfit/frend.c \
+ locfit/help.c \
+ locfit/lf_dercor.c \
+ locfit/lf_fitfun.c \
+ locfit/lf_robust.c \
+ locfit/lf_vari.c \
+ locfit/lfd.c \
+ locfit/lfstr.c \
+ locfit/linalg.c \
+ locfit/locfit.c \
+ locfit/m_chol.c \
+ locfit/m_eigen.c \
+ locfit/m_jacob.c \
+ locfit/m_max.c \
+ locfit/makecmd.c \
+ locfit/math.c \
+ locfit/minmax.c \
+ locfit/nbhd.c \
+ locfit/pcomp.c \
+ locfit/pout.c \
+ locfit/preplot.c \
+ locfit/random.c \
+ locfit/readfile.c \
+ locfit/scb.c \
+ locfit/scb_cons.c \
+ locfit/simul.c \
+ locfit/solve.c \
+ locfit/startlf.c \
+ locfit/strings.c \
+ locfit/vari.cpp \
+ locfit/wdiag.c \
+ locfit/weight.c \
+ replicates.cpp \
+ multireads.cpp \
+ jensen_shannon.cpp \
+ tracking.cpp
+
+libgc_a_SOURCES = \
+ codons.cpp \
+ GArgs.cpp \
+ GBase.cpp \
+ gdna.cpp \
+ GStr.cpp \
+ GFaSeqGet.cpp \
+ GFastaIndex.cpp \
+ gff.cpp \
+ gff_utils.cpp \
+ gtf_tracking.cpp
+
+
+#-- scripts to be installed in $prefix/bin
+dist_bin_SCRIPTS = \
+ cuffmerge
+
+CLEANFILES = $(bin_SCRIPTS)
+
+#SUFFIXES = .py
+#.py:
+# (echo '#!$(PYTHON)'; sed '/^#!/d' $<) > $@
+cufflinks_SOURCES = cufflinks.cpp
+cufflinks_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+cufflinks_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) #$(ZLIB_LDFLAGS)
+cuffcompare_SOURCES = cuffcompare.cpp
+cuffcompare_LDADD = libgc.a
+gffread_SOURCES = gffread.cpp
+gffread_LDADD = libgc.a
+cuffdiff_SOURCES = cuffdiff.cpp
+cuffdiff_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+cuffdiff_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS)
+cuffquant_SOURCES = cuffquant.cpp
+cuffquant_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+cuffquant_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS)
+cuffnorm_SOURCES = cuffnorm.cpp
+cuffnorm_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+cuffnorm_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS)
+gtf_to_sam_SOURCES = gtf_to_sam.cpp
+gtf_to_sam_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+gtf_to_sam_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS)
+
+#cuffcluster_SOURCES = cuffcluster.cpp
+#cuffcluster_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+#cuffcluster_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS)
+compress_gtf_SOURCES = compress_gtf.cpp
+compress_gtf_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+compress_gtf_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libcufflinks.a: $(libcufflinks_a_OBJECTS) $(libcufflinks_a_DEPENDENCIES)
+ -rm -f libcufflinks.a
+ $(libcufflinks_a_AR) libcufflinks.a $(libcufflinks_a_OBJECTS) $(libcufflinks_a_LIBADD)
+ $(RANLIB) libcufflinks.a
+libgc.a: $(libgc_a_OBJECTS) $(libgc_a_DEPENDENCIES)
+ -rm -f libgc.a
+ $(libgc_a_AR) libgc.a $(libgc_a_OBJECTS) $(libgc_a_LIBADD)
+ $(RANLIB) libgc.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+compress_gtf$(EXEEXT): $(compress_gtf_OBJECTS) $(compress_gtf_DEPENDENCIES)
+ @rm -f compress_gtf$(EXEEXT)
+ $(CXXLINK) $(compress_gtf_LDFLAGS) $(compress_gtf_OBJECTS) $(compress_gtf_LDADD) $(LIBS)
+cuffcompare$(EXEEXT): $(cuffcompare_OBJECTS) $(cuffcompare_DEPENDENCIES)
+ @rm -f cuffcompare$(EXEEXT)
+ $(CXXLINK) $(cuffcompare_LDFLAGS) $(cuffcompare_OBJECTS) $(cuffcompare_LDADD) $(LIBS)
+cuffdiff$(EXEEXT): $(cuffdiff_OBJECTS) $(cuffdiff_DEPENDENCIES)
+ @rm -f cuffdiff$(EXEEXT)
+ $(CXXLINK) $(cuffdiff_LDFLAGS) $(cuffdiff_OBJECTS) $(cuffdiff_LDADD) $(LIBS)
+cufflinks$(EXEEXT): $(cufflinks_OBJECTS) $(cufflinks_DEPENDENCIES)
+ @rm -f cufflinks$(EXEEXT)
+ $(CXXLINK) $(cufflinks_LDFLAGS) $(cufflinks_OBJECTS) $(cufflinks_LDADD) $(LIBS)
+cuffnorm$(EXEEXT): $(cuffnorm_OBJECTS) $(cuffnorm_DEPENDENCIES)
+ @rm -f cuffnorm$(EXEEXT)
+ $(CXXLINK) $(cuffnorm_LDFLAGS) $(cuffnorm_OBJECTS) $(cuffnorm_LDADD) $(LIBS)
+cuffquant$(EXEEXT): $(cuffquant_OBJECTS) $(cuffquant_DEPENDENCIES)
+ @rm -f cuffquant$(EXEEXT)
+ $(CXXLINK) $(cuffquant_LDFLAGS) $(cuffquant_OBJECTS) $(cuffquant_LDADD) $(LIBS)
+gffread$(EXEEXT): $(gffread_OBJECTS) $(gffread_DEPENDENCIES)
+ @rm -f gffread$(EXEEXT)
+ $(CXXLINK) $(gffread_LDFLAGS) $(gffread_OBJECTS) $(gffread_LDADD) $(LIBS)
+gtf_to_sam$(EXEEXT): $(gtf_to_sam_OBJECTS) $(gtf_to_sam_DEPENDENCIES)
+ @rm -f gtf_to_sam$(EXEEXT)
+ $(CXXLINK) $(gtf_to_sam_LDFLAGS) $(gtf_to_sam_OBJECTS) $(gtf_to_sam_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(dist_binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(dist_binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GArgs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GBase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GFaSeqGet.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GFastaIndex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/GStr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abundances.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/adap.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ar_funs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/arith.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assemble.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/band.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/biascorrection.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bundles.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/c_args.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/c_plot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/clustering.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cmd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/codons.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/common.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compress_gtf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cuffcompare.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cuffdiff.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cufflinks.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cuffnorm.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cuffquant.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dens_haz.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dens_int.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dens_odi.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/density.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/differential.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ev_atree.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ev_interp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ev_kdtre.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ev_main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ev_trian.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/family.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/filters.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fitted.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/frend.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdna.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gff.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gff_utils.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gffread.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/graph_optimize.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gtf_to_sam.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gtf_tracking.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/help.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hits.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jensen_shannon.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lf_dercor.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lf_fitfun.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lf_robust.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lf_vari.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lfd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lfstr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/linalg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/locfit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/m_chol.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/m_eigen.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/m_jacob.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/m_max.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/makecmd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/matching_merge.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/math.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/minmax.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/multireads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nbhd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcomp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pout.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/preplot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/random.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readfile.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/replicates.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sampling.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scaffold_graph.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scaffolds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scb.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scb_cons.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simul.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/solve.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/startlf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/strings.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tokenize.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tracking.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vari.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/wdiag.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/weight.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+adap.o: locfit/adap.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adap.o -MD -MP -MF "$(DEPDIR)/adap.Tpo" -c -o adap.o `test -f 'locfit/adap.c' || echo '$(srcdir)/'`locfit/adap.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/adap.Tpo" "$(DEPDIR)/adap.Po"; else rm -f "$(DEPDIR)/adap.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/adap.c' object='adap.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adap.o `test -f 'locfit/adap.c' || echo '$(srcdir)/'`locfit/adap.c
+
+adap.obj: locfit/adap.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT adap.obj -MD -MP -MF "$(DEPDIR)/adap.Tpo" -c -o adap.obj `if test -f 'locfit/adap.c'; then $(CYGPATH_W) 'locfit/adap.c'; else $(CYGPATH_W) '$(srcdir)/locfit/adap.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/adap.Tpo" "$(DEPDIR)/adap.Po"; else rm -f "$(DEPDIR)/adap.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/adap.c' object='adap.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o adap.obj `if test -f 'locfit/adap.c'; then $(CYGPATH_W) 'locfit/adap.c'; else $(CYGPATH_W) '$(srcdir)/locfit/adap.c'; fi`
+
+ar_funs.o: locfit/ar_funs.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ar_funs.o -MD -MP -MF "$(DEPDIR)/ar_funs.Tpo" -c -o ar_funs.o `test -f 'locfit/ar_funs.c' || echo '$(srcdir)/'`locfit/ar_funs.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ar_funs.Tpo" "$(DEPDIR)/ar_funs.Po"; else rm -f "$(DEPDIR)/ar_funs.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ar_funs.c' object='ar_funs.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ar_funs.o `test -f 'locfit/ar_funs.c' || echo '$(srcdir)/'`locfit/ar_funs.c
+
+ar_funs.obj: locfit/ar_funs.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ar_funs.obj -MD -MP -MF "$(DEPDIR)/ar_funs.Tpo" -c -o ar_funs.obj `if test -f 'locfit/ar_funs.c'; then $(CYGPATH_W) 'locfit/ar_funs.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ar_funs.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ar_funs.Tpo" "$(DEPDIR)/ar_funs.Po"; else rm -f "$(DEPDIR)/ar_funs.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ar_funs.c' object='ar_funs.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ar_funs.obj `if test -f 'locfit/ar_funs.c'; then $(CYGPATH_W) 'locfit/ar_funs.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ar_funs.c'; fi`
+
+arith.o: locfit/arith.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT arith.o -MD -MP -MF "$(DEPDIR)/arith.Tpo" -c -o arith.o `test -f 'locfit/arith.c' || echo '$(srcdir)/'`locfit/arith.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/arith.Tpo" "$(DEPDIR)/arith.Po"; else rm -f "$(DEPDIR)/arith.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/arith.c' object='arith.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o arith.o `test -f 'locfit/arith.c' || echo '$(srcdir)/'`locfit/arith.c
+
+arith.obj: locfit/arith.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT arith.obj -MD -MP -MF "$(DEPDIR)/arith.Tpo" -c -o arith.obj `if test -f 'locfit/arith.c'; then $(CYGPATH_W) 'locfit/arith.c'; else $(CYGPATH_W) '$(srcdir)/locfit/arith.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/arith.Tpo" "$(DEPDIR)/arith.Po"; else rm -f "$(DEPDIR)/arith.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/arith.c' object='arith.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o arith.obj `if test -f 'locfit/arith.c'; then $(CYGPATH_W) 'locfit/arith.c'; else $(CYGPATH_W) '$(srcdir)/locfit/arith.c'; fi`
+
+band.o: locfit/band.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT band.o -MD -MP -MF "$(DEPDIR)/band.Tpo" -c -o band.o `test -f 'locfit/band.c' || echo '$(srcdir)/'`locfit/band.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/band.Tpo" "$(DEPDIR)/band.Po"; else rm -f "$(DEPDIR)/band.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/band.c' object='band.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o band.o `test -f 'locfit/band.c' || echo '$(srcdir)/'`locfit/band.c
+
+band.obj: locfit/band.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT band.obj -MD -MP -MF "$(DEPDIR)/band.Tpo" -c -o band.obj `if test -f 'locfit/band.c'; then $(CYGPATH_W) 'locfit/band.c'; else $(CYGPATH_W) '$(srcdir)/locfit/band.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/band.Tpo" "$(DEPDIR)/band.Po"; else rm -f "$(DEPDIR)/band.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/band.c' object='band.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o band.obj `if test -f 'locfit/band.c'; then $(CYGPATH_W) 'locfit/band.c'; else $(CYGPATH_W) '$(srcdir)/locfit/band.c'; fi`
+
+c_args.o: locfit/c_args.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT c_args.o -MD -MP -MF "$(DEPDIR)/c_args.Tpo" -c -o c_args.o `test -f 'locfit/c_args.c' || echo '$(srcdir)/'`locfit/c_args.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/c_args.Tpo" "$(DEPDIR)/c_args.Po"; else rm -f "$(DEPDIR)/c_args.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/c_args.c' object='c_args.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o c_args.o `test -f 'locfit/c_args.c' || echo '$(srcdir)/'`locfit/c_args.c
+
+c_args.obj: locfit/c_args.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT c_args.obj -MD -MP -MF "$(DEPDIR)/c_args.Tpo" -c -o c_args.obj `if test -f 'locfit/c_args.c'; then $(CYGPATH_W) 'locfit/c_args.c'; else $(CYGPATH_W) '$(srcdir)/locfit/c_args.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/c_args.Tpo" "$(DEPDIR)/c_args.Po"; else rm -f "$(DEPDIR)/c_args.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/c_args.c' object='c_args.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o c_args.obj `if test -f 'locfit/c_args.c'; then $(CYGPATH_W) 'locfit/c_args.c'; else $(CYGPATH_W) '$(srcdir)/locfit/c_args.c'; fi`
+
+c_plot.o: locfit/c_plot.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT c_plot.o -MD -MP -MF "$(DEPDIR)/c_plot.Tpo" -c -o c_plot.o `test -f 'locfit/c_plot.c' || echo '$(srcdir)/'`locfit/c_plot.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/c_plot.Tpo" "$(DEPDIR)/c_plot.Po"; else rm -f "$(DEPDIR)/c_plot.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/c_plot.c' object='c_plot.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o c_plot.o `test -f 'locfit/c_plot.c' || echo '$(srcdir)/'`locfit/c_plot.c
+
+c_plot.obj: locfit/c_plot.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT c_plot.obj -MD -MP -MF "$(DEPDIR)/c_plot.Tpo" -c -o c_plot.obj `if test -f 'locfit/c_plot.c'; then $(CYGPATH_W) 'locfit/c_plot.c'; else $(CYGPATH_W) '$(srcdir)/locfit/c_plot.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/c_plot.Tpo" "$(DEPDIR)/c_plot.Po"; else rm -f "$(DEPDIR)/c_plot.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/c_plot.c' object='c_plot.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o c_plot.obj `if test -f 'locfit/c_plot.c'; then $(CYGPATH_W) 'locfit/c_plot.c'; else $(CYGPATH_W) '$(srcdir)/locfit/c_plot.c'; fi`
+
+cmd.o: locfit/cmd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cmd.o -MD -MP -MF "$(DEPDIR)/cmd.Tpo" -c -o cmd.o `test -f 'locfit/cmd.c' || echo '$(srcdir)/'`locfit/cmd.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cmd.Tpo" "$(DEPDIR)/cmd.Po"; else rm -f "$(DEPDIR)/cmd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/cmd.c' object='cmd.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmd.o `test -f 'locfit/cmd.c' || echo '$(srcdir)/'`locfit/cmd.c
+
+cmd.obj: locfit/cmd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cmd.obj -MD -MP -MF "$(DEPDIR)/cmd.Tpo" -c -o cmd.obj `if test -f 'locfit/cmd.c'; then $(CYGPATH_W) 'locfit/cmd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/cmd.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cmd.Tpo" "$(DEPDIR)/cmd.Po"; else rm -f "$(DEPDIR)/cmd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/cmd.c' object='cmd.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmd.obj `if test -f 'locfit/cmd.c'; then $(CYGPATH_W) 'locfit/cmd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/cmd.c'; fi`
+
+dens_haz.o: locfit/dens_haz.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dens_haz.o -MD -MP -MF "$(DEPDIR)/dens_haz.Tpo" -c -o dens_haz.o `test -f 'locfit/dens_haz.c' || echo '$(srcdir)/'`locfit/dens_haz.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dens_haz.Tpo" "$(DEPDIR)/dens_haz.Po"; else rm -f "$(DEPDIR)/dens_haz.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dens_haz.c' object='dens_haz.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dens_haz.o `test -f 'locfit/dens_haz.c' || echo '$(srcdir)/'`locfit/dens_haz.c
+
+dens_haz.obj: locfit/dens_haz.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dens_haz.obj -MD -MP -MF "$(DEPDIR)/dens_haz.Tpo" -c -o dens_haz.obj `if test -f 'locfit/dens_haz.c'; then $(CYGPATH_W) 'locfit/dens_haz.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dens_haz.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dens_haz.Tpo" "$(DEPDIR)/dens_haz.Po"; else rm -f "$(DEPDIR)/dens_haz.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dens_haz.c' object='dens_haz.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dens_haz.obj `if test -f 'locfit/dens_haz.c'; then $(CYGPATH_W) 'locfit/dens_haz.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dens_haz.c'; fi`
+
+dens_int.o: locfit/dens_int.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dens_int.o -MD -MP -MF "$(DEPDIR)/dens_int.Tpo" -c -o dens_int.o `test -f 'locfit/dens_int.c' || echo '$(srcdir)/'`locfit/dens_int.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dens_int.Tpo" "$(DEPDIR)/dens_int.Po"; else rm -f "$(DEPDIR)/dens_int.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dens_int.c' object='dens_int.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dens_int.o `test -f 'locfit/dens_int.c' || echo '$(srcdir)/'`locfit/dens_int.c
+
+dens_int.obj: locfit/dens_int.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dens_int.obj -MD -MP -MF "$(DEPDIR)/dens_int.Tpo" -c -o dens_int.obj `if test -f 'locfit/dens_int.c'; then $(CYGPATH_W) 'locfit/dens_int.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dens_int.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dens_int.Tpo" "$(DEPDIR)/dens_int.Po"; else rm -f "$(DEPDIR)/dens_int.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dens_int.c' object='dens_int.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dens_int.obj `if test -f 'locfit/dens_int.c'; then $(CYGPATH_W) 'locfit/dens_int.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dens_int.c'; fi`
+
+dens_odi.o: locfit/dens_odi.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dens_odi.o -MD -MP -MF "$(DEPDIR)/dens_odi.Tpo" -c -o dens_odi.o `test -f 'locfit/dens_odi.c' || echo '$(srcdir)/'`locfit/dens_odi.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dens_odi.Tpo" "$(DEPDIR)/dens_odi.Po"; else rm -f "$(DEPDIR)/dens_odi.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dens_odi.c' object='dens_odi.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dens_odi.o `test -f 'locfit/dens_odi.c' || echo '$(srcdir)/'`locfit/dens_odi.c
+
+dens_odi.obj: locfit/dens_odi.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dens_odi.obj -MD -MP -MF "$(DEPDIR)/dens_odi.Tpo" -c -o dens_odi.obj `if test -f 'locfit/dens_odi.c'; then $(CYGPATH_W) 'locfit/dens_odi.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dens_odi.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dens_odi.Tpo" "$(DEPDIR)/dens_odi.Po"; else rm -f "$(DEPDIR)/dens_odi.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dens_odi.c' object='dens_odi.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dens_odi.obj `if test -f 'locfit/dens_odi.c'; then $(CYGPATH_W) 'locfit/dens_odi.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dens_odi.c'; fi`
+
+density.o: locfit/density.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT density.o -MD -MP -MF "$(DEPDIR)/density.Tpo" -c -o density.o `test -f 'locfit/density.c' || echo '$(srcdir)/'`locfit/density.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/density.Tpo" "$(DEPDIR)/density.Po"; else rm -f "$(DEPDIR)/density.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/density.c' object='density.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o density.o `test -f 'locfit/density.c' || echo '$(srcdir)/'`locfit/density.c
+
+density.obj: locfit/density.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT density.obj -MD -MP -MF "$(DEPDIR)/density.Tpo" -c -o density.obj `if test -f 'locfit/density.c'; then $(CYGPATH_W) 'locfit/density.c'; else $(CYGPATH_W) '$(srcdir)/locfit/density.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/density.Tpo" "$(DEPDIR)/density.Po"; else rm -f "$(DEPDIR)/density.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/density.c' object='density.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o density.obj `if test -f 'locfit/density.c'; then $(CYGPATH_W) 'locfit/density.c'; else $(CYGPATH_W) '$(srcdir)/locfit/density.c'; fi`
+
+dist.o: locfit/dist.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dist.o -MD -MP -MF "$(DEPDIR)/dist.Tpo" -c -o dist.o `test -f 'locfit/dist.c' || echo '$(srcdir)/'`locfit/dist.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dist.Tpo" "$(DEPDIR)/dist.Po"; else rm -f "$(DEPDIR)/dist.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dist.c' object='dist.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dist.o `test -f 'locfit/dist.c' || echo '$(srcdir)/'`locfit/dist.c
+
+dist.obj: locfit/dist.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dist.obj -MD -MP -MF "$(DEPDIR)/dist.Tpo" -c -o dist.obj `if test -f 'locfit/dist.c'; then $(CYGPATH_W) 'locfit/dist.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dist.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dist.Tpo" "$(DEPDIR)/dist.Po"; else rm -f "$(DEPDIR)/dist.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/dist.c' object='dist.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dist.obj `if test -f 'locfit/dist.c'; then $(CYGPATH_W) 'locfit/dist.c'; else $(CYGPATH_W) '$(srcdir)/locfit/dist.c'; fi`
+
+ev_atree.o: locfit/ev_atree.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_atree.o -MD -MP -MF "$(DEPDIR)/ev_atree.Tpo" -c -o ev_atree.o `test -f 'locfit/ev_atree.c' || echo '$(srcdir)/'`locfit/ev_atree.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_atree.Tpo" "$(DEPDIR)/ev_atree.Po"; else rm -f "$(DEPDIR)/ev_atree.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_atree.c' object='ev_atree.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_atree.o `test -f 'locfit/ev_atree.c' || echo '$(srcdir)/'`locfit/ev_atree.c
+
+ev_atree.obj: locfit/ev_atree.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_atree.obj -MD -MP -MF "$(DEPDIR)/ev_atree.Tpo" -c -o ev_atree.obj `if test -f 'locfit/ev_atree.c'; then $(CYGPATH_W) 'locfit/ev_atree.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_atree.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_atree.Tpo" "$(DEPDIR)/ev_atree.Po"; else rm -f "$(DEPDIR)/ev_atree.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_atree.c' object='ev_atree.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_atree.obj `if test -f 'locfit/ev_atree.c'; then $(CYGPATH_W) 'locfit/ev_atree.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_atree.c'; fi`
+
+ev_interp.o: locfit/ev_interp.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_interp.o -MD -MP -MF "$(DEPDIR)/ev_interp.Tpo" -c -o ev_interp.o `test -f 'locfit/ev_interp.c' || echo '$(srcdir)/'`locfit/ev_interp.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_interp.Tpo" "$(DEPDIR)/ev_interp.Po"; else rm -f "$(DEPDIR)/ev_interp.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_interp.c' object='ev_interp.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_interp.o `test -f 'locfit/ev_interp.c' || echo '$(srcdir)/'`locfit/ev_interp.c
+
+ev_interp.obj: locfit/ev_interp.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_interp.obj -MD -MP -MF "$(DEPDIR)/ev_interp.Tpo" -c -o ev_interp.obj `if test -f 'locfit/ev_interp.c'; then $(CYGPATH_W) 'locfit/ev_interp.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_interp.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_interp.Tpo" "$(DEPDIR)/ev_interp.Po"; else rm -f "$(DEPDIR)/ev_interp.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_interp.c' object='ev_interp.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_interp.obj `if test -f 'locfit/ev_interp.c'; then $(CYGPATH_W) 'locfit/ev_interp.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_interp.c'; fi`
+
+ev_kdtre.o: locfit/ev_kdtre.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_kdtre.o -MD -MP -MF "$(DEPDIR)/ev_kdtre.Tpo" -c -o ev_kdtre.o `test -f 'locfit/ev_kdtre.c' || echo '$(srcdir)/'`locfit/ev_kdtre.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_kdtre.Tpo" "$(DEPDIR)/ev_kdtre.Po"; else rm -f "$(DEPDIR)/ev_kdtre.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_kdtre.c' object='ev_kdtre.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_kdtre.o `test -f 'locfit/ev_kdtre.c' || echo '$(srcdir)/'`locfit/ev_kdtre.c
+
+ev_kdtre.obj: locfit/ev_kdtre.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_kdtre.obj -MD -MP -MF "$(DEPDIR)/ev_kdtre.Tpo" -c -o ev_kdtre.obj `if test -f 'locfit/ev_kdtre.c'; then $(CYGPATH_W) 'locfit/ev_kdtre.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_kdtre.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_kdtre.Tpo" "$(DEPDIR)/ev_kdtre.Po"; else rm -f "$(DEPDIR)/ev_kdtre.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_kdtre.c' object='ev_kdtre.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_kdtre.obj `if test -f 'locfit/ev_kdtre.c'; then $(CYGPATH_W) 'locfit/ev_kdtre.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_kdtre.c'; fi`
+
+ev_main.o: locfit/ev_main.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_main.o -MD -MP -MF "$(DEPDIR)/ev_main.Tpo" -c -o ev_main.o `test -f 'locfit/ev_main.c' || echo '$(srcdir)/'`locfit/ev_main.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_main.Tpo" "$(DEPDIR)/ev_main.Po"; else rm -f "$(DEPDIR)/ev_main.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_main.c' object='ev_main.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_main.o `test -f 'locfit/ev_main.c' || echo '$(srcdir)/'`locfit/ev_main.c
+
+ev_main.obj: locfit/ev_main.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_main.obj -MD -MP -MF "$(DEPDIR)/ev_main.Tpo" -c -o ev_main.obj `if test -f 'locfit/ev_main.c'; then $(CYGPATH_W) 'locfit/ev_main.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_main.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_main.Tpo" "$(DEPDIR)/ev_main.Po"; else rm -f "$(DEPDIR)/ev_main.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_main.c' object='ev_main.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_main.obj `if test -f 'locfit/ev_main.c'; then $(CYGPATH_W) 'locfit/ev_main.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_main.c'; fi`
+
+ev_trian.o: locfit/ev_trian.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_trian.o -MD -MP -MF "$(DEPDIR)/ev_trian.Tpo" -c -o ev_trian.o `test -f 'locfit/ev_trian.c' || echo '$(srcdir)/'`locfit/ev_trian.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_trian.Tpo" "$(DEPDIR)/ev_trian.Po"; else rm -f "$(DEPDIR)/ev_trian.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_trian.c' object='ev_trian.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_trian.o `test -f 'locfit/ev_trian.c' || echo '$(srcdir)/'`locfit/ev_trian.c
+
+ev_trian.obj: locfit/ev_trian.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ev_trian.obj -MD -MP -MF "$(DEPDIR)/ev_trian.Tpo" -c -o ev_trian.obj `if test -f 'locfit/ev_trian.c'; then $(CYGPATH_W) 'locfit/ev_trian.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_trian.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ev_trian.Tpo" "$(DEPDIR)/ev_trian.Po"; else rm -f "$(DEPDIR)/ev_trian.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/ev_trian.c' object='ev_trian.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ev_trian.obj `if test -f 'locfit/ev_trian.c'; then $(CYGPATH_W) 'locfit/ev_trian.c'; else $(CYGPATH_W) '$(srcdir)/locfit/ev_trian.c'; fi`
+
+family.o: locfit/family.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT family.o -MD -MP -MF "$(DEPDIR)/family.Tpo" -c -o family.o `test -f 'locfit/family.c' || echo '$(srcdir)/'`locfit/family.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/family.Tpo" "$(DEPDIR)/family.Po"; else rm -f "$(DEPDIR)/family.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/family.c' object='family.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o family.o `test -f 'locfit/family.c' || echo '$(srcdir)/'`locfit/family.c
+
+family.obj: locfit/family.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT family.obj -MD -MP -MF "$(DEPDIR)/family.Tpo" -c -o family.obj `if test -f 'locfit/family.c'; then $(CYGPATH_W) 'locfit/family.c'; else $(CYGPATH_W) '$(srcdir)/locfit/family.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/family.Tpo" "$(DEPDIR)/family.Po"; else rm -f "$(DEPDIR)/family.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/family.c' object='family.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o family.obj `if test -f 'locfit/family.c'; then $(CYGPATH_W) 'locfit/family.c'; else $(CYGPATH_W) '$(srcdir)/locfit/family.c'; fi`
+
+fitted.o: locfit/fitted.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fitted.o -MD -MP -MF "$(DEPDIR)/fitted.Tpo" -c -o fitted.o `test -f 'locfit/fitted.c' || echo '$(srcdir)/'`locfit/fitted.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fitted.Tpo" "$(DEPDIR)/fitted.Po"; else rm -f "$(DEPDIR)/fitted.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/fitted.c' object='fitted.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fitted.o `test -f 'locfit/fitted.c' || echo '$(srcdir)/'`locfit/fitted.c
+
+fitted.obj: locfit/fitted.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fitted.obj -MD -MP -MF "$(DEPDIR)/fitted.Tpo" -c -o fitted.obj `if test -f 'locfit/fitted.c'; then $(CYGPATH_W) 'locfit/fitted.c'; else $(CYGPATH_W) '$(srcdir)/locfit/fitted.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/fitted.Tpo" "$(DEPDIR)/fitted.Po"; else rm -f "$(DEPDIR)/fitted.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/fitted.c' object='fitted.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fitted.obj `if test -f 'locfit/fitted.c'; then $(CYGPATH_W) 'locfit/fitted.c'; else $(CYGPATH_W) '$(srcdir)/locfit/fitted.c'; fi`
+
+frend.o: locfit/frend.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT frend.o -MD -MP -MF "$(DEPDIR)/frend.Tpo" -c -o frend.o `test -f 'locfit/frend.c' || echo '$(srcdir)/'`locfit/frend.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/frend.Tpo" "$(DEPDIR)/frend.Po"; else rm -f "$(DEPDIR)/frend.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/frend.c' object='frend.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o frend.o `test -f 'locfit/frend.c' || echo '$(srcdir)/'`locfit/frend.c
+
+frend.obj: locfit/frend.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT frend.obj -MD -MP -MF "$(DEPDIR)/frend.Tpo" -c -o frend.obj `if test -f 'locfit/frend.c'; then $(CYGPATH_W) 'locfit/frend.c'; else $(CYGPATH_W) '$(srcdir)/locfit/frend.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/frend.Tpo" "$(DEPDIR)/frend.Po"; else rm -f "$(DEPDIR)/frend.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/frend.c' object='frend.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o frend.obj `if test -f 'locfit/frend.c'; then $(CYGPATH_W) 'locfit/frend.c'; else $(CYGPATH_W) '$(srcdir)/locfit/frend.c'; fi`
+
+help.o: locfit/help.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT help.o -MD -MP -MF "$(DEPDIR)/help.Tpo" -c -o help.o `test -f 'locfit/help.c' || echo '$(srcdir)/'`locfit/help.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/help.Tpo" "$(DEPDIR)/help.Po"; else rm -f "$(DEPDIR)/help.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/help.c' object='help.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o help.o `test -f 'locfit/help.c' || echo '$(srcdir)/'`locfit/help.c
+
+help.obj: locfit/help.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT help.obj -MD -MP -MF "$(DEPDIR)/help.Tpo" -c -o help.obj `if test -f 'locfit/help.c'; then $(CYGPATH_W) 'locfit/help.c'; else $(CYGPATH_W) '$(srcdir)/locfit/help.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/help.Tpo" "$(DEPDIR)/help.Po"; else rm -f "$(DEPDIR)/help.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/help.c' object='help.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o help.obj `if test -f 'locfit/help.c'; then $(CYGPATH_W) 'locfit/help.c'; else $(CYGPATH_W) '$(srcdir)/locfit/help.c'; fi`
+
+lf_dercor.o: locfit/lf_dercor.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_dercor.o -MD -MP -MF "$(DEPDIR)/lf_dercor.Tpo" -c -o lf_dercor.o `test -f 'locfit/lf_dercor.c' || echo '$(srcdir)/'`locfit/lf_dercor.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_dercor.Tpo" "$(DEPDIR)/lf_dercor.Po"; else rm -f "$(DEPDIR)/lf_dercor.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_dercor.c' object='lf_dercor.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_dercor.o `test -f 'locfit/lf_dercor.c' || echo '$(srcdir)/'`locfit/lf_dercor.c
+
+lf_dercor.obj: locfit/lf_dercor.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_dercor.obj -MD -MP -MF "$(DEPDIR)/lf_dercor.Tpo" -c -o lf_dercor.obj `if test -f 'locfit/lf_dercor.c'; then $(CYGPATH_W) 'locfit/lf_dercor.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_dercor.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_dercor.Tpo" "$(DEPDIR)/lf_dercor.Po"; else rm -f "$(DEPDIR)/lf_dercor.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_dercor.c' object='lf_dercor.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_dercor.obj `if test -f 'locfit/lf_dercor.c'; then $(CYGPATH_W) 'locfit/lf_dercor.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_dercor.c'; fi`
+
+lf_fitfun.o: locfit/lf_fitfun.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_fitfun.o -MD -MP -MF "$(DEPDIR)/lf_fitfun.Tpo" -c -o lf_fitfun.o `test -f 'locfit/lf_fitfun.c' || echo '$(srcdir)/'`locfit/lf_fitfun.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_fitfun.Tpo" "$(DEPDIR)/lf_fitfun.Po"; else rm -f "$(DEPDIR)/lf_fitfun.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_fitfun.c' object='lf_fitfun.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_fitfun.o `test -f 'locfit/lf_fitfun.c' || echo '$(srcdir)/'`locfit/lf_fitfun.c
+
+lf_fitfun.obj: locfit/lf_fitfun.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_fitfun.obj -MD -MP -MF "$(DEPDIR)/lf_fitfun.Tpo" -c -o lf_fitfun.obj `if test -f 'locfit/lf_fitfun.c'; then $(CYGPATH_W) 'locfit/lf_fitfun.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_fitfun.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_fitfun.Tpo" "$(DEPDIR)/lf_fitfun.Po"; else rm -f "$(DEPDIR)/lf_fitfun.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_fitfun.c' object='lf_fitfun.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_fitfun.obj `if test -f 'locfit/lf_fitfun.c'; then $(CYGPATH_W) 'locfit/lf_fitfun.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_fitfun.c'; fi`
+
+lf_robust.o: locfit/lf_robust.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_robust.o -MD -MP -MF "$(DEPDIR)/lf_robust.Tpo" -c -o lf_robust.o `test -f 'locfit/lf_robust.c' || echo '$(srcdir)/'`locfit/lf_robust.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_robust.Tpo" "$(DEPDIR)/lf_robust.Po"; else rm -f "$(DEPDIR)/lf_robust.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_robust.c' object='lf_robust.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_robust.o `test -f 'locfit/lf_robust.c' || echo '$(srcdir)/'`locfit/lf_robust.c
+
+lf_robust.obj: locfit/lf_robust.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_robust.obj -MD -MP -MF "$(DEPDIR)/lf_robust.Tpo" -c -o lf_robust.obj `if test -f 'locfit/lf_robust.c'; then $(CYGPATH_W) 'locfit/lf_robust.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_robust.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_robust.Tpo" "$(DEPDIR)/lf_robust.Po"; else rm -f "$(DEPDIR)/lf_robust.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_robust.c' object='lf_robust.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_robust.obj `if test -f 'locfit/lf_robust.c'; then $(CYGPATH_W) 'locfit/lf_robust.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_robust.c'; fi`
+
+lf_vari.o: locfit/lf_vari.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_vari.o -MD -MP -MF "$(DEPDIR)/lf_vari.Tpo" -c -o lf_vari.o `test -f 'locfit/lf_vari.c' || echo '$(srcdir)/'`locfit/lf_vari.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_vari.Tpo" "$(DEPDIR)/lf_vari.Po"; else rm -f "$(DEPDIR)/lf_vari.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_vari.c' object='lf_vari.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_vari.o `test -f 'locfit/lf_vari.c' || echo '$(srcdir)/'`locfit/lf_vari.c
+
+lf_vari.obj: locfit/lf_vari.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lf_vari.obj -MD -MP -MF "$(DEPDIR)/lf_vari.Tpo" -c -o lf_vari.obj `if test -f 'locfit/lf_vari.c'; then $(CYGPATH_W) 'locfit/lf_vari.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_vari.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lf_vari.Tpo" "$(DEPDIR)/lf_vari.Po"; else rm -f "$(DEPDIR)/lf_vari.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lf_vari.c' object='lf_vari.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lf_vari.obj `if test -f 'locfit/lf_vari.c'; then $(CYGPATH_W) 'locfit/lf_vari.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lf_vari.c'; fi`
+
+lfd.o: locfit/lfd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lfd.o -MD -MP -MF "$(DEPDIR)/lfd.Tpo" -c -o lfd.o `test -f 'locfit/lfd.c' || echo '$(srcdir)/'`locfit/lfd.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lfd.Tpo" "$(DEPDIR)/lfd.Po"; else rm -f "$(DEPDIR)/lfd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lfd.c' object='lfd.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lfd.o `test -f 'locfit/lfd.c' || echo '$(srcdir)/'`locfit/lfd.c
+
+lfd.obj: locfit/lfd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lfd.obj -MD -MP -MF "$(DEPDIR)/lfd.Tpo" -c -o lfd.obj `if test -f 'locfit/lfd.c'; then $(CYGPATH_W) 'locfit/lfd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lfd.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lfd.Tpo" "$(DEPDIR)/lfd.Po"; else rm -f "$(DEPDIR)/lfd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lfd.c' object='lfd.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lfd.obj `if test -f 'locfit/lfd.c'; then $(CYGPATH_W) 'locfit/lfd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lfd.c'; fi`
+
+lfstr.o: locfit/lfstr.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lfstr.o -MD -MP -MF "$(DEPDIR)/lfstr.Tpo" -c -o lfstr.o `test -f 'locfit/lfstr.c' || echo '$(srcdir)/'`locfit/lfstr.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lfstr.Tpo" "$(DEPDIR)/lfstr.Po"; else rm -f "$(DEPDIR)/lfstr.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lfstr.c' object='lfstr.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lfstr.o `test -f 'locfit/lfstr.c' || echo '$(srcdir)/'`locfit/lfstr.c
+
+lfstr.obj: locfit/lfstr.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lfstr.obj -MD -MP -MF "$(DEPDIR)/lfstr.Tpo" -c -o lfstr.obj `if test -f 'locfit/lfstr.c'; then $(CYGPATH_W) 'locfit/lfstr.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lfstr.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lfstr.Tpo" "$(DEPDIR)/lfstr.Po"; else rm -f "$(DEPDIR)/lfstr.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/lfstr.c' object='lfstr.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lfstr.obj `if test -f 'locfit/lfstr.c'; then $(CYGPATH_W) 'locfit/lfstr.c'; else $(CYGPATH_W) '$(srcdir)/locfit/lfstr.c'; fi`
+
+linalg.o: locfit/linalg.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linalg.o -MD -MP -MF "$(DEPDIR)/linalg.Tpo" -c -o linalg.o `test -f 'locfit/linalg.c' || echo '$(srcdir)/'`locfit/linalg.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/linalg.Tpo" "$(DEPDIR)/linalg.Po"; else rm -f "$(DEPDIR)/linalg.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/linalg.c' object='linalg.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linalg.o `test -f 'locfit/linalg.c' || echo '$(srcdir)/'`locfit/linalg.c
+
+linalg.obj: locfit/linalg.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linalg.obj -MD -MP -MF "$(DEPDIR)/linalg.Tpo" -c -o linalg.obj `if test -f 'locfit/linalg.c'; then $(CYGPATH_W) 'locfit/linalg.c'; else $(CYGPATH_W) '$(srcdir)/locfit/linalg.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/linalg.Tpo" "$(DEPDIR)/linalg.Po"; else rm -f "$(DEPDIR)/linalg.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/linalg.c' object='linalg.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linalg.obj `if test -f 'locfit/linalg.c'; then $(CYGPATH_W) 'locfit/linalg.c'; else $(CYGPATH_W) '$(srcdir)/locfit/linalg.c'; fi`
+
+locfit.o: locfit/locfit.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT locfit.o -MD -MP -MF "$(DEPDIR)/locfit.Tpo" -c -o locfit.o `test -f 'locfit/locfit.c' || echo '$(srcdir)/'`locfit/locfit.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/locfit.Tpo" "$(DEPDIR)/locfit.Po"; else rm -f "$(DEPDIR)/locfit.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/locfit.c' object='locfit.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o locfit.o `test -f 'locfit/locfit.c' || echo '$(srcdir)/'`locfit/locfit.c
+
+locfit.obj: locfit/locfit.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT locfit.obj -MD -MP -MF "$(DEPDIR)/locfit.Tpo" -c -o locfit.obj `if test -f 'locfit/locfit.c'; then $(CYGPATH_W) 'locfit/locfit.c'; else $(CYGPATH_W) '$(srcdir)/locfit/locfit.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/locfit.Tpo" "$(DEPDIR)/locfit.Po"; else rm -f "$(DEPDIR)/locfit.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/locfit.c' object='locfit.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o locfit.obj `if test -f 'locfit/locfit.c'; then $(CYGPATH_W) 'locfit/locfit.c'; else $(CYGPATH_W) '$(srcdir)/locfit/locfit.c'; fi`
+
+m_chol.o: locfit/m_chol.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_chol.o -MD -MP -MF "$(DEPDIR)/m_chol.Tpo" -c -o m_chol.o `test -f 'locfit/m_chol.c' || echo '$(srcdir)/'`locfit/m_chol.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_chol.Tpo" "$(DEPDIR)/m_chol.Po"; else rm -f "$(DEPDIR)/m_chol.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_chol.c' object='m_chol.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_chol.o `test -f 'locfit/m_chol.c' || echo '$(srcdir)/'`locfit/m_chol.c
+
+m_chol.obj: locfit/m_chol.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_chol.obj -MD -MP -MF "$(DEPDIR)/m_chol.Tpo" -c -o m_chol.obj `if test -f 'locfit/m_chol.c'; then $(CYGPATH_W) 'locfit/m_chol.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_chol.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_chol.Tpo" "$(DEPDIR)/m_chol.Po"; else rm -f "$(DEPDIR)/m_chol.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_chol.c' object='m_chol.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_chol.obj `if test -f 'locfit/m_chol.c'; then $(CYGPATH_W) 'locfit/m_chol.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_chol.c'; fi`
+
+m_eigen.o: locfit/m_eigen.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_eigen.o -MD -MP -MF "$(DEPDIR)/m_eigen.Tpo" -c -o m_eigen.o `test -f 'locfit/m_eigen.c' || echo '$(srcdir)/'`locfit/m_eigen.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_eigen.Tpo" "$(DEPDIR)/m_eigen.Po"; else rm -f "$(DEPDIR)/m_eigen.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_eigen.c' object='m_eigen.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_eigen.o `test -f 'locfit/m_eigen.c' || echo '$(srcdir)/'`locfit/m_eigen.c
+
+m_eigen.obj: locfit/m_eigen.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_eigen.obj -MD -MP -MF "$(DEPDIR)/m_eigen.Tpo" -c -o m_eigen.obj `if test -f 'locfit/m_eigen.c'; then $(CYGPATH_W) 'locfit/m_eigen.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_eigen.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_eigen.Tpo" "$(DEPDIR)/m_eigen.Po"; else rm -f "$(DEPDIR)/m_eigen.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_eigen.c' object='m_eigen.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_eigen.obj `if test -f 'locfit/m_eigen.c'; then $(CYGPATH_W) 'locfit/m_eigen.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_eigen.c'; fi`
+
+m_jacob.o: locfit/m_jacob.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_jacob.o -MD -MP -MF "$(DEPDIR)/m_jacob.Tpo" -c -o m_jacob.o `test -f 'locfit/m_jacob.c' || echo '$(srcdir)/'`locfit/m_jacob.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_jacob.Tpo" "$(DEPDIR)/m_jacob.Po"; else rm -f "$(DEPDIR)/m_jacob.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_jacob.c' object='m_jacob.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_jacob.o `test -f 'locfit/m_jacob.c' || echo '$(srcdir)/'`locfit/m_jacob.c
+
+m_jacob.obj: locfit/m_jacob.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_jacob.obj -MD -MP -MF "$(DEPDIR)/m_jacob.Tpo" -c -o m_jacob.obj `if test -f 'locfit/m_jacob.c'; then $(CYGPATH_W) 'locfit/m_jacob.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_jacob.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_jacob.Tpo" "$(DEPDIR)/m_jacob.Po"; else rm -f "$(DEPDIR)/m_jacob.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_jacob.c' object='m_jacob.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_jacob.obj `if test -f 'locfit/m_jacob.c'; then $(CYGPATH_W) 'locfit/m_jacob.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_jacob.c'; fi`
+
+m_max.o: locfit/m_max.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_max.o -MD -MP -MF "$(DEPDIR)/m_max.Tpo" -c -o m_max.o `test -f 'locfit/m_max.c' || echo '$(srcdir)/'`locfit/m_max.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_max.Tpo" "$(DEPDIR)/m_max.Po"; else rm -f "$(DEPDIR)/m_max.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_max.c' object='m_max.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_max.o `test -f 'locfit/m_max.c' || echo '$(srcdir)/'`locfit/m_max.c
+
+m_max.obj: locfit/m_max.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT m_max.obj -MD -MP -MF "$(DEPDIR)/m_max.Tpo" -c -o m_max.obj `if test -f 'locfit/m_max.c'; then $(CYGPATH_W) 'locfit/m_max.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_max.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/m_max.Tpo" "$(DEPDIR)/m_max.Po"; else rm -f "$(DEPDIR)/m_max.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/m_max.c' object='m_max.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o m_max.obj `if test -f 'locfit/m_max.c'; then $(CYGPATH_W) 'locfit/m_max.c'; else $(CYGPATH_W) '$(srcdir)/locfit/m_max.c'; fi`
+
+makecmd.o: locfit/makecmd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT makecmd.o -MD -MP -MF "$(DEPDIR)/makecmd.Tpo" -c -o makecmd.o `test -f 'locfit/makecmd.c' || echo '$(srcdir)/'`locfit/makecmd.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/makecmd.Tpo" "$(DEPDIR)/makecmd.Po"; else rm -f "$(DEPDIR)/makecmd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/makecmd.c' object='makecmd.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o makecmd.o `test -f 'locfit/makecmd.c' || echo '$(srcdir)/'`locfit/makecmd.c
+
+makecmd.obj: locfit/makecmd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT makecmd.obj -MD -MP -MF "$(DEPDIR)/makecmd.Tpo" -c -o makecmd.obj `if test -f 'locfit/makecmd.c'; then $(CYGPATH_W) 'locfit/makecmd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/makecmd.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/makecmd.Tpo" "$(DEPDIR)/makecmd.Po"; else rm -f "$(DEPDIR)/makecmd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/makecmd.c' object='makecmd.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o makecmd.obj `if test -f 'locfit/makecmd.c'; then $(CYGPATH_W) 'locfit/makecmd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/makecmd.c'; fi`
+
+math.o: locfit/math.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT math.o -MD -MP -MF "$(DEPDIR)/math.Tpo" -c -o math.o `test -f 'locfit/math.c' || echo '$(srcdir)/'`locfit/math.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/math.Tpo" "$(DEPDIR)/math.Po"; else rm -f "$(DEPDIR)/math.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/math.c' object='math.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o math.o `test -f 'locfit/math.c' || echo '$(srcdir)/'`locfit/math.c
+
+math.obj: locfit/math.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT math.obj -MD -MP -MF "$(DEPDIR)/math.Tpo" -c -o math.obj `if test -f 'locfit/math.c'; then $(CYGPATH_W) 'locfit/math.c'; else $(CYGPATH_W) '$(srcdir)/locfit/math.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/math.Tpo" "$(DEPDIR)/math.Po"; else rm -f "$(DEPDIR)/math.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/math.c' object='math.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o math.obj `if test -f 'locfit/math.c'; then $(CYGPATH_W) 'locfit/math.c'; else $(CYGPATH_W) '$(srcdir)/locfit/math.c'; fi`
+
+minmax.o: locfit/minmax.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT minmax.o -MD -MP -MF "$(DEPDIR)/minmax.Tpo" -c -o minmax.o `test -f 'locfit/minmax.c' || echo '$(srcdir)/'`locfit/minmax.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minmax.Tpo" "$(DEPDIR)/minmax.Po"; else rm -f "$(DEPDIR)/minmax.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/minmax.c' object='minmax.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minmax.o `test -f 'locfit/minmax.c' || echo '$(srcdir)/'`locfit/minmax.c
+
+minmax.obj: locfit/minmax.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT minmax.obj -MD -MP -MF "$(DEPDIR)/minmax.Tpo" -c -o minmax.obj `if test -f 'locfit/minmax.c'; then $(CYGPATH_W) 'locfit/minmax.c'; else $(CYGPATH_W) '$(srcdir)/locfit/minmax.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/minmax.Tpo" "$(DEPDIR)/minmax.Po"; else rm -f "$(DEPDIR)/minmax.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/minmax.c' object='minmax.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minmax.obj `if test -f 'locfit/minmax.c'; then $(CYGPATH_W) 'locfit/minmax.c'; else $(CYGPATH_W) '$(srcdir)/locfit/minmax.c'; fi`
+
+nbhd.o: locfit/nbhd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nbhd.o -MD -MP -MF "$(DEPDIR)/nbhd.Tpo" -c -o nbhd.o `test -f 'locfit/nbhd.c' || echo '$(srcdir)/'`locfit/nbhd.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nbhd.Tpo" "$(DEPDIR)/nbhd.Po"; else rm -f "$(DEPDIR)/nbhd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/nbhd.c' object='nbhd.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nbhd.o `test -f 'locfit/nbhd.c' || echo '$(srcdir)/'`locfit/nbhd.c
+
+nbhd.obj: locfit/nbhd.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nbhd.obj -MD -MP -MF "$(DEPDIR)/nbhd.Tpo" -c -o nbhd.obj `if test -f 'locfit/nbhd.c'; then $(CYGPATH_W) 'locfit/nbhd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/nbhd.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nbhd.Tpo" "$(DEPDIR)/nbhd.Po"; else rm -f "$(DEPDIR)/nbhd.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/nbhd.c' object='nbhd.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nbhd.obj `if test -f 'locfit/nbhd.c'; then $(CYGPATH_W) 'locfit/nbhd.c'; else $(CYGPATH_W) '$(srcdir)/locfit/nbhd.c'; fi`
+
+pcomp.o: locfit/pcomp.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pcomp.o -MD -MP -MF "$(DEPDIR)/pcomp.Tpo" -c -o pcomp.o `test -f 'locfit/pcomp.c' || echo '$(srcdir)/'`locfit/pcomp.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pcomp.Tpo" "$(DEPDIR)/pcomp.Po"; else rm -f "$(DEPDIR)/pcomp.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/pcomp.c' object='pcomp.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pcomp.o `test -f 'locfit/pcomp.c' || echo '$(srcdir)/'`locfit/pcomp.c
+
+pcomp.obj: locfit/pcomp.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pcomp.obj -MD -MP -MF "$(DEPDIR)/pcomp.Tpo" -c -o pcomp.obj `if test -f 'locfit/pcomp.c'; then $(CYGPATH_W) 'locfit/pcomp.c'; else $(CYGPATH_W) '$(srcdir)/locfit/pcomp.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pcomp.Tpo" "$(DEPDIR)/pcomp.Po"; else rm -f "$(DEPDIR)/pcomp.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/pcomp.c' object='pcomp.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pcomp.obj `if test -f 'locfit/pcomp.c'; then $(CYGPATH_W) 'locfit/pcomp.c'; else $(CYGPATH_W) '$(srcdir)/locfit/pcomp.c'; fi`
+
+pout.o: locfit/pout.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pout.o -MD -MP -MF "$(DEPDIR)/pout.Tpo" -c -o pout.o `test -f 'locfit/pout.c' || echo '$(srcdir)/'`locfit/pout.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pout.Tpo" "$(DEPDIR)/pout.Po"; else rm -f "$(DEPDIR)/pout.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/pout.c' object='pout.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pout.o `test -f 'locfit/pout.c' || echo '$(srcdir)/'`locfit/pout.c
+
+pout.obj: locfit/pout.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pout.obj -MD -MP -MF "$(DEPDIR)/pout.Tpo" -c -o pout.obj `if test -f 'locfit/pout.c'; then $(CYGPATH_W) 'locfit/pout.c'; else $(CYGPATH_W) '$(srcdir)/locfit/pout.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pout.Tpo" "$(DEPDIR)/pout.Po"; else rm -f "$(DEPDIR)/pout.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/pout.c' object='pout.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pout.obj `if test -f 'locfit/pout.c'; then $(CYGPATH_W) 'locfit/pout.c'; else $(CYGPATH_W) '$(srcdir)/locfit/pout.c'; fi`
+
+preplot.o: locfit/preplot.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT preplot.o -MD -MP -MF "$(DEPDIR)/preplot.Tpo" -c -o preplot.o `test -f 'locfit/preplot.c' || echo '$(srcdir)/'`locfit/preplot.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/preplot.Tpo" "$(DEPDIR)/preplot.Po"; else rm -f "$(DEPDIR)/preplot.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/preplot.c' object='preplot.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o preplot.o `test -f 'locfit/preplot.c' || echo '$(srcdir)/'`locfit/preplot.c
+
+preplot.obj: locfit/preplot.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT preplot.obj -MD -MP -MF "$(DEPDIR)/preplot.Tpo" -c -o preplot.obj `if test -f 'locfit/preplot.c'; then $(CYGPATH_W) 'locfit/preplot.c'; else $(CYGPATH_W) '$(srcdir)/locfit/preplot.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/preplot.Tpo" "$(DEPDIR)/preplot.Po"; else rm -f "$(DEPDIR)/preplot.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/preplot.c' object='preplot.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o preplot.obj `if test -f 'locfit/preplot.c'; then $(CYGPATH_W) 'locfit/preplot.c'; else $(CYGPATH_W) '$(srcdir)/locfit/preplot.c'; fi`
+
+random.o: locfit/random.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT random.o -MD -MP -MF "$(DEPDIR)/random.Tpo" -c -o random.o `test -f 'locfit/random.c' || echo '$(srcdir)/'`locfit/random.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/random.Tpo" "$(DEPDIR)/random.Po"; else rm -f "$(DEPDIR)/random.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/random.c' object='random.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o random.o `test -f 'locfit/random.c' || echo '$(srcdir)/'`locfit/random.c
+
+random.obj: locfit/random.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT random.obj -MD -MP -MF "$(DEPDIR)/random.Tpo" -c -o random.obj `if test -f 'locfit/random.c'; then $(CYGPATH_W) 'locfit/random.c'; else $(CYGPATH_W) '$(srcdir)/locfit/random.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/random.Tpo" "$(DEPDIR)/random.Po"; else rm -f "$(DEPDIR)/random.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/random.c' object='random.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o random.obj `if test -f 'locfit/random.c'; then $(CYGPATH_W) 'locfit/random.c'; else $(CYGPATH_W) '$(srcdir)/locfit/random.c'; fi`
+
+readfile.o: locfit/readfile.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT readfile.o -MD -MP -MF "$(DEPDIR)/readfile.Tpo" -c -o readfile.o `test -f 'locfit/readfile.c' || echo '$(srcdir)/'`locfit/readfile.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/readfile.Tpo" "$(DEPDIR)/readfile.Po"; else rm -f "$(DEPDIR)/readfile.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/readfile.c' object='readfile.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o readfile.o `test -f 'locfit/readfile.c' || echo '$(srcdir)/'`locfit/readfile.c
+
+readfile.obj: locfit/readfile.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT readfile.obj -MD -MP -MF "$(DEPDIR)/readfile.Tpo" -c -o readfile.obj `if test -f 'locfit/readfile.c'; then $(CYGPATH_W) 'locfit/readfile.c'; else $(CYGPATH_W) '$(srcdir)/locfit/readfile.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/readfile.Tpo" "$(DEPDIR)/readfile.Po"; else rm -f "$(DEPDIR)/readfile.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/readfile.c' object='readfile.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o readfile.obj `if test -f 'locfit/readfile.c'; then $(CYGPATH_W) 'locfit/readfile.c'; else $(CYGPATH_W) '$(srcdir)/locfit/readfile.c'; fi`
+
+scb.o: locfit/scb.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT scb.o -MD -MP -MF "$(DEPDIR)/scb.Tpo" -c -o scb.o `test -f 'locfit/scb.c' || echo '$(srcdir)/'`locfit/scb.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/scb.Tpo" "$(DEPDIR)/scb.Po"; else rm -f "$(DEPDIR)/scb.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/scb.c' object='scb.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o scb.o `test -f 'locfit/scb.c' || echo '$(srcdir)/'`locfit/scb.c
+
+scb.obj: locfit/scb.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT scb.obj -MD -MP -MF "$(DEPDIR)/scb.Tpo" -c -o scb.obj `if test -f 'locfit/scb.c'; then $(CYGPATH_W) 'locfit/scb.c'; else $(CYGPATH_W) '$(srcdir)/locfit/scb.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/scb.Tpo" "$(DEPDIR)/scb.Po"; else rm -f "$(DEPDIR)/scb.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/scb.c' object='scb.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o scb.obj `if test -f 'locfit/scb.c'; then $(CYGPATH_W) 'locfit/scb.c'; else $(CYGPATH_W) '$(srcdir)/locfit/scb.c'; fi`
+
+scb_cons.o: locfit/scb_cons.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT scb_cons.o -MD -MP -MF "$(DEPDIR)/scb_cons.Tpo" -c -o scb_cons.o `test -f 'locfit/scb_cons.c' || echo '$(srcdir)/'`locfit/scb_cons.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/scb_cons.Tpo" "$(DEPDIR)/scb_cons.Po"; else rm -f "$(DEPDIR)/scb_cons.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/scb_cons.c' object='scb_cons.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o scb_cons.o `test -f 'locfit/scb_cons.c' || echo '$(srcdir)/'`locfit/scb_cons.c
+
+scb_cons.obj: locfit/scb_cons.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT scb_cons.obj -MD -MP -MF "$(DEPDIR)/scb_cons.Tpo" -c -o scb_cons.obj `if test -f 'locfit/scb_cons.c'; then $(CYGPATH_W) 'locfit/scb_cons.c'; else $(CYGPATH_W) '$(srcdir)/locfit/scb_cons.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/scb_cons.Tpo" "$(DEPDIR)/scb_cons.Po"; else rm -f "$(DEPDIR)/scb_cons.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/scb_cons.c' object='scb_cons.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o scb_cons.obj `if test -f 'locfit/scb_cons.c'; then $(CYGPATH_W) 'locfit/scb_cons.c'; else $(CYGPATH_W) '$(srcdir)/locfit/scb_cons.c'; fi`
+
+simul.o: locfit/simul.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT simul.o -MD -MP -MF "$(DEPDIR)/simul.Tpo" -c -o simul.o `test -f 'locfit/simul.c' || echo '$(srcdir)/'`locfit/simul.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/simul.Tpo" "$(DEPDIR)/simul.Po"; else rm -f "$(DEPDIR)/simul.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/simul.c' object='simul.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o simul.o `test -f 'locfit/simul.c' || echo '$(srcdir)/'`locfit/simul.c
+
+simul.obj: locfit/simul.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT simul.obj -MD -MP -MF "$(DEPDIR)/simul.Tpo" -c -o simul.obj `if test -f 'locfit/simul.c'; then $(CYGPATH_W) 'locfit/simul.c'; else $(CYGPATH_W) '$(srcdir)/locfit/simul.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/simul.Tpo" "$(DEPDIR)/simul.Po"; else rm -f "$(DEPDIR)/simul.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/simul.c' object='simul.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o simul.obj `if test -f 'locfit/simul.c'; then $(CYGPATH_W) 'locfit/simul.c'; else $(CYGPATH_W) '$(srcdir)/locfit/simul.c'; fi`
+
+solve.o: locfit/solve.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT solve.o -MD -MP -MF "$(DEPDIR)/solve.Tpo" -c -o solve.o `test -f 'locfit/solve.c' || echo '$(srcdir)/'`locfit/solve.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/solve.Tpo" "$(DEPDIR)/solve.Po"; else rm -f "$(DEPDIR)/solve.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/solve.c' object='solve.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o solve.o `test -f 'locfit/solve.c' || echo '$(srcdir)/'`locfit/solve.c
+
+solve.obj: locfit/solve.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT solve.obj -MD -MP -MF "$(DEPDIR)/solve.Tpo" -c -o solve.obj `if test -f 'locfit/solve.c'; then $(CYGPATH_W) 'locfit/solve.c'; else $(CYGPATH_W) '$(srcdir)/locfit/solve.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/solve.Tpo" "$(DEPDIR)/solve.Po"; else rm -f "$(DEPDIR)/solve.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/solve.c' object='solve.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o solve.obj `if test -f 'locfit/solve.c'; then $(CYGPATH_W) 'locfit/solve.c'; else $(CYGPATH_W) '$(srcdir)/locfit/solve.c'; fi`
+
+startlf.o: locfit/startlf.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT startlf.o -MD -MP -MF "$(DEPDIR)/startlf.Tpo" -c -o startlf.o `test -f 'locfit/startlf.c' || echo '$(srcdir)/'`locfit/startlf.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/startlf.Tpo" "$(DEPDIR)/startlf.Po"; else rm -f "$(DEPDIR)/startlf.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/startlf.c' object='startlf.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o startlf.o `test -f 'locfit/startlf.c' || echo '$(srcdir)/'`locfit/startlf.c
+
+startlf.obj: locfit/startlf.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT startlf.obj -MD -MP -MF "$(DEPDIR)/startlf.Tpo" -c -o startlf.obj `if test -f 'locfit/startlf.c'; then $(CYGPATH_W) 'locfit/startlf.c'; else $(CYGPATH_W) '$(srcdir)/locfit/startlf.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/startlf.Tpo" "$(DEPDIR)/startlf.Po"; else rm -f "$(DEPDIR)/startlf.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/startlf.c' object='startlf.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o startlf.obj `if test -f 'locfit/startlf.c'; then $(CYGPATH_W) 'locfit/startlf.c'; else $(CYGPATH_W) '$(srcdir)/locfit/startlf.c'; fi`
+
+strings.o: locfit/strings.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strings.o -MD -MP -MF "$(DEPDIR)/strings.Tpo" -c -o strings.o `test -f 'locfit/strings.c' || echo '$(srcdir)/'`locfit/strings.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/strings.Tpo" "$(DEPDIR)/strings.Po"; else rm -f "$(DEPDIR)/strings.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/strings.c' object='strings.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strings.o `test -f 'locfit/strings.c' || echo '$(srcdir)/'`locfit/strings.c
+
+strings.obj: locfit/strings.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strings.obj -MD -MP -MF "$(DEPDIR)/strings.Tpo" -c -o strings.obj `if test -f 'locfit/strings.c'; then $(CYGPATH_W) 'locfit/strings.c'; else $(CYGPATH_W) '$(srcdir)/locfit/strings.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/strings.Tpo" "$(DEPDIR)/strings.Po"; else rm -f "$(DEPDIR)/strings.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/strings.c' object='strings.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strings.obj `if test -f 'locfit/strings.c'; then $(CYGPATH_W) 'locfit/strings.c'; else $(CYGPATH_W) '$(srcdir)/locfit/strings.c'; fi`
+
+wdiag.o: locfit/wdiag.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wdiag.o -MD -MP -MF "$(DEPDIR)/wdiag.Tpo" -c -o wdiag.o `test -f 'locfit/wdiag.c' || echo '$(srcdir)/'`locfit/wdiag.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/wdiag.Tpo" "$(DEPDIR)/wdiag.Po"; else rm -f "$(DEPDIR)/wdiag.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/wdiag.c' object='wdiag.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o wdiag.o `test -f 'locfit/wdiag.c' || echo '$(srcdir)/'`locfit/wdiag.c
+
+wdiag.obj: locfit/wdiag.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wdiag.obj -MD -MP -MF "$(DEPDIR)/wdiag.Tpo" -c -o wdiag.obj `if test -f 'locfit/wdiag.c'; then $(CYGPATH_W) 'locfit/wdiag.c'; else $(CYGPATH_W) '$(srcdir)/locfit/wdiag.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/wdiag.Tpo" "$(DEPDIR)/wdiag.Po"; else rm -f "$(DEPDIR)/wdiag.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/wdiag.c' object='wdiag.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o wdiag.obj `if test -f 'locfit/wdiag.c'; then $(CYGPATH_W) 'locfit/wdiag.c'; else $(CYGPATH_W) '$(srcdir)/locfit/wdiag.c'; fi`
+
+weight.o: locfit/weight.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT weight.o -MD -MP -MF "$(DEPDIR)/weight.Tpo" -c -o weight.o `test -f 'locfit/weight.c' || echo '$(srcdir)/'`locfit/weight.c; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/weight.Tpo" "$(DEPDIR)/weight.Po"; else rm -f "$(DEPDIR)/weight.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/weight.c' object='weight.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o weight.o `test -f 'locfit/weight.c' || echo '$(srcdir)/'`locfit/weight.c
+
+weight.obj: locfit/weight.c
+ at am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT weight.obj -MD -MP -MF "$(DEPDIR)/weight.Tpo" -c -o weight.obj `if test -f 'locfit/weight.c'; then $(CYGPATH_W) 'locfit/weight.c'; else $(CYGPATH_W) '$(srcdir)/locfit/weight.c'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/weight.Tpo" "$(DEPDIR)/weight.Po"; else rm -f "$(DEPDIR)/weight.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locfit/weight.c' object='weight.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o weight.obj `if test -f 'locfit/weight.c'; then $(CYGPATH_W) 'locfit/weight.c'; else $(CYGPATH_W) '$(srcdir)/locfit/weight.c'; fi`
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+vari.o: locfit/vari.cpp
+ at am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vari.o -MD -MP -MF "$(DEPDIR)/vari.Tpo" -c -o vari.o `test -f 'locfit/vari.cpp' || echo '$(srcdir)/'`locfit/vari.cpp; \
+ at am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/vari.Tpo" "$(DEPDIR)/vari.Po"; else rm -f "$(DEPDIR)/vari.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='locfit/vari.cpp' object='vari.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vari.o `test -f 'locfit/vari.cpp' || echo '$(srcdir)/'`locfit/vari.cpp
+
+vari.obj: locfit/vari.cpp
+ at am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vari.obj -MD -MP -MF "$(DEPDIR)/vari.Tpo" -c -o vari.obj `if test -f 'locfit/vari.cpp'; then $(CYGPATH_W) 'locfit/vari.cpp'; else $(CYGPATH_W) '$(srcdir)/locfit/vari.cpp'; fi`; \
+ at am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/vari.Tpo" "$(DEPDIR)/vari.Po"; else rm -f "$(DEPDIR)/vari.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='locfit/vari.cpp' object='vari.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vari.obj `if test -f 'locfit/vari.cpp'; then $(CYGPATH_W) 'locfit/vari.cpp'; else $(CYGPATH_W) '$(srcdir)/locfit/vari.cpp'; fi`
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/$(top_srcdir) $(distdir)/lemon $(distdir)/lemon/bits $(distdir)/lemon/concepts $(distdir)/locfit
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS install-dist_binSCRIPTS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am \
+ install-dist_binSCRIPTS install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-info-am
+
+
+#gtf_reads_SOURCES = gtf_reads.cpp
+#gtf_reads_LDADD = libcufflinks.a libgc.a $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_SERIALIZATION_LIB) $(BAM_LIB)
+#gtf_reads_LDFLAGS = $(LDFLAGS) $(BOOST_LDFLAGS) $(BAM_LDFLAGS) #$(ZLIB_LDFLAGS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/lemon/bfs.h b/src/lemon/bfs.h
new file mode 100644
index 0000000..8fda28b
--- /dev/null
+++ b/src/lemon/bfs.h
@@ -0,0 +1,1597 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BFS_H
+#define LEMON_BFS_H
+
+///\ingroup search
+///\file
+///\brief Bfs algorithm.
+
+#include <lemon/list_graph.h>
+#include <lemon/graph_utils.h>
+#include <lemon/bits/path_dump.h>
+#include <lemon/bits/invalid.h>
+#include <lemon/error.h>
+#include <lemon/maps.h>
+
+namespace lemon {
+
+
+
+ ///Default traits class of Bfs class.
+
+ ///Default traits class of Bfs class.
+ ///\param GR Graph type.
+ template<class GR>
+ struct BfsDefaultTraits
+ {
+ ///The graph type the algorithm runs on.
+ typedef GR Graph;
+ ///\brief The type of the map that stores the last
+ ///edges of the shortest paths.
+ ///
+ ///The type of the map that stores the last
+ ///edges of the shortest paths.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef typename Graph::template NodeMap<typename GR::Edge> PredMap;
+ ///Instantiates a PredMap.
+
+ ///This function instantiates a \ref PredMap.
+ ///\param G is the graph, to which we would like to define the PredMap.
+ ///\todo The graph alone may be insufficient to initialize
+ static PredMap *createPredMap(const GR &G)
+ {
+ return new PredMap(G);
+ }
+ ///The type of the map that indicates which nodes are processed.
+
+ ///The type of the map that indicates which nodes are processed.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef NullMap<typename Graph::Node,bool> ProcessedMap;
+ ///Instantiates a ProcessedMap.
+
+ ///This function instantiates a \ref ProcessedMap.
+ ///\param g is the graph, to which
+ ///we would like to define the \ref ProcessedMap
+#ifdef DOXYGEN
+ static ProcessedMap *createProcessedMap(const GR &g)
+#else
+ static ProcessedMap *createProcessedMap(const GR &)
+#endif
+ {
+ return new ProcessedMap();
+ }
+ ///The type of the map that indicates which nodes are reached.
+
+ ///The type of the map that indicates which nodes are reached.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef typename Graph::template NodeMap<bool> ReachedMap;
+ ///Instantiates a ReachedMap.
+
+ ///This function instantiates a \ref ReachedMap.
+ ///\param G is the graph, to which
+ ///we would like to define the \ref ReachedMap.
+ static ReachedMap *createReachedMap(const GR &G)
+ {
+ return new ReachedMap(G);
+ }
+ ///The type of the map that stores the dists of the nodes.
+
+ ///The type of the map that stores the dists of the nodes.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef typename Graph::template NodeMap<int> DistMap;
+ ///Instantiates a DistMap.
+
+ ///This function instantiates a \ref DistMap.
+ ///\param G is the graph, to which we would like to define the \ref DistMap
+ static DistMap *createDistMap(const GR &G)
+ {
+ return new DistMap(G);
+ }
+ };
+
+ ///%BFS algorithm class.
+
+ ///\ingroup search
+ ///This class provides an efficient implementation of the %BFS algorithm.
+ ///
+ ///\param GR The graph type the algorithm runs on. The default value is
+ ///\ref ListGraph. The value of GR is not used directly by Bfs, it
+ ///is only passed to \ref BfsDefaultTraits.
+ ///\param TR Traits class to set various data types used by the algorithm.
+ ///The default traits class is
+ ///\ref BfsDefaultTraits "BfsDefaultTraits<GR>".
+ ///See \ref BfsDefaultTraits for the documentation of
+ ///a Bfs traits class.
+ ///
+ ///\author Alpar Juttner
+
+#ifdef DOXYGEN
+ template <typename GR,
+ typename TR>
+#else
+ template <typename GR=ListGraph,
+ typename TR=BfsDefaultTraits<GR> >
+#endif
+ class Bfs {
+ public:
+ /**
+ * \brief \ref Exception for uninitialized parameters.
+ *
+ * This error represents problems in the initialization
+ * of the parameters of the algorithms.
+ */
+ class UninitializedParameter : public lemon::UninitializedParameter {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::Bfs::UninitializedParameter";
+ }
+ };
+
+ typedef TR Traits;
+ ///The type of the underlying graph.
+ typedef typename TR::Graph Graph;
+
+ ///\brief The type of the map that stores the last
+ ///edges of the shortest paths.
+ typedef typename TR::PredMap PredMap;
+ ///The type of the map indicating which nodes are reached.
+ typedef typename TR::ReachedMap ReachedMap;
+ ///The type of the map indicating which nodes are processed.
+ typedef typename TR::ProcessedMap ProcessedMap;
+ ///The type of the map that stores the dists of the nodes.
+ typedef typename TR::DistMap DistMap;
+ private:
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::OutEdgeIt OutEdgeIt;
+
+ /// Pointer to the underlying graph.
+ const Graph *G;
+ ///Pointer to the map of predecessors edges.
+ PredMap *_pred;
+ ///Indicates if \ref _pred is locally allocated (\c true) or not.
+ bool local_pred;
+ ///Pointer to the map of distances.
+ DistMap *_dist;
+ ///Indicates if \ref _dist is locally allocated (\c true) or not.
+ bool local_dist;
+ ///Pointer to the map of reached status of the nodes.
+ ReachedMap *_reached;
+ ///Indicates if \ref _reached is locally allocated (\c true) or not.
+ bool local_reached;
+ ///Pointer to the map of processed status of the nodes.
+ ProcessedMap *_processed;
+ ///Indicates if \ref _processed is locally allocated (\c true) or not.
+ bool local_processed;
+
+ std::vector<typename Graph::Node> _queue;
+ int _queue_head,_queue_tail,_queue_next_dist;
+ int _curr_dist;
+
+ ///Creates the maps if necessary.
+
+ ///\todo Better memory allocation (instead of new).
+ void create_maps()
+ {
+ if(!_pred) {
+ local_pred = true;
+ _pred = Traits::createPredMap(*G);
+ }
+ if(!_dist) {
+ local_dist = true;
+ _dist = Traits::createDistMap(*G);
+ }
+ if(!_reached) {
+ local_reached = true;
+ _reached = Traits::createReachedMap(*G);
+ }
+ if(!_processed) {
+ local_processed = true;
+ _processed = Traits::createProcessedMap(*G);
+ }
+ }
+
+ protected:
+
+ Bfs() {}
+
+ public:
+
+ typedef Bfs Create;
+
+ ///\name Named template parameters
+
+ ///@{
+
+ template <class T>
+ struct DefPredMapTraits : public Traits {
+ typedef T PredMap;
+ static PredMap *createPredMap(const Graph &)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///PredMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting PredMap type
+ ///
+ template <class T>
+ struct DefPredMap : public Bfs< Graph, DefPredMapTraits<T> > {
+ typedef Bfs< Graph, DefPredMapTraits<T> > Create;
+ };
+
+ template <class T>
+ struct DefDistMapTraits : public Traits {
+ typedef T DistMap;
+ static DistMap *createDistMap(const Graph &)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///DistMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting DistMap type
+ ///
+ template <class T>
+ struct DefDistMap : public Bfs< Graph, DefDistMapTraits<T> > {
+ typedef Bfs< Graph, DefDistMapTraits<T> > Create;
+ };
+
+ template <class T>
+ struct DefReachedMapTraits : public Traits {
+ typedef T ReachedMap;
+ static ReachedMap *createReachedMap(const Graph &)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///ReachedMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting ReachedMap type
+ ///
+ template <class T>
+ struct DefReachedMap : public Bfs< Graph, DefReachedMapTraits<T> > {
+ typedef Bfs< Graph, DefReachedMapTraits<T> > Create;
+ };
+
+ template <class T>
+ struct DefProcessedMapTraits : public Traits {
+ typedef T ProcessedMap;
+ static ProcessedMap *createProcessedMap(const Graph &)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///ProcessedMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting ProcessedMap type
+ ///
+ template <class T>
+ struct DefProcessedMap : public Bfs< Graph, DefProcessedMapTraits<T> > {
+ typedef Bfs< Graph, DefProcessedMapTraits<T> > Create;
+ };
+
+ struct DefGraphProcessedMapTraits : public Traits {
+ typedef typename Graph::template NodeMap<bool> ProcessedMap;
+ static ProcessedMap *createProcessedMap(const Graph &G)
+ {
+ return new ProcessedMap(G);
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter"
+ ///for setting the ProcessedMap type to be Graph::NodeMap<bool>.
+ ///
+ ///\ref named-templ-param "Named parameter"
+ ///for setting the ProcessedMap type to be Graph::NodeMap<bool>.
+ ///If you don't set it explicitly, it will be automatically allocated.
+ template <class T>
+ struct DefProcessedMapToBeDefaultMap :
+ public Bfs< Graph, DefGraphProcessedMapTraits> {
+ typedef Bfs< Graph, DefGraphProcessedMapTraits> Create;
+ };
+
+ ///@}
+
+ public:
+
+ ///Constructor.
+
+ ///\param _G the graph the algorithm will run on.
+ ///
+ Bfs(const Graph& _G) :
+ G(&_G),
+ _pred(NULL), local_pred(false),
+ _dist(NULL), local_dist(false),
+ _reached(NULL), local_reached(false),
+ _processed(NULL), local_processed(false)
+ { }
+
+ ///Destructor.
+ ~Bfs()
+ {
+ if(local_pred) delete _pred;
+ if(local_dist) delete _dist;
+ if(local_reached) delete _reached;
+ if(local_processed) delete _processed;
+ }
+
+ ///Sets the map storing the predecessor edges.
+
+ ///Sets the map storing the predecessor edges.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destructor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Bfs &predMap(PredMap &m)
+ {
+ if(local_pred) {
+ delete _pred;
+ local_pred=false;
+ }
+ _pred = &m;
+ return *this;
+ }
+
+ ///Sets the map indicating the reached nodes.
+
+ ///Sets the map indicating the reached nodes.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destructor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Bfs &reachedMap(ReachedMap &m)
+ {
+ if(local_reached) {
+ delete _reached;
+ local_reached=false;
+ }
+ _reached = &m;
+ return *this;
+ }
+
+ ///Sets the map indicating the processed nodes.
+
+ ///Sets the map indicating the processed nodes.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destructor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Bfs &processedMap(ProcessedMap &m)
+ {
+ if(local_processed) {
+ delete _processed;
+ local_processed=false;
+ }
+ _processed = &m;
+ return *this;
+ }
+
+ ///Sets the map storing the distances calculated by the algorithm.
+
+ ///Sets the map storing the distances calculated by the algorithm.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destructor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Bfs &distMap(DistMap &m)
+ {
+ if(local_dist) {
+ delete _dist;
+ local_dist=false;
+ }
+ _dist = &m;
+ return *this;
+ }
+
+ public:
+ ///\name Execution control
+ ///The simplest way to execute the algorithm is to use
+ ///one of the member functions called \c run(...).
+ ///\n
+ ///If you need more control on the execution,
+ ///first you must call \ref init(), then you can add several source nodes
+ ///with \ref addSource().
+ ///Finally \ref start() will perform the actual path
+ ///computation.
+
+ ///@{
+
+ ///\brief Initializes the internal data structures.
+ ///
+ ///Initializes the internal data structures.
+ ///
+ void init()
+ {
+ create_maps();
+ _queue.resize(countNodes(*G));
+ _queue_head=_queue_tail=0;
+ _curr_dist=1;
+ for ( NodeIt u(*G) ; u!=INVALID ; ++u ) {
+ _pred->set(u,INVALID);
+ _reached->set(u,false);
+ _processed->set(u,false);
+ }
+ }
+
+ ///Adds a new source node.
+
+ ///Adds a new source node to the set of nodes to be processed.
+ ///
+ void addSource(Node s)
+ {
+ if(!(*_reached)[s])
+ {
+ _reached->set(s,true);
+ _pred->set(s,INVALID);
+ _dist->set(s,0);
+ _queue[_queue_head++]=s;
+ _queue_next_dist=_queue_head;
+ }
+ }
+
+ ///Processes the next node.
+
+ ///Processes the next node.
+ ///
+ ///\return The processed node.
+ ///
+ ///\warning The queue must not be empty!
+ Node processNextNode()
+ {
+ if(_queue_tail==_queue_next_dist) {
+ _curr_dist++;
+ _queue_next_dist=_queue_head;
+ }
+ Node n=_queue[_queue_tail++];
+ _processed->set(n,true);
+ Node m;
+ for(OutEdgeIt e(*G,n);e!=INVALID;++e)
+ if(!(*_reached)[m=G->target(e)]) {
+ _queue[_queue_head++]=m;
+ _reached->set(m,true);
+ _pred->set(m,e);
+ _dist->set(m,_curr_dist);
+ }
+ return n;
+ }
+
+ ///Processes the next node.
+
+ ///Processes the next node. And checks that the given target node
+ ///is reached. If the target node is reachable from the processed
+ ///node then the reached parameter will be set true. The reached
+ ///parameter should be initially false.
+ ///
+ ///\param target The target node.
+ ///\retval reach Indicates that the target node is reached.
+ ///\return The processed node.
+ ///
+ ///\warning The queue must not be empty!
+ Node processNextNode(Node target, bool& reach)
+ {
+ if(_queue_tail==_queue_next_dist) {
+ _curr_dist++;
+ _queue_next_dist=_queue_head;
+ }
+ Node n=_queue[_queue_tail++];
+ _processed->set(n,true);
+ Node m;
+ for(OutEdgeIt e(*G,n);e!=INVALID;++e)
+ if(!(*_reached)[m=G->target(e)]) {
+ _queue[_queue_head++]=m;
+ _reached->set(m,true);
+ _pred->set(m,e);
+ _dist->set(m,_curr_dist);
+ reach = reach || (target == m);
+ }
+ return n;
+ }
+
+ ///Processes the next node.
+
+ ///Processes the next node. And checks that at least one of
+ ///reached node has true value in the \c nm node map. If one node
+ ///with true value is reachable from the processed node then the
+ ///rnode parameter will be set to the first of such nodes.
+ ///
+ ///\param nm The node map of possible targets.
+ ///\retval rnode The reached target node.
+ ///\return The processed node.
+ ///
+ ///\warning The queue must not be empty!
+ template<class NM>
+ Node processNextNode(const NM& nm, Node& rnode)
+ {
+ if(_queue_tail==_queue_next_dist) {
+ _curr_dist++;
+ _queue_next_dist=_queue_head;
+ }
+ Node n=_queue[_queue_tail++];
+ _processed->set(n,true);
+ Node m;
+ for(OutEdgeIt e(*G,n);e!=INVALID;++e)
+ if(!(*_reached)[m=G->target(e)]) {
+ _queue[_queue_head++]=m;
+ _reached->set(m,true);
+ _pred->set(m,e);
+ _dist->set(m,_curr_dist);
+ if (nm[m] && rnode == INVALID) rnode = m;
+ }
+ return n;
+ }
+
+ ///Next node to be processed.
+
+ ///Next node to be processed.
+ ///
+ ///\return The next node to be processed or INVALID if the queue is
+ /// empty.
+ Node nextNode()
+ {
+ return _queue_tail<_queue_head?_queue[_queue_tail]:INVALID;
+ }
+
+ ///\brief Returns \c false if there are nodes
+ ///to be processed in the queue
+ ///
+ ///Returns \c false if there are nodes
+ ///to be processed in the queue
+ bool emptyQueue() { return _queue_tail==_queue_head; }
+ ///Returns the number of the nodes to be processed.
+
+ ///Returns the number of the nodes to be processed in the queue.
+ int queueSize() { return _queue_head-_queue_tail; }
+
+ ///Executes the algorithm.
+
+ ///Executes the algorithm.
+ ///
+ ///\pre init() must be called and at least one node should be added
+ ///with addSource() before using this function.
+ ///
+ ///This method runs the %BFS algorithm from the root node(s)
+ ///in order to
+ ///compute the
+ ///shortest path to each node. The algorithm computes
+ ///- The shortest path tree.
+ ///- The distance of each node from the root(s).
+ void start()
+ {
+ while ( !emptyQueue() ) processNextNode();
+ }
+
+ ///Executes the algorithm until \c dest is reached.
+
+ ///Executes the algorithm until \c dest is reached.
+ ///
+ ///\pre init() must be called and at least one node should be added
+ ///with addSource() before using this function.
+ ///
+ ///This method runs the %BFS algorithm from the root node(s)
+ ///in order to compute the shortest path to \c dest.
+ ///The algorithm computes
+ ///- The shortest path to \c dest.
+ ///- The distance of \c dest from the root(s).
+ void start(Node dest)
+ {
+ bool reach = false;
+ while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
+ }
+
+ ///Executes the algorithm until a condition is met.
+
+ ///Executes the algorithm until a condition is met.
+ ///
+ ///\pre init() must be called and at least one node should be added
+ ///with addSource() before using this function.
+ ///
+ ///\param nm must be a bool (or convertible) node map. The
+ ///algorithm will stop when it reaches a node \c v with
+ /// <tt>nm[v]</tt> true.
+ ///
+ ///\return The reached node \c v with <tt>nm[v]</tt> true or
+ ///\c INVALID if no such node was found.
+ template<class NM>
+ Node start(const NM &nm)
+ {
+ Node rnode = INVALID;
+ while ( !emptyQueue() && rnode == INVALID ) {
+ processNextNode(nm, rnode);
+ }
+ return rnode;
+ }
+
+ ///Runs %BFS algorithm from node \c s.
+
+ ///This method runs the %BFS algorithm from a root node \c s
+ ///in order to
+ ///compute the
+ ///shortest path to each node. The algorithm computes
+ ///- The shortest path tree.
+ ///- The distance of each node from the root.
+ ///
+ ///\note b.run(s) is just a shortcut of the following code.
+ ///\code
+ /// b.init();
+ /// b.addSource(s);
+ /// b.start();
+ ///\endcode
+ void run(Node s) {
+ init();
+ addSource(s);
+ start();
+ }
+
+ ///Finds the shortest path between \c s and \c t.
+
+ ///Finds the shortest path between \c s and \c t.
+ ///
+ ///\return The length of the shortest s---t path if there exists one,
+ ///0 otherwise.
+ ///\note Apart from the return value, b.run(s) is
+ ///just a shortcut of the following code.
+ ///\code
+ /// b.init();
+ /// b.addSource(s);
+ /// b.start(t);
+ ///\endcode
+ int run(Node s,Node t) {
+ init();
+ addSource(s);
+ start(t);
+ return reached(t) ? _curr_dist : 0;
+ }
+
+ ///@}
+
+ ///\name Query Functions
+ ///The result of the %BFS algorithm can be obtained using these
+ ///functions.\n
+ ///Before the use of these functions,
+ ///either run() or start() must be calleb.
+
+ ///@{
+
+ typedef PredMapPath<Graph, PredMap> Path;
+
+ ///Gives back the shortest path.
+
+ ///Gives back the shortest path.
+ ///\pre The \c t should be reachable from the source.
+ Path path(Node t)
+ {
+ return Path(*G, *_pred, t);
+ }
+
+ ///The distance of a node from the root(s).
+
+ ///Returns the distance of a node from the root(s).
+ ///\pre \ref run() must be called before using this function.
+ ///\warning If node \c v in unreachable from the root(s) the return value
+ ///of this function is undefined.
+ int dist(Node v) const { return (*_dist)[v]; }
+
+ ///Returns the 'previous edge' of the shortest path tree.
+
+ ///For a node \c v it returns the 'previous edge'
+ ///of the shortest path tree,
+ ///i.e. it returns the last edge of a shortest path from the root(s) to \c
+ ///v. It is \ref INVALID
+ ///if \c v is unreachable from the root(s) or \c v is a root. The
+ ///shortest path tree used here is equal to the shortest path tree used in
+ ///\ref predNode().
+ ///\pre Either \ref run() or \ref start() must be called before using
+ ///this function.
+ Edge predEdge(Node v) const { return (*_pred)[v];}
+
+ ///Returns the 'previous node' of the shortest path tree.
+
+ ///For a node \c v it returns the 'previous node'
+ ///of the shortest path tree,
+ ///i.e. it returns the last but one node from a shortest path from the
+ ///root(a) to \c /v.
+ ///It is INVALID if \c v is unreachable from the root(s) or
+ ///if \c v itself a root.
+ ///The shortest path tree used here is equal to the shortest path
+ ///tree used in \ref predEdge().
+ ///\pre Either \ref run() or \ref start() must be called before
+ ///using this function.
+ Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID:
+ G->source((*_pred)[v]); }
+
+ ///Returns a reference to the NodeMap of distances.
+
+ ///Returns a reference to the NodeMap of distances.
+ ///\pre Either \ref run() or \ref init() must
+ ///be called before using this function.
+ const DistMap &distMap() const { return *_dist;}
+
+ ///Returns a reference to the shortest path tree map.
+
+ ///Returns a reference to the NodeMap of the edges of the
+ ///shortest path tree.
+ ///\pre Either \ref run() or \ref init()
+ ///must be called before using this function.
+ const PredMap &predMap() const { return *_pred;}
+
+ ///Checks if a node is reachable from the root.
+
+ ///Returns \c true if \c v is reachable from the root.
+ ///\warning The source nodes are indicated as unreached.
+ ///\pre Either \ref run() or \ref start()
+ ///must be called before using this function.
+ ///
+ bool reached(Node v) { return (*_reached)[v]; }
+
+ ///@}
+ };
+
+ ///Default traits class of Bfs function.
+
+ ///Default traits class of Bfs function.
+ ///\param GR Graph type.
+ template<class GR>
+ struct BfsWizardDefaultTraits
+ {
+ ///The graph type the algorithm runs on.
+ typedef GR Graph;
+ ///\brief The type of the map that stores the last
+ ///edges of the shortest paths.
+ ///
+ ///The type of the map that stores the last
+ ///edges of the shortest paths.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef NullMap<typename Graph::Node,typename GR::Edge> PredMap;
+ ///Instantiates a PredMap.
+
+ ///This function instantiates a \ref PredMap.
+ ///\param g is the graph, to which we would like to define the PredMap.
+ ///\todo The graph alone may be insufficient to initialize
+#ifdef DOXYGEN
+ static PredMap *createPredMap(const GR &g)
+#else
+ static PredMap *createPredMap(const GR &)
+#endif
+ {
+ return new PredMap();
+ }
+
+ ///The type of the map that indicates which nodes are processed.
+
+ ///The type of the map that indicates which nodes are processed.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef NullMap<typename Graph::Node,bool> ProcessedMap;
+ ///Instantiates a ProcessedMap.
+
+ ///This function instantiates a \ref ProcessedMap.
+ ///\param g is the graph, to which
+ ///we would like to define the \ref ProcessedMap
+#ifdef DOXYGEN
+ static ProcessedMap *createProcessedMap(const GR &g)
+#else
+ static ProcessedMap *createProcessedMap(const GR &)
+#endif
+ {
+ return new ProcessedMap();
+ }
+ ///The type of the map that indicates which nodes are reached.
+
+ ///The type of the map that indicates which nodes are reached.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef typename Graph::template NodeMap<bool> ReachedMap;
+ ///Instantiates a ReachedMap.
+
+ ///This function instantiates a \ref ReachedMap.
+ ///\param G is the graph, to which
+ ///we would like to define the \ref ReachedMap.
+ static ReachedMap *createReachedMap(const GR &G)
+ {
+ return new ReachedMap(G);
+ }
+ ///The type of the map that stores the dists of the nodes.
+
+ ///The type of the map that stores the dists of the nodes.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef NullMap<typename Graph::Node,int> DistMap;
+ ///Instantiates a DistMap.
+
+ ///This function instantiates a \ref DistMap.
+ ///\param g is the graph, to which we would like to define the \ref DistMap
+#ifdef DOXYGEN
+ static DistMap *createDistMap(const GR &g)
+#else
+ static DistMap *createDistMap(const GR &)
+#endif
+ {
+ return new DistMap();
+ }
+ };
+
+ /// Default traits used by \ref BfsWizard
+
+ /// To make it easier to use Bfs algorithm
+ ///we have created a wizard class.
+ /// This \ref BfsWizard class needs default traits,
+ ///as well as the \ref Bfs class.
+ /// The \ref BfsWizardBase is a class to be the default traits of the
+ /// \ref BfsWizard class.
+ template<class GR>
+ class BfsWizardBase : public BfsWizardDefaultTraits<GR>
+ {
+
+ typedef BfsWizardDefaultTraits<GR> Base;
+ protected:
+ /// Type of the nodes in the graph.
+ typedef typename Base::Graph::Node Node;
+
+ /// Pointer to the underlying graph.
+ void *_g;
+ ///Pointer to the map of reached nodes.
+ void *_reached;
+ ///Pointer to the map of processed nodes.
+ void *_processed;
+ ///Pointer to the map of predecessors edges.
+ void *_pred;
+ ///Pointer to the map of distances.
+ void *_dist;
+ ///Pointer to the source node.
+ Node _source;
+
+ public:
+ /// Constructor.
+
+ /// This constructor does not require parameters, therefore it initiates
+ /// all of the attributes to default values (0, INVALID).
+ BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
+ _dist(0), _source(INVALID) {}
+
+ /// Constructor.
+
+ /// This constructor requires some parameters,
+ /// listed in the parameters list.
+ /// Others are initiated to 0.
+ /// \param g is the initial value of \ref _g
+ /// \param s is the initial value of \ref _source
+ BfsWizardBase(const GR &g, Node s=INVALID) :
+ _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
+ _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
+
+ };
+
+ /// A class to make the usage of Bfs algorithm easier
+
+ /// This class is created to make it easier to use Bfs algorithm.
+ /// It uses the functions and features of the plain \ref Bfs,
+ /// but it is much simpler to use it.
+ ///
+ /// Simplicity means that the way to change the types defined
+ /// in the traits class is based on functions that returns the new class
+ /// and not on templatable built-in classes.
+ /// When using the plain \ref Bfs
+ /// the new class with the modified type comes from
+ /// the original class by using the ::
+ /// operator. In the case of \ref BfsWizard only
+ /// a function have to be called and it will
+ /// return the needed class.
+ ///
+ /// It does not have own \ref run method. When its \ref run method is called
+ /// it initiates a plain \ref Bfs class, and calls the \ref Bfs::run
+ /// method of it.
+ template<class TR>
+ class BfsWizard : public TR
+ {
+ typedef TR Base;
+
+ ///The type of the underlying graph.
+ typedef typename TR::Graph Graph;
+ //\e
+ typedef typename Graph::Node Node;
+ //\e
+ typedef typename Graph::NodeIt NodeIt;
+ //\e
+ typedef typename Graph::Edge Edge;
+ //\e
+ typedef typename Graph::OutEdgeIt OutEdgeIt;
+
+ ///\brief The type of the map that stores
+ ///the reached nodes
+ typedef typename TR::ReachedMap ReachedMap;
+ ///\brief The type of the map that stores
+ ///the processed nodes
+ typedef typename TR::ProcessedMap ProcessedMap;
+ ///\brief The type of the map that stores the last
+ ///edges of the shortest paths.
+ typedef typename TR::PredMap PredMap;
+ ///The type of the map that stores the dists of the nodes.
+ typedef typename TR::DistMap DistMap;
+
+ public:
+ /// Constructor.
+ BfsWizard() : TR() {}
+
+ /// Constructor that requires parameters.
+
+ /// Constructor that requires parameters.
+ /// These parameters will be the default values for the traits class.
+ BfsWizard(const Graph &g, Node s=INVALID) :
+ TR(g,s) {}
+
+ ///Copy constructor
+ BfsWizard(const TR &b) : TR(b) {}
+
+ ~BfsWizard() {}
+
+ ///Runs Bfs algorithm from a given node.
+
+ ///Runs Bfs algorithm from a given node.
+ ///The node can be given by the \ref source function.
+ void run()
+ {
+ if(Base::_source==INVALID) throw UninitializedParameter();
+ Bfs<Graph,TR> alg(*reinterpret_cast<const Graph*>(Base::_g));
+ if(Base::_reached)
+ alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
+ if(Base::_processed)
+ alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
+ if(Base::_pred)
+ alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+ if(Base::_dist)
+ alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
+ alg.run(Base::_source);
+ }
+
+ ///Runs Bfs algorithm from the given node.
+
+ ///Runs Bfs algorithm from the given node.
+ ///\param s is the given source.
+ void run(Node s)
+ {
+ Base::_source=s;
+ run();
+ }
+
+ template<class T>
+ struct DefPredMapBase : public Base {
+ typedef T PredMap;
+ static PredMap *createPredMap(const Graph &) { return 0; };
+ DefPredMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting PredMap
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting PredMap
+ ///
+ template<class T>
+ BfsWizard<DefPredMapBase<T> > predMap(const T &t)
+ {
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return BfsWizard<DefPredMapBase<T> >(*this);
+ }
+
+
+ template<class T>
+ struct DefReachedMapBase : public Base {
+ typedef T ReachedMap;
+ static ReachedMap *createReachedMap(const Graph &) { return 0; };
+ DefReachedMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting ReachedMap
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting ReachedMap
+ ///
+ template<class T>
+ BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
+ {
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return BfsWizard<DefReachedMapBase<T> >(*this);
+ }
+
+
+ template<class T>
+ struct DefProcessedMapBase : public Base {
+ typedef T ProcessedMap;
+ static ProcessedMap *createProcessedMap(const Graph &) { return 0; };
+ DefProcessedMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting ProcessedMap
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting ProcessedMap
+ ///
+ template<class T>
+ BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
+ {
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return BfsWizard<DefProcessedMapBase<T> >(*this);
+ }
+
+
+ template<class T>
+ struct DefDistMapBase : public Base {
+ typedef T DistMap;
+ static DistMap *createDistMap(const Graph &) { return 0; };
+ DefDistMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting DistMap type
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting DistMap type
+ ///
+ template<class T>
+ BfsWizard<DefDistMapBase<T> > distMap(const T &t)
+ {
+ Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return BfsWizard<DefDistMapBase<T> >(*this);
+ }
+
+ /// Sets the source node, from which the Bfs algorithm runs.
+
+ /// Sets the source node, from which the Bfs algorithm runs.
+ /// \param s is the source node.
+ BfsWizard<TR> &source(Node s)
+ {
+ Base::_source=s;
+ return *this;
+ }
+
+ };
+
+ ///Function type interface for Bfs algorithm.
+
+ /// \ingroup search
+ ///Function type interface for Bfs algorithm.
+ ///
+ ///This function also has several
+ ///\ref named-templ-func-param "named parameters",
+ ///they are declared as the members of class \ref BfsWizard.
+ ///The following
+ ///example shows how to use these parameters.
+ ///\code
+ /// bfs(g,source).predMap(preds).run();
+ ///\endcode
+ ///\warning Don't forget to put the \ref BfsWizard::run() "run()"
+ ///to the end of the parameter list.
+ ///\sa BfsWizard
+ ///\sa Bfs
+ template<class GR>
+ BfsWizard<BfsWizardBase<GR> >
+ bfs(const GR &g,typename GR::Node s=INVALID)
+ {
+ return BfsWizard<BfsWizardBase<GR> >(g,s);
+ }
+
+#ifdef DOXYGEN
+ /// \brief Visitor class for bfs.
+ ///
+ /// This class defines the interface of the BfsVisit events, and
+ /// it could be the base of a real Visitor class.
+ template <typename _Graph>
+ struct BfsVisitor {
+ typedef _Graph Graph;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::Node Node;
+ /// \brief Called when the edge reach a node.
+ ///
+ /// It is called when the bfs find an edge which target is not
+ /// reached yet.
+ void discover(const Edge& edge) {}
+ /// \brief Called when the node reached first time.
+ ///
+ /// It is Called when the node reached first time.
+ void reach(const Node& node) {}
+ /// \brief Called when the edge examined but target of the edge
+ /// already discovered.
+ ///
+ /// It called when the edge examined but the target of the edge
+ /// already discovered.
+ void examine(const Edge& edge) {}
+ /// \brief Called for the source node of the bfs.
+ ///
+ /// It is called for the source node of the bfs.
+ void start(const Node& node) {}
+ /// \brief Called when the node processed.
+ ///
+ /// It is Called when the node processed.
+ void process(const Node& node) {}
+ };
+#else
+ template <typename _Graph>
+ struct BfsVisitor {
+ typedef _Graph Graph;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::Node Node;
+ void discover(const Edge&) {}
+ void reach(const Node&) {}
+ void examine(const Edge&) {}
+ void start(const Node&) {}
+ void process(const Node&) {}
+
+ template <typename _Visitor>
+ struct Constraints {
+ void constraints() {
+ Edge edge;
+ Node node;
+ visitor.discover(edge);
+ visitor.reach(node);
+ visitor.examine(edge);
+ visitor.start(node);
+ visitor.process(node);
+ }
+ _Visitor& visitor;
+ };
+ };
+#endif
+
+ /// \brief Default traits class of BfsVisit class.
+ ///
+ /// Default traits class of BfsVisit class.
+ /// \param _Graph Graph type.
+ template<class _Graph>
+ struct BfsVisitDefaultTraits {
+
+ /// \brief The graph type the algorithm runs on.
+ typedef _Graph Graph;
+
+ /// \brief The type of the map that indicates which nodes are reached.
+ ///
+ /// The type of the map that indicates which nodes are reached.
+ /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ /// \todo named parameter to set this type, function to read and write.
+ typedef typename Graph::template NodeMap<bool> ReachedMap;
+
+ /// \brief Instantiates a ReachedMap.
+ ///
+ /// This function instantiates a \ref ReachedMap.
+ /// \param graph is the graph, to which
+ /// we would like to define the \ref ReachedMap.
+ static ReachedMap *createReachedMap(const Graph &graph) {
+ return new ReachedMap(graph);
+ }
+
+ };
+
+ /// \ingroup search
+ ///
+ /// \brief %BFS Visit algorithm class.
+ ///
+ /// This class provides an efficient implementation of the %BFS algorithm
+ /// with visitor interface.
+ ///
+ /// The %BfsVisit class provides an alternative interface to the Bfs
+ /// class. It works with callback mechanism, the BfsVisit object calls
+ /// on every bfs event the \c Visitor class member functions.
+ ///
+ /// \param _Graph The graph type the algorithm runs on. The default value is
+ /// \ref ListGraph. The value of _Graph is not used directly by Bfs, it
+ /// is only passed to \ref BfsDefaultTraits.
+ /// \param _Visitor The Visitor object for the algorithm. The
+ /// \ref BfsVisitor "BfsVisitor<_Graph>" is an empty Visitor which
+ /// does not observe the Bfs events. If you want to observe the bfs
+ /// events you should implement your own Visitor class.
+ /// \param _Traits Traits class to set various data types used by the
+ /// algorithm. The default traits class is
+ /// \ref BfsVisitDefaultTraits "BfsVisitDefaultTraits<_Graph>".
+ /// See \ref BfsVisitDefaultTraits for the documentation of
+ /// a Bfs visit traits class.
+ ///
+ /// \author Jacint Szabo, Alpar Juttner and Balazs Dezso
+#ifdef DOXYGEN
+ template <typename _Graph, typename _Visitor, typename _Traits>
+#else
+ template <typename _Graph = ListGraph,
+ typename _Visitor = BfsVisitor<_Graph>,
+ typename _Traits = BfsDefaultTraits<_Graph> >
+#endif
+ class BfsVisit {
+ public:
+
+ /// \brief \ref Exception for uninitialized parameters.
+ ///
+ /// This error represents problems in the initialization
+ /// of the parameters of the algorithms.
+ class UninitializedParameter : public lemon::UninitializedParameter {
+ public:
+ virtual const char* what() const throw()
+ {
+ return "lemon::BfsVisit::UninitializedParameter";
+ }
+ };
+
+ typedef _Traits Traits;
+
+ typedef typename Traits::Graph Graph;
+
+ typedef _Visitor Visitor;
+
+ ///The type of the map indicating which nodes are reached.
+ typedef typename Traits::ReachedMap ReachedMap;
+
+ private:
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::OutEdgeIt OutEdgeIt;
+
+ /// Pointer to the underlying graph.
+ const Graph *_graph;
+ /// Pointer to the visitor object.
+ Visitor *_visitor;
+ ///Pointer to the map of reached status of the nodes.
+ ReachedMap *_reached;
+ ///Indicates if \ref _reached is locally allocated (\c true) or not.
+ bool local_reached;
+
+ std::vector<typename Graph::Node> _list;
+ int _list_front, _list_back;
+
+ /// \brief Creates the maps if necessary.
+ ///
+ /// Creates the maps if necessary.
+ void create_maps() {
+ if(!_reached) {
+ local_reached = true;
+ _reached = Traits::createReachedMap(*_graph);
+ }
+ }
+
+ protected:
+
+ BfsVisit() {}
+
+ public:
+
+ typedef BfsVisit Create;
+
+ /// \name Named template parameters
+
+ ///@{
+ template <class T>
+ struct DefReachedMapTraits : public Traits {
+ typedef T ReachedMap;
+ static ReachedMap *createReachedMap(const Graph &graph) {
+ throw UninitializedParameter();
+ }
+ };
+ /// \brief \ref named-templ-param "Named parameter" for setting
+ /// ReachedMap type
+ ///
+ /// \ref named-templ-param "Named parameter" for setting ReachedMap type
+ template <class T>
+ struct DefReachedMap : public BfsVisit< Graph, Visitor,
+ DefReachedMapTraits<T> > {
+ typedef BfsVisit< Graph, Visitor, DefReachedMapTraits<T> > Create;
+ };
+ ///@}
+
+ public:
+
+ /// \brief Constructor.
+ ///
+ /// Constructor.
+ ///
+ /// \param graph the graph the algorithm will run on.
+ /// \param visitor The visitor of the algorithm.
+ ///
+ BfsVisit(const Graph& graph, Visitor& visitor)
+ : _graph(&graph), _visitor(&visitor),
+ _reached(0), local_reached(false) {}
+
+ /// \brief Destructor.
+ ///
+ /// Destructor.
+ ~BfsVisit() {
+ if(local_reached) delete _reached;
+ }
+
+ /// \brief Sets the map indicating if a node is reached.
+ ///
+ /// Sets the map indicating if a node is reached.
+ /// If you don't use this function before calling \ref run(),
+ /// it will allocate one. The destuctor deallocates this
+ /// automatically allocated map, of course.
+ /// \return <tt> (*this) </tt>
+ BfsVisit &reachedMap(ReachedMap &m) {
+ if(local_reached) {
+ delete _reached;
+ local_reached = false;
+ }
+ _reached = &m;
+ return *this;
+ }
+
+ public:
+ /// \name Execution control
+ /// The simplest way to execute the algorithm is to use
+ /// one of the member functions called \c run(...).
+ /// \n
+ /// If you need more control on the execution,
+ /// first you must call \ref init(), then you can adda source node
+ /// with \ref addSource().
+ /// Finally \ref start() will perform the actual path
+ /// computation.
+
+ /// @{
+ /// \brief Initializes the internal data structures.
+ ///
+ /// Initializes the internal data structures.
+ ///
+ void init() {
+ create_maps();
+ _list.resize(countNodes(*_graph));
+ _list_front = _list_back = -1;
+ for (NodeIt u(*_graph) ; u != INVALID ; ++u) {
+ _reached->set(u, false);
+ }
+ }
+
+ /// \brief Adds a new source node.
+ ///
+ /// Adds a new source node to the set of nodes to be processed.
+ void addSource(Node s) {
+ if(!(*_reached)[s]) {
+ _reached->set(s,true);
+ _visitor->start(s);
+ _visitor->reach(s);
+ _list[++_list_back] = s;
+ }
+ }
+
+ /// \brief Processes the next node.
+ ///
+ /// Processes the next node.
+ ///
+ /// \return The processed node.
+ ///
+ /// \pre The queue must not be empty!
+ Node processNextNode() {
+ Node n = _list[++_list_front];
+ _visitor->process(n);
+ Edge e;
+ for (_graph->firstOut(e, n); e != INVALID; _graph->nextOut(e)) {
+ Node m = _graph->target(e);
+ if (!(*_reached)[m]) {
+ _visitor->discover(e);
+ _visitor->reach(m);
+ _reached->set(m, true);
+ _list[++_list_back] = m;
+ } else {
+ _visitor->examine(e);
+ }
+ }
+ return n;
+ }
+
+ /// \brief Processes the next node.
+ ///
+ /// Processes the next node. And checks that the given target node
+ /// is reached. If the target node is reachable from the processed
+ /// node then the reached parameter will be set true. The reached
+ /// parameter should be initially false.
+ ///
+ /// \param target The target node.
+ /// \retval reach Indicates that the target node is reached.
+ /// \return The processed node.
+ ///
+ /// \warning The queue must not be empty!
+ Node processNextNode(Node target, bool& reach) {
+ Node n = _list[++_list_front];
+ _visitor->process(n);
+ Edge e;
+ for (_graph->firstOut(e, n); e != INVALID; _graph->nextOut(e)) {
+ Node m = _graph->target(e);
+ if (!(*_reached)[m]) {
+ _visitor->discover(e);
+ _visitor->reach(m);
+ _reached->set(m, true);
+ _list[++_list_back] = m;
+ reach = reach || (target == m);
+ } else {
+ _visitor->examine(e);
+ }
+ }
+ return n;
+ }
+
+ /// \brief Processes the next node.
+ ///
+ /// Processes the next node. And checks that at least one of
+ /// reached node has true value in the \c nm node map. If one node
+ /// with true value is reachable from the processed node then the
+ /// rnode parameter will be set to the first of such nodes.
+ ///
+ /// \param nm The node map of possible targets.
+ /// \retval rnode The reached target node.
+ /// \return The processed node.
+ ///
+ /// \warning The queue must not be empty!
+ template <typename NM>
+ Node processNextNode(const NM& nm, Node& rnode) {
+ Node n = _list[++_list_front];
+ _visitor->process(n);
+ Edge e;
+ for (_graph->firstOut(e, n); e != INVALID; _graph->nextOut(e)) {
+ Node m = _graph->target(e);
+ if (!(*_reached)[m]) {
+ _visitor->discover(e);
+ _visitor->reach(m);
+ _reached->set(m, true);
+ _list[++_list_back] = m;
+ if (nm[m] && rnode == INVALID) rnode = m;
+ } else {
+ _visitor->examine(e);
+ }
+ }
+ return n;
+ }
+
+ /// \brief Next node to be processed.
+ ///
+ /// Next node to be processed.
+ ///
+ /// \return The next node to be processed or INVALID if the stack is
+ /// empty.
+ Node nextNode() {
+ return _list_front != _list_back ? _list[_list_front + 1] : INVALID;
+ }
+
+ /// \brief Returns \c false if there are nodes
+ /// to be processed in the queue
+ ///
+ /// Returns \c false if there are nodes
+ /// to be processed in the queue
+ bool emptyQueue() { return _list_front == _list_back; }
+
+ /// \brief Returns the number of the nodes to be processed.
+ ///
+ /// Returns the number of the nodes to be processed in the queue.
+ int queueSize() { return _list_back - _list_front; }
+
+ /// \brief Executes the algorithm.
+ ///
+ /// Executes the algorithm.
+ ///
+ /// \pre init() must be called and at least one node should be added
+ /// with addSource() before using this function.
+ void start() {
+ while ( !emptyQueue() ) processNextNode();
+ }
+
+ /// \brief Executes the algorithm until \c dest is reached.
+ ///
+ /// Executes the algorithm until \c dest is reached.
+ ///
+ /// \pre init() must be called and at least one node should be added
+ /// with addSource() before using this function.
+ void start(Node dest) {
+ bool reach = false;
+ while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
+ }
+
+ /// \brief Executes the algorithm until a condition is met.
+ ///
+ /// Executes the algorithm until a condition is met.
+ ///
+ /// \pre init() must be called and at least one node should be added
+ /// with addSource() before using this function.
+ ///
+ ///\param nm must be a bool (or convertible) node map. The
+ ///algorithm will stop when it reaches a node \c v with
+ /// <tt>nm[v]</tt> true.
+ ///
+ ///\return The reached node \c v with <tt>nm[v]</tt> true or
+ ///\c INVALID if no such node was found.
+ template <typename NM>
+ Node start(const NM &nm) {
+ Node rnode = INVALID;
+ while ( !emptyQueue() && rnode == INVALID ) {
+ processNextNode(nm, rnode);
+ }
+ return rnode;
+ }
+
+ /// \brief Runs %BFSVisit algorithm from node \c s.
+ ///
+ /// This method runs the %BFS algorithm from a root node \c s.
+ /// \note b.run(s) is just a shortcut of the following code.
+ ///\code
+ /// b.init();
+ /// b.addSource(s);
+ /// b.start();
+ ///\endcode
+ void run(Node s) {
+ init();
+ addSource(s);
+ start();
+ }
+
+ /// \brief Runs %BFSVisit algorithm to visit all nodes in the graph.
+ ///
+ /// This method runs the %BFS algorithm in order to
+ /// compute the %BFS path to each node. The algorithm computes
+ /// - The %BFS tree.
+ /// - The distance of each node from the root in the %BFS tree.
+ ///
+ ///\note b.run() is just a shortcut of the following code.
+ ///\code
+ /// b.init();
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!b.reached(it)) {
+ /// b.addSource(it);
+ /// b.start();
+ /// }
+ /// }
+ ///\endcode
+ void run() {
+ init();
+ for (NodeIt it(*_graph); it != INVALID; ++it) {
+ if (!reached(it)) {
+ addSource(it);
+ start();
+ }
+ }
+ }
+ ///@}
+
+ /// \name Query Functions
+ /// The result of the %BFS algorithm can be obtained using these
+ /// functions.\n
+ /// Before the use of these functions,
+ /// either run() or start() must be called.
+ ///@{
+
+ /// \brief Checks if a node is reachable from the root.
+ ///
+ /// Returns \c true if \c v is reachable from the root(s).
+ /// \warning The source nodes are inditated as unreachable.
+ /// \pre Either \ref run() or \ref start()
+ /// must be called before using this function.
+ ///
+ bool reached(Node v) { return (*_reached)[v]; }
+ ///@}
+ };
+
+} //END OF NAMESPACE LEMON
+
+#endif
+
diff --git a/src/lemon/bin_heap.h b/src/lemon/bin_heap.h
new file mode 100644
index 0000000..63e0c08
--- /dev/null
+++ b/src/lemon/bin_heap.h
@@ -0,0 +1,346 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BIN_HEAP_H
+#define LEMON_BIN_HEAP_H
+
+///\ingroup auxdat
+///\file
+///\brief Binary Heap implementation.
+
+#include <vector>
+#include <utility>
+#include <functional>
+
+namespace lemon {
+
+ ///\ingroup auxdat
+ ///
+ ///\brief A Binary Heap implementation.
+ ///
+ ///This class implements the \e binary \e heap data structure. A \e heap
+ ///is a data structure for storing items with specified values called \e
+ ///priorities in such a way that finding the item with minimum priority is
+ ///efficient. \c Compare specifies the ordering of the priorities. In a heap
+ ///one can change the priority of an item, add or erase an item, etc.
+ ///
+ ///\param _Prio Type of the priority of the items.
+ ///\param _ItemIntMap A read and writable Item int map, used internally
+ ///to handle the cross references.
+ ///\param _Compare A class for the ordering of the priorities. The
+ ///default is \c std::less<_Prio>.
+ ///
+ ///\sa FibHeap
+ ///\sa Dijkstra
+ template <typename _Prio, typename _ItemIntMap,
+ typename _Compare = std::less<_Prio> >
+ class BinHeap {
+
+ public:
+ ///\e
+ typedef _ItemIntMap ItemIntMap;
+ ///\e
+ typedef _Prio Prio;
+ ///\e
+ typedef typename ItemIntMap::Key Item;
+ ///\e
+ typedef std::pair<Item,Prio> Pair;
+ ///\e
+ typedef _Compare Compare;
+
+ /// \brief Type to represent the items states.
+ ///
+ /// Each Item element have a state associated to it. It may be "in heap",
+ /// "pre heap" or "post heap". The latter two are indifferent from the
+ /// heap's point of view, but may be useful to the user.
+ ///
+ /// The ItemIntMap \e should be initialized in such way that it maps
+ /// PRE_HEAP (-1) to any element to be put in the heap...
+ enum State {
+ IN_HEAP = 0,
+ PRE_HEAP = -1,
+ POST_HEAP = -2
+ };
+
+ private:
+ std::vector<Pair> data;
+ Compare comp;
+ ItemIntMap &iim;
+
+ public:
+ /// \brief The constructor.
+ ///
+ /// The constructor.
+ /// \param _iim should be given to the constructor, since it is used
+ /// internally to handle the cross references. The value of the map
+ /// should be PRE_HEAP (-1) for each element.
+ explicit BinHeap(ItemIntMap &_iim) : iim(_iim) {}
+
+ /// \brief The constructor.
+ ///
+ /// The constructor.
+ /// \param _iim should be given to the constructor, since it is used
+ /// internally to handle the cross references. The value of the map
+ /// should be PRE_HEAP (-1) for each element.
+ ///
+ /// \param _comp The comparator function object.
+ BinHeap(ItemIntMap &_iim, const Compare &_comp)
+ : iim(_iim), comp(_comp) {}
+
+
+ /// The number of items stored in the heap.
+ ///
+ /// \brief Returns the number of items stored in the heap.
+ int size() const { return data.size(); }
+
+ /// \brief Checks if the heap stores no items.
+ ///
+ /// Returns \c true if and only if the heap stores no items.
+ bool empty() const { return data.empty(); }
+
+ /// \brief Make empty this heap.
+ ///
+ /// Make empty this heap. It does not change the cross reference map.
+ /// If you want to reuse what is not surely empty you should first clear
+ /// the heap and after that you should set the cross reference map for
+ /// each item to \c PRE_HEAP.
+ void clear() {
+ data.clear();
+ }
+
+ private:
+ static int parent(int i) { return (i-1)/2; }
+
+ static int second_child(int i) { return 2*i+2; }
+ bool less(const Pair &p1, const Pair &p2) const {
+ return comp(p1.second, p2.second);
+ }
+
+ int bubble_up(int hole, Pair p) {
+ int par = parent(hole);
+ while( hole>0 && less(p,data[par]) ) {
+ move(data[par],hole);
+ hole = par;
+ par = parent(hole);
+ }
+ move(p, hole);
+ return hole;
+ }
+
+ int bubble_down(int hole, Pair p, int length) {
+ int child = second_child(hole);
+ while(child < length) {
+ if( less(data[child-1], data[child]) ) {
+ --child;
+ }
+ if( !less(data[child], p) )
+ goto ok;
+ move(data[child], hole);
+ hole = child;
+ child = second_child(hole);
+ }
+ child--;
+ if( child<length && less(data[child], p) ) {
+ move(data[child], hole);
+ hole=child;
+ }
+ ok:
+ move(p, hole);
+ return hole;
+ }
+
+ void move(const Pair &p, int i) {
+ data[i] = p;
+ iim.set(p.first, i);
+ }
+
+ public:
+ /// \brief Insert a pair of item and priority into the heap.
+ ///
+ /// Adds \c p.first to the heap with priority \c p.second.
+ /// \param p The pair to insert.
+ void push(const Pair &p) {
+ int n = data.size();
+ data.resize(n+1);
+ bubble_up(n, p);
+ }
+
+ /// \brief Insert an item into the heap with the given heap.
+ ///
+ /// Adds \c i to the heap with priority \c p.
+ /// \param i The item to insert.
+ /// \param p The priority of the item.
+ void push(const Item &i, const Prio &p) { push(Pair(i,p)); }
+
+ /// \brief Returns the item with minimum priority relative to \c Compare.
+ ///
+ /// This method returns the item with minimum priority relative to \c
+ /// Compare.
+ /// \pre The heap must be nonempty.
+ Item top() const {
+ return data[0].first;
+ }
+
+ /// \brief Returns the minimum priority relative to \c Compare.
+ ///
+ /// It returns the minimum priority relative to \c Compare.
+ /// \pre The heap must be nonempty.
+ Prio prio() const {
+ return data[0].second;
+ }
+
+ /// \brief Deletes the item with minimum priority relative to \c Compare.
+ ///
+ /// This method deletes the item with minimum priority relative to \c
+ /// Compare from the heap.
+ /// \pre The heap must be non-empty.
+ void pop() {
+ int n = data.size()-1;
+ iim.set(data[0].first, POST_HEAP);
+ if (n > 0) {
+ bubble_down(0, data[n], n);
+ }
+ data.pop_back();
+ }
+
+ /// \brief Deletes \c i from the heap.
+ ///
+ /// This method deletes item \c i from the heap.
+ /// \param i The item to erase.
+ /// \pre The item should be in the heap.
+ void erase(const Item &i) {
+ int h = iim[i];
+ int n = data.size()-1;
+ iim.set(data[h].first, POST_HEAP);
+ if( h < n ) {
+ if ( bubble_up(h, data[n]) == h) {
+ bubble_down(h, data[n], n);
+ }
+ }
+ data.pop_back();
+ }
+
+
+ /// \brief Returns the priority of \c i.
+ ///
+ /// This function returns the priority of item \c i.
+ /// \pre \c i must be in the heap.
+ /// \param i The item.
+ Prio operator[](const Item &i) const {
+ int idx = iim[i];
+ return data[idx].second;
+ }
+
+ /// \brief \c i gets to the heap with priority \c p independently
+ /// if \c i was already there.
+ ///
+ /// This method calls \ref push(\c i, \c p) if \c i is not stored
+ /// in the heap and sets the priority of \c i to \c p otherwise.
+ /// \param i The item.
+ /// \param p The priority.
+ void set(const Item &i, const Prio &p) {
+ int idx = iim[i];
+ if( idx < 0 ) {
+ push(i,p);
+ }
+ else if( comp(p, data[idx].second) ) {
+ bubble_up(idx, Pair(i,p));
+ }
+ else {
+ bubble_down(idx, Pair(i,p), data.size());
+ }
+ }
+
+ /// \brief Decreases the priority of \c i to \c p.
+ ///
+ /// This method decreases the priority of item \c i to \c p.
+ /// \pre \c i must be stored in the heap with priority at least \c
+ /// p relative to \c Compare.
+ /// \param i The item.
+ /// \param p The priority.
+ void decrease(const Item &i, const Prio &p) {
+ int idx = iim[i];
+ bubble_up(idx, Pair(i,p));
+ }
+
+ /// \brief Increases the priority of \c i to \c p.
+ ///
+ /// This method sets the priority of item \c i to \c p.
+ /// \pre \c i must be stored in the heap with priority at most \c
+ /// p relative to \c Compare.
+ /// \param i The item.
+ /// \param p The priority.
+ void increase(const Item &i, const Prio &p) {
+ int idx = iim[i];
+ bubble_down(idx, Pair(i,p), data.size());
+ }
+
+ /// \brief Returns if \c item is in, has already been in, or has
+ /// never been in the heap.
+ ///
+ /// This method returns PRE_HEAP if \c item has never been in the
+ /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
+ /// otherwise. In the latter case it is possible that \c item will
+ /// get back to the heap again.
+ /// \param i The item.
+ State state(const Item &i) const {
+ int s = iim[i];
+ if( s>=0 )
+ s=0;
+ return State(s);
+ }
+
+ /// \brief Sets the state of the \c item in the heap.
+ ///
+ /// Sets the state of the \c item in the heap. It can be used to
+ /// manually clear the heap when it is important to achive the
+ /// better time complexity.
+ /// \param i The item.
+ /// \param st The state. It should not be \c IN_HEAP.
+ void state(const Item& i, State st) {
+ switch (st) {
+ case POST_HEAP:
+ case PRE_HEAP:
+ if (state(i) == IN_HEAP) {
+ erase(i);
+ }
+ iim[i] = st;
+ break;
+ case IN_HEAP:
+ break;
+ }
+ }
+
+ /// \brief Replaces an item in the heap.
+ ///
+ /// The \c i item is replaced with \c j item. The \c i item should
+ /// be in the heap, while the \c j should be out of the heap. The
+ /// \c i item will out of the heap and \c j will be in the heap
+ /// with the same prioriority as prevoiusly the \c i item.
+ void replace(const Item& i, const Item& j) {
+ int idx = iim[i];
+ iim.set(i, iim[j]);
+ iim.set(j, idx);
+ data[idx].first = j;
+ }
+
+ }; // class BinHeap
+
+} // namespace lemon
+
+#endif // LEMON_BIN_HEAP_H
diff --git a/src/lemon/bipartite_matching.h b/src/lemon/bipartite_matching.h
new file mode 100644
index 0000000..ce3cb4f
--- /dev/null
+++ b/src/lemon/bipartite_matching.h
@@ -0,0 +1,1732 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BIPARTITE_MATCHING
+#define LEMON_BIPARTITE_MATCHING
+
+#include <functional>
+
+#include <lemon/bin_heap.h>
+#include <lemon/fib_heap.h>
+#include <lemon/maps.h>
+
+#include <iostream>
+
+///\ingroup matching
+///\file
+///\brief Maximum matching algorithms in bipartite graphs.
+///
+///\note The pr_bipartite_matching.h file also contains algorithms to
+///solve maximum cardinality bipartite matching problems.
+
+namespace lemon {
+
+ /// \ingroup matching
+ ///
+ /// \brief Bipartite Max Cardinality Matching algorithm
+ ///
+ /// Bipartite Max Cardinality Matching algorithm. This class implements
+ /// the Hopcroft-Karp algorithm which has \f$ O(e\sqrt{n}) \f$ time
+ /// complexity.
+ ///
+ /// \note In several cases the push-relabel based algorithms have
+ /// better runtime performance than the augmenting path based ones.
+ ///
+ /// \see PrBipartiteMatching
+ template <typename BpUGraph>
+ class MaxBipartiteMatching {
+ protected:
+
+ typedef BpUGraph Graph;
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::ANodeIt ANodeIt;
+ typedef typename Graph::BNodeIt BNodeIt;
+ typedef typename Graph::UEdge UEdge;
+ typedef typename Graph::UEdgeIt UEdgeIt;
+ typedef typename Graph::IncEdgeIt IncEdgeIt;
+
+ typedef typename BpUGraph::template ANodeMap<UEdge> ANodeMatchingMap;
+ typedef typename BpUGraph::template BNodeMap<UEdge> BNodeMatchingMap;
+
+
+ public:
+
+ /// \brief Constructor.
+ ///
+ /// Constructor of the algorithm.
+ MaxBipartiteMatching(const BpUGraph& graph)
+ : _matching(graph), _rmatching(graph), _reached(graph), _graph(&graph) {}
+
+ /// \name Execution control
+ /// The simplest way to execute the algorithm is to use
+ /// one of the member functions called \c run().
+ /// \n
+ /// If you need more control on the execution,
+ /// first you must call \ref init() or one alternative for it.
+ /// Finally \ref start() will perform the matching computation or
+ /// with step-by-step execution you can augment the solution.
+
+ /// @{
+
+ /// \brief Initalize the data structures.
+ ///
+ /// It initalizes the data structures and creates an empty matching.
+ void init() {
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ _matching.set(it, INVALID);
+ }
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ _rmatching.set(it, INVALID);
+ _reached.set(it, -1);
+ }
+ _size = 0;
+ _phase = -1;
+ }
+
+ /// \brief Initalize the data structures.
+ ///
+ /// It initalizes the data structures and creates a greedy
+ /// matching. From this matching sometimes it is faster to get
+ /// the matching than from the initial empty matching.
+ void greedyInit() {
+ _size = 0;
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ _rmatching.set(it, INVALID);
+ _reached.set(it, 0);
+ }
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ _matching[it] = INVALID;
+ for (IncEdgeIt jt(*_graph, it); jt != INVALID; ++jt) {
+ if (_rmatching[_graph->bNode(jt)] == INVALID) {
+ _matching.set(it, jt);
+ _rmatching.set(_graph->bNode(jt), jt);
+ _reached.set(_graph->bNode(jt), -1);
+ ++_size;
+ break;
+ }
+ }
+ }
+ _phase = 0;
+ }
+
+ /// \brief Initalize the data structures with an initial matching.
+ ///
+ /// It initalizes the data structures with an initial matching.
+ template <typename MatchingMap>
+ void matchingInit(const MatchingMap& mm) {
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ _matching.set(it, INVALID);
+ }
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ _rmatching.set(it, INVALID);
+ _reached.set(it, 0);
+ }
+ _size = 0;
+ for (UEdgeIt it(*_graph); it != INVALID; ++it) {
+ if (mm[it]) {
+ ++_size;
+ _matching.set(_graph->aNode(it), it);
+ _rmatching.set(_graph->bNode(it), it);
+ _reached.set(_graph->bNode(it), 0);
+ }
+ }
+ _phase = 0;
+ }
+
+ /// \brief Initalize the data structures with an initial matching.
+ ///
+ /// It initalizes the data structures with an initial matching.
+ /// \return %True when the given map contains really a matching.
+ template <typename MatchingMap>
+ bool checkedMatchingInit(const MatchingMap& mm) {
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ _matching.set(it, INVALID);
+ }
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ _rmatching.set(it, INVALID);
+ _reached.set(it, 0);
+ }
+ _size = 0;
+ for (UEdgeIt it(*_graph); it != INVALID; ++it) {
+ if (mm[it]) {
+ ++_size;
+ if (_matching[_graph->aNode(it)] != INVALID) {
+ return false;
+ }
+ _matching.set(_graph->aNode(it), it);
+ if (_matching[_graph->bNode(it)] != INVALID) {
+ return false;
+ }
+ _matching.set(_graph->bNode(it), it);
+ _reached.set(_graph->bNode(it), -1);
+ }
+ }
+ _phase = 0;
+ return true;
+ }
+
+ private:
+
+ bool _find_path(Node anode, int maxlevel,
+ typename Graph::template BNodeMap<int>& level) {
+ for (IncEdgeIt it(*_graph, anode); it != INVALID; ++it) {
+ Node bnode = _graph->bNode(it);
+ if (level[bnode] == maxlevel) {
+ level.set(bnode, -1);
+ if (maxlevel == 0) {
+ _matching.set(anode, it);
+ _rmatching.set(bnode, it);
+ return true;
+ } else {
+ Node nnode = _graph->aNode(_rmatching[bnode]);
+ if (_find_path(nnode, maxlevel - 1, level)) {
+ _matching.set(anode, it);
+ _rmatching.set(bnode, it);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public:
+
+ /// \brief An augmenting phase of the Hopcroft-Karp algorithm
+ ///
+ /// It runs an augmenting phase of the Hopcroft-Karp
+ /// algorithm. This phase finds maximal edge disjoint augmenting
+ /// paths and augments on these paths. The algorithm consists at
+ /// most of \f$ O(\sqrt{n}) \f$ phase and one phase is \f$ O(e)
+ /// \f$ long.
+ bool augment() {
+
+ ++_phase;
+
+ typename Graph::template BNodeMap<int> _level(*_graph, -1);
+ //typename Graph::template ANodeMap<int> _found(*_graph, false);
+ typename Graph::template ANodeMap<bool> _found(*_graph, false);
+ std::vector<Node> queue, aqueue;
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ if (_rmatching[it] == INVALID) {
+ queue.push_back(it);
+ _reached.set(it, _phase);
+ _level.set(it, 0);
+ }
+ }
+
+ bool success = false;
+
+ int level = 0;
+ //std::vector<Node> nqueue;
+ while (!success && !queue.empty()) {
+ //nqueue.clear();
+ std::vector<Node> nqueue;
+ for (int i = 0; i < int(queue.size()); ++i) {
+ Node bnode = queue[i];
+ for (IncEdgeIt jt(*_graph, bnode); jt != INVALID; ++jt) {
+ Node anode = _graph->aNode(jt);
+ if (_matching[anode] == INVALID) {
+
+ if (!_found[anode]) {
+ if (_find_path(anode, level, _level)) {
+ ++_size;
+ }
+ _found.set(anode, true);
+ }
+ success = true;
+ } else {
+ Node nnode = _graph->bNode(_matching[anode]);
+ if (_reached[nnode] != _phase) {
+ _reached.set(nnode, _phase);
+ nqueue.push_back(nnode);
+ _level.set(nnode, level + 1);
+ }
+ }
+ }
+ }
+ ++level;
+ queue.swap(nqueue);
+ }
+
+ return success;
+ }
+ private:
+
+ void _find_path_bfs(Node anode,
+ typename Graph::template ANodeMap<UEdge>& pred) {
+ while (true) {
+ UEdge uedge = pred[anode];
+ Node bnode = _graph->bNode(uedge);
+
+ UEdge nedge = _rmatching[bnode];
+
+ _matching.set(anode, uedge);
+ _rmatching.set(bnode, uedge);
+
+ if (nedge == INVALID) break;
+ anode = _graph->aNode(nedge);
+ }
+ }
+
+ public:
+
+ /// \brief An augmenting phase with single path augementing
+ ///
+ /// This phase finds only one augmenting paths and augments on
+ /// these paths. The algorithm consists at most of \f$ O(n) \f$
+ /// phase and one phase is \f$ O(e) \f$ long.
+ bool simpleAugment() {
+ ++_phase;
+
+ typename Graph::template ANodeMap<UEdge> _pred(*_graph);
+
+ std::vector<Node> queue, aqueue;
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ if (_rmatching[it] == INVALID) {
+ queue.push_back(it);
+ _reached.set(it, _phase);
+ }
+ }
+
+ bool success = false;
+
+ int level = 0;
+ while (!success && !queue.empty()) {
+ std::vector<Node> nqueue;
+ for (int i = 0; i < int(queue.size()); ++i) {
+ Node bnode = queue[i];
+ for (IncEdgeIt jt(*_graph, bnode); jt != INVALID; ++jt) {
+ Node anode = _graph->aNode(jt);
+ if (_matching[anode] == INVALID) {
+ _pred.set(anode, jt);
+ _find_path_bfs(anode, _pred);
+ ++_size;
+ return true;
+ } else {
+ Node nnode = _graph->bNode(_matching[anode]);
+ if (_reached[nnode] != _phase) {
+ _pred.set(anode, jt);
+ _reached.set(nnode, _phase);
+ nqueue.push_back(nnode);
+ }
+ }
+ }
+ }
+ ++level;
+ queue.swap(nqueue);
+ }
+
+ return success;
+ }
+
+
+
+ /// \brief Starts the algorithm.
+ ///
+ /// Starts the algorithm. It runs augmenting phases until the optimal
+ /// solution reached.
+ void start() {
+ while (augment()) {}
+ }
+
+ /// \brief Runs the algorithm.
+ ///
+ /// It just initalize the algorithm and then start it.
+ void run() {
+ greedyInit();
+ start();
+ }
+
+ /// @}
+
+ /// \name Query Functions
+ /// The result of the %Matching algorithm can be obtained using these
+ /// functions.\n
+ /// Before the use of these functions,
+ /// either run() or start() must be called.
+
+ ///@{
+
+ /// \brief Return true if the given uedge is in the matching.
+ ///
+ /// It returns true if the given uedge is in the matching.
+ bool matchingEdge(const UEdge& edge) const {
+ return _matching[_graph->aNode(edge)] == edge;
+ }
+
+ /// \brief Returns the matching edge from the node.
+ ///
+ /// Returns the matching edge from the node. If there is not such
+ /// edge it gives back \c INVALID.
+ /// \note If the parameter node is a B-node then the running time is
+ /// propotional to the degree of the node.
+ UEdge matchingEdge(const Node& node) const {
+ if (_graph->aNode(node)) {
+ return _matching[node];
+ } else {
+ return _rmatching[node];
+ }
+ }
+
+ /// \brief Set true all matching uedge in the map.
+ ///
+ /// Set true all matching uedge in the map. It does not change the
+ /// value mapped to the other uedges.
+ /// \return The number of the matching edges.
+ template <typename MatchingMap>
+ int quickMatching(MatchingMap& mm) const {
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ if (_matching[it] != INVALID) {
+ mm.set(_matching[it], true);
+ }
+ }
+ return _size;
+ }
+
+ /// \brief Set true all matching uedge in the map and the others to false.
+ ///
+ /// Set true all matching uedge in the map and the others to false.
+ /// \return The number of the matching edges.
+ template <typename MatchingMap>
+ int matching(MatchingMap& mm) const {
+ for (UEdgeIt it(*_graph); it != INVALID; ++it) {
+ mm.set(it, it == _matching[_graph->aNode(it)]);
+ }
+ return _size;
+ }
+
+ ///Gives back the matching in an ANodeMap.
+
+ ///Gives back the matching in an ANodeMap. The parameter should
+ ///be a write ANodeMap of UEdge values.
+ ///\return The number of the matching edges.
+ template<class MatchingMap>
+ int aMatching(MatchingMap& mm) const {
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ mm.set(it, _matching[it]);
+ }
+ return _size;
+ }
+
+ ///Gives back the matching in a BNodeMap.
+
+ ///Gives back the matching in a BNodeMap. The parameter should
+ ///be a write BNodeMap of UEdge values.
+ ///\return The number of the matching edges.
+ template<class MatchingMap>
+ int bMatching(MatchingMap& mm) const {
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ mm.set(it, _rmatching[it]);
+ }
+ return _size;
+ }
+
+ /// \brief Returns a minimum covering of the nodes.
+ ///
+ /// The minimum covering set problem is the dual solution of the
+ /// maximum bipartite matching. It provides a solution for this
+ /// problem what is proof of the optimality of the matching.
+ /// \return The size of the cover set.
+ template <typename CoverMap>
+ int coverSet(CoverMap& covering) const {
+
+ int size = 0;
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ bool cn = _matching[it] != INVALID &&
+ _reached[_graph->bNode(_matching[it])] == _phase;
+ covering.set(it, cn);
+ if (cn) ++size;
+ }
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ bool cn = _reached[it] != _phase;
+ covering.set(it, cn);
+ if (cn) ++size;
+ }
+ return size;
+ }
+
+ /// \brief Gives back a barrier on the A-nodes
+ ///
+ /// The barrier is s subset of the nodes on the same side of the
+ /// graph, which size minus its neighbours is exactly the
+ /// unmatched nodes on the A-side.
+ /// \retval barrier A WriteMap on the ANodes with bool value.
+ template <typename BarrierMap>
+ void aBarrier(BarrierMap& barrier) const {
+
+ for (ANodeIt it(*_graph); it != INVALID; ++it) {
+ barrier.set(it, _matching[it] == INVALID ||
+ _reached[_graph->bNode(_matching[it])] != _phase);
+ }
+ }
+
+ /// \brief Gives back a barrier on the B-nodes
+ ///
+ /// The barrier is s subset of the nodes on the same side of the
+ /// graph, which size minus its neighbours is exactly the
+ /// unmatched nodes on the B-side.
+ /// \retval barrier A WriteMap on the BNodes with bool value.
+ template <typename BarrierMap>
+ void bBarrier(BarrierMap& barrier) const {
+
+ for (BNodeIt it(*_graph); it != INVALID; ++it) {
+ barrier.set(it, _reached[it] == _phase);
+ }
+ }
+
+ /// \brief Gives back the number of the matching edges.
+ ///
+ /// Gives back the number of the matching edges.
+ int matchingSize() const {
+ return _size;
+ }
+
+ /// @}
+
+ private:
+
+ typename BpUGraph::template ANodeMap<UEdge> _matching;
+ typename BpUGraph::template BNodeMap<UEdge> _rmatching;
+
+ typename BpUGraph::template BNodeMap<int> _reached;
+
+ int _phase;
+ const Graph *_graph;
+
+ int _size;
+
+ };
+
+ /// \ingroup matching
+ ///
+ /// \brief Maximum cardinality bipartite matching
+ ///
+ /// This function calculates the maximum cardinality matching
+ /// in a bipartite graph. It gives back the matching in an undirected
+ /// edge map.
+ ///
+ /// \param graph The bipartite graph.
+ /// \return The size of the matching.
+ template <typename BpUGraph>
+ int maxBipartiteMatching(const BpUGraph& graph) {
+ MaxBipartiteMatching<BpUGraph> bpmatching(graph);
+ bpmatching.run();
+ return bpmatching.matchingSize();
+ }
+
+ /// \ingroup matching
+ ///
+ /// \brief Maximum cardinality bipartite matching
+ ///
+ /// This function calculates the maximum cardinality matching
+ /// in a bipartite graph. It gives back the matching in an undirected
+ /// edge map.
+ ///
+ /// \param graph The bipartite graph.
+ /// \retval matching The ANodeMap of UEdges which will be set to covered
+ /// matching undirected edge.
+ /// \return The size of the matching.
+ template <typename BpUGraph, typename MatchingMap>
+ int maxBipartiteMatching(const BpUGraph& graph, MatchingMap& matching) {
+ MaxBipartiteMatching<BpUGraph> bpmatching(graph);
+ bpmatching.run();
+ bpmatching.aMatching(matching);
+ return bpmatching.matchingSize();
+ }
+
+ /// \ingroup matching
+ ///
+ /// \brief Maximum cardinality bipartite matching
+ ///
+ /// This function calculates the maximum cardinality matching
+ /// in a bipartite graph. It gives back the matching in an undirected
+ /// edge map.
+ ///
+ /// \param graph The bipartite graph.
+ /// \retval matching The ANodeMap of UEdges which will be set to covered
+ /// matching undirected edge.
+ /// \retval barrier The BNodeMap of bools which will be set to a barrier
+ /// of the BNode-set.
+ /// \return The size of the matching.
+ template <typename BpUGraph, typename MatchingMap, typename BarrierMap>
+ int maxBipartiteMatching(const BpUGraph& graph,
+ MatchingMap& matching, BarrierMap& barrier) {
+ MaxBipartiteMatching<BpUGraph> bpmatching(graph);
+ bpmatching.run();
+ bpmatching.aMatching(matching);
+ bpmatching.bBarrier(barrier);
+ return bpmatching.matchingSize();
+ }
+
+ /// \brief Default traits class for weighted bipartite matching algoritms.
+ ///
+ /// Default traits class for weighted bipartite matching algoritms.
+ /// \param _BpUGraph The bipartite undirected graph type.
+ /// \param _WeightMap Type of weight map.
+ template <typename _BpUGraph, typename _WeightMap>
+ struct MaxWeightedBipartiteMatchingDefaultTraits {
+ /// \brief The type of the weight of the undirected edges.
+ typedef typename _WeightMap::Value Value;
+
+ /// The undirected bipartite graph type the algorithm runs on.
+ typedef _BpUGraph BpUGraph;
+
+ /// The map of the edges weights
+ typedef _WeightMap WeightMap;
+
+ /// \brief The cross reference type used by heap.
+ ///
+ /// The cross reference type used by heap.
+ /// Usually it is \c Graph::ANodeMap<int>.
+ typedef typename BpUGraph::template ANodeMap<int> HeapCrossRef;
+
+ /// \brief Instantiates a HeapCrossRef.
+ ///
+ /// This function instantiates a \ref HeapCrossRef.
+ /// \param graph is the graph, to which we would like to define the
+ /// HeapCrossRef.
+ static HeapCrossRef *createHeapCrossRef(const BpUGraph &graph) {
+ return new HeapCrossRef(graph);
+ }
+
+ /// \brief The heap type used by weighted matching algorithms.
+ ///
+ /// The heap type used by weighted matching algorithms. It should
+ /// minimize the priorities and the heap's key type is the graph's
+ /// anode graph's node.
+ ///
+ /// \sa BinHeap
+ //typedef BinHeap<Value, HeapCrossRef> Heap;
+ typedef FibHeap<Value, HeapCrossRef> Heap;
+
+ /// \brief Instantiates a Heap.
+ ///
+ /// This function instantiates a \ref Heap.
+ /// \param crossref The cross reference of the heap.
+ static Heap *createHeap(HeapCrossRef& crossref) {
+ return new Heap(crossref);
+ }
+
+ };
+
+
+ /// \ingroup matching
+ ///
+ /// \brief Bipartite Max Weighted Matching algorithm
+ ///
+ /// This class implements the bipartite Max Weighted Matching
+ /// algorithm. It uses the successive shortest path algorithm to
+ /// calculate the maximum weighted matching in the bipartite
+ /// graph. The algorithm can be used also to calculate the maximum
+ /// cardinality maximum weighted matching. The time complexity
+ /// of the algorithm is \f$ O(ne\log(n)) \f$ with the default binary
+ /// heap implementation but this can be improved to
+ /// \f$ O(n^2\log(n)+ne) \f$ if we use fibonacci heaps.
+ ///
+ /// The algorithm also provides a potential function on the nodes
+ /// which a dual solution of the matching algorithm and it can be
+ /// used to proof the optimality of the given pimal solution.
+#ifdef DOXYGEN
+ template <typename _BpUGraph, typename _WeightMap, typename _Traits>
+#else
+ template <typename _BpUGraph,
+ typename _WeightMap = typename _BpUGraph::template UEdgeMap<int>,
+ typename _Traits =
+ MaxWeightedBipartiteMatchingDefaultTraits<_BpUGraph, _WeightMap> >
+#endif
+ class MaxWeightedBipartiteMatching {
+public:
+
+ typedef _Traits Traits;
+ typedef typename Traits::BpUGraph BpUGraph;
+ typedef typename Traits::WeightMap WeightMap;
+ typedef typename Traits::Value Value;
+
+protected:
+
+ typedef typename Traits::HeapCrossRef HeapCrossRef;
+ typedef typename Traits::Heap Heap;
+
+
+ typedef typename BpUGraph::Node Node;
+ typedef typename BpUGraph::ANodeIt ANodeIt;
+ typedef typename BpUGraph::BNodeIt BNodeIt;
+ typedef typename BpUGraph::UEdge UEdge;
+ typedef typename BpUGraph::UEdgeIt UEdgeIt;
+ typedef typename BpUGraph::IncEdgeIt IncEdgeIt;
+
+ typedef typename BpUGraph::template ANodeMap<UEdge> ANodeMatchingMap;
+ typedef typename BpUGraph::template BNodeMap<UEdge> BNodeMatchingMap;
+
+ typedef typename BpUGraph::template ANodeMap<Value> ANodePotentialMap;
+ typedef typename BpUGraph::template BNodeMap<Value> BNodePotentialMap;
+
+
+public:
+
+ /// \brief \ref Exception for uninitialized parameters.
+ ///
+ /// This error represents problems in the initialization
+ /// of the parameters of the algorithms.
+ class UninitializedParameter : public lemon::UninitializedParameter {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::MaxWeightedBipartiteMatching::UninitializedParameter";
+ }
+ };
+
+ ///\name Named template parameters
+
+ ///@{
+
+ template <class H, class CR>
+ struct DefHeapTraits : public Traits {
+ typedef CR HeapCrossRef;
+ typedef H Heap;
+ static HeapCrossRef *createHeapCrossRef(const BpUGraph &) {
+ throw UninitializedParameter();
+ }
+ static Heap *createHeap(HeapCrossRef &) {
+ throw UninitializedParameter();
+ }
+ };
+
+ /// \brief \ref named-templ-param "Named parameter" for setting heap
+ /// and cross reference type
+ ///
+ /// \ref named-templ-param "Named parameter" for setting heap and cross
+ /// reference type
+ template <class H, class CR = typename BpUGraph::template NodeMap<int> >
+ struct DefHeap
+ : public MaxWeightedBipartiteMatching<BpUGraph, WeightMap,
+ DefHeapTraits<H, CR> > {
+ typedef MaxWeightedBipartiteMatching<BpUGraph, WeightMap,
+ DefHeapTraits<H, CR> > Create;
+};
+
+template <class H, class CR>
+struct DefStandardHeapTraits : public Traits {
+ typedef CR HeapCrossRef;
+ typedef H Heap;
+ static HeapCrossRef *createHeapCrossRef(const BpUGraph &graph) {
+ return new HeapCrossRef(graph);
+ }
+ static Heap *createHeap(HeapCrossRef &crossref) {
+ return new Heap(crossref);
+ }
+};
+
+/// \brief \ref named-templ-param "Named parameter" for setting heap and
+/// cross reference type with automatic allocation
+///
+/// \ref named-templ-param "Named parameter" for setting heap and cross
+/// reference type. It can allocate the heap and the cross reference
+/// object if the cross reference's constructor waits for the graph as
+/// parameter and the heap's constructor waits for the cross reference.
+template <class H, class CR = typename BpUGraph::template NodeMap<int> >
+struct DefStandardHeap
+: public MaxWeightedBipartiteMatching<BpUGraph, WeightMap,
+DefStandardHeapTraits<H, CR> > {
+typedef MaxWeightedBipartiteMatching<BpUGraph, WeightMap,
+DefStandardHeapTraits<H, CR> >
+Create;
+};
+
+///@}
+
+
+/// \brief Constructor.
+///
+/// Constructor of the algorithm.
+MaxWeightedBipartiteMatching(const BpUGraph& _graph,
+ const WeightMap& _weight)
+: graph(&_graph), weight(&_weight),
+anode_matching(_graph), bnode_matching(_graph),
+anode_potential(_graph), bnode_potential(_graph),
+_heap_cross_ref(0), local_heap_cross_ref(false),
+_heap(0), local_heap(0) {}
+
+/// \brief Destructor.
+///
+/// Destructor of the algorithm.
+~MaxWeightedBipartiteMatching() {
+ destroyStructures();
+}
+
+/// \brief Sets the heap and the cross reference used by algorithm.
+///
+/// Sets the heap and the cross reference used by algorithm.
+/// If you don't use this function before calling \ref run(),
+/// it will allocate one. The destuctor deallocates this
+/// automatically allocated map, of course.
+/// \return \c (*this)
+MaxWeightedBipartiteMatching& heap(Heap& hp, HeapCrossRef &cr) {
+ if(local_heap_cross_ref) {
+ delete _heap_cross_ref;
+ local_heap_cross_ref = false;
+ }
+ _heap_cross_ref = &cr;
+ if(local_heap) {
+ delete _heap;
+ local_heap = false;
+ }
+ _heap = &hp;
+ return *this;
+}
+
+/// \name Execution control
+/// The simplest way to execute the algorithm is to use
+/// one of the member functions called \c run().
+/// \n
+/// If you need more control on the execution,
+/// first you must call \ref init() or one alternative for it.
+/// Finally \ref start() will perform the matching computation or
+/// with step-by-step execution you can augment the solution.
+
+/// @{
+
+/// \brief Initalize the data structures.
+///
+/// It initalizes the data structures and creates an empty matching.
+void init() {
+ initStructures();
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ anode_matching[it] = INVALID;
+ anode_potential[it] = 0;
+ }
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ bnode_matching[it] = INVALID;
+ bnode_potential[it] = 0;
+ for (IncEdgeIt jt(*graph, it); jt != INVALID; ++jt) {
+ if ((*weight)[jt] > bnode_potential[it]) {
+ bnode_potential[it] = (*weight)[jt];
+ }
+ }
+ }
+ matching_value = 0;
+ matching_size = 0;
+}
+
+
+/// \brief An augmenting phase of the weighted matching algorithm
+///
+/// It runs an augmenting phase of the weighted matching
+/// algorithm. This phase finds the best augmenting path and
+/// augments only on this paths.
+///
+/// The algorithm consists at most
+/// of \f$ O(n) \f$ phase and one phase is \f$ O(n\log(n)+e) \f$
+/// long with Fibonacci heap or \f$ O((n+e)\log(n)) \f$ long
+/// with binary heap.
+/// \param decrease If the given parameter true the matching value
+/// can be decreased in the augmenting phase. If we would like
+/// to calculate the maximum cardinality maximum weighted matching
+/// then we should let the algorithm to decrease the matching
+/// value in order to increase the number of the matching edges.
+bool augment(bool decrease = false) {
+
+ typename BpUGraph::template BNodeMap<Value> bdist(*graph);
+ typename BpUGraph::template BNodeMap<UEdge> bpred(*graph, INVALID);
+
+ Node bestNode = INVALID;
+ Value bestValue = 0;
+
+ _heap->clear();
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ (*_heap_cross_ref)[it] = Heap::PRE_HEAP;
+ }
+
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ if (anode_matching[it] == INVALID) {
+ _heap->push(it, 0);
+ }
+ }
+
+ Value bdistMax = 0;
+ while (!_heap->empty()) {
+ Node anode = _heap->top();
+ Value avalue = _heap->prio();
+ _heap->pop();
+ for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
+ if (jt == anode_matching[anode]) continue;
+ Node bnode = graph->bNode(jt);
+ Value bvalue = avalue - (*weight)[jt] +
+ anode_potential[anode] + bnode_potential[bnode];
+ if (bvalue > bdistMax) {
+ bdistMax = bvalue;
+ }
+ if (bpred[bnode] == INVALID || bvalue < bdist[bnode]) {
+ bdist[bnode] = bvalue;
+ bpred[bnode] = jt;
+ } else continue;
+ if (bnode_matching[bnode] != INVALID) {
+ Node newanode = graph->aNode(bnode_matching[bnode]);
+ switch (_heap->state(newanode)) {
+ case Heap::PRE_HEAP:
+ _heap->push(newanode, bvalue);
+ break;
+ case Heap::IN_HEAP:
+ if (bvalue < (*_heap)[newanode]) {
+ _heap->decrease(newanode, bvalue);
+ }
+ break;
+ case Heap::POST_HEAP:
+ break;
+ }
+ } else {
+ if (bestNode == INVALID ||
+ bnode_potential[bnode] - bvalue > bestValue) {
+ bestValue = bnode_potential[bnode] - bvalue;
+ bestNode = bnode;
+ }
+ }
+ }
+ }
+
+ if (bestNode == INVALID || (!decrease && bestValue < 0)) {
+ return false;
+ }
+
+ matching_value += bestValue;
+ ++matching_size;
+
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ if (bpred[it] != INVALID) {
+ bnode_potential[it] -= bdist[it];
+ } else {
+ bnode_potential[it] -= bdistMax;
+ }
+ }
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ if (anode_matching[it] != INVALID) {
+ Node bnode = graph->bNode(anode_matching[it]);
+ if (bpred[bnode] != INVALID) {
+ anode_potential[it] += bdist[bnode];
+ } else {
+ anode_potential[it] += bdistMax;
+ }
+ }
+ }
+
+ while (bestNode != INVALID) {
+ UEdge uedge = bpred[bestNode];
+ Node anode = graph->aNode(uedge);
+
+ bnode_matching[bestNode] = uedge;
+ if (anode_matching[anode] != INVALID) {
+ bestNode = graph->bNode(anode_matching[anode]);
+ } else {
+ bestNode = INVALID;
+ }
+ anode_matching[anode] = uedge;
+ }
+
+
+ return true;
+}
+
+/// \brief Starts the algorithm.
+///
+/// Starts the algorithm. It runs augmenting phases until the
+/// optimal solution reached.
+///
+/// \param maxCardinality If the given value is true it will
+/// calculate the maximum cardinality maximum matching instead of
+/// the maximum matching.
+void start(bool maxCardinality = false) {
+ while (augment(maxCardinality)) {}
+}
+
+/// \brief Runs the algorithm.
+///
+/// It just initalize the algorithm and then start it.
+///
+/// \param maxCardinality If the given value is true it will
+/// calculate the maximum cardinality maximum matching instead of
+/// the maximum matching.
+void run(bool maxCardinality = false) {
+ init();
+ start(maxCardinality);
+}
+
+/// @}
+
+/// \name Query Functions
+/// The result of the %Matching algorithm can be obtained using these
+/// functions.\n
+/// Before the use of these functions,
+/// either run() or start() must be called.
+
+///@{
+
+/// \brief Gives back the potential in the NodeMap
+///
+/// Gives back the potential in the NodeMap. The matching is optimal
+/// with the current number of edges if \f$ \pi(a) + \pi(b) - w(ab) = 0 \f$
+/// for each matching edges and \f$ \pi(a) + \pi(b) - w(ab) \ge 0 \f$
+/// for each edges.
+template <typename PotentialMap>
+void potential(PotentialMap& pt) const {
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ pt.set(it, anode_potential[it]);
+ }
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ pt.set(it, bnode_potential[it]);
+ }
+}
+
+/// \brief Set true all matching uedge in the map.
+///
+/// Set true all matching uedge in the map. It does not change the
+/// value mapped to the other uedges.
+/// \return The number of the matching edges.
+template <typename MatchingMap>
+int quickMatching(MatchingMap& mm) const {
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ if (anode_matching[it] != INVALID) {
+ mm.set(anode_matching[it], true);
+ }
+ }
+ return matching_size;
+}
+
+/// \brief Set true all matching uedge in the map and the others to false.
+///
+/// Set true all matching uedge in the map and the others to false.
+/// \return The number of the matching edges.
+template <typename MatchingMap>
+int matching(MatchingMap& mm) const {
+ for (UEdgeIt it(*graph); it != INVALID; ++it) {
+ mm.set(it, it == anode_matching[graph->aNode(it)]);
+ }
+ return matching_size;
+}
+
+///Gives back the matching in an ANodeMap.
+
+///Gives back the matching in an ANodeMap. The parameter should
+///be a write ANodeMap of UEdge values.
+///\return The number of the matching edges.
+template<class MatchingMap>
+int aMatching(MatchingMap& mm) const {
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ mm.set(it, anode_matching[it]);
+ }
+ return matching_size;
+}
+
+///Gives back the matching in a BNodeMap.
+
+///Gives back the matching in a BNodeMap. The parameter should
+///be a write BNodeMap of UEdge values.
+///\return The number of the matching edges.
+template<class MatchingMap>
+int bMatching(MatchingMap& mm) const {
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ mm.set(it, bnode_matching[it]);
+ }
+ return matching_size;
+}
+
+
+/// \brief Return true if the given uedge is in the matching.
+///
+/// It returns true if the given uedge is in the matching.
+bool matchingEdge(const UEdge& edge) const {
+ return anode_matching[graph->aNode(edge)] == edge;
+}
+
+/// \brief Returns the matching edge from the node.
+///
+/// Returns the matching edge from the node. If there is not such
+/// edge it gives back \c INVALID.
+UEdge matchingEdge(const Node& node) const {
+ if (graph->aNode(node)) {
+ return anode_matching[node];
+ } else {
+ return bnode_matching[node];
+ }
+}
+
+/// \brief Gives back the sum of weights of the matching edges.
+///
+/// Gives back the sum of weights of the matching edges.
+Value matchingValue() const {
+ return matching_value;
+}
+
+/// \brief Gives back the number of the matching edges.
+///
+/// Gives back the number of the matching edges.
+int matchingSize() const {
+ return matching_size;
+}
+
+/// @}
+
+private:
+
+void initStructures() {
+ if (!_heap_cross_ref) {
+ local_heap_cross_ref = true;
+ _heap_cross_ref = Traits::createHeapCrossRef(*graph);
+ }
+ if (!_heap) {
+ local_heap = true;
+ _heap = Traits::createHeap(*_heap_cross_ref);
+ }
+}
+
+void destroyStructures() {
+ if (local_heap_cross_ref) delete _heap_cross_ref;
+ if (local_heap) delete _heap;
+}
+
+
+private:
+
+const BpUGraph *graph;
+const WeightMap* weight;
+
+ANodeMatchingMap anode_matching;
+BNodeMatchingMap bnode_matching;
+
+ANodePotentialMap anode_potential;
+BNodePotentialMap bnode_potential;
+
+Value matching_value;
+int matching_size;
+
+HeapCrossRef *_heap_cross_ref;
+bool local_heap_cross_ref;
+
+Heap *_heap;
+bool local_heap;
+
+};
+
+/// \ingroup matching
+///
+/// \brief Maximum weighted bipartite matching
+///
+/// This function calculates the maximum weighted matching
+/// in a bipartite graph. It gives back the matching in an undirected
+/// edge map.
+///
+/// \param graph The bipartite graph.
+/// \param weight The undirected edge map which contains the weights.
+/// \retval matching The undirected edge map which will be set to
+/// the matching.
+/// \return The value of the matching.
+template <typename BpUGraph, typename WeightMap, typename MatchingMap>
+typename WeightMap::Value
+maxWeightedBipartiteMatching(const BpUGraph& graph, const WeightMap& weight,
+ MatchingMap& matching) {
+ MaxWeightedBipartiteMatching<BpUGraph, WeightMap>
+ bpmatching(graph, weight);
+ bpmatching.run();
+ bpmatching.matching(matching);
+ return bpmatching.matchingValue();
+}
+
+/// \ingroup matching
+///
+/// \brief Maximum weighted maximum cardinality bipartite matching
+///
+/// This function calculates the maximum weighted of the maximum cardinality
+/// matchings of a bipartite graph. It gives back the matching in an
+/// undirected edge map.
+///
+/// \param graph The bipartite graph.
+/// \param weight The undirected edge map which contains the weights.
+/// \retval matching The undirected edge map which will be set to
+/// the matching.
+/// \return The value of the matching.
+template <typename BpUGraph, typename WeightMap, typename MatchingMap>
+typename WeightMap::Value
+maxWeightedMaxBipartiteMatching(const BpUGraph& graph,
+ const WeightMap& weight,
+ MatchingMap& matching) {
+ MaxWeightedBipartiteMatching<BpUGraph, WeightMap>
+ bpmatching(graph, weight);
+ bpmatching.run(true);
+ bpmatching.matching(matching);
+ return bpmatching.matchingValue();
+}
+
+/// \brief Default traits class for minimum cost bipartite matching
+/// algoritms.
+///
+/// Default traits class for minimum cost bipartite matching
+/// algoritms.
+///
+/// \param _BpUGraph The bipartite undirected graph
+/// type.
+///
+/// \param _CostMap Type of cost map.
+template <typename _BpUGraph, typename _CostMap>
+struct MinCostMaxBipartiteMatchingDefaultTraits {
+ /// \brief The type of the cost of the undirected edges.
+ typedef typename _CostMap::Value Value;
+
+ /// The undirected bipartite graph type the algorithm runs on.
+ typedef _BpUGraph BpUGraph;
+
+ /// The map of the edges costs
+ typedef _CostMap CostMap;
+
+ /// \brief The cross reference type used by heap.
+ ///
+ /// The cross reference type used by heap.
+ /// Usually it is \c Graph::NodeMap<int>.
+ typedef typename BpUGraph::template NodeMap<int> HeapCrossRef;
+
+ /// \brief Instantiates a HeapCrossRef.
+ ///
+ /// This function instantiates a \ref HeapCrossRef.
+ /// \param graph is the graph, to which we would like to define the
+ /// HeapCrossRef.
+ static HeapCrossRef *createHeapCrossRef(const BpUGraph &graph) {
+ return new HeapCrossRef(graph);
+ }
+
+ /// \brief The heap type used by costed matching algorithms.
+ ///
+ /// The heap type used by costed matching algorithms. It should
+ /// minimize the priorities and the heap's key type is the graph's
+ /// anode graph's node.
+ ///
+ /// \sa BinHeap
+ //typedef BinHeap<Value, HeapCrossRef> Heap;
+ typedef FibHeap<Value, HeapCrossRef> Heap;
+
+ /// \brief Instantiates a Heap.
+ ///
+ /// This function instantiates a \ref Heap.
+ /// \param crossref The cross reference of the heap.
+ static Heap *createHeap(HeapCrossRef& crossref) {
+ return new Heap(crossref);
+ }
+
+};
+
+
+/// \ingroup matching
+///
+/// \brief Bipartite Min Cost Matching algorithm
+///
+/// This class implements the bipartite Min Cost Matching algorithm.
+/// It uses the successive shortest path algorithm to calculate the
+/// minimum cost maximum matching in the bipartite graph. The time
+/// complexity of the algorithm is \f$ O(ne\log(n)) \f$ with the
+/// default binary heap implementation but this can be improved to
+/// \f$ O(n^2\log(n)+ne) \f$ if we use fibonacci heaps.
+///
+/// The algorithm also provides a potential function on the nodes
+/// which a dual solution of the matching algorithm and it can be
+/// used to proof the optimality of the given pimal solution.
+#ifdef DOXYGEN
+template <typename _BpUGraph, typename _CostMap, typename _Traits>
+#else
+template <typename _BpUGraph,
+typename _CostMap = typename _BpUGraph::template UEdgeMap<int>,
+typename _Traits =
+MinCostMaxBipartiteMatchingDefaultTraits<_BpUGraph, _CostMap> >
+#endif
+class MinCostMaxBipartiteMatching {
+public:
+
+typedef _Traits Traits;
+typedef typename Traits::BpUGraph BpUGraph;
+typedef typename Traits::CostMap CostMap;
+typedef typename Traits::Value Value;
+
+protected:
+
+typedef typename Traits::HeapCrossRef HeapCrossRef;
+typedef typename Traits::Heap Heap;
+
+
+typedef typename BpUGraph::Node Node;
+typedef typename BpUGraph::ANodeIt ANodeIt;
+typedef typename BpUGraph::BNodeIt BNodeIt;
+typedef typename BpUGraph::UEdge UEdge;
+typedef typename BpUGraph::UEdgeIt UEdgeIt;
+typedef typename BpUGraph::IncEdgeIt IncEdgeIt;
+
+typedef typename BpUGraph::template ANodeMap<UEdge> ANodeMatchingMap;
+typedef typename BpUGraph::template BNodeMap<UEdge> BNodeMatchingMap;
+
+typedef typename BpUGraph::template ANodeMap<Value> ANodePotentialMap;
+typedef typename BpUGraph::template BNodeMap<Value> BNodePotentialMap;
+
+
+public:
+
+/// \brief \ref Exception for uninitialized parameters.
+///
+/// This error represents problems in the initialization
+/// of the parameters of the algorithms.
+class UninitializedParameter : public lemon::UninitializedParameter {
+public:
+ virtual const char* what() const throw() {
+ return "lemon::MinCostMaxBipartiteMatching::UninitializedParameter";
+ }
+};
+
+///\name Named template parameters
+
+///@{
+
+template <class H, class CR>
+struct DefHeapTraits : public Traits {
+ typedef CR HeapCrossRef;
+ typedef H Heap;
+ static HeapCrossRef *createHeapCrossRef(const BpUGraph &) {
+ throw UninitializedParameter();
+ }
+ static Heap *createHeap(HeapCrossRef &) {
+ throw UninitializedParameter();
+ }
+};
+
+/// \brief \ref named-templ-param "Named parameter" for setting heap
+/// and cross reference type
+///
+/// \ref named-templ-param "Named parameter" for setting heap and cross
+/// reference type
+template <class H, class CR = typename BpUGraph::template NodeMap<int> >
+struct DefHeap
+: public MinCostMaxBipartiteMatching<BpUGraph, CostMap,
+DefHeapTraits<H, CR> > {
+typedef MinCostMaxBipartiteMatching<BpUGraph, CostMap,
+DefHeapTraits<H, CR> > Create;
+};
+
+template <class H, class CR>
+struct DefStandardHeapTraits : public Traits {
+ typedef CR HeapCrossRef;
+ typedef H Heap;
+ static HeapCrossRef *createHeapCrossRef(const BpUGraph &graph) {
+ return new HeapCrossRef(graph);
+ }
+ static Heap *createHeap(HeapCrossRef &crossref) {
+ return new Heap(crossref);
+ }
+};
+
+/// \brief \ref named-templ-param "Named parameter" for setting heap and
+/// cross reference type with automatic allocation
+///
+/// \ref named-templ-param "Named parameter" for setting heap and cross
+/// reference type. It can allocate the heap and the cross reference
+/// object if the cross reference's constructor waits for the graph as
+/// parameter and the heap's constructor waits for the cross reference.
+template <class H, class CR = typename BpUGraph::template NodeMap<int> >
+struct DefStandardHeap
+: public MinCostMaxBipartiteMatching<BpUGraph, CostMap,
+DefStandardHeapTraits<H, CR> > {
+typedef MinCostMaxBipartiteMatching<BpUGraph, CostMap,
+DefStandardHeapTraits<H, CR> >
+Create;
+};
+
+///@}
+
+
+/// \brief Constructor.
+///
+/// Constructor of the algorithm.
+MinCostMaxBipartiteMatching(const BpUGraph& _graph,
+ const CostMap& _cost)
+: graph(&_graph), cost(&_cost),
+anode_matching(_graph), bnode_matching(_graph),
+anode_potential(_graph), bnode_potential(_graph),
+_heap_cross_ref(0), local_heap_cross_ref(false),
+_heap(0), local_heap(0) {}
+
+/// \brief Destructor.
+///
+/// Destructor of the algorithm.
+~MinCostMaxBipartiteMatching() {
+ destroyStructures();
+}
+
+/// \brief Sets the heap and the cross reference used by algorithm.
+///
+/// Sets the heap and the cross reference used by algorithm.
+/// If you don't use this function before calling \ref run(),
+/// it will allocate one. The destuctor deallocates this
+/// automatically allocated map, of course.
+/// \return \c (*this)
+MinCostMaxBipartiteMatching& heap(Heap& hp, HeapCrossRef &cr) {
+ if(local_heap_cross_ref) {
+ delete _heap_cross_ref;
+ local_heap_cross_ref = false;
+ }
+ _heap_cross_ref = &cr;
+ if(local_heap) {
+ delete _heap;
+ local_heap = false;
+ }
+ _heap = &hp;
+ return *this;
+}
+
+/// \name Execution control
+/// The simplest way to execute the algorithm is to use
+/// one of the member functions called \c run().
+/// \n
+/// If you need more control on the execution,
+/// first you must call \ref init() or one alternative for it.
+/// Finally \ref start() will perform the matching computation or
+/// with step-by-step execution you can augment the solution.
+
+/// @{
+
+/// \brief Initalize the data structures.
+///
+/// It initalizes the data structures and creates an empty matching.
+void init() {
+ initStructures();
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ anode_matching[it] = INVALID;
+ anode_potential[it] = 0;
+ }
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ bnode_matching[it] = INVALID;
+ bnode_potential[it] = 0;
+ }
+ matching_cost = 0;
+ matching_size = 0;
+}
+
+
+/// \brief An augmenting phase of the costed matching algorithm
+///
+/// It runs an augmenting phase of the matching algorithm. The
+/// phase finds the best augmenting path and augments only on this
+/// paths.
+///
+/// The algorithm consists at most
+/// of \f$ O(n) \f$ phase and one phase is \f$ O(n\log(n)+e) \f$
+/// long with Fibonacci heap or \f$ O((n+e)\log(n)) \f$ long
+/// with binary heap.
+bool augment() {
+
+ typename BpUGraph::template BNodeMap<Value> bdist(*graph);
+ typename BpUGraph::template BNodeMap<UEdge> bpred(*graph, INVALID);
+
+ Node bestNode = INVALID;
+ Value bestValue = 0;
+
+ _heap->clear();
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ (*_heap_cross_ref)[it] = Heap::PRE_HEAP;
+ }
+
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ if (anode_matching[it] == INVALID) {
+ _heap->push(it, 0);
+ }
+ }
+ Value bdistMax = 0;
+
+ while (!_heap->empty()) {
+ Node anode = _heap->top();
+ Value avalue = _heap->prio();
+ _heap->pop();
+ for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
+ if (jt == anode_matching[anode]) continue;
+ Node bnode = graph->bNode(jt);
+ Value bvalue = avalue + (*cost)[jt] +
+ anode_potential[anode] - bnode_potential[bnode];
+ if (bvalue > bdistMax) {
+ bdistMax = bvalue;
+ }
+ if (bpred[bnode] == INVALID || bvalue < bdist[bnode]) {
+ bdist[bnode] = bvalue;
+ bpred[bnode] = jt;
+ } else continue;
+ if (bnode_matching[bnode] != INVALID) {
+ Node newanode = graph->aNode(bnode_matching[bnode]);
+ switch (_heap->state(newanode)) {
+ case Heap::PRE_HEAP:
+ _heap->push(newanode, bvalue);
+ break;
+ case Heap::IN_HEAP:
+ if (bvalue < (*_heap)[newanode]) {
+ _heap->decrease(newanode, bvalue);
+ }
+ break;
+ case Heap::POST_HEAP:
+ break;
+ }
+ } else {
+ if (bestNode == INVALID ||
+ bvalue + bnode_potential[bnode] < bestValue) {
+ bestValue = bvalue + bnode_potential[bnode];
+ bestNode = bnode;
+ }
+ }
+ }
+ }
+
+ if (bestNode == INVALID) {
+ return false;
+ }
+
+ matching_cost += bestValue;
+ ++matching_size;
+
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ if (bpred[it] != INVALID) {
+ bnode_potential[it] += bdist[it];
+ } else {
+ bnode_potential[it] += bdistMax;
+ }
+ }
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ if (anode_matching[it] != INVALID) {
+ Node bnode = graph->bNode(anode_matching[it]);
+ if (bpred[bnode] != INVALID) {
+ anode_potential[it] += bdist[bnode];
+ } else {
+ anode_potential[it] += bdistMax;
+ }
+ }
+ }
+
+ while (bestNode != INVALID) {
+ UEdge uedge = bpred[bestNode];
+ Node anode = graph->aNode(uedge);
+
+ bnode_matching[bestNode] = uedge;
+ if (anode_matching[anode] != INVALID) {
+ bestNode = graph->bNode(anode_matching[anode]);
+ } else {
+ bestNode = INVALID;
+ }
+ anode_matching[anode] = uedge;
+ }
+
+
+ return true;
+}
+
+/// \brief Starts the algorithm.
+///
+/// Starts the algorithm. It runs augmenting phases until the
+/// optimal solution reached.
+void start() {
+ while (augment()) {}
+}
+
+/// \brief Runs the algorithm.
+///
+/// It just initalize the algorithm and then start it.
+void run() {
+ init();
+ start();
+}
+
+/// @}
+
+/// \name Query Functions
+/// The result of the %Matching algorithm can be obtained using these
+/// functions.\n
+/// Before the use of these functions,
+/// either run() or start() must be called.
+
+///@{
+
+/// \brief Gives back the potential in the NodeMap
+///
+/// Gives back the potential in the NodeMap. The matching is optimal
+/// with the current number of edges if \f$ \pi(a) + \pi(b) - w(ab) = 0 \f$
+/// for each matching edges and \f$ \pi(a) + \pi(b) - w(ab) \ge 0 \f$
+/// for each edges.
+template <typename PotentialMap>
+void potential(PotentialMap& pt) const {
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ pt.set(it, anode_potential[it]);
+ }
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ pt.set(it, bnode_potential[it]);
+ }
+}
+
+/// \brief Set true all matching uedge in the map.
+///
+/// Set true all matching uedge in the map. It does not change the
+/// value mapped to the other uedges.
+/// \return The number of the matching edges.
+template <typename MatchingMap>
+int quickMatching(MatchingMap& mm) const {
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ if (anode_matching[it] != INVALID) {
+ mm.set(anode_matching[it], true);
+ }
+ }
+ return matching_size;
+}
+
+/// \brief Set true all matching uedge in the map and the others to false.
+///
+/// Set true all matching uedge in the map and the others to false.
+/// \return The number of the matching edges.
+template <typename MatchingMap>
+int matching(MatchingMap& mm) const {
+ for (UEdgeIt it(*graph); it != INVALID; ++it) {
+ mm.set(it, it == anode_matching[graph->aNode(it)]);
+ }
+ return matching_size;
+}
+
+/// \brief Gives back the matching in an ANodeMap.
+///
+/// Gives back the matching in an ANodeMap. The parameter should
+/// be a write ANodeMap of UEdge values.
+/// \return The number of the matching edges.
+template<class MatchingMap>
+int aMatching(MatchingMap& mm) const {
+ for (ANodeIt it(*graph); it != INVALID; ++it) {
+ mm.set(it, anode_matching[it]);
+ }
+ return matching_size;
+}
+
+/// \brief Gives back the matching in a BNodeMap.
+///
+/// Gives back the matching in a BNodeMap. The parameter should
+/// be a write BNodeMap of UEdge values.
+/// \return The number of the matching edges.
+template<class MatchingMap>
+int bMatching(MatchingMap& mm) const {
+ for (BNodeIt it(*graph); it != INVALID; ++it) {
+ mm.set(it, bnode_matching[it]);
+ }
+ return matching_size;
+}
+
+/// \brief Return true if the given uedge is in the matching.
+///
+/// It returns true if the given uedge is in the matching.
+bool matchingEdge(const UEdge& edge) const {
+ return anode_matching[graph->aNode(edge)] == edge;
+}
+
+/// \brief Returns the matching edge from the node.
+///
+/// Returns the matching edge from the node. If there is not such
+/// edge it gives back \c INVALID.
+UEdge matchingEdge(const Node& node) const {
+ if (graph->aNode(node)) {
+ return anode_matching[node];
+ } else {
+ return bnode_matching[node];
+ }
+}
+
+/// \brief Gives back the sum of costs of the matching edges.
+///
+/// Gives back the sum of costs of the matching edges.
+Value matchingCost() const {
+ return matching_cost;
+}
+
+/// \brief Gives back the number of the matching edges.
+///
+/// Gives back the number of the matching edges.
+int matchingSize() const {
+ return matching_size;
+}
+
+/// @}
+
+private:
+
+void initStructures() {
+ if (!_heap_cross_ref) {
+ local_heap_cross_ref = true;
+ _heap_cross_ref = Traits::createHeapCrossRef(*graph);
+ }
+ if (!_heap) {
+ local_heap = true;
+ _heap = Traits::createHeap(*_heap_cross_ref);
+ }
+}
+
+void destroyStructures() {
+ if (local_heap_cross_ref) delete _heap_cross_ref;
+ if (local_heap) delete _heap;
+}
+
+
+private:
+
+const BpUGraph *graph;
+const CostMap* cost;
+
+ANodeMatchingMap anode_matching;
+BNodeMatchingMap bnode_matching;
+
+ANodePotentialMap anode_potential;
+BNodePotentialMap bnode_potential;
+
+Value matching_cost;
+int matching_size;
+
+HeapCrossRef *_heap_cross_ref;
+bool local_heap_cross_ref;
+
+Heap *_heap;
+bool local_heap;
+
+};
+
+/// \ingroup matching
+///
+/// \brief Minimum cost maximum cardinality bipartite matching
+///
+/// This function calculates the maximum cardinality matching with
+/// minimum cost of a bipartite graph. It gives back the matching in
+/// an undirected edge map.
+///
+/// \param graph The bipartite graph.
+/// \param cost The undirected edge map which contains the costs.
+/// \retval matching The undirected edge map which will be set to
+/// the matching.
+/// \return The cost of the matching.
+template <typename BpUGraph, typename CostMap, typename MatchingMap>
+typename CostMap::Value
+minCostMaxBipartiteMatching(const BpUGraph& graph,
+ const CostMap& cost,
+ MatchingMap& matching) {
+ MinCostMaxBipartiteMatching<BpUGraph, CostMap>
+ bpmatching(graph, cost);
+ bpmatching.run();
+ bpmatching.matching(matching);
+ return bpmatching.matchingCost();
+}
+
+}
+
+#endif
diff --git a/src/lemon/bits/alteration_notifier.h b/src/lemon/bits/alteration_notifier.h
new file mode 100644
index 0000000..9a164bf
--- /dev/null
+++ b/src/lemon/bits/alteration_notifier.h
@@ -0,0 +1,485 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_ALTERATION_NOTIFIER_H
+#define LEMON_BITS_ALTERATION_NOTIFIER_H
+
+#include <vector>
+#include <list>
+
+#include <lemon/bits/utility.h>
+
+///\ingroup graphbits
+///\file
+///\brief Observer notifier for graph alteration observers.
+
+namespace lemon {
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Notifier class to notify observes about alterations in
+ /// a container.
+ ///
+ /// The simple graph's can be refered as two containers, one node container
+ /// and one edge container. But they are not standard containers they
+ /// does not store values directly they are just key continars for more
+ /// value containers which are the node and edge maps.
+ ///
+ /// The graph's node and edge sets can be changed as we add or erase
+ /// nodes and edges in the graph. Lemon would like to handle easily
+ /// that the node and edge maps should contain values for all nodes or
+ /// edges. If we want to check on every indicing if the map contains
+ /// the current indicing key that cause a drawback in the performance
+ /// in the library. We use another solution we notify all maps about
+ /// an alteration in the graph, which cause only drawback on the
+ /// alteration of the graph.
+ ///
+ /// This class provides an interface to the container. The \e first() and \e
+ /// next() member functions make possible to iterate on the keys of the
+ /// container. The \e id() function returns an integer id for each key.
+ /// The \e maxId() function gives back an upper bound of the ids.
+ ///
+ /// For the proper functonality of this class, we should notify it
+ /// about each alteration in the container. The alterations have four type
+ /// as \e add(), \e erase(), \e build() and \e clear(). The \e add() and
+ /// \e erase() signals that only one or few items added or erased to or
+ /// from the graph. If all items are erased from the graph or from an empty
+ /// graph a new graph is builded then it can be signaled with the
+ /// clear() and build() members. Important rule that if we erase items
+ /// from graph we should first signal the alteration and after that erase
+ /// them from the container, on the other way on item addition we should
+ /// first extend the container and just after that signal the alteration.
+ ///
+ /// The alteration can be observed with a class inherited from the
+ /// \e ObserverBase nested class. The signals can be handled with
+ /// overriding the virtual functions defined in the base class. The
+ /// observer base can be attached to the notifier with the
+ /// \e attach() member and can be detached with detach() function. The
+ /// alteration handlers should not call any function which signals
+ /// an other alteration in the same notifier and should not
+ /// detach any observer from the notifier.
+ ///
+ /// Alteration observers try to be exception safe. If an \e add() or
+ /// a \e clear() function throws an exception then the remaining
+ /// observeres will not be notified and the fulfilled additions will
+ /// be rolled back by calling the \e erase() or \e clear()
+ /// functions. Thence the \e erase() and \e clear() should not throw
+ /// exception. Actullay, it can be throw only
+ /// \ref AlterationObserver::ImmediateDetach ImmediateDetach
+ /// exception which detach the observer from the notifier.
+ ///
+ /// There are some place when the alteration observing is not completly
+ /// reliable. If we want to carry out the node degree in the graph
+ /// as in the \ref InDegMap and we use the reverseEdge that cause
+ /// unreliable functionality. Because the alteration observing signals
+ /// only erasing and adding but not the reversing it will stores bad
+ /// degrees. The sub graph adaptors cannot signal the alterations because
+ /// just a setting in the filter map can modify the graph and this cannot
+ /// be watched in any way.
+ ///
+ /// \param _Container The container which is observed.
+ /// \param _Item The item type which is obserbved.
+ ///
+ /// \author Balazs Dezso
+
+ template <typename _Container, typename _Item>
+ class AlterationNotifier {
+ public:
+
+ typedef True Notifier;
+
+ typedef _Container Container;
+ typedef _Item Item;
+
+ /// \brief Exception which can be called from \e clear() and
+ /// \e erase().
+ ///
+ /// From the \e clear() and \e erase() function only this
+ /// exception is allowed to throw. The exception immediatly
+ /// detaches the current observer from the notifier. Because the
+ /// \e clear() and \e erase() should not throw other exceptions
+ /// it can be used to invalidate the observer.
+ struct ImmediateDetach {};
+
+ /// \brief ObserverBase is the base class for the observers.
+ ///
+ /// ObserverBase is the abstract base class for the observers.
+ /// It will be notified about an item was inserted into or
+ /// erased from the graph.
+ ///
+ /// The observer interface contains some pure virtual functions
+ /// to override. The add() and erase() functions are
+ /// to notify the oberver when one item is added or
+ /// erased.
+ ///
+ /// The build() and clear() members are to notify the observer
+ /// about the container is built from an empty container or
+ /// is cleared to an empty container.
+ ///
+ /// \author Balazs Dezso
+
+ class ObserverBase {
+ protected:
+ typedef AlterationNotifier Notifier;
+
+ friend class AlterationNotifier;
+
+ /// \brief Default constructor.
+ ///
+ /// Default constructor for ObserverBase.
+ ///
+ ObserverBase() : _notifier(0) {}
+
+ /// \brief Constructor which attach the observer into notifier.
+ ///
+ /// Constructor which attach the observer into notifier.
+ ObserverBase(AlterationNotifier& nf) {
+ attach(nf);
+ }
+
+ /// \brief Constructor which attach the obserever to the same notifier.
+ ///
+ /// Constructor which attach the obserever to the same notifier as
+ /// the other observer is attached to.
+ ObserverBase(const ObserverBase& copy) {
+ if (copy.attached()) {
+ attach(*copy.notifier());
+ }
+ }
+
+ /// \brief Destructor
+ virtual ~ObserverBase() {
+ if (attached()) {
+ detach();
+ }
+ }
+
+ /// \brief Attaches the observer into an AlterationNotifier.
+ ///
+ /// This member attaches the observer into an AlterationNotifier.
+ ///
+ void attach(AlterationNotifier& nf) {
+ nf.attach(*this);
+ }
+
+ /// \brief Detaches the observer into an AlterationNotifier.
+ ///
+ /// This member detaches the observer from an AlterationNotifier.
+ ///
+ void detach() {
+ _notifier->detach(*this);
+ }
+
+ /// \brief Gives back a pointer to the notifier which the map
+ /// attached into.
+ ///
+ /// This function gives back a pointer to the notifier which the map
+ /// attached into.
+ ///
+ Notifier* notifier() const { return const_cast<Notifier*>(_notifier); }
+
+ /// Gives back true when the observer is attached into a notifier.
+ bool attached() const { return _notifier != 0; }
+
+ private:
+
+ ObserverBase& operator=(const ObserverBase& copy);
+
+ protected:
+
+ Notifier* _notifier;
+ typename std::list<ObserverBase*>::iterator _index;
+
+ /// \brief The member function to notificate the observer about an
+ /// item is added to the container.
+ ///
+ /// The add() member function notificates the observer about an item
+ /// is added to the container. It have to be overrided in the
+ /// subclasses.
+ virtual void add(const Item&) = 0;
+
+ /// \brief The member function to notificate the observer about
+ /// more item is added to the container.
+ ///
+ /// The add() member function notificates the observer about more item
+ /// is added to the container. It have to be overrided in the
+ /// subclasses.
+ virtual void add(const std::vector<Item>& items) = 0;
+
+ /// \brief The member function to notificate the observer about an
+ /// item is erased from the container.
+ ///
+ /// The erase() member function notificates the observer about an
+ /// item is erased from the container. It have to be overrided in
+ /// the subclasses.
+ virtual void erase(const Item&) = 0;
+
+ /// \brief The member function to notificate the observer about
+ /// more item is erased from the container.
+ ///
+ /// The erase() member function notificates the observer about more item
+ /// is erased from the container. It have to be overrided in the
+ /// subclasses.
+ virtual void erase(const std::vector<Item>& items) = 0;
+
+ /// \brief The member function to notificate the observer about the
+ /// container is built.
+ ///
+ /// The build() member function notificates the observer about the
+ /// container is built from an empty container. It have to be
+ /// overrided in the subclasses.
+
+ virtual void build() = 0;
+
+ /// \brief The member function to notificate the observer about all
+ /// items are erased from the container.
+ ///
+ /// The clear() member function notificates the observer about all
+ /// items are erased from the container. It have to be overrided in
+ /// the subclasses.
+ virtual void clear() = 0;
+
+ };
+
+ protected:
+
+ const Container* container;
+
+ typedef std::list<ObserverBase*> Observers;
+ Observers _observers;
+
+
+ public:
+
+ /// \brief Default constructor.
+ ///
+ /// The default constructor of the AlterationNotifier.
+ /// It creates an empty notifier.
+ AlterationNotifier()
+ : container(0) {}
+
+ /// \brief Constructor.
+ ///
+ /// Constructor with the observed container parameter.
+ AlterationNotifier(const Container& _container)
+ : container(&_container) {}
+
+ /// \brief Copy Constructor of the AlterationNotifier.
+ ///
+ /// Copy constructor of the AlterationNotifier.
+ /// It creates only an empty notifier because the copiable
+ /// notifier's observers have to be registered still into that notifier.
+ AlterationNotifier(const AlterationNotifier& _notifier)
+ : container(_notifier.container) {}
+
+ /// \brief Destructor.
+ ///
+ /// Destructor of the AlterationNotifier.
+ ///
+ ~AlterationNotifier() {
+ typename Observers::iterator it;
+ for (it = _observers.begin(); it != _observers.end(); ++it) {
+ (*it)->_notifier = 0;
+ }
+ }
+
+ /// \brief Sets the container.
+ ///
+ /// Sets the container.
+ void setContainer(const Container& _container) {
+ container = &_container;
+ }
+
+ protected:
+
+ AlterationNotifier& operator=(const AlterationNotifier&);
+
+ public:
+
+
+
+ /// \brief First item in the container.
+ ///
+ /// Returns the first item in the container. It is
+ /// for start the iteration on the container.
+ void first(Item& item) const {
+ container->first(item);
+ }
+
+ /// \brief Next item in the container.
+ ///
+ /// Returns the next item in the container. It is
+ /// for iterate on the container.
+ void next(Item& item) const {
+ container->next(item);
+ }
+
+ /// \brief Returns the id of the item.
+ ///
+ /// Returns the id of the item provided by the container.
+ int id(const Item& item) const {
+ return container->id(item);
+ }
+
+ /// \brief Returns the maximum id of the container.
+ ///
+ /// Returns the maximum id of the container.
+ int maxId() const {
+ return container->maxId(Item());
+ }
+
+ protected:
+
+ void attach(ObserverBase& observer) {
+ observer._index = _observers.insert(_observers.begin(), &observer);
+ observer._notifier = this;
+ }
+
+ void detach(ObserverBase& observer) {
+ _observers.erase(observer._index);
+ observer._index = _observers.end();
+ observer._notifier = 0;
+ }
+
+ public:
+
+ /// \brief Notifies all the registed observers about an item added to
+ /// the container.
+ ///
+ /// It notifies all the registed observers about an item added to
+ /// the container.
+ ///
+ void add(const Item& item) {
+ typename Observers::reverse_iterator it;
+ try {
+ for (it = _observers.rbegin(); it != _observers.rend(); ++it) {
+ (*it)->add(item);
+ }
+ } catch (...) {
+ typename Observers::iterator jt;
+ for (jt = it.base(); jt != _observers.end(); ++jt) {
+ (*jt)->erase(item);
+ }
+ throw;
+ }
+ }
+
+ /// \brief Notifies all the registed observers about more item added to
+ /// the container.
+ ///
+ /// It notifies all the registed observers about more item added to
+ /// the container.
+ ///
+ void add(const std::vector<Item>& items) {
+ typename Observers::reverse_iterator it;
+ try {
+ for (it = _observers.rbegin(); it != _observers.rend(); ++it) {
+ (*it)->add(items);
+ }
+ } catch (...) {
+ typename Observers::iterator jt;
+ for (jt = it.base(); jt != _observers.end(); ++jt) {
+ (*jt)->erase(items);
+ }
+ throw;
+ }
+ }
+
+ /// \brief Notifies all the registed observers about an item erased from
+ /// the container.
+ ///
+ /// It notifies all the registed observers about an item erased from
+ /// the container.
+ ///
+ void erase(const Item& item) throw() {
+ typename Observers::iterator it = _observers.begin();
+ while (it != _observers.end()) {
+ try {
+ (*it)->erase(item);
+ ++it;
+ } catch (const ImmediateDetach&) {
+ it = _observers.erase(it);
+ (*it)->_index = _observers.end();
+ (*it)->_notifier = 0;
+ }
+ }
+ }
+
+ /// \brief Notifies all the registed observers about more item erased
+ /// from the container.
+ ///
+ /// It notifies all the registed observers about more item erased from
+ /// the container.
+ ///
+ void erase(const std::vector<Item>& items) {
+ typename Observers::iterator it = _observers.begin();
+ while (it != _observers.end()) {
+ try {
+ (*it)->erase(items);
+ ++it;
+ } catch (const ImmediateDetach&) {
+ it = _observers.erase(it);
+ (*it)->_index = _observers.end();
+ (*it)->_notifier = 0;
+ }
+ }
+ }
+
+ /// \brief Notifies all the registed observers about the container is
+ /// built.
+ ///
+ /// Notifies all the registed observers about the container is built
+ /// from an empty container.
+ void build() {
+ typename Observers::reverse_iterator it;
+ try {
+ for (it = _observers.rbegin(); it != _observers.rend(); ++it) {
+ (*it)->build();
+ }
+ } catch (...) {
+ typename Observers::iterator jt;
+ for (jt = it.base(); jt != _observers.end(); ++jt) {
+ (*jt)->clear();
+ }
+ throw;
+ }
+ }
+
+ /// \brief Notifies all the registed observers about all items are
+ /// erased.
+ ///
+ /// Notifies all the registed observers about all items are erased
+ /// from the container.
+ void clear() {
+ typename Observers::iterator it = _observers.begin();
+ while (it != _observers.end()) {
+ try {
+ (*it)->clear();
+ ++it;
+ } catch (const ImmediateDetach&) {
+ it = _observers.erase(it);
+ (*it)->_index = _observers.end();
+ (*it)->_notifier = 0;
+ }
+ }
+ }
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/array_map.h b/src/lemon/bits/array_map.h
new file mode 100644
index 0000000..08ab218
--- /dev/null
+++ b/src/lemon/bits/array_map.h
@@ -0,0 +1,346 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_ARRAY_MAP_H
+#define LEMON_BITS_ARRAY_MAP_H
+
+#include <memory>
+
+#include <lemon/bits/traits.h>
+#include <lemon/bits/alteration_notifier.h>
+#include <lemon/concept_check.h>
+#include <lemon/concepts/maps.h>
+
+/// \ingroup graphbits
+/// \file
+/// \brief Graph map based on the array storage.
+
+namespace lemon {
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Graph map based on the array storage.
+ ///
+ /// The ArrayMap template class is graph map structure what
+ /// automatically updates the map when a key is added to or erased from
+ /// the map. This map uses the allocators to implement
+ /// the container functionality.
+ ///
+ /// The template parameters are the Graph the current Item type and
+ /// the Value type of the map.
+ template <typename _Graph, typename _Item, typename _Value>
+ class ArrayMap
+ : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
+ public:
+ /// The graph type of the maps.
+ typedef _Graph Graph;
+ /// The item type of the map.
+ typedef _Item Item;
+ /// The reference map tag.
+ typedef True ReferenceMapTag;
+
+ /// The key type of the maps.
+ typedef _Item Key;
+ /// The value type of the map.
+ typedef _Value Value;
+
+ /// The const reference type of the map.
+ typedef const _Value& ConstReference;
+ /// The reference type of the map.
+ typedef _Value& Reference;
+
+ /// The notifier type.
+ typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
+
+ /// The MapBase of the Map which imlements the core regisitry function.
+ typedef typename Notifier::ObserverBase Parent;
+
+ private:
+ typedef std::allocator<Value> Allocator;
+
+ public:
+
+ /// \brief Graph initialized map constructor.
+ ///
+ /// Graph initialized map constructor.
+ explicit ArrayMap(const Graph& graph) {
+ Parent::attach(graph.notifier(Item()));
+ allocate_memory();
+ Notifier* nf = Parent::notifier();
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
+ allocator.construct(&(values[id]), Value());
+ }
+ }
+
+ /// \brief Constructor to use default value to initialize the map.
+ ///
+ /// It constructs a map and initialize all of the the map.
+ ArrayMap(const Graph& graph, const Value& value) {
+ Parent::attach(graph.notifier(Item()));
+ allocate_memory();
+ Notifier* nf = Parent::notifier();
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
+ allocator.construct(&(values[id]), value);
+ }
+ }
+
+ /// \brief Constructor to copy a map of the same map type.
+ ///
+ /// Constructor to copy a map of the same map type.
+ ArrayMap(const ArrayMap& copy) : Parent() {
+ if (copy.attached()) {
+ attach(*copy.notifier());
+ }
+ capacity = copy.capacity;
+ if (capacity == 0) return;
+ values = allocator.allocate(capacity);
+ Notifier* nf = Parent::notifier();
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
+ allocator.construct(&(values[id]), copy.values[id]);
+ }
+ }
+
+ /// \brief Assign operator.
+ ///
+ /// This operator assigns for each item in the map the
+ /// value mapped to the same item in the copied map.
+ /// The parameter map should be indiced with the same
+ /// itemset because this assign operator does not change
+ /// the container of the map.
+ ArrayMap& operator=(const ArrayMap& cmap) {
+ return operator=<ArrayMap>(cmap);
+ }
+
+
+ /// \brief Template assign operator.
+ ///
+ /// The given parameter should be conform to the ReadMap
+ /// concecpt and could be indiced by the current item set of
+ /// the NodeMap. In this case the value for each item
+ /// is assigned by the value of the given ReadMap.
+ template <typename CMap>
+ ArrayMap& operator=(const CMap& cmap) {
+ checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
+ const typename Parent::Notifier* nf = Parent::notifier();
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ set(it, cmap[it]);
+ }
+ return *this;
+ }
+
+ /// \brief The destructor of the map.
+ ///
+ /// The destructor of the map.
+ virtual ~ArrayMap() {
+ if (attached()) {
+ clear();
+ detach();
+ }
+ }
+
+ protected:
+
+ using Parent::attach;
+ using Parent::detach;
+ using Parent::attached;
+
+ public:
+
+ /// \brief The subscript operator.
+ ///
+ /// The subscript operator. The map can be subscripted by the
+ /// actual keys of the graph.
+ Value& operator[](const Key& key) {
+ int id = Parent::notifier()->id(key);
+ return values[id];
+ }
+
+ /// \brief The const subscript operator.
+ ///
+ /// The const subscript operator. The map can be subscripted by the
+ /// actual keys of the graph.
+ const Value& operator[](const Key& key) const {
+ int id = Parent::notifier()->id(key);
+ return values[id];
+ }
+
+ /// \brief Setter function of the map.
+ ///
+ /// Setter function of the map. Equivalent with map[key] = val.
+ /// This is a compatibility feature with the not dereferable maps.
+ void set(const Key& key, const Value& val) {
+ (*this)[key] = val;
+ }
+
+ protected:
+
+ /// \brief Adds a new key to the map.
+ ///
+ /// It adds a new key to the map. It called by the observer notifier
+ /// and it overrides the add() member function of the observer base.
+ virtual void add(const Key& key) {
+ Notifier* nf = Parent::notifier();
+ int id = nf->id(key);
+ if (id >= capacity) {
+ int new_capacity = (capacity == 0 ? 1 : capacity);
+ while (new_capacity <= id) {
+ new_capacity <<= 1;
+ }
+ Value* new_values = allocator.allocate(new_capacity);
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int jd = nf->id(it);;
+ if (id != jd) {
+ allocator.construct(&(new_values[jd]), values[jd]);
+ allocator.destroy(&(values[jd]));
+ }
+ }
+ if (capacity != 0) allocator.deallocate(values, capacity);
+ values = new_values;
+ capacity = new_capacity;
+ }
+ allocator.construct(&(values[id]), Value());
+ }
+
+ /// \brief Adds more new keys to the map.
+ ///
+ /// It adds more new keys to the map. It called by the observer notifier
+ /// and it overrides the add() member function of the observer base.
+ virtual void add(const std::vector<Key>& keys) {
+ Notifier* nf = Parent::notifier();
+ int max_id = -1;
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int id = nf->id(keys[i]);
+ if (id > max_id) {
+ max_id = id;
+ }
+ }
+ if (max_id >= capacity) {
+ int new_capacity = (capacity == 0 ? 1 : capacity);
+ while (new_capacity <= max_id) {
+ new_capacity <<= 1;
+ }
+ Value* new_values = allocator.allocate(new_capacity);
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);
+ bool found = false;
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int jd = nf->id(keys[i]);
+ if (id == jd) {
+ found = true;
+ break;
+ }
+ }
+ if (found) continue;
+ allocator.construct(&(new_values[id]), values[id]);
+ allocator.destroy(&(values[id]));
+ }
+ if (capacity != 0) allocator.deallocate(values, capacity);
+ values = new_values;
+ capacity = new_capacity;
+ }
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int id = nf->id(keys[i]);
+ allocator.construct(&(values[id]), Value());
+ }
+ }
+
+ /// \brief Erase a key from the map.
+ ///
+ /// Erase a key from the map. It called by the observer notifier
+ /// and it overrides the erase() member function of the observer base.
+ virtual void erase(const Key& key) {
+ int id = Parent::notifier()->id(key);
+ allocator.destroy(&(values[id]));
+ }
+
+ /// \brief Erase more keys from the map.
+ ///
+ /// Erase more keys from the map. It called by the observer notifier
+ /// and it overrides the erase() member function of the observer base.
+ virtual void erase(const std::vector<Key>& keys) {
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int id = Parent::notifier()->id(keys[i]);
+ allocator.destroy(&(values[id]));
+ }
+ }
+
+ /// \brief Buildes the map.
+ ///
+ /// It buildes the map. It called by the observer notifier
+ /// and it overrides the build() member function of the observer base.
+ virtual void build() {
+ Notifier* nf = Parent::notifier();
+ allocate_memory();
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
+ allocator.construct(&(values[id]), Value());
+ }
+ }
+
+ /// \brief Clear the map.
+ ///
+ /// It erase all items from the map. It called by the observer notifier
+ /// and it overrides the clear() member function of the observer base.
+ virtual void clear() {
+ Notifier* nf = Parent::notifier();
+ if (capacity != 0) {
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);
+ allocator.destroy(&(values[id]));
+ }
+ allocator.deallocate(values, capacity);
+ capacity = 0;
+ }
+ }
+
+ private:
+
+ void allocate_memory() {
+ int max_id = Parent::notifier()->maxId();
+ if (max_id == -1) {
+ capacity = 0;
+ values = 0;
+ return;
+ }
+ capacity = 1;
+ while (capacity <= max_id) {
+ capacity <<= 1;
+ }
+ values = allocator.allocate(capacity);
+ }
+
+ int capacity;
+ Value* values;
+ Allocator allocator;
+
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/base_extender.h b/src/lemon/bits/base_extender.h
new file mode 100644
index 0000000..b812247
--- /dev/null
+++ b/src/lemon/bits/base_extender.h
@@ -0,0 +1,495 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_BASE_EXTENDER_H
+#define LEMON_BITS_BASE_EXTENDER_H
+
+#include <lemon/bits/invalid.h>
+#include <lemon/error.h>
+
+#include <lemon/bits/map_extender.h>
+#include <lemon/bits/default_map.h>
+
+#include <lemon/concept_check.h>
+#include <lemon/concepts/maps.h>
+
+///\ingroup graphbits
+///\file
+///\brief Extenders for the graph types
+namespace lemon {
+
+ /// \ingroup graphbits
+ ///
+ /// \brief BaseGraph to BaseUGraph extender
+ template <typename Base>
+ class UndirGraphExtender : public Base {
+
+ public:
+
+ typedef Base Parent;
+ typedef typename Parent::Edge UEdge;
+ typedef typename Parent::Node Node;
+
+ typedef True UndirectedTag;
+
+ class Edge : public UEdge {
+ friend class UndirGraphExtender;
+
+ protected:
+ bool forward;
+
+ Edge(const UEdge &ue, bool _forward) :
+ UEdge(ue), forward(_forward) {}
+
+ public:
+ Edge() {}
+
+ /// Invalid edge constructor
+ Edge(Invalid i) : UEdge(i), forward(true) {}
+
+ bool operator==(const Edge &that) const {
+ return forward==that.forward && UEdge(*this)==UEdge(that);
+ }
+ bool operator!=(const Edge &that) const {
+ return forward!=that.forward || UEdge(*this)!=UEdge(that);
+ }
+ bool operator<(const Edge &that) const {
+ return forward<that.forward ||
+ (!(that.forward<forward) && UEdge(*this)<UEdge(that));
+ }
+ };
+
+
+
+ using Parent::source;
+
+ /// Source of the given Edge.
+ Node source(const Edge &e) const {
+ return e.forward ? Parent::source(e) : Parent::target(e);
+ }
+
+ using Parent::target;
+
+ /// Target of the given Edge.
+ Node target(const Edge &e) const {
+ return e.forward ? Parent::target(e) : Parent::source(e);
+ }
+
+ /// \brief Directed edge from an undirected edge.
+ ///
+ /// Returns a directed edge corresponding to the specified UEdge.
+ /// If the given bool is true the given undirected edge and the
+ /// returned edge have the same source node.
+ static Edge direct(const UEdge &ue, bool d) {
+ return Edge(ue, d);
+ }
+
+ /// Returns whether the given directed edge is same orientation as the
+ /// corresponding undirected edge.
+ ///
+ /// \todo reference to the corresponding point of the undirected graph
+ /// concept. "What does the direction of an undirected edge mean?"
+ static bool direction(const Edge &e) { return e.forward; }
+
+
+ using Parent::first;
+ using Parent::next;
+
+ void first(Edge &e) const {
+ Parent::first(e);
+ e.forward=true;
+ }
+
+ void next(Edge &e) const {
+ if( e.forward ) {
+ e.forward = false;
+ }
+ else {
+ Parent::next(e);
+ e.forward = true;
+ }
+ }
+
+ void firstOut(Edge &e, const Node &n) const {
+ Parent::firstIn(e,n);
+ if( UEdge(e) != INVALID ) {
+ e.forward = false;
+ }
+ else {
+ Parent::firstOut(e,n);
+ e.forward = true;
+ }
+ }
+ void nextOut(Edge &e) const {
+ if( ! e.forward ) {
+ Node n = Parent::target(e);
+ Parent::nextIn(e);
+ if( UEdge(e) == INVALID ) {
+ Parent::firstOut(e, n);
+ e.forward = true;
+ }
+ }
+ else {
+ Parent::nextOut(e);
+ }
+ }
+
+ void firstIn(Edge &e, const Node &n) const {
+ Parent::firstOut(e,n);
+ if( UEdge(e) != INVALID ) {
+ e.forward = false;
+ }
+ else {
+ Parent::firstIn(e,n);
+ e.forward = true;
+ }
+ }
+ void nextIn(Edge &e) const {
+ if( ! e.forward ) {
+ Node n = Parent::source(e);
+ Parent::nextOut(e);
+ if( UEdge(e) == INVALID ) {
+ Parent::firstIn(e, n);
+ e.forward = true;
+ }
+ }
+ else {
+ Parent::nextIn(e);
+ }
+ }
+
+ void firstInc(UEdge &e, bool &d, const Node &n) const {
+ d = true;
+ Parent::firstOut(e, n);
+ if (e != INVALID) return;
+ d = false;
+ Parent::firstIn(e, n);
+ }
+
+ void nextInc(UEdge &e, bool &d) const {
+ if (d) {
+ Node s = Parent::source(e);
+ Parent::nextOut(e);
+ if (e != INVALID) return;
+ d = false;
+ Parent::firstIn(e, s);
+ } else {
+ Parent::nextIn(e);
+ }
+ }
+
+ Node nodeFromId(int ix) const {
+ return Parent::nodeFromId(ix);
+ }
+
+ Edge edgeFromId(int ix) const {
+ return direct(Parent::edgeFromId(ix >> 1), bool(ix & 1));
+ }
+
+ UEdge uEdgeFromId(int ix) const {
+ return Parent::edgeFromId(ix);
+ }
+
+ int id(const Node &n) const {
+ return Parent::id(n);
+ }
+
+ int id(const UEdge &e) const {
+ return Parent::id(e);
+ }
+
+ int id(const Edge &e) const {
+ return 2 * Parent::id(e) + int(e.forward);
+ }
+
+ int maxNodeId() const {
+ return Parent::maxNodeId();
+ }
+
+ int maxEdgeId() const {
+ return 2 * Parent::maxEdgeId() + 1;
+ }
+
+ int maxUEdgeId() const {
+ return Parent::maxEdgeId();
+ }
+
+
+ int edgeNum() const {
+ return 2 * Parent::edgeNum();
+ }
+
+ int uEdgeNum() const {
+ return Parent::edgeNum();
+ }
+
+ Edge findEdge(Node s, Node t, Edge p = INVALID) const {
+ if (p == INVALID) {
+ UEdge edge = Parent::findEdge(s, t);
+ if (edge != INVALID) return direct(edge, true);
+ edge = Parent::findEdge(t, s);
+ if (edge != INVALID) return direct(edge, false);
+ } else if (direction(p)) {
+ UEdge edge = Parent::findEdge(s, t, p);
+ if (edge != INVALID) return direct(edge, true);
+ edge = Parent::findEdge(t, s);
+ if (edge != INVALID) return direct(edge, false);
+ } else {
+ UEdge edge = Parent::findEdge(t, s, p);
+ if (edge != INVALID) return direct(edge, false);
+ }
+ return INVALID;
+ }
+
+ UEdge findUEdge(Node s, Node t, UEdge p = INVALID) const {
+ if (s != t) {
+ if (p == INVALID) {
+ UEdge edge = Parent::findEdge(s, t);
+ if (edge != INVALID) return edge;
+ edge = Parent::findEdge(t, s);
+ if (edge != INVALID) return edge;
+ } else if (Parent::s(p) == s) {
+ UEdge edge = Parent::findEdge(s, t, p);
+ if (edge != INVALID) return edge;
+ edge = Parent::findEdge(t, s);
+ if (edge != INVALID) return edge;
+ } else {
+ UEdge edge = Parent::findEdge(t, s, p);
+ if (edge != INVALID) return edge;
+ }
+ } else {
+ return Parent::findEdge(s, t, p);
+ }
+ return INVALID;
+ }
+ };
+
+ template <typename Base>
+ class BidirBpUGraphExtender : public Base {
+ public:
+ typedef Base Parent;
+ typedef BidirBpUGraphExtender Graph;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::UEdge UEdge;
+
+
+ using Parent::first;
+ using Parent::next;
+
+ using Parent::id;
+
+ class ANode : public Node {
+ friend class BidirBpUGraphExtender;
+ public:
+ ANode() {}
+ ANode(const Node& node) : Node(node) {
+ LEMON_ASSERT(Parent::aNode(node) || node == INVALID,
+ typename Parent::NodeSetError());
+ }
+ ANode& operator=(const Node& node) {
+ LEMON_ASSERT(Parent::aNode(node) || node == INVALID,
+ typename Parent::NodeSetError());
+ Node::operator=(node);
+ return *this;
+ }
+ ANode(Invalid) : Node(INVALID) {}
+ ANode& operator=(Invalid) {
+ Node::operator=(INVALID);
+ return *this;
+ }
+ };
+
+ void first(ANode& node) const {
+ Parent::firstANode(static_cast<Node&>(node));
+ }
+ void next(ANode& node) const {
+ Parent::nextANode(static_cast<Node&>(node));
+ }
+
+ int id(const ANode& node) const {
+ return Parent::aNodeId(node);
+ }
+
+ class BNode : public Node {
+ friend class BidirBpUGraphExtender;
+ public:
+ BNode() {}
+ BNode(const Node& node) : Node(node) {
+ LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
+ typename Parent::NodeSetError());
+ }
+ BNode& operator=(const Node& node) {
+ LEMON_ASSERT(Parent::bNode(node) || node == INVALID,
+ typename Parent::NodeSetError());
+ Node::operator=(node);
+ return *this;
+ }
+ BNode(Invalid) : Node(INVALID) {}
+ BNode& operator=(Invalid) {
+ Node::operator=(INVALID);
+ return *this;
+ }
+ };
+
+ void first(BNode& node) const {
+ Parent::firstBNode(static_cast<Node&>(node));
+ }
+ void next(BNode& node) const {
+ Parent::nextBNode(static_cast<Node&>(node));
+ }
+
+ int id(const BNode& node) const {
+ return Parent::aNodeId(node);
+ }
+
+ Node source(const UEdge& edge) const {
+ return this->aNode(edge);
+ }
+ Node target(const UEdge& edge) const {
+ return this->bNode(edge);
+ }
+
+ void firstInc(UEdge& edge, bool& dir, const Node& node) const {
+ if (Parent::aNode(node)) {
+ Parent::firstFromANode(edge, node);
+ dir = true;
+ } else {
+ Parent::firstFromBNode(edge, node);
+ dir = static_cast<UEdge&>(edge) == INVALID;
+ }
+ }
+ void nextInc(UEdge& edge, bool& dir) const {
+ if (dir) {
+ Parent::nextFromANode(edge);
+ } else {
+ Parent::nextFromBNode(edge);
+ if (edge == INVALID) dir = true;
+ }
+ }
+
+ class Edge : public UEdge {
+ friend class BidirBpUGraphExtender;
+ protected:
+ bool forward;
+
+ Edge(const UEdge& edge, bool _forward)
+ : UEdge(edge), forward(_forward) {}
+
+ public:
+ Edge() {}
+ Edge (Invalid) : UEdge(INVALID), forward(true) {}
+ bool operator==(const Edge& i) const {
+ return UEdge::operator==(i) && forward == i.forward;
+ }
+ bool operator!=(const Edge& i) const {
+ return UEdge::operator!=(i) || forward != i.forward;
+ }
+ bool operator<(const Edge& i) const {
+ return UEdge::operator<(i) ||
+ (!(i.forward<forward) && UEdge(*this)<UEdge(i));
+ }
+ };
+
+ void first(Edge& edge) const {
+ Parent::first(static_cast<UEdge&>(edge));
+ edge.forward = true;
+ }
+
+ void next(Edge& edge) const {
+ if (!edge.forward) {
+ Parent::next(static_cast<UEdge&>(edge));
+ }
+ edge.forward = !edge.forward;
+ }
+
+ void firstOut(Edge& edge, const Node& node) const {
+ if (Parent::aNode(node)) {
+ Parent::firstFromANode(edge, node);
+ edge.forward = true;
+ } else {
+ Parent::firstFromBNode(edge, node);
+ edge.forward = static_cast<UEdge&>(edge) == INVALID;
+ }
+ }
+ void nextOut(Edge& edge) const {
+ if (edge.forward) {
+ Parent::nextFromANode(edge);
+ } else {
+ Parent::nextFromBNode(edge);
+ edge.forward = static_cast<UEdge&>(edge) == INVALID;
+ }
+ }
+
+ void firstIn(Edge& edge, const Node& node) const {
+ if (Parent::bNode(node)) {
+ Parent::firstFromBNode(edge, node);
+ edge.forward = true;
+ } else {
+ Parent::firstFromANode(edge, node);
+ edge.forward = static_cast<UEdge&>(edge) == INVALID;
+ }
+ }
+ void nextIn(Edge& edge) const {
+ if (edge.forward) {
+ Parent::nextFromBNode(edge);
+ } else {
+ Parent::nextFromANode(edge);
+ edge.forward = static_cast<UEdge&>(edge) == INVALID;
+ }
+ }
+
+ Node source(const Edge& edge) const {
+ return edge.forward ? Parent::aNode(edge) : Parent::bNode(edge);
+ }
+ Node target(const Edge& edge) const {
+ return edge.forward ? Parent::bNode(edge) : Parent::aNode(edge);
+ }
+
+ int id(const Edge& edge) const {
+ return (Parent::id(static_cast<const UEdge&>(edge)) << 1) +
+ (edge.forward ? 0 : 1);
+ }
+ Edge edgeFromId(int ix) const {
+ return Edge(Parent::fromUEdgeId(ix >> 1), (ix & 1) == 0);
+ }
+ int maxEdgeId() const {
+ return (Parent::maxUEdgeId() << 1) + 1;
+ }
+
+ bool direction(const Edge& edge) const {
+ return edge.forward;
+ }
+
+ Edge direct(const UEdge& edge, bool dir) const {
+ return Edge(edge, dir);
+ }
+
+ int edgeNum() const {
+ return 2 * Parent::uEdgeNum();
+ }
+
+ int uEdgeNum() const {
+ return Parent::uEdgeNum();
+ }
+
+
+ };
+}
+
+#endif
diff --git a/src/lemon/bits/debug_map.h b/src/lemon/bits/debug_map.h
new file mode 100644
index 0000000..9447822
--- /dev/null
+++ b/src/lemon/bits/debug_map.h
@@ -0,0 +1,382 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_DEBUG_MAP_H
+#define LEMON_BITS_DEBUG_MAP_H
+
+#include <vector>
+#include <algorithm>
+
+#include <lemon/bits/traits.h>
+#include <lemon/bits/utility.h>
+#include <lemon/error.h>
+
+#include <lemon/bits/alteration_notifier.h>
+
+#include <lemon/concept_check.h>
+#include <lemon/concepts/maps.h>
+
+///\ingroup graphbits
+///
+///\file
+///\brief Vector based graph maps for debugging.
+namespace lemon {
+
+#ifndef LEMON_STRICT_DEBUG_MAP
+#define LEMON_STRICT_DEBUG_MAP false
+#endif
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Graph map based on the std::vector storage.
+ ///
+ /// The DebugMap template class is graph map structure what
+ /// automatically updates the map when a key is added to or erased from
+ /// the map. This map also checks some programming failures by example
+ /// multiple addition of items, erasing of not existing item or
+ /// not erased items at the destruction of the map. It helps the
+ /// programmer to avoid segmentation faults and memory leaks.
+ ///
+ /// \param Notifier The AlterationNotifier that will notify this map.
+ /// \param Item The item type of the graph items.
+ /// \param Value The value type of the map.
+ ///
+ /// \author Balazs Dezso
+ template <typename _Graph, typename _Item, typename _Value>
+ class DebugMap
+ : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
+ private:
+
+ /// The container type of the map.
+ typedef std::vector<_Value> Container;
+
+ /// The container type of the debug flags.
+ typedef std::vector<bool> Flag;
+
+ public:
+
+ static const bool strictCheck = LEMON_STRICT_DEBUG_MAP;
+
+ struct MapError {
+ public:
+ virtual ~MapError() {}
+ virtual const char* what() const throw() {
+ return "lemon::DebugMap::MapError";
+ }
+ };
+
+ /// The graph type of the map.
+ typedef _Graph Graph;
+ /// The item type of the map.
+ typedef _Item Item;
+ /// The reference map tag.
+ typedef True ReferenceMapTag;
+
+ /// The key type of the map.
+ typedef _Item Key;
+ /// The value type of the map.
+ typedef _Value Value;
+
+ /// The notifier type.
+ typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
+
+ /// The map type.
+ typedef DebugMap Map;
+ /// The base class of the map.
+ typedef typename Notifier::ObserverBase Parent;
+
+ /// The reference type of the map;
+ typedef typename Container::reference Reference;
+ /// The const reference type of the map;
+ typedef typename Container::const_reference ConstReference;
+
+
+ /// \brief Constructor to attach the new map into the notifier.
+ ///
+ /// It constructs a map and attachs it into the notifier.
+ /// It adds all the items of the graph to the map.
+ DebugMap(const Graph& graph) {
+ Parent::attach(graph.notifier(Item()));
+ container.resize(Parent::notifier()->maxId() + 1);
+ flag.resize(Parent::notifier()->maxId() + 1, false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ flag[Parent::notifier()->id(it)] = true;
+ }
+ }
+
+ /// \brief Constructor uses given value to initialize the map.
+ ///
+ /// It constructs a map uses a given value to initialize the map.
+ /// It adds all the items of the graph to the map.
+ DebugMap(const Graph& graph, const Value& value) {
+ Parent::attach(graph.notifier(Item()));
+ container.resize(Parent::notifier()->maxId() + 1, value);
+ flag.resize(Parent::notifier()->maxId() + 1, false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ flag[Parent::notifier()->id(it)] = true;
+ }
+ }
+
+ /// \brief Copy constructor
+ ///
+ /// Copy constructor.
+ DebugMap(const DebugMap& _copy) : Parent() {
+ if (_copy.attached()) {
+ Parent::attach(*_copy.notifier());
+ container = _copy.container;
+ }
+ flag.resize(Parent::notifier()->maxId() + 1, false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ flag[Parent::notifier()->id(it)] = true;
+ LEMON_ASSERT(_copy.flag[Parent::notifier()->id(it)], MapError());
+ }
+ }
+
+ /// \brief Destructor
+ ///
+ /// Destructor.
+ ~DebugMap() {
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ if (notifier != 0) {
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ LEMON_ASSERT(flag[Parent::notifier()->id(it)], MapError());
+ flag[Parent::notifier()->id(it)] = false;
+ }
+ }
+ for (int i = 0; i < int(flag.size()); ++i) {
+ LEMON_ASSERT(!flag[i], MapError());
+ }
+ }
+
+ /// \brief Assign operator.
+ ///
+ /// This operator assigns for each item in the map the
+ /// value mapped to the same item in the copied map.
+ /// The parameter map should be indiced with the same
+ /// itemset because this assign operator does not change
+ /// the container of the map.
+ DebugMap& operator=(const DebugMap& cmap) {
+ return operator=<DebugMap>(cmap);
+ }
+
+
+ /// \brief Template assign operator.
+ ///
+ /// The given parameter should be conform to the ReadMap
+ /// concecpt and could be indiced by the current item set of
+ /// the NodeMap. In this case the value for each item
+ /// is assigned by the value of the given ReadMap.
+ template <typename CMap>
+ DebugMap& operator=(const CMap& cmap) {
+ checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ set(it, cmap[it]);
+ }
+ return *this;
+ }
+
+ public:
+
+ /// \brief The subcript operator.
+ ///
+ /// The subscript operator. The map can be subscripted by the
+ /// actual items of the graph.
+ Reference operator[](const Key& key) {
+ LEMON_ASSERT(flag[Parent::notifier()->id(key)], MapError());
+ return container[Parent::notifier()->id(key)];
+ }
+
+ /// \brief The const subcript operator.
+ ///
+ /// The const subscript operator. The map can be subscripted by the
+ /// actual items of the graph.
+ ConstReference operator[](const Key& key) const {
+ LEMON_ASSERT(flag[Parent::notifier()->id(key)], MapError());
+ return container[Parent::notifier()->id(key)];
+ }
+
+
+ /// \brief The setter function of the map.
+ ///
+ /// It the same as operator[](key) = value expression.
+ void set(const Key& key, const Value& value) {
+ (*this)[key] = value;
+ }
+
+ protected:
+
+ /// \brief Adds a new key to the map.
+ ///
+ /// It adds a new key to the map. It called by the observer notifier
+ /// and it overrides the add() member function of the observer base.
+ virtual void add(const Key& key) {
+ int id = Parent::notifier()->id(key);
+ if (id >= int(container.size())) {
+ container.resize(id + 1);
+ flag.resize(id + 1, false);
+ }
+ LEMON_ASSERT(!flag[Parent::notifier()->id(key)], MapError());
+ flag[Parent::notifier()->id(key)] = true;
+ if (strictCheck) {
+ std::vector<bool> fl(flag.size(), false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ int jd = Parent::notifier()->id(it);
+ fl[jd] = true;
+ }
+ LEMON_ASSERT(fl == flag, MapError());
+ }
+ }
+
+ /// \brief Adds more new keys to the map.
+ ///
+ /// It adds more new keys to the map. It called by the observer notifier
+ /// and it overrides the add() member function of the observer base.
+ virtual void add(const std::vector<Key>& keys) {
+ int max = container.size() - 1;
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int id = Parent::notifier()->id(keys[i]);
+ if (id >= max) {
+ max = id;
+ }
+ }
+ container.resize(max + 1);
+ flag.resize(max + 1, false);
+ for (int i = 0; i < int(keys.size()); ++i) {
+ LEMON_ASSERT(!flag[Parent::notifier()->id(keys[i])], MapError());
+ flag[Parent::notifier()->id(keys[i])] = true;
+ }
+ if (strictCheck) {
+ std::vector<bool> fl(flag.size(), false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ int id = Parent::notifier()->id(it);
+ fl[id] = true;
+ }
+ LEMON_ASSERT(fl == flag, MapError());
+ }
+ }
+
+ /// \brief Erase a key from the map.
+ ///
+ /// Erase a key from the map. It called by the observer notifier
+ /// and it overrides the erase() member function of the observer base.
+ virtual void erase(const Key& key) {
+ if (strictCheck) {
+ std::vector<bool> fl(flag.size(), false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ int id = Parent::notifier()->id(it);
+ fl[id] = true;
+ }
+ LEMON_ASSERT(fl == flag, MapError());
+ }
+ container[Parent::notifier()->id(key)] = Value();
+ LEMON_ASSERT(flag[Parent::notifier()->id(key)], MapError());
+ flag[Parent::notifier()->id(key)] = false;
+ }
+
+ /// \brief Erase more keys from the map.
+ ///
+ /// Erase more keys from the map. It called by the observer notifier
+ /// and it overrides the erase() member function of the observer base.
+ virtual void erase(const std::vector<Key>& keys) {
+ if (strictCheck) {
+ std::vector<bool> fl(flag.size(), false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ int id = Parent::notifier()->id(it);
+ fl[id] = true;
+ }
+ LEMON_ASSERT(fl == flag, MapError());
+ }
+ for (int i = 0; i < int(keys.size()); ++i) {
+ container[Parent::notifier()->id(keys[i])] = Value();
+ LEMON_ASSERT(flag[Parent::notifier()->id(keys[i])], MapError());
+ flag[Parent::notifier()->id(keys[i])] = false;
+ }
+ }
+
+ /// \brief Buildes the map.
+ ///
+ /// It buildes the map. It called by the observer notifier
+ /// and it overrides the build() member function of the observer base.
+ virtual void build() {
+ if (strictCheck) {
+ for (int i = 0; i < int(flag.size()); ++i) {
+ LEMON_ASSERT(flag[i], MapError());
+ }
+ }
+ int size = Parent::notifier()->maxId() + 1;
+ container.reserve(size);
+ container.resize(size);
+ flag.reserve(size);
+ flag.resize(size, false);
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ int id = Parent::notifier()->id(it);
+ LEMON_ASSERT(!flag[id], MapError());
+ flag[id] = true;
+ }
+ }
+
+ /// \brief Clear the map.
+ ///
+ /// It erase all items from the map. It called by the observer notifier
+ /// and it overrides the clear() member function of the observer base.
+ virtual void clear() {
+ const typename Parent::Notifier* notifier = Parent::notifier();
+ Item it;
+ for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ int id = Parent::notifier()->id(it);
+ LEMON_ASSERT(flag[id], MapError());
+ flag[id] = false;
+ }
+ if (strictCheck) {
+ for (int i = 0; i < int(flag.size()); ++i) {
+ LEMON_ASSERT(!flag[i], MapError());
+ }
+ }
+ container.clear();
+ flag.clear();
+ }
+
+ private:
+
+ Container container;
+ Flag flag;
+
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/default_map.h b/src/lemon/bits/default_map.h
new file mode 100644
index 0000000..2a8689d
--- /dev/null
+++ b/src/lemon/bits/default_map.h
@@ -0,0 +1,181 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_DEFAULT_MAP_H
+#define LEMON_BITS_DEFAULT_MAP_H
+
+
+#include <lemon/bits/array_map.h>
+#include <lemon/bits/vector_map.h>
+#include <lemon/bits/debug_map.h>
+
+///\ingroup graphbits
+///\file
+///\brief Graph maps that construct and destruct their elements dynamically.
+
+namespace lemon {
+
+
+#ifndef LEMON_USE_DEBUG_MAP
+
+ template <typename _Graph, typename _Item, typename _Value>
+ struct DefaultMapSelector {
+ typedef ArrayMap<_Graph, _Item, _Value> Map;
+ };
+
+ // bool
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, bool> {
+ typedef VectorMap<_Graph, _Item, bool> Map;
+ };
+
+ // char
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, char> {
+ typedef VectorMap<_Graph, _Item, char> Map;
+ };
+
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, signed char> {
+ typedef VectorMap<_Graph, _Item, signed char> Map;
+ };
+
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, unsigned char> {
+ typedef VectorMap<_Graph, _Item, unsigned char> Map;
+ };
+
+
+ // int
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, signed int> {
+ typedef VectorMap<_Graph, _Item, signed int> Map;
+ };
+
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, unsigned int> {
+ typedef VectorMap<_Graph, _Item, unsigned int> Map;
+ };
+
+
+ // short
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, signed short> {
+ typedef VectorMap<_Graph, _Item, signed short> Map;
+ };
+
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, unsigned short> {
+ typedef VectorMap<_Graph, _Item, unsigned short> Map;
+ };
+
+
+ // long
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, signed long> {
+ typedef VectorMap<_Graph, _Item, signed long> Map;
+ };
+
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, unsigned long> {
+ typedef VectorMap<_Graph, _Item, unsigned long> Map;
+ };
+
+
+#if defined __GNUC__ && !defined __STRICT_ANSI__
+
+ // long long
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, signed long long> {
+ typedef VectorMap<_Graph, _Item, signed long long> Map;
+ };
+
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, unsigned long long> {
+ typedef VectorMap<_Graph, _Item, unsigned long long> Map;
+ };
+
+#endif
+
+
+ // float
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, float> {
+ typedef VectorMap<_Graph, _Item, float> Map;
+ };
+
+
+ // double
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, double> {
+ typedef VectorMap<_Graph, _Item, double> Map;
+ };
+
+
+ // long double
+ template <typename _Graph, typename _Item>
+ struct DefaultMapSelector<_Graph, _Item, long double> {
+ typedef VectorMap<_Graph, _Item, long double> Map;
+ };
+
+
+ // pointer
+ template <typename _Graph, typename _Item, typename _Ptr>
+ struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
+ typedef VectorMap<_Graph, _Item, _Ptr*> Map;
+ };
+
+#else
+
+ template <typename _Graph, typename _Item, typename _Value>
+ struct DefaultMapSelector {
+ typedef DebugMap<_Graph, _Item, _Value> Map;
+ };
+
+#endif
+
+ /// \e
+ template <typename _Graph, typename _Item, typename _Value>
+ class DefaultMap
+ : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
+ public:
+ typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
+ typedef DefaultMap<_Graph, _Item, _Value> Map;
+
+ typedef typename Parent::Graph Graph;
+ typedef typename Parent::Value Value;
+
+ explicit DefaultMap(const Graph& graph) : Parent(graph) {}
+ DefaultMap(const Graph& graph, const Value& value)
+ : Parent(graph, value) {}
+
+ DefaultMap& operator=(const DefaultMap& cmap) {
+ return operator=<DefaultMap>(cmap);
+ }
+
+ template <typename CMap>
+ DefaultMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/graph_adaptor_extender.h b/src/lemon/bits/graph_adaptor_extender.h
new file mode 100644
index 0000000..3619264
--- /dev/null
+++ b/src/lemon/bits/graph_adaptor_extender.h
@@ -0,0 +1,742 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H
+#define LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H
+
+#include <lemon/bits/invalid.h>
+#include <lemon/error.h>
+
+#include <lemon/bits/default_map.h>
+
+
+///\ingroup graphbits
+///\file
+///\brief Extenders for the graph adaptor types
+namespace lemon {
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for the GraphAdaptors
+ template <typename _Graph>
+ class GraphAdaptorExtender : public _Graph {
+ public:
+
+ typedef _Graph Parent;
+ typedef _Graph Graph;
+ typedef GraphAdaptorExtender Adaptor;
+
+ // Base extensions
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ int maxId(Node) const {
+ return Parent::maxNodeId();
+ }
+
+ int maxId(Edge) const {
+ return Parent::maxEdgeId();
+ }
+
+ Node fromId(int id, Node) const {
+ return Parent::nodeFromId(id);
+ }
+
+ Edge fromId(int id, Edge) const {
+ return Parent::edgeFromId(id);
+ }
+
+ Node oppositeNode(const Node &n, const Edge &e) const {
+ if (n == Parent::source(e))
+ return Parent::target(e);
+ else if(n==Parent::target(e))
+ return Parent::source(e);
+ else
+ return INVALID;
+ }
+
+ class NodeIt : public Node {
+ const Adaptor* graph;
+ public:
+
+ NodeIt() {}
+
+ NodeIt(Invalid i) : Node(i) { }
+
+ explicit NodeIt(const Adaptor& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Node&>(*this));
+ }
+
+ NodeIt(const Adaptor& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ NodeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class EdgeIt : public Edge {
+ const Adaptor* graph;
+ public:
+
+ EdgeIt() { }
+
+ EdgeIt(Invalid i) : Edge(i) { }
+
+ explicit EdgeIt(const Adaptor& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Edge&>(*this));
+ }
+
+ EdgeIt(const Adaptor& _graph, const Edge& e) :
+ Edge(e), graph(&_graph) { }
+
+ EdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class OutEdgeIt : public Edge {
+ const Adaptor* graph;
+ public:
+
+ OutEdgeIt() { }
+
+ OutEdgeIt(Invalid i) : Edge(i) { }
+
+ OutEdgeIt(const Adaptor& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstOut(*this, node);
+ }
+
+ OutEdgeIt(const Adaptor& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) {}
+
+ OutEdgeIt& operator++() {
+ graph->nextOut(*this);
+ return *this;
+ }
+
+ };
+
+
+ class InEdgeIt : public Edge {
+ const Adaptor* graph;
+ public:
+
+ InEdgeIt() { }
+
+ InEdgeIt(Invalid i) : Edge(i) { }
+
+ InEdgeIt(const Adaptor& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstIn(*this, node);
+ }
+
+ InEdgeIt(const Adaptor& _graph, const Edge& edge) :
+ Edge(edge), graph(&_graph) {}
+
+ InEdgeIt& operator++() {
+ graph->nextIn(*this);
+ return *this;
+ }
+
+ };
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the source in this case) of the iterator
+ Node baseNode(const OutEdgeIt &e) const {
+ return Parent::source(e);
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the target in this case) of the
+ /// iterator
+ Node runningNode(const OutEdgeIt &e) const {
+ return Parent::target(e);
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the target in this case) of the iterator
+ Node baseNode(const InEdgeIt &e) const {
+ return Parent::target(e);
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the source in this case) of the
+ /// iterator
+ Node runningNode(const InEdgeIt &e) const {
+ return Parent::source(e);
+ }
+
+ };
+
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for the UGraphAdaptors
+ template <typename _UGraph>
+ class UGraphAdaptorExtender : public _UGraph {
+ public:
+
+ typedef _UGraph Parent;
+ typedef _UGraph UGraph;
+ typedef UGraphAdaptorExtender Adaptor;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+ typedef typename Parent::UEdge UEdge;
+
+ // UGraph extension
+
+ int maxId(Node) const {
+ return Parent::maxNodeId();
+ }
+
+ int maxId(Edge) const {
+ return Parent::maxEdgeId();
+ }
+
+ int maxId(UEdge) const {
+ return Parent::maxUEdgeId();
+ }
+
+ Node fromId(int id, Node) const {
+ return Parent::nodeFromId(id);
+ }
+
+ Edge fromId(int id, Edge) const {
+ return Parent::edgeFromId(id);
+ }
+
+ UEdge fromId(int id, UEdge) const {
+ return Parent::uEdgeFromId(id);
+ }
+
+ Node oppositeNode(const Node &n, const UEdge &e) const {
+ if( n == Parent::source(e))
+ return Parent::target(e);
+ else if( n == Parent::target(e))
+ return Parent::source(e);
+ else
+ return INVALID;
+ }
+
+ Edge oppositeEdge(const Edge &e) const {
+ return Parent::direct(e, !Parent::direction(e));
+ }
+
+ using Parent::direct;
+ Edge direct(const UEdge &ue, const Node &s) const {
+ return Parent::direct(ue, Parent::source(ue) == s);
+ }
+
+
+ class NodeIt : public Node {
+ const Adaptor* graph;
+ public:
+
+ NodeIt() {}
+
+ NodeIt(Invalid i) : Node(i) { }
+
+ explicit NodeIt(const Adaptor& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Node&>(*this));
+ }
+
+ NodeIt(const Adaptor& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ NodeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class EdgeIt : public Edge {
+ const Adaptor* graph;
+ public:
+
+ EdgeIt() { }
+
+ EdgeIt(Invalid i) : Edge(i) { }
+
+ explicit EdgeIt(const Adaptor& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Edge&>(*this));
+ }
+
+ EdgeIt(const Adaptor& _graph, const Edge& e) :
+ Edge(e), graph(&_graph) { }
+
+ EdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class OutEdgeIt : public Edge {
+ const Adaptor* graph;
+ public:
+
+ OutEdgeIt() { }
+
+ OutEdgeIt(Invalid i) : Edge(i) { }
+
+ OutEdgeIt(const Adaptor& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstOut(*this, node);
+ }
+
+ OutEdgeIt(const Adaptor& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) {}
+
+ OutEdgeIt& operator++() {
+ graph->nextOut(*this);
+ return *this;
+ }
+
+ };
+
+
+ class InEdgeIt : public Edge {
+ const Adaptor* graph;
+ public:
+
+ InEdgeIt() { }
+
+ InEdgeIt(Invalid i) : Edge(i) { }
+
+ InEdgeIt(const Adaptor& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstIn(*this, node);
+ }
+
+ InEdgeIt(const Adaptor& _graph, const Edge& edge) :
+ Edge(edge), graph(&_graph) {}
+
+ InEdgeIt& operator++() {
+ graph->nextIn(*this);
+ return *this;
+ }
+
+ };
+
+ class UEdgeIt : public Parent::UEdge {
+ const Adaptor* graph;
+ public:
+
+ UEdgeIt() { }
+
+ UEdgeIt(Invalid i) : UEdge(i) { }
+
+ explicit UEdgeIt(const Adaptor& _graph) : graph(&_graph) {
+ _graph.first(static_cast<UEdge&>(*this));
+ }
+
+ UEdgeIt(const Adaptor& _graph, const UEdge& e) :
+ UEdge(e), graph(&_graph) { }
+
+ UEdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+ class IncEdgeIt : public Parent::UEdge {
+ friend class UGraphAdaptorExtender;
+ const Adaptor* graph;
+ bool direction;
+ public:
+
+ IncEdgeIt() { }
+
+ IncEdgeIt(Invalid i) : UEdge(i), direction(false) { }
+
+ IncEdgeIt(const Adaptor& _graph, const Node &n) : graph(&_graph) {
+ _graph.firstInc(static_cast<UEdge&>(*this), direction, n);
+ }
+
+ IncEdgeIt(const Adaptor& _graph, const UEdge &ue, const Node &n)
+ : graph(&_graph), UEdge(ue) {
+ direction = (_graph.source(ue) == n);
+ }
+
+ IncEdgeIt& operator++() {
+ graph->nextInc(*this, direction);
+ return *this;
+ }
+ };
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the source in this case) of the iterator
+ Node baseNode(const OutEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the target in this case) of the
+ /// iterator
+ Node runningNode(const OutEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the target in this case) of the iterator
+ Node baseNode(const InEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the source in this case) of the
+ /// iterator
+ Node runningNode(const InEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+
+ /// Base node of the iterator
+ ///
+ /// Returns the base node of the iterator
+ Node baseNode(const IncEdgeIt &e) const {
+ return e.direction ? source(e) : target(e);
+ }
+ /// Running node of the iterator
+ ///
+ /// Returns the running node of the iterator
+ Node runningNode(const IncEdgeIt &e) const {
+ return e.direction ? target(e) : source(e);
+ }
+
+ };
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for the BpUGraphAdaptors
+ template <typename Base>
+ class BpUGraphAdaptorExtender : public Base {
+ public:
+ typedef Base Parent;
+ typedef BpUGraphAdaptorExtender Graph;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::BNode BNode;
+ typedef typename Parent::ANode ANode;
+ typedef typename Parent::Edge Edge;
+ typedef typename Parent::UEdge UEdge;
+
+
+ int maxId(Node) const {
+ return Parent::maxNodeId();
+ }
+ int maxId(BNode) const {
+ return Parent::maxBNodeId();
+ }
+ int maxId(ANode) const {
+ return Parent::maxANodeId();
+ }
+ int maxId(Edge) const {
+ return Parent::maxEdgeId();
+ }
+ int maxId(UEdge) const {
+ return Parent::maxUEdgeId();
+ }
+
+
+ Node fromId(int id, Node) const {
+ return Parent::nodeFromId(id);
+ }
+ ANode fromId(int id, ANode) const {
+ return Parent::nodeFromANodeId(id);
+ }
+ BNode fromId(int id, BNode) const {
+ return Parent::nodeFromBNodeId(id);
+ }
+ Edge fromId(int id, Edge) const {
+ return Parent::edgeFromId(id);
+ }
+ UEdge fromId(int id, UEdge) const {
+ return Parent::uEdgeFromId(id);
+ }
+
+ class NodeIt : public Node {
+ const Graph* graph;
+ public:
+
+ NodeIt() { }
+
+ NodeIt(Invalid i) : Node(INVALID) { }
+
+ explicit NodeIt(const Graph& _graph) : graph(&_graph) {
+ graph->first(static_cast<Node&>(*this));
+ }
+
+ NodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) { }
+
+ NodeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+ class ANodeIt : public Node {
+ friend class BpUGraphAdaptorExtender;
+ const Graph* graph;
+ public:
+
+ ANodeIt() { }
+
+ ANodeIt(Invalid i) : Node(INVALID) { }
+
+ explicit ANodeIt(const Graph& _graph) : graph(&_graph) {
+ graph->firstANode(static_cast<Node&>(*this));
+ }
+
+ ANodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ ANodeIt& operator++() {
+ graph->nextANode(*this);
+ return *this;
+ }
+ };
+
+ class BNodeIt : public Node {
+ friend class BpUGraphAdaptorExtender;
+ const Graph* graph;
+ public:
+
+ BNodeIt() { }
+
+ BNodeIt(Invalid i) : Node(INVALID) { }
+
+ explicit BNodeIt(const Graph& _graph) : graph(&_graph) {
+ graph->firstBNode(static_cast<Node&>(*this));
+ }
+
+ BNodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ BNodeIt& operator++() {
+ graph->nextBNode(*this);
+ return *this;
+ }
+ };
+
+ class EdgeIt : public Edge {
+ friend class BpUGraphAdaptorExtender;
+ const Graph* graph;
+ public:
+
+ EdgeIt() { }
+
+ EdgeIt(Invalid i) : Edge(INVALID) { }
+
+ explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
+ graph->first(static_cast<Edge&>(*this));
+ }
+
+ EdgeIt(const Graph& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) { }
+
+ EdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+ class UEdgeIt : public UEdge {
+ friend class BpUGraphAdaptorExtender;
+ const Graph* graph;
+ public:
+
+ UEdgeIt() { }
+
+ UEdgeIt(Invalid i) : UEdge(INVALID) { }
+
+ explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
+ graph->first(static_cast<UEdge&>(*this));
+ }
+
+ UEdgeIt(const Graph& _graph, const UEdge& edge)
+ : UEdge(edge), graph(&_graph) { }
+
+ UEdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+ };
+
+ class OutEdgeIt : public Edge {
+ friend class BpUGraphAdaptorExtender;
+ const Graph* graph;
+ public:
+
+ OutEdgeIt() { }
+
+ OutEdgeIt(Invalid i) : Edge(i) { }
+
+ OutEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ graph->firstOut(*this, node);
+ }
+
+ OutEdgeIt(const Graph& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) {}
+
+ OutEdgeIt& operator++() {
+ graph->nextOut(*this);
+ return *this;
+ }
+
+ };
+
+
+ class InEdgeIt : public Edge {
+ friend class BpUGraphAdaptorExtender;
+ const Graph* graph;
+ public:
+
+ InEdgeIt() { }
+
+ InEdgeIt(Invalid i) : Edge(i) { }
+
+ InEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ graph->firstIn(*this, node);
+ }
+
+ InEdgeIt(const Graph& _graph, const Edge& edge) :
+ Edge(edge), graph(&_graph) {}
+
+ InEdgeIt& operator++() {
+ graph->nextIn(*this);
+ return *this;
+ }
+
+ };
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the source in this case) of the iterator
+ Node baseNode(const OutEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the target in this case) of the
+ /// iterator
+ Node runningNode(const OutEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the target in this case) of the iterator
+ Node baseNode(const InEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the source in this case) of the
+ /// iterator
+ Node runningNode(const InEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+
+ class IncEdgeIt : public Parent::UEdge {
+ friend class BpUGraphAdaptorExtender;
+ const Graph* graph;
+ bool direction;
+ public:
+
+ IncEdgeIt() { }
+
+ IncEdgeIt(Invalid i) : UEdge(i), direction(true) { }
+
+ IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
+ graph->firstInc(*this, direction, n);
+ }
+
+ IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n)
+ : graph(&_graph), UEdge(ue) {
+ direction = (graph->source(ue) == n);
+ }
+
+ IncEdgeIt& operator++() {
+ graph->nextInc(*this, direction);
+ return *this;
+ }
+ };
+
+
+ /// Base node of the iterator
+ ///
+ /// Returns the base node of the iterator
+ Node baseNode(const IncEdgeIt &e) const {
+ return e.direction ? source(e) : target(e);
+ }
+
+ /// Running node of the iterator
+ ///
+ /// Returns the running node of the iterator
+ Node runningNode(const IncEdgeIt &e) const {
+ return e.direction ? target(e) : source(e);
+ }
+
+ Node oppositeNode(const Node &n, const UEdge &e) const {
+ if( n == Parent::source(e))
+ return Parent::target(e);
+ else if( n == Parent::target(e))
+ return Parent::source(e);
+ else
+ return INVALID;
+ }
+
+ Edge oppositeEdge(const Edge &e) const {
+ return Parent::direct(e, !Parent::direction(e));
+ }
+
+ using Parent::direct;
+ Edge direct(const UEdge &ue, const Node &s) const {
+ return Parent::direct(ue, Parent::source(ue) == s);
+ }
+
+ };
+
+
+}
+
+
+#endif
diff --git a/src/lemon/bits/graph_extender.h b/src/lemon/bits/graph_extender.h
new file mode 100644
index 0000000..464594d
--- /dev/null
+++ b/src/lemon/bits/graph_extender.h
@@ -0,0 +1,1397 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_GRAPH_EXTENDER_H
+#define LEMON_BITS_GRAPH_EXTENDER_H
+
+#include <lemon/bits/invalid.h>
+#include <lemon/bits/utility.h>
+#include <lemon/error.h>
+
+#include <lemon/bits/map_extender.h>
+#include <lemon/bits/default_map.h>
+
+#include <lemon/concept_check.h>
+#include <lemon/concepts/maps.h>
+
+///\ingroup graphbits
+///\file
+///\brief Extenders for the graph types
+namespace lemon {
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for the Graphs
+ template <typename Base>
+ class GraphExtender : public Base {
+ public:
+
+ typedef Base Parent;
+ typedef GraphExtender Graph;
+
+ // Base extensions
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ int maxId(Node) const {
+ return Parent::maxNodeId();
+ }
+
+ int maxId(Edge) const {
+ return Parent::maxEdgeId();
+ }
+
+ Node fromId(int id, Node) const {
+ return Parent::nodeFromId(id);
+ }
+
+ Edge fromId(int id, Edge) const {
+ return Parent::edgeFromId(id);
+ }
+
+ Node oppositeNode(const Node &n, const Edge &e) const {
+ if (n == Parent::source(e))
+ return Parent::target(e);
+ else if(n==Parent::target(e))
+ return Parent::source(e);
+ else
+ return INVALID;
+ }
+
+ // Alterable extension
+
+ typedef AlterationNotifier<GraphExtender, Node> NodeNotifier;
+ typedef AlterationNotifier<GraphExtender, Edge> EdgeNotifier;
+
+
+ protected:
+
+ mutable NodeNotifier node_notifier;
+ mutable EdgeNotifier edge_notifier;
+
+ public:
+
+ NodeNotifier& notifier(Node) const {
+ return node_notifier;
+ }
+
+ EdgeNotifier& notifier(Edge) const {
+ return edge_notifier;
+ }
+
+ class NodeIt : public Node {
+ const Graph* graph;
+ public:
+
+ NodeIt() {}
+
+ NodeIt(Invalid i) : Node(i) { }
+
+ explicit NodeIt(const Graph& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Node&>(*this));
+ }
+
+ NodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ NodeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class EdgeIt : public Edge {
+ const Graph* graph;
+ public:
+
+ EdgeIt() { }
+
+ EdgeIt(Invalid i) : Edge(i) { }
+
+ explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Edge&>(*this));
+ }
+
+ EdgeIt(const Graph& _graph, const Edge& e) :
+ Edge(e), graph(&_graph) { }
+
+ EdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class OutEdgeIt : public Edge {
+ const Graph* graph;
+ public:
+
+ OutEdgeIt() { }
+
+ OutEdgeIt(Invalid i) : Edge(i) { }
+
+ OutEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstOut(*this, node);
+ }
+
+ OutEdgeIt(const Graph& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) {}
+
+ OutEdgeIt& operator++() {
+ graph->nextOut(*this);
+ return *this;
+ }
+
+ };
+
+
+ class InEdgeIt : public Edge {
+ const Graph* graph;
+ public:
+
+ InEdgeIt() { }
+
+ InEdgeIt(Invalid i) : Edge(i) { }
+
+ InEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstIn(*this, node);
+ }
+
+ InEdgeIt(const Graph& _graph, const Edge& edge) :
+ Edge(edge), graph(&_graph) {}
+
+ InEdgeIt& operator++() {
+ graph->nextIn(*this);
+ return *this;
+ }
+
+ };
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (i.e. the source in this case) of the iterator
+ Node baseNode(const OutEdgeIt &e) const {
+ return Parent::source(e);
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (i.e. the target in this case) of the
+ /// iterator
+ Node runningNode(const OutEdgeIt &e) const {
+ return Parent::target(e);
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (i.e. the target in this case) of the iterator
+ Node baseNode(const InEdgeIt &e) const {
+ return Parent::target(e);
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (i.e. the source in this case) of the
+ /// iterator
+ Node runningNode(const InEdgeIt &e) const {
+ return Parent::source(e);
+ }
+
+
+ template <typename _Value>
+ class NodeMap
+ : public MapExtender<DefaultMap<Graph, Node, _Value> > {
+ public:
+ typedef GraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
+
+ explicit NodeMap(const Graph& graph)
+ : Parent(graph) {}
+ NodeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ NodeMap& operator=(const NodeMap& cmap) {
+ return operator=<NodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ NodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ template <typename _Value>
+ class EdgeMap
+ : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
+ public:
+ typedef GraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
+
+ explicit EdgeMap(const Graph& graph)
+ : Parent(graph) {}
+ EdgeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+
+ Node addNode() {
+ Node node = Parent::addNode();
+ notifier(Node()).add(node);
+ return node;
+ }
+
+ Edge addEdge(const Node& from, const Node& to) {
+ Edge edge = Parent::addEdge(from, to);
+ notifier(Edge()).add(edge);
+ return edge;
+ }
+
+ void clear() {
+ notifier(Edge()).clear();
+ notifier(Node()).clear();
+ Parent::clear();
+ }
+
+ template <typename Graph, typename NodeRefMap, typename EdgeRefMap>
+ void build(const Graph& graph, NodeRefMap& nodeRef, EdgeRefMap& edgeRef) {
+ Parent::build(graph, nodeRef, edgeRef);
+ notifier(Node()).build();
+ notifier(Edge()).build();
+ }
+
+ void erase(const Node& node) {
+ Edge edge;
+ Parent::firstOut(edge, node);
+ while (edge != INVALID ) {
+ erase(edge);
+ Parent::firstOut(edge, node);
+ }
+
+ Parent::firstIn(edge, node);
+ while (edge != INVALID ) {
+ erase(edge);
+ Parent::firstIn(edge, node);
+ }
+
+ notifier(Node()).erase(node);
+ Parent::erase(node);
+ }
+
+ void erase(const Edge& edge) {
+ notifier(Edge()).erase(edge);
+ Parent::erase(edge);
+ }
+
+ GraphExtender() {
+ node_notifier.setContainer(*this);
+ edge_notifier.setContainer(*this);
+ }
+
+
+ ~GraphExtender() {
+ edge_notifier.clear();
+ node_notifier.clear();
+ }
+ };
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for the UGraphs
+ template <typename Base>
+ class UGraphExtender : public Base {
+ public:
+
+ typedef Base Parent;
+ typedef UGraphExtender Graph;
+
+ typedef True UndirectedTag;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+ typedef typename Parent::UEdge UEdge;
+
+ // UGraph extension
+
+ int maxId(Node) const {
+ return Parent::maxNodeId();
+ }
+
+ int maxId(Edge) const {
+ return Parent::maxEdgeId();
+ }
+
+ int maxId(UEdge) const {
+ return Parent::maxUEdgeId();
+ }
+
+ Node fromId(int id, Node) const {
+ return Parent::nodeFromId(id);
+ }
+
+ Edge fromId(int id, Edge) const {
+ return Parent::edgeFromId(id);
+ }
+
+ UEdge fromId(int id, UEdge) const {
+ return Parent::uEdgeFromId(id);
+ }
+
+ Node oppositeNode(const Node &n, const UEdge &e) const {
+ if( n == Parent::source(e))
+ return Parent::target(e);
+ else if( n == Parent::target(e))
+ return Parent::source(e);
+ else
+ return INVALID;
+ }
+
+ Edge oppositeEdge(const Edge &e) const {
+ return Parent::direct(e, !Parent::direction(e));
+ }
+
+ using Parent::direct;
+ Edge direct(const UEdge &ue, const Node &s) const {
+ return Parent::direct(ue, Parent::source(ue) == s);
+ }
+
+ // Alterable extension
+
+ typedef AlterationNotifier<UGraphExtender, Node> NodeNotifier;
+ typedef AlterationNotifier<UGraphExtender, Edge> EdgeNotifier;
+ typedef AlterationNotifier<UGraphExtender, UEdge> UEdgeNotifier;
+
+
+ protected:
+
+ mutable NodeNotifier node_notifier;
+ mutable EdgeNotifier edge_notifier;
+ mutable UEdgeNotifier uedge_notifier;
+
+ public:
+
+ NodeNotifier& notifier(Node) const {
+ return node_notifier;
+ }
+
+ EdgeNotifier& notifier(Edge) const {
+ return edge_notifier;
+ }
+
+ UEdgeNotifier& notifier(UEdge) const {
+ return uedge_notifier;
+ }
+
+
+
+ class NodeIt : public Node {
+ const Graph* graph;
+ public:
+
+ NodeIt() {}
+
+ NodeIt(Invalid i) : Node(i) { }
+
+ explicit NodeIt(const Graph& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Node&>(*this));
+ }
+
+ NodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ NodeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class EdgeIt : public Edge {
+ const Graph* graph;
+ public:
+
+ EdgeIt() { }
+
+ EdgeIt(Invalid i) : Edge(i) { }
+
+ explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
+ _graph.first(static_cast<Edge&>(*this));
+ }
+
+ EdgeIt(const Graph& _graph, const Edge& e) :
+ Edge(e), graph(&_graph) { }
+
+ EdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+
+ class OutEdgeIt : public Edge {
+ const Graph* graph;
+ public:
+
+ OutEdgeIt() { }
+
+ OutEdgeIt(Invalid i) : Edge(i) { }
+
+ OutEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstOut(*this, node);
+ }
+
+ OutEdgeIt(const Graph& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) {}
+
+ OutEdgeIt& operator++() {
+ graph->nextOut(*this);
+ return *this;
+ }
+
+ };
+
+
+ class InEdgeIt : public Edge {
+ const Graph* graph;
+ public:
+
+ InEdgeIt() { }
+
+ InEdgeIt(Invalid i) : Edge(i) { }
+
+ InEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ _graph.firstIn(*this, node);
+ }
+
+ InEdgeIt(const Graph& _graph, const Edge& edge) :
+ Edge(edge), graph(&_graph) {}
+
+ InEdgeIt& operator++() {
+ graph->nextIn(*this);
+ return *this;
+ }
+
+ };
+
+
+ class UEdgeIt : public Parent::UEdge {
+ const Graph* graph;
+ public:
+
+ UEdgeIt() { }
+
+ UEdgeIt(Invalid i) : UEdge(i) { }
+
+ explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
+ _graph.first(static_cast<UEdge&>(*this));
+ }
+
+ UEdgeIt(const Graph& _graph, const UEdge& e) :
+ UEdge(e), graph(&_graph) { }
+
+ UEdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+ class IncEdgeIt : public Parent::UEdge {
+ friend class UGraphExtender;
+ const Graph* graph;
+ bool direction;
+ public:
+
+ IncEdgeIt() { }
+
+ IncEdgeIt(Invalid i) : UEdge(i), direction(false) { }
+
+ IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
+ _graph.firstInc(*this, direction, n);
+ }
+
+ IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n)
+ : graph(&_graph), UEdge(ue) {
+ direction = (_graph.source(ue) == n);
+ }
+
+ IncEdgeIt& operator++() {
+ graph->nextInc(*this, direction);
+ return *this;
+ }
+ };
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the source in this case) of the iterator
+ Node baseNode(const OutEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the target in this case) of the
+ /// iterator
+ Node runningNode(const OutEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the target in this case) of the iterator
+ Node baseNode(const InEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the source in this case) of the
+ /// iterator
+ Node runningNode(const InEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+
+ /// Base node of the iterator
+ ///
+ /// Returns the base node of the iterator
+ Node baseNode(const IncEdgeIt &e) const {
+ return e.direction ? source(e) : target(e);
+ }
+ /// Running node of the iterator
+ ///
+ /// Returns the running node of the iterator
+ Node runningNode(const IncEdgeIt &e) const {
+ return e.direction ? target(e) : source(e);
+ }
+
+ // Mappable extension
+
+ template <typename _Value>
+ class NodeMap
+ : public MapExtender<DefaultMap<Graph, Node, _Value> > {
+ public:
+ typedef UGraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
+
+ NodeMap(const Graph& graph)
+ : Parent(graph) {}
+ NodeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ NodeMap& operator=(const NodeMap& cmap) {
+ return operator=<NodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ NodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ template <typename _Value>
+ class EdgeMap
+ : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
+ public:
+ typedef UGraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
+
+ EdgeMap(const Graph& graph)
+ : Parent(graph) {}
+ EdgeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+
+ template <typename _Value>
+ class UEdgeMap
+ : public MapExtender<DefaultMap<Graph, UEdge, _Value> > {
+ public:
+ typedef UGraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, UEdge, _Value> > Parent;
+
+ UEdgeMap(const Graph& graph)
+ : Parent(graph) {}
+
+ UEdgeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ UEdgeMap& operator=(const UEdgeMap& cmap) {
+ return operator=<UEdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ UEdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ // Alteration extension
+
+ Node addNode() {
+ Node node = Parent::addNode();
+ notifier(Node()).add(node);
+ return node;
+ }
+
+ UEdge addEdge(const Node& from, const Node& to) {
+ UEdge uedge = Parent::addEdge(from, to);
+ notifier(UEdge()).add(uedge);
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).add(ev);
+ return uedge;
+ }
+
+ void clear() {
+ notifier(Edge()).clear();
+ notifier(UEdge()).clear();
+ notifier(Node()).clear();
+ Parent::clear();
+ }
+
+ template <typename Graph, typename NodeRefMap, typename UEdgeRefMap>
+ void build(const Graph& graph, NodeRefMap& nodeRef,
+ UEdgeRefMap& uEdgeRef) {
+ Parent::build(graph, nodeRef, uEdgeRef);
+ notifier(Node()).build();
+ notifier(UEdge()).build();
+ notifier(Edge()).build();
+ }
+
+ void erase(const Node& node) {
+ Edge edge;
+ Parent::firstOut(edge, node);
+ while (edge != INVALID ) {
+ erase(edge);
+ Parent::firstOut(edge, node);
+ }
+
+ Parent::firstIn(edge, node);
+ while (edge != INVALID ) {
+ erase(edge);
+ Parent::firstIn(edge, node);
+ }
+
+ notifier(Node()).erase(node);
+ Parent::erase(node);
+ }
+
+ void erase(const UEdge& uedge) {
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).erase(ev);
+ notifier(UEdge()).erase(uedge);
+ Parent::erase(uedge);
+ }
+
+ UGraphExtender() {
+ node_notifier.setContainer(*this);
+ edge_notifier.setContainer(*this);
+ uedge_notifier.setContainer(*this);
+ }
+
+ ~UGraphExtender() {
+ uedge_notifier.clear();
+ edge_notifier.clear();
+ node_notifier.clear();
+ }
+
+ };
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for the BpUGraphs
+ template <typename Base>
+ class BpUGraphExtender : public Base {
+ public:
+
+ typedef Base Parent;
+ typedef BpUGraphExtender Graph;
+
+ typedef True UndirectedTag;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::ANode ANode;
+ typedef typename Parent::BNode BNode;
+ typedef typename Parent::Edge Edge;
+ typedef typename Parent::UEdge UEdge;
+
+
+ Node oppositeNode(const Node& node, const UEdge& edge) const {
+ return Parent::aNode(edge) == node ?
+ Parent::bNode(edge) : Parent::aNode(edge);
+ }
+
+ using Parent::direct;
+ Edge direct(const UEdge& edge, const Node& node) const {
+ return Parent::direct(edge, node == Parent::source(edge));
+ }
+
+ Edge oppositeEdge(const Edge& edge) const {
+ return direct(edge, !Parent::direction(edge));
+ }
+
+ int maxId(Node) const {
+ return Parent::maxNodeId();
+ }
+ int maxId(BNode) const {
+ return Parent::maxBNodeId();
+ }
+ int maxId(ANode) const {
+ return Parent::maxANodeId();
+ }
+ int maxId(Edge) const {
+ return Parent::maxEdgeId();
+ }
+ int maxId(UEdge) const {
+ return Parent::maxUEdgeId();
+ }
+
+
+ Node fromId(int id, Node) const {
+ return Parent::nodeFromId(id);
+ }
+ ANode fromId(int id, ANode) const {
+ return Parent::nodeFromANodeId(id);
+ }
+ BNode fromId(int id, BNode) const {
+ return Parent::nodeFromBNodeId(id);
+ }
+ Edge fromId(int id, Edge) const {
+ return Parent::edgeFromId(id);
+ }
+ UEdge fromId(int id, UEdge) const {
+ return Parent::uEdgeFromId(id);
+ }
+
+ typedef AlterationNotifier<BpUGraphExtender, ANode> ANodeNotifier;
+ typedef AlterationNotifier<BpUGraphExtender, BNode> BNodeNotifier;
+ typedef AlterationNotifier<BpUGraphExtender, Node> NodeNotifier;
+ typedef AlterationNotifier<BpUGraphExtender, Edge> EdgeNotifier;
+ typedef AlterationNotifier<BpUGraphExtender, UEdge> UEdgeNotifier;
+
+ protected:
+
+ mutable ANodeNotifier anode_notifier;
+ mutable BNodeNotifier bnode_notifier;
+ mutable NodeNotifier node_notifier;
+ mutable EdgeNotifier edge_notifier;
+ mutable UEdgeNotifier uedge_notifier;
+
+ public:
+
+ NodeNotifier& notifier(Node) const {
+ return node_notifier;
+ }
+
+ ANodeNotifier& notifier(ANode) const {
+ return anode_notifier;
+ }
+
+ BNodeNotifier& notifier(BNode) const {
+ return bnode_notifier;
+ }
+
+ EdgeNotifier& notifier(Edge) const {
+ return edge_notifier;
+ }
+
+ UEdgeNotifier& notifier(UEdge) const {
+ return uedge_notifier;
+ }
+
+ class NodeIt : public Node {
+ const Graph* graph;
+ public:
+
+ NodeIt() { }
+
+ NodeIt(Invalid i) : Node(INVALID) { }
+
+ explicit NodeIt(const Graph& _graph) : graph(&_graph) {
+ graph->first(static_cast<Node&>(*this));
+ }
+
+ NodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) { }
+
+ NodeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+ class ANodeIt : public Node {
+ friend class BpUGraphExtender;
+ const Graph* graph;
+ public:
+
+ ANodeIt() { }
+
+ ANodeIt(Invalid i) : Node(INVALID) { }
+
+ explicit ANodeIt(const Graph& _graph) : graph(&_graph) {
+ graph->firstANode(static_cast<Node&>(*this));
+ }
+
+ ANodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ ANodeIt& operator++() {
+ graph->nextANode(*this);
+ return *this;
+ }
+ };
+
+ class BNodeIt : public Node {
+ friend class BpUGraphExtender;
+ const Graph* graph;
+ public:
+
+ BNodeIt() { }
+
+ BNodeIt(Invalid i) : Node(INVALID) { }
+
+ explicit BNodeIt(const Graph& _graph) : graph(&_graph) {
+ graph->firstBNode(static_cast<Node&>(*this));
+ }
+
+ BNodeIt(const Graph& _graph, const Node& node)
+ : Node(node), graph(&_graph) {}
+
+ BNodeIt& operator++() {
+ graph->nextBNode(*this);
+ return *this;
+ }
+ };
+
+ class EdgeIt : public Edge {
+ friend class BpUGraphExtender;
+ const Graph* graph;
+ public:
+
+ EdgeIt() { }
+
+ EdgeIt(Invalid i) : Edge(INVALID) { }
+
+ explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
+ graph->first(static_cast<Edge&>(*this));
+ }
+
+ EdgeIt(const Graph& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) { }
+
+ EdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+
+ };
+
+ class UEdgeIt : public UEdge {
+ friend class BpUGraphExtender;
+ const Graph* graph;
+ public:
+
+ UEdgeIt() { }
+
+ UEdgeIt(Invalid i) : UEdge(INVALID) { }
+
+ explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
+ graph->first(static_cast<UEdge&>(*this));
+ }
+
+ UEdgeIt(const Graph& _graph, const UEdge& edge)
+ : UEdge(edge), graph(&_graph) { }
+
+ UEdgeIt& operator++() {
+ graph->next(*this);
+ return *this;
+ }
+ };
+
+ class OutEdgeIt : public Edge {
+ friend class BpUGraphExtender;
+ const Graph* graph;
+ public:
+
+ OutEdgeIt() { }
+
+ OutEdgeIt(Invalid i) : Edge(i) { }
+
+ OutEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ graph->firstOut(*this, node);
+ }
+
+ OutEdgeIt(const Graph& _graph, const Edge& edge)
+ : Edge(edge), graph(&_graph) {}
+
+ OutEdgeIt& operator++() {
+ graph->nextOut(*this);
+ return *this;
+ }
+
+ };
+
+
+ class InEdgeIt : public Edge {
+ friend class BpUGraphExtender;
+ const Graph* graph;
+ public:
+
+ InEdgeIt() { }
+
+ InEdgeIt(Invalid i) : Edge(i) { }
+
+ InEdgeIt(const Graph& _graph, const Node& node)
+ : graph(&_graph) {
+ graph->firstIn(*this, node);
+ }
+
+ InEdgeIt(const Graph& _graph, const Edge& edge) :
+ Edge(edge), graph(&_graph) {}
+
+ InEdgeIt& operator++() {
+ graph->nextIn(*this);
+ return *this;
+ }
+
+ };
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the source in this case) of the iterator
+ Node baseNode(const OutEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the target in this case) of the
+ /// iterator
+ Node runningNode(const OutEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (ie. the target in this case) of the iterator
+ Node baseNode(const InEdgeIt &e) const {
+ return Parent::target(static_cast<const Edge&>(e));
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (ie. the source in this case) of the
+ /// iterator
+ Node runningNode(const InEdgeIt &e) const {
+ return Parent::source(static_cast<const Edge&>(e));
+ }
+
+ class IncEdgeIt : public Parent::UEdge {
+ friend class BpUGraphExtender;
+ const Graph* graph;
+ bool direction;
+ public:
+
+ IncEdgeIt() { }
+
+ IncEdgeIt(Invalid i) : UEdge(i), direction(true) { }
+
+ IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
+ graph->firstInc(*this, direction, n);
+ }
+
+ IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n)
+ : graph(&_graph), UEdge(ue) {
+ direction = (graph->source(ue) == n);
+ }
+
+ IncEdgeIt& operator++() {
+ graph->nextInc(*this, direction);
+ return *this;
+ }
+ };
+
+
+ /// Base node of the iterator
+ ///
+ /// Returns the base node of the iterator
+ Node baseNode(const IncEdgeIt &e) const {
+ return e.direction ? source(e) : target(e);
+ }
+
+ /// Running node of the iterator
+ ///
+ /// Returns the running node of the iterator
+ Node runningNode(const IncEdgeIt &e) const {
+ return e.direction ? target(e) : source(e);
+ }
+
+ template <typename _Value>
+ class ANodeMap
+ : public MapExtender<DefaultMap<Graph, ANode, _Value> > {
+ public:
+ typedef BpUGraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, ANode, _Value> > Parent;
+
+ ANodeMap(const Graph& graph)
+ : Parent(graph) {}
+ ANodeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ ANodeMap& operator=(const ANodeMap& cmap) {
+ return operator=<ANodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ ANodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ template <typename _Value>
+ class BNodeMap
+ : public MapExtender<DefaultMap<Graph, BNode, _Value> > {
+ public:
+ typedef BpUGraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, BNode, _Value> > Parent;
+
+ BNodeMap(const Graph& graph)
+ : Parent(graph) {}
+ BNodeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ BNodeMap& operator=(const BNodeMap& cmap) {
+ return operator=<BNodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ BNodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ public:
+
+ template <typename _Value>
+ class NodeMap {
+ public:
+ typedef BpUGraphExtender Graph;
+
+ typedef Node Key;
+ typedef _Value Value;
+
+ /// The reference type of the map;
+ typedef typename ANodeMap<_Value>::Reference Reference;
+ /// The const reference type of the map;
+ typedef typename ANodeMap<_Value>::ConstReference ConstReference;
+
+ typedef True ReferenceMapTag;
+
+ NodeMap(const Graph& _graph)
+ : graph(_graph), aNodeMap(_graph), bNodeMap(_graph) {}
+ NodeMap(const Graph& _graph, const _Value& _value)
+ : graph(_graph), aNodeMap(_graph, _value), bNodeMap(_graph, _value) {}
+
+ NodeMap& operator=(const NodeMap& cmap) {
+ return operator=<NodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ NodeMap& operator=(const CMap& cmap) {
+ checkConcept<concepts::ReadMap<Node, _Value>, CMap>();
+ aNodeMap = cmap;
+ bNodeMap = cmap;
+ return *this;
+ }
+
+ ConstReference operator[](const Key& node) const {
+ if (Parent::aNode(node)) {
+ return aNodeMap[node];
+ } else {
+ return bNodeMap[node];
+ }
+ }
+
+ Reference operator[](const Key& node) {
+ if (Parent::aNode(node)) {
+ return aNodeMap[node];
+ } else {
+ return bNodeMap[node];
+ }
+ }
+
+ void set(const Key& node, const Value& value) {
+ if (Parent::aNode(node)) {
+ aNodeMap.set(node, value);
+ } else {
+ bNodeMap.set(node, value);
+ }
+ }
+
+ class MapIt : public NodeIt {
+ public:
+
+ typedef NodeIt Parent;
+
+ explicit MapIt(NodeMap& _map)
+ : Parent(_map.graph), map(_map) {}
+
+ typename MapTraits<NodeMap>::ConstReturnValue operator*() const {
+ return map[*this];
+ }
+
+ typename MapTraits<NodeMap>::ReturnValue operator*() {
+ return map[*this];
+ }
+
+ void set(const Value& value) {
+ map.set(*this, value);
+ }
+
+ private:
+ NodeMap& map;
+ };
+
+ class ConstMapIt : public NodeIt {
+ public:
+
+ typedef NodeIt Parent;
+
+ explicit ConstMapIt(const NodeMap& _map)
+ : Parent(_map.graph), map(_map) {}
+
+ typename MapTraits<NodeMap>::ConstReturnValue operator*() const {
+ return map[*this];
+ }
+
+ private:
+ const NodeMap& map;
+ };
+
+ class ItemIt : public NodeIt {
+ public:
+
+ typedef NodeIt Parent;
+
+ explicit ItemIt(const NodeMap& _map)
+ : Parent(_map.graph) {}
+
+ };
+
+ private:
+ const Graph& graph;
+ ANodeMap<_Value> aNodeMap;
+ BNodeMap<_Value> bNodeMap;
+ };
+
+
+ template <typename _Value>
+ class EdgeMap
+ : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
+ public:
+ typedef BpUGraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
+
+ EdgeMap(const Graph& graph)
+ : Parent(graph) {}
+ EdgeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+ template <typename _Value>
+ class UEdgeMap
+ : public MapExtender<DefaultMap<Graph, UEdge, _Value> > {
+ public:
+ typedef BpUGraphExtender Graph;
+ typedef MapExtender<DefaultMap<Graph, UEdge, _Value> > Parent;
+
+ UEdgeMap(const Graph& graph)
+ : Parent(graph) {}
+ UEdgeMap(const Graph& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ UEdgeMap& operator=(const UEdgeMap& cmap) {
+ return operator=<UEdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ UEdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+
+ Node addANode() {
+ Node node = Parent::addANode();
+ notifier(ANode()).add(node);
+ notifier(Node()).add(node);
+ return node;
+ }
+
+ Node addBNode() {
+ Node node = Parent::addBNode();
+ notifier(BNode()).add(node);
+ notifier(Node()).add(node);
+ return node;
+ }
+
+ UEdge addEdge(const Node& s, const Node& t) {
+ UEdge uedge = Parent::addEdge(s, t);
+ notifier(UEdge()).add(uedge);
+
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).add(ev);
+
+ return uedge;
+ }
+
+ void clear() {
+ notifier(Edge()).clear();
+ notifier(UEdge()).clear();
+ notifier(Node()).clear();
+ notifier(BNode()).clear();
+ notifier(ANode()).clear();
+ Parent::clear();
+ }
+
+ template <typename Graph, typename ANodeRefMap,
+ typename BNodeRefMap, typename UEdgeRefMap>
+ void build(const Graph& graph, ANodeRefMap& aNodeRef,
+ BNodeRefMap& bNodeRef, UEdgeRefMap& uEdgeRef) {
+ Parent::build(graph, aNodeRef, bNodeRef, uEdgeRef);
+ notifier(ANode()).build();
+ notifier(BNode()).build();
+ notifier(Node()).build();
+ notifier(UEdge()).build();
+ notifier(Edge()).build();
+ }
+
+ void erase(const Node& node) {
+ UEdge uedge;
+ if (Parent::aNode(node)) {
+ Parent::firstFromANode(uedge, node);
+ while (uedge != INVALID) {
+ erase(uedge);
+ Parent::firstFromANode(uedge, node);
+ }
+ notifier(ANode()).erase(node);
+ } else {
+ Parent::firstFromBNode(uedge, node);
+ while (uedge != INVALID) {
+ erase(uedge);
+ Parent::firstFromBNode(uedge, node);
+ }
+ notifier(BNode()).erase(node);
+ }
+
+ notifier(Node()).erase(node);
+ Parent::erase(node);
+ }
+
+ void erase(const UEdge& uedge) {
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).erase(ev);
+ notifier(UEdge()).erase(uedge);
+ Parent::erase(uedge);
+ }
+
+
+ BpUGraphExtender() {
+ anode_notifier.setContainer(*this);
+ bnode_notifier.setContainer(*this);
+ node_notifier.setContainer(*this);
+ edge_notifier.setContainer(*this);
+ uedge_notifier.setContainer(*this);
+ }
+
+ ~BpUGraphExtender() {
+ uedge_notifier.clear();
+ edge_notifier.clear();
+ node_notifier.clear();
+ anode_notifier.clear();
+ bnode_notifier.clear();
+ }
+
+ Edge findEdge(Node u, Node v, Edge prev = INVALID) const {
+ UEdge uedge = Parent::findUEdge(u, v, prev);
+ if (uedge != INVALID) {
+ return Parent::direct(uedge, Parent::aNode(u));
+ } else {
+ return INVALID;
+ }
+ }
+
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/invalid.h b/src/lemon/bits/invalid.h
new file mode 100644
index 0000000..164e5c3
--- /dev/null
+++ b/src/lemon/bits/invalid.h
@@ -0,0 +1,54 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_INVALID_H
+#define LEMON_BITS_INVALID_H
+
+///\file
+///\brief Definition of INVALID.
+
+namespace lemon {
+
+ /// \brief Dummy type to make it easier to make invalid iterators.
+ ///
+ /// See \ref INVALID for the usage.
+ struct Invalid {
+ public:
+ bool operator==(Invalid) { return true; }
+ bool operator!=(Invalid) { return false; }
+ bool operator< (Invalid) { return false; }
+ };
+
+ /// Invalid iterators.
+
+ /// \ref Invalid is a global type that converts to each iterator
+ /// in such a way that the value of the target iterator will be invalid.
+
+ //Some people didn't like this:
+ //const Invalid &INVALID = *(Invalid *)0;
+
+#ifdef LEMON_ONLY_TEMPLATES
+ const Invalid INVALID = Invalid();
+#else
+ extern const Invalid INVALID;
+#endif
+
+} //namespace lemon
+
+#endif
+
diff --git a/src/lemon/bits/map_extender.h b/src/lemon/bits/map_extender.h
new file mode 100644
index 0000000..68e8608
--- /dev/null
+++ b/src/lemon/bits/map_extender.h
@@ -0,0 +1,321 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_MAP_EXTENDER_H
+#define LEMON_BITS_MAP_EXTENDER_H
+
+#include <iterator>
+
+#include <lemon/bits/traits.h>
+
+#include <lemon/concept_check.h>
+#include <lemon/concepts/maps.h>
+
+///\file
+///\brief Extenders for iterable maps.
+
+namespace lemon {
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for maps
+ template <typename _Map>
+ class MapExtender : public _Map {
+ public:
+
+ typedef _Map Parent;
+ typedef MapExtender Map;
+
+
+ typedef typename Parent::Graph Graph;
+ typedef typename Parent::Key Item;
+
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ class MapIt;
+ class ConstMapIt;
+
+ friend class MapIt;
+ friend class ConstMapIt;
+
+ public:
+
+ MapExtender(const Graph& graph)
+ : Parent(graph) {}
+
+ MapExtender(const Graph& graph, const Value& value)
+ : Parent(graph, value) {}
+
+ MapExtender& operator=(const MapExtender& cmap) {
+ return operator=<MapExtender>(cmap);
+ }
+
+ template <typename CMap>
+ MapExtender& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ class MapIt : public Item {
+ public:
+
+ typedef Item Parent;
+ typedef typename Map::Value Value;
+
+ MapIt() {}
+
+ MapIt(Invalid i) : Parent(i) { }
+
+ explicit MapIt(Map& _map) : map(_map) {
+ map.notifier()->first(*this);
+ }
+
+ MapIt(const Map& _map, const Item& item)
+ : Parent(item), map(_map) {}
+
+ MapIt& operator++() {
+ map.notifier()->next(*this);
+ return *this;
+ }
+
+ typename MapTraits<Map>::ConstReturnValue operator*() const {
+ return map[*this];
+ }
+
+ typename MapTraits<Map>::ReturnValue operator*() {
+ return map[*this];
+ }
+
+ void set(const Value& value) {
+ map.set(*this, value);
+ }
+
+ protected:
+ Map& map;
+
+ };
+
+ class ConstMapIt : public Item {
+ public:
+
+ typedef Item Parent;
+
+ typedef typename Map::Value Value;
+
+ ConstMapIt() {}
+
+ ConstMapIt(Invalid i) : Parent(i) { }
+
+ explicit ConstMapIt(Map& _map) : map(_map) {
+ map.notifier()->first(*this);
+ }
+
+ ConstMapIt(const Map& _map, const Item& item)
+ : Parent(item), map(_map) {}
+
+ ConstMapIt& operator++() {
+ map.notifier()->next(*this);
+ return *this;
+ }
+
+ typename MapTraits<Map>::ConstReturnValue operator*() const {
+ return map[*this];
+ }
+
+ protected:
+ const Map& map;
+ };
+
+ class ItemIt : public Item {
+ public:
+
+ typedef Item Parent;
+
+ ItemIt() {}
+
+ ItemIt(Invalid i) : Parent(i) { }
+
+ explicit ItemIt(Map& _map) : map(_map) {
+ map.notifier()->first(*this);
+ }
+
+ ItemIt(const Map& _map, const Item& item)
+ : Parent(item), map(_map) {}
+
+ ItemIt& operator++() {
+ map.notifier()->next(*this);
+ return *this;
+ }
+
+ protected:
+ const Map& map;
+
+ };
+ };
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Extender for maps which use a subset of the items.
+ template <typename _Graph, typename _Map>
+ class SubMapExtender : public _Map {
+ public:
+
+ typedef _Map Parent;
+ typedef SubMapExtender Map;
+
+ typedef _Graph Graph;
+
+ typedef typename Parent::Key Item;
+
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ class MapIt;
+ class ConstMapIt;
+
+ friend class MapIt;
+ friend class ConstMapIt;
+
+ public:
+
+ SubMapExtender(const Graph& _graph)
+ : Parent(_graph), graph(_graph) {}
+
+ SubMapExtender(const Graph& _graph, const Value& _value)
+ : Parent(_graph, _value), graph(_graph) {}
+
+ SubMapExtender& operator=(const SubMapExtender& cmap) {
+ return operator=<MapExtender>(cmap);
+ }
+
+ template <typename CMap>
+ SubMapExtender& operator=(const CMap& cmap) {
+ checkConcept<concepts::ReadMap<Key, Value>, CMap>();
+ Item it;
+ for (graph.first(it); it != INVALID; graph.next(it)) {
+ Parent::set(it, cmap[it]);
+ }
+ return *this;
+ }
+
+ class MapIt : public Item {
+ public:
+
+ typedef Item Parent;
+ typedef typename Map::Value Value;
+
+ MapIt() {}
+
+ MapIt(Invalid i) : Parent(i) { }
+
+ explicit MapIt(Map& _map) : map(_map) {
+ map.graph.first(*this);
+ }
+
+ MapIt(const Map& _map, const Item& item)
+ : Parent(item), map(_map) {}
+
+ MapIt& operator++() {
+ map.graph.next(*this);
+ return *this;
+ }
+
+ typename MapTraits<Map>::ConstReturnValue operator*() const {
+ return map[*this];
+ }
+
+ typename MapTraits<Map>::ReturnValue operator*() {
+ return map[*this];
+ }
+
+ void set(const Value& value) {
+ map.set(*this, value);
+ }
+
+ protected:
+ Map& map;
+
+ };
+
+ class ConstMapIt : public Item {
+ public:
+
+ typedef Item Parent;
+
+ typedef typename Map::Value Value;
+
+ ConstMapIt() {}
+
+ ConstMapIt(Invalid i) : Parent(i) { }
+
+ explicit ConstMapIt(Map& _map) : map(_map) {
+ map.graph.first(*this);
+ }
+
+ ConstMapIt(const Map& _map, const Item& item)
+ : Parent(item), map(_map) {}
+
+ ConstMapIt& operator++() {
+ map.graph.next(*this);
+ return *this;
+ }
+
+ typename MapTraits<Map>::ConstReturnValue operator*() const {
+ return map[*this];
+ }
+
+ protected:
+ const Map& map;
+ };
+
+ class ItemIt : public Item {
+ public:
+
+ typedef Item Parent;
+
+ ItemIt() {}
+
+ ItemIt(Invalid i) : Parent(i) { }
+
+ explicit ItemIt(Map& _map) : map(_map) {
+ map.graph.first(*this);
+ }
+
+ ItemIt(const Map& _map, const Item& item)
+ : Parent(item), map(_map) {}
+
+ ItemIt& operator++() {
+ map.graph.next(*this);
+ return *this;
+ }
+
+ protected:
+ const Map& map;
+
+ };
+
+ private:
+
+ const Graph& graph;
+
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/path_dump.h b/src/lemon/bits/path_dump.h
new file mode 100644
index 0000000..ccef70c
--- /dev/null
+++ b/src/lemon/bits/path_dump.h
@@ -0,0 +1,174 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_PRED_MAP_PATH_H
+#define LEMON_BITS_PRED_MAP_PATH_H
+
+namespace lemon {
+
+ template <typename _Graph, typename _PredMap>
+ class PredMapPath {
+ public:
+ typedef True RevPathTag;
+
+ typedef _Graph Graph;
+ typedef typename Graph::Edge Edge;
+ typedef _PredMap PredMap;
+
+ PredMapPath(const Graph& _graph, const PredMap& _predMap,
+ typename Graph::Node _target)
+ : graph(_graph), predMap(_predMap), target(_target) {}
+
+ int length() const {
+ int len = 0;
+ typename Graph::Node node = target;
+ typename Graph::Edge edge;
+ while ((edge = predMap[node]) != INVALID) {
+ node = graph.source(edge);
+ ++len;
+ }
+ return len;
+ }
+
+ bool empty() const {
+ return predMap[target] != INVALID;
+ }
+
+ class RevEdgeIt {
+ public:
+ RevEdgeIt() {}
+ RevEdgeIt(Invalid) : path(0), current(INVALID) {}
+ RevEdgeIt(const PredMapPath& _path)
+ : path(&_path), current(_path.target) {
+ if (path->predMap[current] == INVALID) current = INVALID;
+ }
+
+ operator const typename Graph::Edge() const {
+ return path->predMap[current];
+ }
+
+ RevEdgeIt& operator++() {
+ current = path->graph.source(path->predMap[current]);
+ if (path->predMap[current] == INVALID) current = INVALID;
+ return *this;
+ }
+
+ bool operator==(const RevEdgeIt& e) const {
+ return current == e.current;
+ }
+
+ bool operator!=(const RevEdgeIt& e) const {
+ return current != e.current;
+ }
+
+ bool operator<(const RevEdgeIt& e) const {
+ return current < e.current;
+ }
+
+ private:
+ const PredMapPath* path;
+ typename Graph::Node current;
+ };
+
+ private:
+ const Graph& graph;
+ const PredMap& predMap;
+ typename Graph::Node target;
+ };
+
+
+ template <typename _Graph, typename _PredMatrixMap>
+ class PredMatrixMapPath {
+ public:
+ typedef True RevPathTag;
+
+ typedef _Graph Graph;
+ typedef typename Graph::Edge Edge;
+ typedef _PredMatrixMap PredMatrixMap;
+
+ PredMatrixMapPath(const Graph& _graph,
+ const PredMatrixMap& _predMatrixMap,
+ typename Graph::Node _source,
+ typename Graph::Node _target)
+ : graph(_graph), predMatrixMap(_predMatrixMap),
+ source(_source), target(_target) {}
+
+ int length() const {
+ int len = 0;
+ typename Graph::Node node = target;
+ typename Graph::Edge edge;
+ while ((edge = predMatrixMap(source, node)) != INVALID) {
+ node = graph.source(edge);
+ ++len;
+ }
+ return len;
+ }
+
+ bool empty() const {
+ return source != target;
+ }
+
+ class RevEdgeIt {
+ public:
+ RevEdgeIt() {}
+ RevEdgeIt(Invalid) : path(0), current(INVALID) {}
+ RevEdgeIt(const PredMatrixMapPath& _path)
+ : path(&_path), current(_path.target) {
+ if (path->predMatrixMap(path->source, current) == INVALID)
+ current = INVALID;
+ }
+
+ operator const typename Graph::Edge() const {
+ return path->predMatrixMap(path->source, current);
+ }
+
+ RevEdgeIt& operator++() {
+ current =
+ path->graph.source(path->predMatrixMap(path->source, current));
+ if (path->predMatrixMap(path->source, current) == INVALID)
+ current = INVALID;
+ return *this;
+ }
+
+ bool operator==(const RevEdgeIt& e) const {
+ return current == e.current;
+ }
+
+ bool operator!=(const RevEdgeIt& e) const {
+ return current != e.current;
+ }
+
+ bool operator<(const RevEdgeIt& e) const {
+ return current < e.current;
+ }
+
+ private:
+ const PredMatrixMapPath* path;
+ typename Graph::Node current;
+ };
+
+ private:
+ const Graph& graph;
+ const PredMatrixMap& predMatrixMap;
+ typename Graph::Node source;
+ typename Graph::Node target;
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/traits.h b/src/lemon/bits/traits.h
new file mode 100644
index 0000000..6eb5b75
--- /dev/null
+++ b/src/lemon/bits/traits.h
@@ -0,0 +1,346 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_TRAITS_H
+#define LEMON_BITS_TRAITS_H
+
+#include <lemon/bits/utility.h>
+
+///\file
+///\brief Traits for graphs and maps
+///
+
+namespace lemon {
+ template <typename _Graph, typename _Item>
+ class ItemSetTraits {};
+
+
+ template <typename Graph, typename Enable = void>
+ struct NodeNotifierIndicator {
+ typedef InvalidType Type;
+ };
+ template <typename Graph>
+ struct NodeNotifierIndicator<
+ Graph,
+ typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type
+ > {
+ typedef typename Graph::NodeNotifier Type;
+ };
+
+ template <typename _Graph>
+ class ItemSetTraits<_Graph, typename _Graph::Node> {
+ public:
+
+ typedef _Graph Graph;
+
+ typedef typename Graph::Node Item;
+ typedef typename Graph::NodeIt ItemIt;
+
+ typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier;
+
+ template <typename _Value>
+ class Map : public Graph::template NodeMap<_Value> {
+ public:
+ typedef typename Graph::template NodeMap<_Value> Parent;
+ typedef typename Graph::template NodeMap<_Value> Type;
+ typedef typename Parent::Value Value;
+
+ Map(const Graph& _graph) : Parent(_graph) {}
+ Map(const Graph& _graph, const Value& _value)
+ : Parent(_graph, _value) {}
+
+ };
+
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct EdgeNotifierIndicator {
+ typedef InvalidType Type;
+ };
+ template <typename Graph>
+ struct EdgeNotifierIndicator<
+ Graph,
+ typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type
+ > {
+ typedef typename Graph::EdgeNotifier Type;
+ };
+
+ template <typename _Graph>
+ class ItemSetTraits<_Graph, typename _Graph::Edge> {
+ public:
+
+ typedef _Graph Graph;
+
+ typedef typename Graph::Edge Item;
+ typedef typename Graph::EdgeIt ItemIt;
+
+ typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier;
+
+ template <typename _Value>
+ class Map : public Graph::template EdgeMap<_Value> {
+ public:
+ typedef typename Graph::template EdgeMap<_Value> Parent;
+ typedef typename Graph::template EdgeMap<_Value> Type;
+ typedef typename Parent::Value Value;
+
+ Map(const Graph& _graph) : Parent(_graph) {}
+ Map(const Graph& _graph, const Value& _value)
+ : Parent(_graph, _value) {}
+ };
+
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct UEdgeNotifierIndicator {
+ typedef InvalidType Type;
+ };
+ template <typename Graph>
+ struct UEdgeNotifierIndicator<
+ Graph,
+ typename enable_if<typename Graph::UEdgeNotifier::Notifier, void>::type
+ > {
+ typedef typename Graph::UEdgeNotifier Type;
+ };
+
+ template <typename _Graph>
+ class ItemSetTraits<_Graph, typename _Graph::UEdge> {
+ public:
+
+ typedef _Graph Graph;
+
+ typedef typename Graph::UEdge Item;
+ typedef typename Graph::UEdgeIt ItemIt;
+
+ typedef typename UEdgeNotifierIndicator<Graph>::Type ItemNotifier;
+
+ template <typename _Value>
+ class Map : public Graph::template UEdgeMap<_Value> {
+ public:
+ typedef typename Graph::template UEdgeMap<_Value> Parent;
+ typedef typename Graph::template UEdgeMap<_Value> Type;
+ typedef typename Parent::Value Value;
+
+ Map(const Graph& _graph) : Parent(_graph) {}
+ Map(const Graph& _graph, const Value& _value)
+ : Parent(_graph, _value) {}
+ };
+
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct ANodeNotifierIndicator {
+ typedef InvalidType Type;
+ };
+ template <typename Graph>
+ struct ANodeNotifierIndicator<
+ Graph,
+ typename enable_if<typename Graph::ANodeNotifier::Notifier, void>::type
+ > {
+ typedef typename Graph::ANodeNotifier Type;
+ };
+
+ template <typename _Graph>
+ class ItemSetTraits<_Graph, typename _Graph::ANode> {
+ public:
+
+ typedef _Graph Graph;
+
+ typedef typename Graph::ANode Item;
+ typedef typename Graph::ANodeIt ItemIt;
+
+ typedef typename ANodeNotifierIndicator<Graph>::Type ItemNotifier;
+
+ template <typename _Value>
+ class Map : public Graph::template ANodeMap<_Value> {
+ public:
+ typedef typename Graph::template ANodeMap<_Value> Parent;
+ typedef typename Graph::template ANodeMap<_Value> Type;
+ typedef typename Parent::Value Value;
+
+ Map(const Graph& _graph) : Parent(_graph) {}
+ Map(const Graph& _graph, const Value& _value)
+ : Parent(_graph, _value) {}
+ };
+
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct BNodeNotifierIndicator {
+ typedef InvalidType Type;
+ };
+ template <typename Graph>
+ struct BNodeNotifierIndicator<
+ Graph,
+ typename enable_if<typename Graph::BNodeNotifier::Notifier, void>::type
+ > {
+ typedef typename Graph::BNodeNotifier Type;
+ };
+
+ template <typename _Graph>
+ class ItemSetTraits<_Graph, typename _Graph::BNode> {
+ public:
+
+ typedef _Graph Graph;
+
+ typedef typename Graph::BNode Item;
+ typedef typename Graph::BNodeIt ItemIt;
+
+ typedef typename BNodeNotifierIndicator<Graph>::Type ItemNotifier;
+
+ template <typename _Value>
+ class Map : public Graph::template BNodeMap<_Value> {
+ public:
+ typedef typename Graph::template BNodeMap<_Value> Parent;
+ typedef typename Graph::template BNodeMap<_Value> Type;
+ typedef typename Parent::Value Value;
+
+ Map(const Graph& _graph) : Parent(_graph) {}
+ Map(const Graph& _graph, const Value& _value)
+ : Parent(_graph, _value) {}
+ };
+
+ };
+
+
+ template <typename Map, typename Enable = void>
+ struct MapTraits {
+ typedef False ReferenceMapTag;
+
+ typedef typename Map::Key Key;
+ typedef typename Map::Value Value;
+
+ typedef const Value ConstReturnValue;
+ typedef const Value ReturnValue;
+ };
+
+ template <typename Map>
+ struct MapTraits<
+ Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
+ {
+ typedef True ReferenceMapTag;
+
+ typedef typename Map::Key Key;
+ typedef typename Map::Value Value;
+
+ typedef typename Map::ConstReference ConstReturnValue;
+ typedef typename Map::Reference ReturnValue;
+
+ typedef typename Map::ConstReference ConstReference;
+ typedef typename Map::Reference Reference;
+ };
+
+ template <typename MatrixMap, typename Enable = void>
+ struct MatrixMapTraits {
+ typedef False ReferenceMapTag;
+
+ typedef typename MatrixMap::FirstKey FirstKey;
+ typedef typename MatrixMap::SecondKey SecondKey;
+ typedef typename MatrixMap::Value Value;
+
+ typedef const Value ConstReturnValue;
+ typedef const Value ReturnValue;
+ };
+
+ template <typename MatrixMap>
+ struct MatrixMapTraits<
+ MatrixMap, typename enable_if<typename MatrixMap::ReferenceMapTag,
+ void>::type >
+ {
+ typedef True ReferenceMapTag;
+
+ typedef typename MatrixMap::FirstKey FirstKey;
+ typedef typename MatrixMap::SecondKey SecondKey;
+ typedef typename MatrixMap::Value Value;
+
+ typedef typename MatrixMap::ConstReference ConstReturnValue;
+ typedef typename MatrixMap::Reference ReturnValue;
+
+ typedef typename MatrixMap::ConstReference ConstReference;
+ typedef typename MatrixMap::Reference Reference;
+ };
+
+ // Indicators for the tags
+
+ template <typename Graph, typename Enable = void>
+ struct NodeNumTagIndicator {
+ static const bool value = false;
+ };
+
+ template <typename Graph>
+ struct NodeNumTagIndicator<
+ Graph,
+ typename enable_if<typename Graph::NodeNumTag, void>::type
+ > {
+ static const bool value = true;
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct EdgeNumTagIndicator {
+ static const bool value = false;
+ };
+
+ template <typename Graph>
+ struct EdgeNumTagIndicator<
+ Graph,
+ typename enable_if<typename Graph::EdgeNumTag, void>::type
+ > {
+ static const bool value = true;
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct FindEdgeTagIndicator {
+ static const bool value = false;
+ };
+
+ template <typename Graph>
+ struct FindEdgeTagIndicator<
+ Graph,
+ typename enable_if<typename Graph::FindEdgeTag, void>::type
+ > {
+ static const bool value = true;
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct UndirectedTagIndicator {
+ static const bool value = false;
+ };
+
+ template <typename Graph>
+ struct UndirectedTagIndicator<
+ Graph,
+ typename enable_if<typename Graph::UndirectedTag, void>::type
+ > {
+ static const bool value = true;
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct BuildTagIndicator {
+ static const bool value = false;
+ };
+
+ template <typename Graph>
+ struct BuildTagIndicator<
+ Graph,
+ typename enable_if<typename Graph::BuildTag, void>::type
+ > {
+ static const bool value = true;
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bits/utility.h b/src/lemon/bits/utility.h
new file mode 100644
index 0000000..34fa159
--- /dev/null
+++ b/src/lemon/bits/utility.h
@@ -0,0 +1,140 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+// This file contains a modified version of the enable_if library from BOOST.
+// See the appropriate copyright notice below.
+
+// Boost enable_if library
+
+// Copyright 2003 � The Trustees of Indiana University.
+
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Authors: Jaakko J�rvi (jajarvi at osl.iu.edu)
+// Jeremiah Willcock (jewillco at osl.iu.edu)
+// Andrew Lumsdaine (lums at osl.iu.edu)
+
+
+#ifndef LEMON_BITS_UTILITY_H
+#define LEMON_BITS_UTILITY_H
+
+///\file
+///\brief Miscellaneous basic utilities
+///
+///\todo Please rethink the organisation of the basic files like this.
+///E.g. this file might be merged with invalid.h.
+
+
+namespace lemon
+{
+
+ /// Basic type for defining "tags". A "YES" condition for \c enable_if.
+
+ /// Basic type for defining "tags". A "YES" condition for \c enable_if.
+ ///
+ ///\sa False
+ ///
+ /// \todo This should go to a separate "basic_types.h" (or something)
+ /// file.
+ struct True {
+ ///\e
+ static const bool value = true;
+ };
+
+ /// Basic type for defining "tags". A "NO" condition for \c enable_if.
+
+ /// Basic type for defining "tags". A "NO" condition for \c enable_if.
+ ///
+ ///\sa True
+ struct False {
+ ///\e
+ static const bool value = false;
+ };
+
+
+ struct InvalidType {
+ };
+
+ template <typename T>
+ struct Wrap {
+ const T &value;
+ Wrap(const T &t) : value(t) {}
+ };
+
+ /**************** dummy class to avoid ambiguity ****************/
+
+ template<int T> struct dummy { dummy(int) {} };
+
+ /**************** enable_if from BOOST ****************/
+
+ template <typename Type, typename T = void>
+ struct exists {
+ typedef T type;
+ };
+
+
+ template <bool B, class T = void>
+ struct enable_if_c {
+ typedef T type;
+ };
+
+ template <class T>
+ struct enable_if_c<false, T> {};
+
+ template <class Cond, class T = void>
+ struct enable_if : public enable_if_c<Cond::value, T> {};
+
+ template <bool B, class T>
+ struct lazy_enable_if_c {
+ typedef typename T::type type;
+ };
+
+ template <class T>
+ struct lazy_enable_if_c<false, T> {};
+
+ template <class Cond, class T>
+ struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
+
+
+ template <bool B, class T = void>
+ struct disable_if_c {
+ typedef T type;
+ };
+
+ template <class T>
+ struct disable_if_c<true, T> {};
+
+ template <class Cond, class T = void>
+ struct disable_if : public disable_if_c<Cond::value, T> {};
+
+ template <bool B, class T>
+ struct lazy_disable_if_c {
+ typedef typename T::type type;
+ };
+
+ template <class T>
+ struct lazy_disable_if_c<true, T> {};
+
+ template <class Cond, class T>
+ struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
+
+} // namespace lemon
+
+#endif
diff --git a/src/lemon/bits/variant.h b/src/lemon/bits/variant.h
new file mode 100644
index 0000000..1f71484
--- /dev/null
+++ b/src/lemon/bits/variant.h
@@ -0,0 +1,508 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_VARIANT_H
+#define LEMON_BITS_VARIANT_H
+
+#include <lemon/error.h>
+
+/// \file
+/// \brief Variant types
+
+namespace lemon {
+
+ namespace _variant_bits {
+
+ template <int left, int right>
+ struct CTMax {
+ static const int value = left < right ? right : left;
+ };
+
+ }
+
+
+ /// \brief Simple Variant type for two types
+ ///
+ /// Simple Variant type for two types. The Variant type is a type
+ /// safe union. The C++ has strong limitations for using unions, by
+ /// example we can not store type with non default constructor or
+ /// destructor in an union. This class always knowns the current
+ /// state of the variant and it cares for the proper construction
+ /// and destruction.
+ template <typename _First, typename _Second>
+ class BiVariant {
+ public:
+
+ /// \brief The \c First type.
+ typedef _First First;
+ /// \brief The \c Second type.
+ typedef _Second Second;
+
+ struct WrongStateError : public lemon::LogicError {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::BiVariant::WrongStateError";
+ }
+ };
+
+ /// \brief Constructor
+ ///
+ /// This constructor initalizes to the default value of the \c First
+ /// type.
+ BiVariant() {
+ flag = true;
+ new(reinterpret_cast<First*>(data)) First();
+ }
+
+ /// \brief Constructor
+ ///
+ /// This constructor initalizes to the given value of the \c First
+ /// type.
+ BiVariant(const First& f) {
+ flag = true;
+ new(reinterpret_cast<First*>(data)) First(f);
+ }
+
+ /// \brief Constructor
+ ///
+ /// This constructor initalizes to the given value of the \c
+ /// Second type.
+ BiVariant(const Second& s) {
+ flag = false;
+ new(reinterpret_cast<Second*>(data)) Second(s);
+ }
+
+ /// \brief Copy constructor
+ ///
+ /// Copy constructor
+ BiVariant(const BiVariant& bivariant) {
+ flag = bivariant.flag;
+ if (flag) {
+ new(reinterpret_cast<First*>(data)) First(bivariant.first());
+ } else {
+ new(reinterpret_cast<Second*>(data)) Second(bivariant.second());
+ }
+ }
+
+ /// \brief Destrcutor
+ ///
+ /// Destructor
+ ~BiVariant() {
+ destroy();
+ }
+
+ /// \brief Set to the default value of the \c First type.
+ ///
+ /// This function sets the variant to the default value of the \c
+ /// First type.
+ BiVariant& setFirst() {
+ destroy();
+ flag = true;
+ new(reinterpret_cast<First*>(data)) First();
+ return *this;
+ }
+
+ /// \brief Set to the given value of the \c First type.
+ ///
+ /// This function sets the variant to the given value of the \c
+ /// First type.
+ BiVariant& setFirst(const First& f) {
+ destroy();
+ flag = true;
+ new(reinterpret_cast<First*>(data)) First(f);
+ return *this;
+ }
+
+ /// \brief Set to the default value of the \c Second type.
+ ///
+ /// This function sets the variant to the default value of the \c
+ /// Second type.
+ BiVariant& setSecond() {
+ destroy();
+ flag = false;
+ new(reinterpret_cast<Second*>(data)) Second();
+ return *this;
+ }
+
+ /// \brief Set to the given value of the \c Second type.
+ ///
+ /// This function sets the variant to the given value of the \c
+ /// Second type.
+ BiVariant& setSecond(const Second& s) {
+ destroy();
+ flag = false;
+ new(reinterpret_cast<Second*>(data)) Second(s);
+ return *this;
+ }
+
+ /// \brief Operator form of the \c setFirst()
+ BiVariant& operator=(const First& f) {
+ return setFirst(f);
+ }
+
+ /// \brief Operator form of the \c setSecond()
+ BiVariant& operator=(const Second& s) {
+ return setSecond(s);
+ }
+
+ /// \brief Assign operator
+ BiVariant& operator=(const BiVariant& bivariant) {
+ if (this == &bivariant) return *this;
+ destroy();
+ flag = bivariant.flag;
+ if (flag) {
+ new(reinterpret_cast<First*>(data)) First(bivariant.first());
+ } else {
+ new(reinterpret_cast<Second*>(data)) Second(bivariant.second());
+ }
+ return *this;
+ }
+
+ /// \brief Reference to the value
+ ///
+ /// Reference to the value of the \c First type.
+ /// \pre The BiVariant should store value of \c First type.
+ First& first() {
+ LEMON_ASSERT(flag, WrongStateError());
+ return *reinterpret_cast<First*>(data);
+ }
+
+ /// \brief Const reference to the value
+ ///
+ /// Const reference to the value of the \c First type.
+ /// \pre The BiVariant should store value of \c First type.
+ const First& first() const {
+ LEMON_ASSERT(flag, WrongStateError());
+ return *reinterpret_cast<const First*>(data);
+ }
+
+ /// \brief Operator form of the \c first()
+ operator First&() { return first(); }
+ /// \brief Operator form of the const \c first()
+ operator const First&() const { return first(); }
+
+ /// \brief Reference to the value
+ ///
+ /// Reference to the value of the \c Second type.
+ /// \pre The BiVariant should store value of \c Second type.
+ Second& second() {
+ LEMON_ASSERT(!flag, WrongStateError());
+ return *reinterpret_cast<Second*>(data);
+ }
+
+ /// \brief Const reference to the value
+ ///
+ /// Const reference to the value of the \c Second type.
+ /// \pre The BiVariant should store value of \c Second type.
+ const Second& second() const {
+ LEMON_ASSERT(!flag, WrongStateError());
+ return *reinterpret_cast<const Second*>(data);
+ }
+
+ /// \brief Operator form of the \c second()
+ operator Second&() { return second(); }
+ /// \brief Operator form of the const \c second()
+ operator const Second&() const { return second(); }
+
+ /// \brief %True when the variant is in the first state
+ ///
+ /// %True when the variant stores value of the \c First type.
+ bool firstState() const { return flag; }
+
+ /// \brief %True when the variant is in the second state
+ ///
+ /// %True when the variant stores value of the \c Second type.
+ bool secondState() const { return !flag; }
+
+ private:
+
+ void destroy() {
+ if (flag) {
+ reinterpret_cast<First*>(data)->~First();
+ } else {
+ reinterpret_cast<Second*>(data)->~Second();
+ }
+ }
+
+ char data[_variant_bits::CTMax<sizeof(First), sizeof(Second)>::value];
+ bool flag;
+ };
+
+ namespace _variant_bits {
+
+ template <int _idx, typename _TypeMap>
+ struct Memory {
+
+ typedef typename _TypeMap::template Map<_idx>::Type Current;
+
+ static void destroy(int index, char* place) {
+ if (index == _idx) {
+ reinterpret_cast<Current*>(place)->~Current();
+ } else {
+ Memory<_idx - 1, _TypeMap>::destroy(index, place);
+ }
+ }
+
+ static void copy(int index, char* to, const char* from) {
+ if (index == _idx) {
+ new (reinterpret_cast<Current*>(to))
+ Current(reinterpret_cast<const Current*>(from));
+ } else {
+ Memory<_idx - 1, _TypeMap>::copy(index, to, from);
+ }
+ }
+
+ };
+
+ template <typename _TypeMap>
+ struct Memory<-1, _TypeMap> {
+
+ static void destroy(int, char*) {
+ LEMON_ASSERT(false, "Wrong Variant Index.");
+ }
+
+ static void copy(int, char*, const char*) {
+ LEMON_ASSERT(false, "Wrong Variant Index.");
+ }
+ };
+
+ template <int _idx, typename _TypeMap>
+ struct Size {
+ static const int value =
+ CTMax<sizeof(typename _TypeMap::template Map<_idx>::Type),
+ Size<_idx - 1, _TypeMap>::value>::value;
+ };
+
+ template <typename _TypeMap>
+ struct Size<0, _TypeMap> {
+ static const int value =
+ sizeof(typename _TypeMap::template Map<0>::Type);
+ };
+
+ }
+
+ /// \brief Variant type
+ ///
+ /// Simple Variant type. The Variant type is a type safe union. The
+ /// C++ has strong limitations for using unions, by example we
+ /// cannot store type with non default constructor or destructor in
+ /// a union. This class always knowns the current state of the
+ /// variant and it cares for the proper construction and
+ /// destruction.
+ ///
+ /// \param _num The number of the types which can be stored in the
+ /// variant type.
+ /// \param _TypeMap This class describes the types of the Variant. The
+ /// _TypeMap::Map<index>::Type should be a valid type for each index
+ /// in the range {0, 1, ..., _num - 1}. The \c VariantTypeMap is helper
+ /// class to define such type mappings up to 10 types.
+ ///
+ /// And the usage of the class:
+ ///\code
+ /// typedef Variant<3, VariantTypeMap<int, std::string, double> > MyVariant;
+ /// MyVariant var;
+ /// var.set<0>(12);
+ /// std::cout << var.get<0>() << std::endl;
+ /// var.set<1>("alpha");
+ /// std::cout << var.get<1>() << std::endl;
+ /// var.set<2>(0.75);
+ /// std::cout << var.get<2>() << std::endl;
+ ///\endcode
+ ///
+ /// The result of course:
+ ///\code
+ /// 12
+ /// alpha
+ /// 0.75
+ ///\endcode
+ template <int _num, typename _TypeMap>
+ class Variant {
+ public:
+
+ static const int num = _num;
+
+ typedef _TypeMap TypeMap;
+
+ struct WrongStateError : public lemon::LogicError {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::Variant::WrongStateError";
+ }
+ };
+
+ /// \brief Constructor
+ ///
+ /// This constructor initalizes to the default value of the \c type
+ /// with 0 index.
+ Variant() {
+ flag = 0;
+ new(reinterpret_cast<typename TypeMap::template Map<0>::Type*>(data))
+ typename TypeMap::template Map<0>::Type();
+ }
+
+
+ /// \brief Copy constructor
+ ///
+ /// Copy constructor
+ Variant(const Variant& variant) {
+ flag = variant.flag;
+ _variant_bits::Memory<num - 1, TypeMap>::copy(flag, data, variant.data);
+ }
+
+ /// \brief Assign operator
+ ///
+ /// Assign operator
+ Variant& operator=(const Variant& variant) {
+ if (this == &variant) return *this;
+ _variant_bits::Memory<num - 1, TypeMap>::
+ destroy(flag, data);
+ flag = variant.flag;
+ _variant_bits::Memory<num - 1, TypeMap>::
+ copy(flag, data, variant.data);
+ return *this;
+ }
+
+ /// \brief Destrcutor
+ ///
+ /// Destructor
+ ~Variant() {
+ _variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
+ }
+
+ /// \brief Set to the default value of the type with \c _idx index.
+ ///
+ /// This function sets the variant to the default value of the
+ /// type with \c _idx index.
+ template <int _idx>
+ Variant& set() {
+ _variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
+ flag = _idx;
+ new(reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>(data))
+ typename TypeMap::template Map<_idx>::Type();
+ return *this;
+ }
+
+ /// \brief Set to the given value of the type with \c _idx index.
+ ///
+ /// This function sets the variant to the given value of the type
+ /// with \c _idx index.
+ template <int _idx>
+ Variant& set(const typename _TypeMap::template Map<_idx>::Type& init) {
+ _variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
+ flag = _idx;
+ new(reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>(data))
+ typename TypeMap::template Map<_idx>::Type(init);
+ return *this;
+ }
+
+ /// \brief Gets the current value of the type with \c _idx index.
+ ///
+ /// Gets the current value of the type with \c _idx index.
+ template <int _idx>
+ const typename TypeMap::template Map<_idx>::Type& get() const {
+ LEMON_ASSERT(_idx == flag, "Wrong Variant Index.");
+ return *reinterpret_cast<const typename TypeMap::
+ template Map<_idx>::Type*>(data);
+ }
+
+ /// \brief Gets the current value of the type with \c _idx index.
+ ///
+ /// Gets the current value of the type with \c _idx index.
+ template <int _idx>
+ typename _TypeMap::template Map<_idx>::Type& get() {
+ LEMON_ASSERT(_idx == flag, "Wrong Variant Index.");
+ return *reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>
+ (data);
+ }
+
+ /// \brief Returns the current state of the variant.
+ ///
+ /// Returns the current state of the variant.
+ int state() const {
+ return flag;
+ }
+
+ private:
+
+ char data[_variant_bits::Size<num - 1, TypeMap>::value];
+ int flag;
+ };
+
+ namespace _variant_bits {
+
+ template <int _index, typename _List>
+ struct Get {
+ typedef typename Get<_index - 1, typename _List::Next>::Type Type;
+ };
+
+ template <typename _List>
+ struct Get<0, _List> {
+ typedef typename _List::Type Type;
+ };
+
+ struct List {};
+
+ template <typename _Type, typename _List>
+ struct Insert {
+ typedef _List Next;
+ typedef _Type Type;
+ };
+
+ template <int _idx, typename _T0, typename _T1, typename _T2,
+ typename _T3, typename _T5, typename _T4, typename _T6,
+ typename _T7, typename _T8, typename _T9>
+ struct Mapper {
+ typedef List L10;
+ typedef Insert<_T9, L10> L9;
+ typedef Insert<_T8, L9> L8;
+ typedef Insert<_T7, L8> L7;
+ typedef Insert<_T6, L7> L6;
+ typedef Insert<_T5, L6> L5;
+ typedef Insert<_T4, L5> L4;
+ typedef Insert<_T3, L4> L3;
+ typedef Insert<_T2, L3> L2;
+ typedef Insert<_T1, L2> L1;
+ typedef Insert<_T0, L1> L0;
+ typedef typename Get<_idx, L0>::Type Type;
+ };
+
+ }
+
+ /// \brief Helper class for Variant
+ ///
+ /// Helper class to define type mappings for Variant. This class
+ /// converts the template parameters to be mappable by integer.
+ /// \see Variant
+ template <
+ typename _T0,
+ typename _T1 = void, typename _T2 = void, typename _T3 = void,
+ typename _T5 = void, typename _T4 = void, typename _T6 = void,
+ typename _T7 = void, typename _T8 = void, typename _T9 = void>
+ struct VariantTypeMap {
+ template <int _idx>
+ struct Map {
+ typedef typename _variant_bits::
+ Mapper<_idx, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9>::Type
+ Type;
+ };
+ };
+
+}
+
+
+#endif
diff --git a/src/lemon/bits/vector_map.h b/src/lemon/bits/vector_map.h
new file mode 100644
index 0000000..9299671
--- /dev/null
+++ b/src/lemon/bits/vector_map.h
@@ -0,0 +1,243 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_VECTOR_MAP_H
+#define LEMON_BITS_VECTOR_MAP_H
+
+#include <vector>
+#include <algorithm>
+
+#include <lemon/bits/traits.h>
+#include <lemon/bits/utility.h>
+
+#include <lemon/bits/alteration_notifier.h>
+
+#include <lemon/concept_check.h>
+#include <lemon/concepts/maps.h>
+
+///\ingroup graphbits
+///
+///\file
+///\brief Vector based graph maps.
+namespace lemon {
+
+ /// \ingroup graphbits
+ ///
+ /// \brief Graph map based on the std::vector storage.
+ ///
+ /// The VectorMap template class is graph map structure what
+ /// automatically updates the map when a key is added to or erased from
+ /// the map. This map type uses the std::vector to store the values.
+ ///
+ /// \param Notifier The AlterationNotifier that will notify this map.
+ /// \param Item The item type of the graph items.
+ /// \param Value The value type of the map.
+ ///
+ /// \author Balazs Dezso
+ template <typename _Graph, typename _Item, typename _Value>
+ class VectorMap
+ : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
+ private:
+
+ /// The container type of the map.
+ typedef std::vector<_Value> Container;
+
+ public:
+
+ /// The graph type of the map.
+ typedef _Graph Graph;
+ /// The item type of the map.
+ typedef _Item Item;
+ /// The reference map tag.
+ typedef True ReferenceMapTag;
+
+ /// The key type of the map.
+ typedef _Item Key;
+ /// The value type of the map.
+ typedef _Value Value;
+
+ /// The notifier type.
+ typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
+
+ /// The map type.
+ typedef VectorMap Map;
+ /// The base class of the map.
+ typedef typename Notifier::ObserverBase Parent;
+
+ /// The reference type of the map;
+ typedef typename Container::reference Reference;
+ /// The const reference type of the map;
+ typedef typename Container::const_reference ConstReference;
+
+
+ /// \brief Constructor to attach the new map into the notifier.
+ ///
+ /// It constructs a map and attachs it into the notifier.
+ /// It adds all the items of the graph to the map.
+ VectorMap(const Graph& graph) {
+ Parent::attach(graph.notifier(Item()));
+ container.resize(Parent::notifier()->maxId() + 1);
+ }
+
+ /// \brief Constructor uses given value to initialize the map.
+ ///
+ /// It constructs a map uses a given value to initialize the map.
+ /// It adds all the items of the graph to the map.
+ VectorMap(const Graph& graph, const Value& value) {
+ Parent::attach(graph.notifier(Item()));
+ container.resize(Parent::notifier()->maxId() + 1, value);
+ }
+
+ /// \brief Copy constructor
+ ///
+ /// Copy constructor.
+ VectorMap(const VectorMap& _copy) : Parent() {
+ if (_copy.attached()) {
+ Parent::attach(*_copy.notifier());
+ container = _copy.container;
+ }
+ }
+
+ /// \brief Assign operator.
+ ///
+ /// This operator assigns for each item in the map the
+ /// value mapped to the same item in the copied map.
+ /// The parameter map should be indiced with the same
+ /// itemset because this assign operator does not change
+ /// the container of the map.
+ VectorMap& operator=(const VectorMap& cmap) {
+ return operator=<VectorMap>(cmap);
+ }
+
+
+ /// \brief Template assign operator.
+ ///
+ /// The given parameter should be conform to the ReadMap
+ /// concecpt and could be indiced by the current item set of
+ /// the NodeMap. In this case the value for each item
+ /// is assigned by the value of the given ReadMap.
+ template <typename CMap>
+ VectorMap& operator=(const CMap& cmap) {
+ checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
+ const typename Parent::Notifier* nf = Parent::notifier();
+ Item it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ set(it, cmap[it]);
+ }
+ return *this;
+ }
+
+ public:
+
+ /// \brief The subcript operator.
+ ///
+ /// The subscript operator. The map can be subscripted by the
+ /// actual items of the graph.
+ Reference operator[](const Key& key) {
+ return container[Parent::notifier()->id(key)];
+ }
+
+ /// \brief The const subcript operator.
+ ///
+ /// The const subscript operator. The map can be subscripted by the
+ /// actual items of the graph.
+ ConstReference operator[](const Key& key) const {
+ return container[Parent::notifier()->id(key)];
+ }
+
+
+ /// \brief The setter function of the map.
+ ///
+ /// It the same as operator[](key) = value expression.
+ void set(const Key& key, const Value& value) {
+ (*this)[key] = value;
+ }
+
+ protected:
+
+ /// \brief Adds a new key to the map.
+ ///
+ /// It adds a new key to the map. It called by the observer notifier
+ /// and it overrides the add() member function of the observer base.
+ virtual void add(const Key& key) {
+ int id = Parent::notifier()->id(key);
+ if (id >= int(container.size())) {
+ container.resize(id + 1);
+ }
+ }
+
+ /// \brief Adds more new keys to the map.
+ ///
+ /// It adds more new keys to the map. It called by the observer notifier
+ /// and it overrides the add() member function of the observer base.
+ virtual void add(const std::vector<Key>& keys) {
+ int max = container.size() - 1;
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int id = Parent::notifier()->id(keys[i]);
+ if (id >= max) {
+ max = id;
+ }
+ }
+ container.resize(max + 1);
+ }
+
+ /// \brief Erase a key from the map.
+ ///
+ /// Erase a key from the map. It called by the observer notifier
+ /// and it overrides the erase() member function of the observer base.
+ virtual void erase(const Key& key) {
+ container[Parent::notifier()->id(key)] = Value();
+ }
+
+ /// \brief Erase more keys from the map.
+ ///
+ /// Erase more keys from the map. It called by the observer notifier
+ /// and it overrides the erase() member function of the observer base.
+ virtual void erase(const std::vector<Key>& keys) {
+ for (int i = 0; i < int(keys.size()); ++i) {
+ container[Parent::notifier()->id(keys[i])] = Value();
+ }
+ }
+
+ /// \brief Buildes the map.
+ ///
+ /// It buildes the map. It called by the observer notifier
+ /// and it overrides the build() member function of the observer base.
+ virtual void build() {
+ int size = Parent::notifier()->maxId() + 1;
+ container.reserve(size);
+ container.resize(size);
+ }
+
+ /// \brief Clear the map.
+ ///
+ /// It erase all items from the map. It called by the observer notifier
+ /// and it overrides the clear() member function of the observer base.
+ virtual void clear() {
+ container.clear();
+ }
+
+ private:
+
+ Container container;
+
+ };
+
+}
+
+#endif
diff --git a/src/lemon/bucket_heap.h b/src/lemon/bucket_heap.h
new file mode 100644
index 0000000..f8b57e1
--- /dev/null
+++ b/src/lemon/bucket_heap.h
@@ -0,0 +1,831 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BUCKET_HEAP_H
+#define LEMON_BUCKET_HEAP_H
+
+///\ingroup auxdat
+///\file
+///\brief Bucket Heap implementation.
+
+#include <vector>
+#include <utility>
+#include <functional>
+
+namespace lemon {
+
+ /// \ingroup auxdat
+ ///
+ /// \brief A Bucket Heap implementation.
+ ///
+ /// This class implements the \e bucket \e heap data structure. A \e heap
+ /// is a data structure for storing items with specified values called \e
+ /// priorities in such a way that finding the item with minimum priority is
+ /// efficient. The bucket heap is very simple implementation, it can store
+ /// only integer priorities and it stores for each priority in the
+ /// \f$ [0..C) \f$ range a list of items. So it should be used only when
+ /// the priorities are small. It is not intended to use as dijkstra heap.
+ ///
+ /// \param _ItemIntMap A read and writable Item int map, used internally
+ /// to handle the cross references.
+ /// \param minimize If the given parameter is true then the heap gives back
+ /// the lowest priority.
+ template <typename _ItemIntMap, bool minimize = true >
+ class BucketHeap {
+
+ public:
+ /// \e
+ typedef typename _ItemIntMap::Key Item;
+ /// \e
+ typedef int Prio;
+ /// \e
+ typedef std::pair<Item, Prio> Pair;
+ /// \e
+ typedef _ItemIntMap ItemIntMap;
+
+ /// \brief Type to represent the items states.
+ ///
+ /// Each Item element have a state associated to it. It may be "in heap",
+ /// "pre heap" or "post heap". The latter two are indifferent from the
+ /// heap's point of view, but may be useful to the user.
+ ///
+ /// The ItemIntMap \e should be initialized in such way that it maps
+ /// PRE_HEAP (-1) to any element to be put in the heap...
+ enum State {
+ IN_HEAP = 0,
+ PRE_HEAP = -1,
+ POST_HEAP = -2
+ };
+
+ public:
+ /// \brief The constructor.
+ ///
+ /// The constructor.
+ /// \param _index should be given to the constructor, since it is used
+ /// internally to handle the cross references. The value of the map
+ /// should be PRE_HEAP (-1) for each element.
+ explicit BucketHeap(ItemIntMap &_index) : index(_index), minimal(0) {}
+
+ /// The number of items stored in the heap.
+ ///
+ /// \brief Returns the number of items stored in the heap.
+ int size() const { return data.size(); }
+
+ /// \brief Checks if the heap stores no items.
+ ///
+ /// Returns \c true if and only if the heap stores no items.
+ bool empty() const { return data.empty(); }
+
+ /// \brief Make empty this heap.
+ ///
+ /// Make empty this heap. It does not change the cross reference
+ /// map. If you want to reuse a heap what is not surely empty you
+ /// should first clear the heap and after that you should set the
+ /// cross reference map for each item to \c PRE_HEAP.
+ void clear() {
+ data.clear(); first.clear(); minimal = 0;
+ }
+
+ private:
+
+ void relocate_last(int idx) {
+ if (idx + 1 < int(data.size())) {
+ data[idx] = data.back();
+ if (data[idx].prev != -1) {
+ data[data[idx].prev].next = idx;
+ } else {
+ first[data[idx].value] = idx;
+ }
+ if (data[idx].next != -1) {
+ data[data[idx].next].prev = idx;
+ }
+ index[data[idx].item] = idx;
+ }
+ data.pop_back();
+ }
+
+ void unlace(int idx) {
+ if (data[idx].prev != -1) {
+ data[data[idx].prev].next = data[idx].next;
+ } else {
+ first[data[idx].value] = data[idx].next;
+ }
+ if (data[idx].next != -1) {
+ data[data[idx].next].prev = data[idx].prev;
+ }
+ }
+
+ void lace(int idx) {
+ if (int(first.size()) <= data[idx].value) {
+ first.resize(data[idx].value + 1, -1);
+ }
+ data[idx].next = first[data[idx].value];
+ if (data[idx].next != -1) {
+ data[data[idx].next].prev = idx;
+ }
+ first[data[idx].value] = idx;
+ data[idx].prev = -1;
+ }
+
+ public:
+ /// \brief Insert a pair of item and priority into the heap.
+ ///
+ /// Adds \c p.first to the heap with priority \c p.second.
+ /// \param p The pair to insert.
+ void push(const Pair& p) {
+ push(p.first, p.second);
+ }
+
+ /// \brief Insert an item into the heap with the given priority.
+ ///
+ /// Adds \c i to the heap with priority \c p.
+ /// \param i The item to insert.
+ /// \param p The priority of the item.
+ void push(const Item &i, const Prio &p) {
+ int idx = data.size();
+ index[i] = idx;
+ data.push_back(BucketItem(i, p));
+ lace(idx);
+ if (p < minimal) {
+ minimal = p;
+ }
+ }
+
+ /// \brief Returns the item with minimum priority.
+ ///
+ /// This method returns the item with minimum priority.
+ /// \pre The heap must be nonempty.
+ Item top() const {
+ while (first[minimal] == -1) {
+ ++minimal;
+ }
+ return data[first[minimal]].item;
+ }
+
+ /// \brief Returns the minimum priority.
+ ///
+ /// It returns the minimum priority.
+ /// \pre The heap must be nonempty.
+ Prio prio() const {
+ while (first[minimal] == -1) {
+ ++minimal;
+ }
+ return minimal;
+ }
+
+ /// \brief Deletes the item with minimum priority.
+ ///
+ /// This method deletes the item with minimum priority from the heap.
+ /// \pre The heap must be non-empty.
+ void pop() {
+ while (first[minimal] == -1) {
+ ++minimal;
+ }
+ int idx = first[minimal];
+ index[data[idx].item] = -2;
+ unlace(idx);
+ relocate_last(idx);
+ }
+
+ /// \brief Deletes \c i from the heap.
+ ///
+ /// This method deletes item \c i from the heap, if \c i was
+ /// already stored in the heap.
+ /// \param i The item to erase.
+ void erase(const Item &i) {
+ int idx = index[i];
+ index[data[idx].item] = -2;
+ unlace(idx);
+ relocate_last(idx);
+ }
+
+
+ /// \brief Returns the priority of \c i.
+ ///
+ /// This function returns the priority of item \c i.
+ /// \pre \c i must be in the heap.
+ /// \param i The item.
+ Prio operator[](const Item &i) const {
+ int idx = index[i];
+ return data[idx].value;
+ }
+
+ /// \brief \c i gets to the heap with priority \c p independently
+ /// if \c i was already there.
+ ///
+ /// This method calls \ref push(\c i, \c p) if \c i is not stored
+ /// in the heap and sets the priority of \c i to \c p otherwise.
+ /// \param i The item.
+ /// \param p The priority.
+ void set(const Item &i, const Prio &p) {
+ int idx = index[i];
+ if (idx < 0) {
+ push(i,p);
+ } else if (p > data[idx].value) {
+ increase(i, p);
+ } else {
+ decrease(i, p);
+ }
+ }
+
+ /// \brief Decreases the priority of \c i to \c p.
+ ///
+ /// This method decreases the priority of item \c i to \c p.
+ /// \pre \c i must be stored in the heap with priority at least \c
+ /// p relative to \c Compare.
+ /// \param i The item.
+ /// \param p The priority.
+ void decrease(const Item &i, const Prio &p) {
+ int idx = index[i];
+ unlace(idx);
+ data[idx].value = p;
+ if (p < minimal) {
+ minimal = p;
+ }
+ lace(idx);
+ }
+
+ /// \brief Increases the priority of \c i to \c p.
+ ///
+ /// This method sets the priority of item \c i to \c p.
+ /// \pre \c i must be stored in the heap with priority at most \c
+ /// p relative to \c Compare.
+ /// \param i The item.
+ /// \param p The priority.
+ void increase(const Item &i, const Prio &p) {
+ int idx = index[i];
+ unlace(idx);
+ data[idx].value = p;
+ lace(idx);
+ }
+
+ /// \brief Returns if \c item is in, has already been in, or has
+ /// never been in the heap.
+ ///
+ /// This method returns PRE_HEAP if \c item has never been in the
+ /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
+ /// otherwise. In the latter case it is possible that \c item will
+ /// get back to the heap again.
+ /// \param i The item.
+ State state(const Item &i) const {
+ int idx = index[i];
+ if (idx >= 0) idx = 0;
+ return State(idx);
+ }
+
+ /// \brief Sets the state of the \c item in the heap.
+ ///
+ /// Sets the state of the \c item in the heap. It can be used to
+ /// manually clear the heap when it is important to achive the
+ /// better time complexity.
+ /// \param i The item.
+ /// \param st The state. It should not be \c IN_HEAP.
+ void state(const Item& i, State st) {
+ switch (st) {
+ case POST_HEAP:
+ case PRE_HEAP:
+ if (state(i) == IN_HEAP) {
+ erase(i);
+ }
+ index[i] = st;
+ break;
+ case IN_HEAP:
+ break;
+ }
+ }
+
+ private:
+
+ struct BucketItem {
+ BucketItem(const Item& _item, int _value)
+ : item(_item), value(_value) {}
+
+ Item item;
+ int value;
+
+ int prev, next;
+ };
+
+ ItemIntMap& index;
+ std::vector<int> first;
+ std::vector<BucketItem> data;
+ mutable int minimal;
+
+ }; // class BucketHeap
+
+
+ template <typename _ItemIntMap>
+ class BucketHeap<_ItemIntMap, false> {
+
+ public:
+ typedef typename _ItemIntMap::Key Item;
+ typedef int Prio;
+ typedef std::pair<Item, Prio> Pair;
+ typedef _ItemIntMap ItemIntMap;
+
+ enum State {
+ IN_HEAP = 0,
+ PRE_HEAP = -1,
+ POST_HEAP = -2
+ };
+
+ public:
+
+ explicit BucketHeap(ItemIntMap &_index) : index(_index), maximal(-1) {}
+
+ int size() const { return data.size(); }
+ bool empty() const { return data.empty(); }
+
+ void clear() {
+ data.clear(); first.clear(); maximal = -1;
+ }
+
+ private:
+
+ void relocate_last(int idx) {
+ if (idx + 1 != int(data.size())) {
+ data[idx] = data.back();
+ if (data[idx].prev != -1) {
+ data[data[idx].prev].next = idx;
+ } else {
+ first[data[idx].value] = idx;
+ }
+ if (data[idx].next != -1) {
+ data[data[idx].next].prev = idx;
+ }
+ index[data[idx].item] = idx;
+ }
+ data.pop_back();
+ }
+
+ void unlace(int idx) {
+ if (data[idx].prev != -1) {
+ data[data[idx].prev].next = data[idx].next;
+ } else {
+ first[data[idx].value] = data[idx].next;
+ }
+ if (data[idx].next != -1) {
+ data[data[idx].next].prev = data[idx].prev;
+ }
+ }
+
+ void lace(int idx) {
+ if (int(first.size()) <= data[idx].value) {
+ first.resize(data[idx].value + 1, -1);
+ }
+ data[idx].next = first[data[idx].value];
+ if (data[idx].next != -1) {
+ data[data[idx].next].prev = idx;
+ }
+ first[data[idx].value] = idx;
+ data[idx].prev = -1;
+ }
+
+ public:
+
+ void push(const Pair& p) {
+ push(p.first, p.second);
+ }
+
+ void push(const Item &i, const Prio &p) {
+ int idx = data.size();
+ index[i] = idx;
+ data.push_back(BucketItem(i, p));
+ lace(idx);
+ if (data[idx].value > maximal) {
+ maximal = data[idx].value;
+ }
+ }
+
+ Item top() const {
+ while (first[maximal] == -1) {
+ --maximal;
+ }
+ return data[first[maximal]].item;
+ }
+
+ Prio prio() const {
+ while (first[maximal] == -1) {
+ --maximal;
+ }
+ return maximal;
+ }
+
+ void pop() {
+ while (first[maximal] == -1) {
+ --maximal;
+ }
+ int idx = first[maximal];
+ index[data[idx].item] = -2;
+ unlace(idx);
+ relocate_last(idx);
+ }
+
+ void erase(const Item &i) {
+ int idx = index[i];
+ index[data[idx].item] = -2;
+ unlace(idx);
+ relocate_last(idx);
+ }
+
+ Prio operator[](const Item &i) const {
+ int idx = index[i];
+ return data[idx].value;
+ }
+
+ void set(const Item &i, const Prio &p) {
+ int idx = index[i];
+ if (idx < 0) {
+ push(i,p);
+ } else if (p > data[idx].value) {
+ decrease(i, p);
+ } else {
+ increase(i, p);
+ }
+ }
+
+ void decrease(const Item &i, const Prio &p) {
+ int idx = index[i];
+ unlace(idx);
+ data[idx].value = p;
+ if (p > maximal) {
+ maximal = p;
+ }
+ lace(idx);
+ }
+
+ void increase(const Item &i, const Prio &p) {
+ int idx = index[i];
+ unlace(idx);
+ data[idx].value = p;
+ lace(idx);
+ }
+
+ State state(const Item &i) const {
+ int idx = index[i];
+ if (idx >= 0) idx = 0;
+ return State(idx);
+ }
+
+ void state(const Item& i, State st) {
+ switch (st) {
+ case POST_HEAP:
+ case PRE_HEAP:
+ if (state(i) == IN_HEAP) {
+ erase(i);
+ }
+ index[i] = st;
+ break;
+ case IN_HEAP:
+ break;
+ }
+ }
+
+ private:
+
+ struct BucketItem {
+ BucketItem(const Item& _item, int _value)
+ : item(_item), value(_value) {}
+
+ Item item;
+ int value;
+
+ int prev, next;
+ };
+
+ ItemIntMap& index;
+ std::vector<int> first;
+ std::vector<BucketItem> data;
+ mutable int maximal;
+
+ }; // class BucketHeap
+
+ /// \ingroup auxdat
+ ///
+ /// \brief A Simplified Bucket Heap implementation.
+ ///
+ /// This class implements a simplified \e bucket \e heap data
+ /// structure. It does not provide some functionality but it faster
+ /// and simplier data structure than the BucketHeap. The main
+ /// difference is that the BucketHeap stores for every key a double
+ /// linked list while this class stores just simple lists. In the
+ /// other way it does not supports erasing each elements just the
+ /// minimal and it does not supports key increasing, decreasing.
+ ///
+ /// \param _ItemIntMap A read and writable Item int map, used internally
+ /// to handle the cross references.
+ /// \param minimize If the given parameter is true then the heap gives back
+ /// the lowest priority.
+ ///
+ /// \sa BucketHeap
+ template <typename _ItemIntMap, bool minimize = true >
+ class SimpleBucketHeap {
+
+ public:
+ typedef typename _ItemIntMap::Key Item;
+ typedef int Prio;
+ typedef std::pair<Item, Prio> Pair;
+ typedef _ItemIntMap ItemIntMap;
+
+ /// \brief Type to represent the items states.
+ ///
+ /// Each Item element have a state associated to it. It may be "in heap",
+ /// "pre heap" or "post heap". The latter two are indifferent from the
+ /// heap's point of view, but may be useful to the user.
+ ///
+ /// The ItemIntMap \e should be initialized in such way that it maps
+ /// PRE_HEAP (-1) to any element to be put in the heap...
+ enum State {
+ IN_HEAP = 0,
+ PRE_HEAP = -1,
+ POST_HEAP = -2
+ };
+
+ public:
+
+ /// \brief The constructor.
+ ///
+ /// The constructor.
+ /// \param _index should be given to the constructor, since it is used
+ /// internally to handle the cross references. The value of the map
+ /// should be PRE_HEAP (-1) for each element.
+ explicit SimpleBucketHeap(ItemIntMap &_index)
+ : index(_index), free(-1), num(0), minimal(0) {}
+
+ /// \brief Returns the number of items stored in the heap.
+ ///
+ /// The number of items stored in the heap.
+ int size() const { return num; }
+
+ /// \brief Checks if the heap stores no items.
+ ///
+ /// Returns \c true if and only if the heap stores no items.
+ bool empty() const { return num == 0; }
+
+ /// \brief Make empty this heap.
+ ///
+ /// Make empty this heap. It does not change the cross reference
+ /// map. If you want to reuse a heap what is not surely empty you
+ /// should first clear the heap and after that you should set the
+ /// cross reference map for each item to \c PRE_HEAP.
+ void clear() {
+ data.clear(); first.clear(); free = -1; num = 0; minimal = 0;
+ }
+
+ /// \brief Insert a pair of item and priority into the heap.
+ ///
+ /// Adds \c p.first to the heap with priority \c p.second.
+ /// \param p The pair to insert.
+ void push(const Pair& p) {
+ push(p.first, p.second);
+ }
+
+ /// \brief Insert an item into the heap with the given priority.
+ ///
+ /// Adds \c i to the heap with priority \c p.
+ /// \param i The item to insert.
+ /// \param p The priority of the item.
+ void push(const Item &i, const Prio &p) {
+ int idx;
+ if (free == -1) {
+ idx = data.size();
+ data.push_back(BucketItem(i));
+ } else {
+ idx = free;
+ free = data[idx].next;
+ data[idx].item = i;
+ }
+ index[i] = idx;
+ if (p >= int(first.size())) first.resize(p + 1, -1);
+ data[idx].next = first[p];
+ first[p] = idx;
+ if (p < minimal) {
+ minimal = p;
+ }
+ ++num;
+ }
+
+ /// \brief Returns the item with minimum priority.
+ ///
+ /// This method returns the item with minimum priority.
+ /// \pre The heap must be nonempty.
+ Item top() const {
+ while (first[minimal] == -1) {
+ ++minimal;
+ }
+ return data[first[minimal]].item;
+ }
+
+ /// \brief Returns the minimum priority.
+ ///
+ /// It returns the minimum priority.
+ /// \pre The heap must be nonempty.
+ Prio prio() const {
+ while (first[minimal] == -1) {
+ ++minimal;
+ }
+ return minimal;
+ }
+
+ /// \brief Deletes the item with minimum priority.
+ ///
+ /// This method deletes the item with minimum priority from the heap.
+ /// \pre The heap must be non-empty.
+ void pop() {
+ while (first[minimal] == -1) {
+ ++minimal;
+ }
+ int idx = first[minimal];
+ index[data[idx].item] = -2;
+ first[minimal] = data[idx].next;
+ data[idx].next = free;
+ free = idx;
+ --num;
+ }
+
+ /// \brief Returns the priority of \c i.
+ ///
+ /// This function returns the priority of item \c i.
+ /// \warning This operator is not a constant time function
+ /// because it scans the whole data structure to find the proper
+ /// value.
+ /// \pre \c i must be in the heap.
+ /// \param i The item.
+ Prio operator[](const Item &i) const {
+ for (int k = 0; k < first.size(); ++k) {
+ int idx = first[k];
+ while (idx != -1) {
+ if (data[idx].item == i) {
+ return k;
+ }
+ idx = data[idx].next;
+ }
+ }
+ return -1;
+ }
+
+ /// \brief Returns if \c item is in, has already been in, or has
+ /// never been in the heap.
+ ///
+ /// This method returns PRE_HEAP if \c item has never been in the
+ /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
+ /// otherwise. In the latter case it is possible that \c item will
+ /// get back to the heap again.
+ /// \param i The item.
+ State state(const Item &i) const {
+ int idx = index[i];
+ if (idx >= 0) idx = 0;
+ return State(idx);
+ }
+
+ private:
+
+ struct BucketItem {
+ BucketItem(const Item& _item)
+ : item(_item) {}
+
+ Item item;
+ int next;
+ };
+
+ ItemIntMap& index;
+ std::vector<int> first;
+ std::vector<BucketItem> data;
+ int free, num;
+ mutable int minimal;
+
+ }; // class SimpleBucketHeap
+
+ template <typename _ItemIntMap>
+ class SimpleBucketHeap<_ItemIntMap, false> {
+
+ public:
+ typedef typename _ItemIntMap::Key Item;
+ typedef int Prio;
+ typedef std::pair<Item, Prio> Pair;
+ typedef _ItemIntMap ItemIntMap;
+
+ enum State {
+ IN_HEAP = 0,
+ PRE_HEAP = -1,
+ POST_HEAP = -2
+ };
+
+ public:
+
+ explicit SimpleBucketHeap(ItemIntMap &_index)
+ : index(_index), free(-1), num(0), maximal(0) {}
+
+ int size() const { return num; }
+
+ bool empty() const { return num == 0; }
+
+ void clear() {
+ data.clear(); first.clear(); free = -1; num = 0; maximal = 0;
+ }
+
+ void push(const Pair& p) {
+ push(p.first, p.second);
+ }
+
+ void push(const Item &i, const Prio &p) {
+ int idx;
+ if (free == -1) {
+ idx = data.size();
+ data.push_back(BucketItem(i));
+ } else {
+ idx = free;
+ free = data[idx].next;
+ data[idx].item = i;
+ }
+ index[i] = idx;
+ if (p >= int(first.size())) first.resize(p + 1, -1);
+ data[idx].next = first[p];
+ first[p] = idx;
+ if (p > maximal) {
+ maximal = p;
+ }
+ ++num;
+ }
+
+ Item top() const {
+ while (first[maximal] == -1) {
+ --maximal;
+ }
+ return data[first[maximal]].item;
+ }
+
+ Prio prio() const {
+ while (first[maximal] == -1) {
+ --maximal;
+ }
+ return maximal;
+ }
+
+ void pop() {
+ while (first[maximal] == -1) {
+ --maximal;
+ }
+ int idx = first[maximal];
+ index[data[idx].item] = -2;
+ first[maximal] = data[idx].next;
+ data[idx].next = free;
+ free = idx;
+ --num;
+ }
+
+ Prio operator[](const Item &i) const {
+ for (int k = 0; k < first.size(); ++k) {
+ int idx = first[k];
+ while (idx != -1) {
+ if (data[idx].item == i) {
+ return k;
+ }
+ idx = data[idx].next;
+ }
+ }
+ return -1;
+ }
+
+ State state(const Item &i) const {
+ int idx = index[i];
+ if (idx >= 0) idx = 0;
+ return State(idx);
+ }
+
+ private:
+
+ struct BucketItem {
+ BucketItem(const Item& _item) : item(_item) {}
+
+ Item item;
+
+ int next;
+ };
+
+ ItemIntMap& index;
+ std::vector<int> first;
+ std::vector<BucketItem> data;
+ int free, num;
+ mutable int maximal;
+
+ };
+
+}
+
+#endif
diff --git a/src/lemon/concept_check.h b/src/lemon/concept_check.h
new file mode 100644
index 0000000..59fa93d
--- /dev/null
+++ b/src/lemon/concept_check.h
@@ -0,0 +1,105 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+// Modified for use in LEMON.
+// We should really consider using Boost...
+
+//
+// (C) Copyright Jeremy Siek 2000.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// Revision History:
+// 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
+// 02 April 2001: Removed limits header altogether. (Jeremy Siek)
+// 01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
+//
+
+// See http://www.boost.org/libs/concept_check for documentation.
+
+#ifndef LEMON_BOOST_CONCEPT_CHECKS_HPP
+#define LEMON_BOOST_CONCEPT_CHECKS_HPP
+
+namespace lemon {
+
+ /*
+ "inline" is used for ignore_unused_variable_warning()
+ and function_requires() to make sure there is no
+ overtarget with g++.
+ */
+
+ template <class T> inline void ignore_unused_variable_warning(const T&) { }
+
+ template <class Concept>
+ inline void function_requires()
+ {
+#if !defined(NDEBUG)
+ void (Concept::*x)() = & Concept::constraints;
+ ignore_unused_variable_warning(x);
+#endif
+ }
+
+ template <typename Concept, typename Type>
+ inline void checkConcept() {
+#if !defined(NDEBUG)
+ typedef typename Concept::template Constraints<Type> ConceptCheck;
+ void (ConceptCheck::*x)() = & ConceptCheck::constraints;
+ ignore_unused_variable_warning(x);
+#endif
+ }
+#if 0
+#define BOOST_CLASS_REQUIRE(type_var, ns, concept) \
+ typedef void (ns::concept <type_var>::* func##type_var##concept)(); \
+ template <func##type_var##concept Tp1_> \
+ struct concept_checking_##type_var##concept { }; \
+ typedef concept_checking_##type_var##concept< \
+ BOOST_FPTR ns::concept<type_var>::constraints> \
+ concept_checking_typedef_##type_var##concept
+
+#define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \
+ typedef void (ns::concept <type_var1,type_var2>::* \
+ func##type_var1##type_var2##concept)(); \
+ template <func##type_var1##type_var2##concept Tp1_> \
+ struct concept_checking_##type_var1##type_var2##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##concept< \
+ BOOST_FPTR ns::concept<type_var1,type_var2>::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##concept
+
+#define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \
+ typedef void (ns::concept <tv1,tv2,tv3>::* \
+ func##tv1##tv2##tv3##concept)(); \
+ template <func##tv1##tv2##tv3##concept Tp1_> \
+ struct concept_checking_##tv1##tv2##tv3##concept { }; \
+ typedef concept_checking_##tv1##tv2##tv3##concept< \
+ BOOST_FPTR ns::concept<tv1,tv2,tv3>::constraints> \
+ concept_checking_typedef_##tv1##tv2##tv3##concept
+
+#define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \
+ typedef void (ns::concept <tv1,tv2,tv3,tv4>::* \
+ func##tv1##tv2##tv3##tv4##concept)(); \
+ template <func##tv1##tv2##tv3##tv4##concept Tp1_> \
+ struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \
+ typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \
+ BOOST_FPTR ns::concept<tv1,tv2,tv3,tv4>::constraints> \
+ concept_checking_typedef_##tv1##tv2##tv3##tv4##concept
+#endif
+
+} // namespace lemon
+
+#endif // LEMON_BOOST_CONCEPT_CHECKS_HPP
diff --git a/src/lemon/concepts/bpugraph.h b/src/lemon/concepts/bpugraph.h
new file mode 100644
index 0000000..8b1867d
--- /dev/null
+++ b/src/lemon/concepts/bpugraph.h
@@ -0,0 +1,1004 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+/// \ingroup graph_concepts
+/// \file
+/// \brief The concept of Bipartite Undirected Graphs.
+
+#ifndef LEMON_CONCEPT_BPUGRAPH_H
+#define LEMON_CONCEPT_BPUGRAPH_H
+
+#include <lemon/concepts/graph_components.h>
+
+#include <lemon/concepts/graph.h>
+#include <lemon/concepts/ugraph.h>
+
+#include <lemon/bits/utility.h>
+
+namespace lemon {
+ namespace concepts {
+
+ /// \ingroup graph_concepts
+ ///
+ /// \brief Class describing the concept of Bipartite Undirected Graphs.
+ ///
+ /// This class describes the common interface of all
+ /// Undirected Bipartite Graphs.
+ ///
+ /// As all concept describing classes it provides only interface
+ /// without any sensible implementation. So any algorithm for
+ /// bipartite undirected graph should compile with this class, but it
+ /// will not run properly, of course.
+ ///
+ /// In LEMON bipartite undirected graphs also fulfill the concept of
+ /// the undirected graphs (\ref lemon::concepts::UGraph "UGraph Concept").
+ ///
+ /// You can assume that all undirected bipartite graph can be handled
+ /// as an undirected graph and consequently as a static graph.
+ ///
+ /// The bipartite graph stores two types of nodes which are named
+ /// ANode and BNode. The graph type contains two types ANode and
+ /// BNode which are inherited from Node type. Moreover they have
+ /// constructor which converts Node to either ANode or BNode when
+ /// it is possible. Therefor everywhere the Node type can be used
+ /// instead of ANode and BNode. So the usage of the ANode and
+ /// BNode is not suggested.
+ ///
+ /// The iteration on the partition can be done with the ANodeIt and
+ /// BNodeIt classes. The node map can be used to map values to the nodes
+ /// and similarly we can use to map values for just the ANodes and
+ /// BNodes the ANodeMap and BNodeMap template classes.
+
+ class BpUGraph {
+ public:
+ /// \brief The undirected graph should be tagged by the
+ /// UndirectedTag.
+ ///
+ /// The undirected graph should be tagged by the UndirectedTag. This
+ /// tag helps the enable_if technics to make compile time
+ /// specializations for undirected graphs.
+ typedef True UndirectedTag;
+
+ /// \brief The base type of node iterators,
+ /// or in other words, the trivial node iterator.
+ ///
+ /// This is the base type of each node iterator,
+ /// thus each kind of node iterator converts to this.
+ /// More precisely each kind of node iterator should be inherited
+ /// from the trivial node iterator. The Node class represents
+ /// both of two types of nodes.
+ class Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Node() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ Node(const Node&) { }
+
+ /// Invalid constructor \& conversion.
+
+ /// This constructor initializes the iterator to be invalid.
+ /// \sa Invalid for more details.
+ Node(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(Node) const { return true; }
+
+ /// Inequality operator
+
+ /// \sa operator==(Node n)
+ ///
+ bool operator!=(Node) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(Node) const { return false; }
+
+ };
+
+ /// \brief Helper class for ANodes.
+ ///
+ /// This class is just a helper class for ANodes, it is not
+ /// suggested to use it directly. It can be converted easily to
+ /// node and vice versa. The usage of this class is limited
+ /// to use just as template parameters for special map types.
+ class ANode : public Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ ANode() : Node() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ ANode(const ANode&) : Node() { }
+
+ /// Construct the same node as ANode.
+
+ /// Construct the same node as ANode. It may throws assertion
+ /// when the given node is from the BNode set.
+ ANode(const Node&) : Node() { }
+
+ /// Assign node to A-node.
+
+ /// Besides the core graph item functionality each node should
+ /// be convertible to the represented A-node if it is it possible.
+ ANode& operator=(const Node&) { return *this; }
+
+ /// Invalid constructor \& conversion.
+
+ /// This constructor initializes the iterator to be invalid.
+ /// \sa Invalid for more details.
+ ANode(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(ANode) const { return true; }
+
+ /// Inequality operator
+
+ /// \sa operator==(ANode n)
+ ///
+ bool operator!=(ANode) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(ANode) const { return false; }
+
+ };
+
+ /// \brief Helper class for BNodes.
+ ///
+ /// This class is just a helper class for BNodes, it is not
+ /// suggested to use it directly. It can be converted easily to
+ /// node and vice versa. The usage of this class is limited
+ /// to use just as template parameters for special map types.
+ class BNode : public Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ BNode() : Node() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ BNode(const BNode&) : Node() { }
+
+ /// Construct the same node as BNode.
+
+ /// Construct the same node as BNode. It may throws assertion
+ /// when the given node is from the ANode set.
+ BNode(const Node&) : Node() { }
+
+ /// Assign node to B-node.
+
+ /// Besides the core graph item functionality each node should
+ /// be convertible to the represented B-node if it is it possible.
+ BNode& operator=(const Node&) { return *this; }
+
+ /// Invalid constructor \& conversion.
+
+ /// This constructor initializes the iterator to be invalid.
+ /// \sa Invalid for more details.
+ BNode(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(BNode) const { return true; }
+
+ /// Inequality operator
+
+ /// \sa operator==(BNode n)
+ ///
+ bool operator!=(BNode) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(BNode) const { return false; }
+
+ };
+
+ /// This iterator goes through each node.
+
+ /// This iterator goes through each node.
+ /// Its usage is quite simple, for example you can count the number
+ /// of nodes in graph \c g of type \c Graph like this:
+ ///\code
+ /// int count=0;
+ /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
+ ///\endcode
+ class NodeIt : public Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ NodeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ NodeIt(const NodeIt& n) : Node(n) { }
+ /// Invalid constructor \& conversion.
+
+ /// Initialize the iterator to be invalid.
+ /// \sa Invalid for more details.
+ NodeIt(Invalid) { }
+ /// Sets the iterator to the first node.
+
+ /// Sets the iterator to the first node of \c g.
+ ///
+ NodeIt(const BpUGraph&) { }
+ /// Node -> NodeIt conversion.
+
+ /// Sets the iterator to the node of \c the graph pointed by
+ /// the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ NodeIt(const BpUGraph&, const Node&) { }
+ /// Next node.
+
+ /// Assign the iterator to the next node.
+ ///
+ NodeIt& operator++() { return *this; }
+ };
+
+ /// This iterator goes through each ANode.
+
+ /// This iterator goes through each ANode.
+ /// Its usage is quite simple, for example you can count the number
+ /// of nodes in graph \c g of type \c Graph like this:
+ ///\code
+ /// int count=0;
+ /// for (Graph::ANodeIt n(g); n!=INVALID; ++n) ++count;
+ ///\endcode
+ class ANodeIt : public Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ ANodeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ ANodeIt(const ANodeIt& n) : Node(n) { }
+ /// Invalid constructor \& conversion.
+
+ /// Initialize the iterator to be invalid.
+ /// \sa Invalid for more details.
+ ANodeIt(Invalid) { }
+ /// Sets the iterator to the first node.
+
+ /// Sets the iterator to the first node of \c g.
+ ///
+ ANodeIt(const BpUGraph&) { }
+ /// Node -> ANodeIt conversion.
+
+ /// Sets the iterator to the node of \c the graph pointed by
+ /// the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ ANodeIt(const BpUGraph&, const Node&) { }
+ /// Next node.
+
+ /// Assign the iterator to the next node.
+ ///
+ ANodeIt& operator++() { return *this; }
+ };
+
+ /// This iterator goes through each BNode.
+
+ /// This iterator goes through each BNode.
+ /// Its usage is quite simple, for example you can count the number
+ /// of nodes in graph \c g of type \c Graph like this:
+ ///\code
+ /// int count=0;
+ /// for (Graph::BNodeIt n(g); n!=INVALID; ++n) ++count;
+ ///\endcode
+ class BNodeIt : public Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ BNodeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ BNodeIt(const BNodeIt& n) : Node(n) { }
+ /// Invalid constructor \& conversion.
+
+ /// Initialize the iterator to be invalid.
+ /// \sa Invalid for more details.
+ BNodeIt(Invalid) { }
+ /// Sets the iterator to the first node.
+
+ /// Sets the iterator to the first node of \c g.
+ ///
+ BNodeIt(const BpUGraph&) { }
+ /// Node -> BNodeIt conversion.
+
+ /// Sets the iterator to the node of \c the graph pointed by
+ /// the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ BNodeIt(const BpUGraph&, const Node&) { }
+ /// Next node.
+
+ /// Assign the iterator to the next node.
+ ///
+ BNodeIt& operator++() { return *this; }
+ };
+
+
+ /// The base type of the undirected edge iterators.
+
+ /// The base type of the undirected edge iterators.
+ ///
+ class UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ UEdge() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ UEdge(const UEdge&) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ UEdge(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(UEdge) const { return true; }
+ /// Inequality operator
+
+ /// \sa operator==(UEdge n)
+ ///
+ bool operator!=(UEdge) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(UEdge) const { return false; }
+ };
+
+ /// This iterator goes through each undirected edge.
+
+ /// This iterator goes through each undirected edge of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of undirected edges in a graph \c g of type \c Graph as follows:
+ ///\code
+ /// int count=0;
+ /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
+ ///\endcode
+ class UEdgeIt : public UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ UEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ UEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first undirected edge.
+
+ /// This constructor sets the iterator to the first undirected edge.
+ UEdgeIt(const BpUGraph&) { }
+ /// UEdge -> UEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the undirected edge-set, the iteration order is the
+ /// same.
+ UEdgeIt(const BpUGraph&, const UEdge&) { }
+ /// Next undirected edge
+
+ /// Assign the iterator to the next undirected edge.
+ UEdgeIt& operator++() { return *this; }
+ };
+
+ /// \brief This iterator goes trough the incident undirected
+ /// edges of a node.
+ ///
+ /// This iterator goes trough the incident undirected edges
+ /// of a certain node
+ /// of a graph.
+ /// Its usage is quite simple, for example you can compute the
+ /// degree (i.e. count the number
+ /// of incident edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///\code
+ /// int count=0;
+ /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+ class IncEdgeIt : public UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ IncEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ IncEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to first incident edge.
+
+ /// This constructor set the iterator to the first incident edge of
+ /// the node.
+ IncEdgeIt(const BpUGraph&, const Node&) { }
+ /// UEdge -> IncEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ IncEdgeIt(const BpUGraph&, const UEdge&) { }
+ /// Next incident edge
+
+ /// Assign the iterator to the next incident edge
+ /// of the corresponding node.
+ IncEdgeIt& operator++() { return *this; }
+ };
+
+ /// The directed edge type.
+
+ /// The directed edge type. It can be converted to the
+ /// undirected edge.
+ class Edge : public UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Edge() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ Edge(const Edge& e) : UEdge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ Edge(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(Edge) const { return true; }
+ /// Inequality operator
+
+ /// \sa operator==(Edge n)
+ ///
+ bool operator!=(Edge) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(Edge) const { return false; }
+
+ };
+ /// This iterator goes through each directed edge.
+
+ /// This iterator goes through each edge of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of edges in a graph \c g of type \c Graph as follows:
+ ///\code
+ /// int count=0;
+ /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
+ ///\endcode
+ class EdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ EdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ EdgeIt(const EdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ EdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first edge.
+
+ /// This constructor sets the iterator to the first edge of \c g.
+ ///@param g the graph
+ EdgeIt(const BpUGraph &g) { ignore_unused_variable_warning(g); }
+ /// Edge -> EdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ EdgeIt(const BpUGraph&, const Edge&) { }
+ ///Next edge
+
+ /// Assign the iterator to the next edge.
+ EdgeIt& operator++() { return *this; }
+ };
+
+ /// This iterator goes trough the outgoing directed edges of a node.
+
+ /// This iterator goes trough the \e outgoing edges of a certain node
+ /// of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of outgoing edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///\code
+ /// int count=0;
+ /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+
+ class OutEdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ OutEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ OutEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first outgoing edge.
+
+ /// This constructor sets the iterator to the first outgoing edge of
+ /// the node.
+ ///@param n the node
+ ///@param g the graph
+ OutEdgeIt(const BpUGraph& n, const Node& g) {
+ ignore_unused_variable_warning(n);
+ ignore_unused_variable_warning(g);
+ }
+ /// Edge -> OutEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ OutEdgeIt(const BpUGraph&, const Edge&) { }
+ ///Next outgoing edge
+
+ /// Assign the iterator to the next
+ /// outgoing edge of the corresponding node.
+ OutEdgeIt& operator++() { return *this; }
+ };
+
+ /// This iterator goes trough the incoming directed edges of a node.
+
+ /// This iterator goes trough the \e incoming edges of a certain node
+ /// of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of outgoing edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///\code
+ /// int count=0;
+ /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+
+ class InEdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ InEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ InEdgeIt(const InEdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ InEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to first incoming edge.
+
+ /// This constructor set the iterator to the first incoming edge of
+ /// the node.
+ ///@param n the node
+ ///@param g the graph
+ InEdgeIt(const BpUGraph& g, const Node& n) {
+ ignore_unused_variable_warning(n);
+ ignore_unused_variable_warning(g);
+ }
+ /// Edge -> InEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ InEdgeIt(const BpUGraph&, const Edge&) { }
+ /// Next incoming edge
+
+ /// Assign the iterator to the next inedge of the corresponding node.
+ ///
+ InEdgeIt& operator++() { return *this; }
+ };
+
+ /// \brief Read write map of the nodes to type \c T.
+ ///
+ /// ReadWrite map of the nodes to type \c T.
+ /// \sa Reference
+ /// \todo Wrong documentation
+ template<class T>
+ class NodeMap : public ReadWriteMap< Node, T >
+ {
+ public:
+
+ ///\e
+ NodeMap(const BpUGraph&) { }
+ ///\e
+ NodeMap(const BpUGraph&, T) { }
+
+ ///Copy constructor
+ NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
+ ///Assignment operator
+ NodeMap& operator=(const NodeMap&) { return *this; }
+ ///Assignment operator
+ template <typename CMap>
+ NodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// \brief Read write map of the ANodes to type \c T.
+ ///
+ /// ReadWrite map of the ANodes to type \c T.
+ /// \sa Reference
+ /// \todo Wrong documentation
+ template<class T>
+ class ANodeMap : public ReadWriteMap< Node, T >
+ {
+ public:
+
+ ///\e
+ ANodeMap(const BpUGraph&) { }
+ ///\e
+ ANodeMap(const BpUGraph&, T) { }
+
+ ///Copy constructor
+ ANodeMap(const ANodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
+ ///Assignment operator
+ ANodeMap& operator=(const ANodeMap&) { return *this; }
+ ///Assignment operator
+ template <typename CMap>
+ ANodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// \brief Read write map of the BNodes to type \c T.
+ ///
+ /// ReadWrite map of the BNodes to type \c T.
+ /// \sa Reference
+ /// \todo Wrong documentation
+ template<class T>
+ class BNodeMap : public ReadWriteMap< Node, T >
+ {
+ public:
+
+ ///\e
+ BNodeMap(const BpUGraph&) { }
+ ///\e
+ BNodeMap(const BpUGraph&, T) { }
+
+ ///Copy constructor
+ BNodeMap(const BNodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
+ ///Assignment operator
+ BNodeMap& operator=(const BNodeMap&) { return *this; }
+ ///Assignment operator
+ template <typename CMap>
+ BNodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// \brief Read write map of the directed edges to type \c T.
+ ///
+ /// Reference map of the directed edges to type \c T.
+ /// \sa Reference
+ /// \todo Wrong documentation
+ template<class T>
+ class EdgeMap : public ReadWriteMap<Edge,T>
+ {
+ public:
+
+ ///\e
+ EdgeMap(const BpUGraph&) { }
+ ///\e
+ EdgeMap(const BpUGraph&, T) { }
+ ///Copy constructor
+ EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
+ ///Assignment operator
+ EdgeMap& operator=(const EdgeMap&) { return *this; }
+ ///Assignment operator
+ template <typename CMap>
+ EdgeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Edge, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// Read write map of the undirected edges to type \c T.
+
+ /// Reference map of the edges to type \c T.
+ /// \sa Reference
+ /// \todo Wrong documentation
+ template<class T>
+ class UEdgeMap : public ReadWriteMap<UEdge,T>
+ {
+ public:
+
+ ///\e
+ UEdgeMap(const BpUGraph&) { }
+ ///\e
+ UEdgeMap(const BpUGraph&, T) { }
+ ///Copy constructor
+ UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
+ ///Assignment operator
+ UEdgeMap &operator=(const UEdgeMap&) { return *this; }
+ ///Assignment operator
+ template <typename CMap>
+ UEdgeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<UEdge, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// \brief Direct the given undirected edge.
+ ///
+ /// Direct the given undirected edge. The returned edge source
+ /// will be the given node.
+ Edge direct(const UEdge&, const Node&) const {
+ return INVALID;
+ }
+
+ /// \brief Direct the given undirected edge.
+ ///
+ /// Direct the given undirected edge. The returned edge
+ /// represents the given undirected edge and the direction comes
+ /// from the given bool. The source of the undirected edge and
+ /// the directed edge is the same when the given bool is true.
+ Edge direct(const UEdge&, bool) const {
+ return INVALID;
+ }
+
+ /// \brief Returns true when the given node is an ANode.
+ ///
+ /// Returns true when the given node is an ANode.
+ bool aNode(Node) const { return true;}
+
+ /// \brief Returns true when the given node is an BNode.
+ ///
+ /// Returns true when the given node is an BNode.
+ bool bNode(Node) const { return true;}
+
+ /// \brief Returns the edge's end node which is in the ANode set.
+ ///
+ /// Returns the edge's end node which is in the ANode set.
+ Node aNode(UEdge) const { return INVALID;}
+
+ /// \brief Returns the edge's end node which is in the BNode set.
+ ///
+ /// Returns the edge's end node which is in the BNode set.
+ Node bNode(UEdge) const { return INVALID;}
+
+ /// \brief Returns true if the edge has default orientation.
+ ///
+ /// Returns whether the given directed edge is same orientation as
+ /// the corresponding undirected edge's default orientation.
+ bool direction(Edge) const { return true; }
+
+ /// \brief Returns the opposite directed edge.
+ ///
+ /// Returns the opposite directed edge.
+ Edge oppositeEdge(Edge) const { return INVALID; }
+
+ /// \brief Opposite node on an edge
+ ///
+ /// \return the opposite of the given Node on the given UEdge
+ Node oppositeNode(Node, UEdge) const { return INVALID; }
+
+ /// \brief First node of the undirected edge.
+ ///
+ /// \return the first node of the given UEdge.
+ ///
+ /// Naturally undirected edges don't have direction and thus
+ /// don't have source and target node. But we use these two methods
+ /// to query the two endnodes of the edge. The direction of the edge
+ /// which arises this way is called the inherent direction of the
+ /// undirected edge, and is used to define the "default" direction
+ /// of the directed versions of the edges.
+ /// \sa direction
+ Node source(UEdge) const { return INVALID; }
+
+ /// \brief Second node of the undirected edge.
+ Node target(UEdge) const { return INVALID; }
+
+ /// \brief Source node of the directed edge.
+ Node source(Edge) const { return INVALID; }
+
+ /// \brief Target node of the directed edge.
+ Node target(Edge) const { return INVALID; }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (the source in this case) of the iterator
+ Node baseNode(OutEdgeIt e) const {
+ return source(e);
+ }
+
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (the target in this case) of the
+ /// iterator
+ Node runningNode(OutEdgeIt e) const {
+ return target(e);
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (the target in this case) of the iterator
+ Node baseNode(InEdgeIt e) const {
+ return target(e);
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (the source in this case) of the
+ /// iterator
+ Node runningNode(InEdgeIt e) const {
+ return source(e);
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node of the iterator
+ Node baseNode(IncEdgeIt) const {
+ return INVALID;
+ }
+
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node of the iterator
+ Node runningNode(IncEdgeIt) const {
+ return INVALID;
+ }
+
+ void first(Node&) const {}
+ void next(Node&) const {}
+
+ void first(Edge&) const {}
+ void next(Edge&) const {}
+
+ void first(UEdge&) const {}
+ void next(UEdge&) const {}
+
+ void firstANode(Node&) const {}
+ void nextANode(Node&) const {}
+
+ void firstBNode(Node&) const {}
+ void nextBNode(Node&) const {}
+
+ void firstIn(Edge&, const Node&) const {}
+ void nextIn(Edge&) const {}
+
+ void firstOut(Edge&, const Node&) const {}
+ void nextOut(Edge&) const {}
+
+ void firstInc(UEdge &, bool &, const Node &) const {}
+ void nextInc(UEdge &, bool &) const {}
+
+ void firstFromANode(UEdge&, const Node&) const {}
+ void nextFromANode(UEdge&) const {}
+
+ void firstFromBNode(UEdge&, const Node&) const {}
+ void nextFromBNode(UEdge&) const {}
+
+ template <typename Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<IterableBpUGraphComponent<>, Graph>();
+ checkConcept<MappableBpUGraphComponent<>, Graph>();
+ }
+ };
+
+ };
+
+ }
+
+}
+
+#endif
diff --git a/src/lemon/concepts/graph.h b/src/lemon/concepts/graph.h
new file mode 100644
index 0000000..8189803
--- /dev/null
+++ b/src/lemon/concepts/graph.h
@@ -0,0 +1,453 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_CONCEPT_GRAPH_H
+#define LEMON_CONCEPT_GRAPH_H
+
+///\ingroup graph_concepts
+///\file
+///\brief The concept of Directed Graphs.
+
+#include <lemon/bits/invalid.h>
+#include <lemon/bits/utility.h>
+#include <lemon/concepts/maps.h>
+#include <lemon/concept_check.h>
+#include <lemon/concepts/graph_components.h>
+
+namespace lemon {
+ namespace concepts {
+
+ /// \ingroup graph_concepts
+ ///
+ /// \brief Class describing the concept of Directed Graphs.
+ ///
+ /// This class describes the \ref concept "concept" of the
+ /// immutable directed graphs.
+ ///
+ /// Note that actual graph implementation like @ref ListGraph or
+ /// @ref SmartGraph may have several additional functionality.
+ ///
+ /// \sa concept
+ class Graph {
+ private:
+ ///Graphs are \e not copy constructible. Use GraphCopy() instead.
+
+ ///Graphs are \e not copy constructible. Use GraphCopy() instead.
+ ///
+ Graph(const Graph &) {};
+ ///\brief Assignment of \ref Graph "Graph"s to another ones are
+ ///\e not allowed. Use GraphCopy() instead.
+
+ ///Assignment of \ref Graph "Graph"s to another ones are
+ ///\e not allowed. Use GraphCopy() instead.
+
+ void operator=(const Graph &) {}
+ public:
+ ///\e
+
+ /// Defalult constructor.
+
+ /// Defalult constructor.
+ ///
+ Graph() { }
+ /// Class for identifying a node of the graph
+
+ /// This class identifies a node of the graph. It also serves
+ /// as a base class of the node iterators,
+ /// thus they will convert to this type.
+ class Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Node() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ Node(const Node&) { }
+
+ /// Invalid constructor \& conversion.
+
+ /// This constructor initializes the iterator to be invalid.
+ /// \sa Invalid for more details.
+ Node(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(Node) const { return true; }
+
+ /// Inequality operator
+
+ /// \sa operator==(Node n)
+ ///
+ bool operator!=(Node) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(Node) const { return false; }
+
+ };
+
+ /// This iterator goes through each node.
+
+ /// This iterator goes through each node.
+ /// Its usage is quite simple, for example you can count the number
+ /// of nodes in graph \c g of type \c Graph like this:
+ ///\code
+ /// int count=0;
+ /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
+ ///\endcode
+ class NodeIt : public Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ NodeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ NodeIt(const NodeIt& n) : Node(n) { }
+ /// Invalid constructor \& conversion.
+
+ /// Initialize the iterator to be invalid.
+ /// \sa Invalid for more details.
+ NodeIt(Invalid) { }
+ /// Sets the iterator to the first node.
+
+ /// Sets the iterator to the first node of \c g.
+ ///
+ NodeIt(const Graph&) { }
+ /// Node -> NodeIt conversion.
+
+ /// Sets the iterator to the node of \c the graph pointed by
+ /// the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ NodeIt(const Graph&, const Node&) { }
+ /// Next node.
+
+ /// Assign the iterator to the next node.
+ ///
+ NodeIt& operator++() { return *this; }
+ };
+
+
+ /// Class for identifying an edge of the graph
+
+ /// This class identifies an edge of the graph. It also serves
+ /// as a base class of the edge iterators,
+ /// thus they will convert to this type.
+ class Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Edge() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ Edge(const Edge&) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ Edge(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(Edge) const { return true; }
+ /// Inequality operator
+
+ /// \sa operator==(Edge n)
+ ///
+ bool operator!=(Edge) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(Edge) const { return false; }
+ };
+
+ /// This iterator goes trough the outgoing edges of a node.
+
+ /// This iterator goes trough the \e outgoing edges of a certain node
+ /// of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of outgoing edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///\code
+ /// int count=0;
+ /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+
+ class OutEdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ OutEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ OutEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first outgoing edge.
+
+ /// This constructor sets the iterator to the first outgoing edge of
+ /// the node.
+ OutEdgeIt(const Graph&, const Node&) { }
+ /// Edge -> OutEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ OutEdgeIt(const Graph&, const Edge&) { }
+ ///Next outgoing edge
+
+ /// Assign the iterator to the next
+ /// outgoing edge of the corresponding node.
+ OutEdgeIt& operator++() { return *this; }
+ };
+
+ /// This iterator goes trough the incoming edges of a node.
+
+ /// This iterator goes trough the \e incoming edges of a certain node
+ /// of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of outgoing edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///\code
+ /// int count=0;
+ /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+
+ class InEdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ InEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ InEdgeIt(const InEdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ InEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to first incoming edge.
+
+ /// This constructor set the iterator to the first incoming edge of
+ /// the node.
+ InEdgeIt(const Graph&, const Node&) { }
+ /// Edge -> InEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ InEdgeIt(const Graph&, const Edge&) { }
+ /// Next incoming edge
+
+ /// Assign the iterator to the next inedge of the corresponding node.
+ ///
+ InEdgeIt& operator++() { return *this; }
+ };
+ /// This iterator goes through each edge.
+
+ /// This iterator goes through each edge of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of edges in a graph \c g of type \c Graph as follows:
+ ///\code
+ /// int count=0;
+ /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
+ ///\endcode
+ class EdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ EdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ EdgeIt(const EdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ EdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first edge.
+
+ /// This constructor sets the iterator to the first edge of \c g.
+ ///@param g the graph
+ EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); }
+ /// Edge -> EdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ EdgeIt(const Graph&, const Edge&) { }
+ ///Next edge
+
+ /// Assign the iterator to the next edge.
+ EdgeIt& operator++() { return *this; }
+ };
+ ///Gives back the target node of an edge.
+
+ ///Gives back the target node of an edge.
+ ///
+ Node target(Edge) const { return INVALID; }
+ ///Gives back the source node of an edge.
+
+ ///Gives back the source node of an edge.
+ ///
+ Node source(Edge) const { return INVALID; }
+
+ void first(Node&) const {}
+ void next(Node&) const {}
+
+ void first(Edge&) const {}
+ void next(Edge&) const {}
+
+
+ void firstIn(Edge&, const Node&) const {}
+ void nextIn(Edge&) const {}
+
+ void firstOut(Edge&, const Node&) const {}
+ void nextOut(Edge&) const {}
+
+ /// \brief The base node of the iterator.
+ ///
+ /// Gives back the base node of the iterator.
+ /// It is always the target of the pointed edge.
+ Node baseNode(const InEdgeIt&) const { return INVALID; }
+
+ /// \brief The running node of the iterator.
+ ///
+ /// Gives back the running node of the iterator.
+ /// It is always the source of the pointed edge.
+ Node runningNode(const InEdgeIt&) const { return INVALID; }
+
+ /// \brief The base node of the iterator.
+ ///
+ /// Gives back the base node of the iterator.
+ /// It is always the source of the pointed edge.
+ Node baseNode(const OutEdgeIt&) const { return INVALID; }
+
+ /// \brief The running node of the iterator.
+ ///
+ /// Gives back the running node of the iterator.
+ /// It is always the target of the pointed edge.
+ Node runningNode(const OutEdgeIt&) const { return INVALID; }
+
+ /// \brief The opposite node on the given edge.
+ ///
+ /// Gives back the opposite node on the given edge.
+ Node oppositeNode(const Node&, const Edge&) const { return INVALID; }
+
+ /// \brief Read write map of the nodes to type \c T.
+ ///
+ /// ReadWrite map of the nodes to type \c T.
+ /// \sa Reference
+ template<class T>
+ class NodeMap : public ReadWriteMap< Node, T > {
+ public:
+
+ ///\e
+ NodeMap(const Graph&) { }
+ ///\e
+ NodeMap(const Graph&, T) { }
+
+ ///Copy constructor
+ NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
+ ///Assignment operator
+ template <typename CMap>
+ NodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// \brief Read write map of the edges to type \c T.
+ ///
+ /// Reference map of the edges to type \c T.
+ /// \sa Reference
+ template<class T>
+ class EdgeMap : public ReadWriteMap<Edge,T> {
+ public:
+
+ ///\e
+ EdgeMap(const Graph&) { }
+ ///\e
+ EdgeMap(const Graph&, T) { }
+ ///Copy constructor
+ EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
+ ///Assignment operator
+ template <typename CMap>
+ EdgeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Edge, T>, CMap>();
+ return *this;
+ }
+ };
+
+ template <typename RGraph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<IterableGraphComponent<>, Graph>();
+ checkConcept<MappableGraphComponent<>, Graph>();
+ }
+ };
+
+ };
+
+ } //namespace concepts
+} //namespace lemon
+
+
+
+#endif // LEMON_CONCEPT_GRAPH_H
diff --git a/src/lemon/concepts/graph_components.h b/src/lemon/concepts/graph_components.h
new file mode 100644
index 0000000..91aaf95
--- /dev/null
+++ b/src/lemon/concepts/graph_components.h
@@ -0,0 +1,2093 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+///\ingroup graph_concepts
+///\file
+///\brief The concept of graph components.
+
+
+#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H
+#define LEMON_CONCEPT_GRAPH_COMPONENTS_H
+
+#include <lemon/bits/invalid.h>
+#include <lemon/concepts/maps.h>
+
+#include <lemon/bits/alteration_notifier.h>
+
+namespace lemon {
+ namespace concepts {
+
+ /// \brief Skeleton class for graph Node and Edge types
+ ///
+ /// This class describes the interface of Node and Edge (and UEdge
+ /// in undirected graphs) subtypes of graph types.
+ ///
+ /// \note This class is a template class so that we can use it to
+ /// create graph skeleton classes. The reason for this is than Node
+ /// and Edge types should \em not derive from the same base class.
+ /// For Node you should instantiate it with character 'n' and for Edge
+ /// with 'e'.
+
+#ifndef DOXYGEN
+ template <char _selector = '0'>
+#endif
+ class GraphItem {
+ public:
+ /// \brief Default constructor.
+ ///
+ /// \warning The default constructor is not required to set
+ /// the item to some well-defined value. So you should consider it
+ /// as uninitialized.
+ GraphItem() {}
+ /// \brief Copy constructor.
+ ///
+ /// Copy constructor.
+ ///
+ GraphItem(const GraphItem &) {}
+ /// \brief Invalid constructor \& conversion.
+ ///
+ /// This constructor initializes the item to be invalid.
+ /// \sa Invalid for more details.
+ GraphItem(Invalid) {}
+ /// \brief Assign operator for nodes.
+ ///
+ /// The nodes are assignable.
+ ///
+ GraphItem& operator=(GraphItem const&) { return *this; }
+ /// \brief Equality operator.
+ ///
+ /// Two iterators are equal if and only if they represents the
+ /// same node in the graph or both are invalid.
+ bool operator==(GraphItem) const { return false; }
+ /// \brief Inequality operator.
+ ///
+ /// \sa operator==(const Node& n)
+ ///
+ bool operator!=(GraphItem) const { return false; }
+
+ /// \brief Artificial ordering operator.
+ ///
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(GraphItem) const { return false; }
+
+ template<typename _GraphItem>
+ struct Constraints {
+ void constraints() {
+ _GraphItem i1;
+ _GraphItem i2 = i1;
+ _GraphItem i3 = INVALID;
+
+ i1 = i2 = i3;
+
+ bool b;
+ // b = (ia == ib) && (ia != ib) && (ia < ib);
+ b = (ia == ib) && (ia != ib);
+ b = (ia == INVALID) && (ib != INVALID);
+ b = (ia < ib);
+ }
+
+ const _GraphItem &ia;
+ const _GraphItem &ib;
+ };
+ };
+
+ /// \brief An empty base graph class.
+ ///
+ /// This class provides the minimal set of features needed for a graph
+ /// structure. All graph concepts have to be conform to this base
+ /// graph. It just provides types for nodes and edges and functions to
+ /// get the source and the target of the edges.
+ class BaseGraphComponent {
+ public:
+
+ typedef BaseGraphComponent Graph;
+
+ /// \brief Node class of the graph.
+ ///
+ /// This class represents the Nodes of the graph.
+ ///
+ typedef GraphItem<'n'> Node;
+
+ /// \brief Edge class of the graph.
+ ///
+ /// This class represents the Edges of the graph.
+ ///
+ typedef GraphItem<'e'> Edge;
+
+ /// \brief Gives back the target node of an edge.
+ ///
+ /// Gives back the target node of an edge.
+ ///
+ Node target(const Edge&) const { return INVALID;}
+
+ /// \brief Gives back the source node of an edge.
+ ///
+ /// Gives back the source node of an edge.
+ ///
+ Node source(const Edge&) const { return INVALID;}
+
+ /// \brief Gives back the opposite node on the given edge.
+ ///
+ /// Gives back the opposite node on the given edge.
+ Node oppositeNode(const Node&, const Edge&) const {
+ return INVALID;
+ }
+
+ template <typename _Graph>
+ struct Constraints {
+ typedef typename _Graph::Node Node;
+ typedef typename _Graph::Edge Edge;
+
+ void constraints() {
+ checkConcept<GraphItem<'n'>, Node>();
+ checkConcept<GraphItem<'e'>, Edge>();
+ {
+ Node n;
+ Edge e(INVALID);
+ n = graph.source(e);
+ n = graph.target(e);
+ n = graph.oppositeNode(n, e);
+ }
+ }
+
+ const _Graph& graph;
+ };
+ };
+
+ /// \brief An empty base undirected graph class.
+ ///
+ /// This class provides the minimal set of features needed for an
+ /// undirected graph structure. All undirected graph concepts have
+ /// to be conform to this base graph. It just provides types for
+ /// nodes, edges and undirected edges and functions to get the
+ /// source and the target of the edges and undirected edges,
+ /// conversion from edges to undirected edges and function to get
+ /// both direction of the undirected edges.
+ class BaseUGraphComponent : public BaseGraphComponent {
+ public:
+ typedef BaseGraphComponent::Node Node;
+ typedef BaseGraphComponent::Edge Edge;
+ /// \brief Undirected edge class of the graph.
+ ///
+ /// This class represents the undirected edges of the graph.
+ /// The undirected graphs can be used as a directed graph which
+ /// for each edge contains the opposite edge too so the graph is
+ /// bidirected. The undirected edge represents two opposite
+ /// directed edges.
+ class UEdge : public GraphItem<'u'> {
+ public:
+ typedef GraphItem<'u'> Parent;
+ /// \brief Default constructor.
+ ///
+ /// \warning The default constructor is not required to set
+ /// the item to some well-defined value. So you should consider it
+ /// as uninitialized.
+ UEdge() {}
+ /// \brief Copy constructor.
+ ///
+ /// Copy constructor.
+ ///
+ UEdge(const UEdge &) : Parent() {}
+ /// \brief Invalid constructor \& conversion.
+ ///
+ /// This constructor initializes the item to be invalid.
+ /// \sa Invalid for more details.
+ UEdge(Invalid) {}
+ /// \brief Converter from edge to undirected edge.
+ ///
+ /// Besides the core graph item functionality each edge should
+ /// be convertible to the represented undirected edge.
+ UEdge(const Edge&) {}
+ /// \brief Assign edge to undirected edge.
+ ///
+ /// Besides the core graph item functionality each edge should
+ /// be convertible to the represented undirected edge.
+ UEdge& operator=(const Edge&) { return *this; }
+ };
+
+ /// \brief Returns the direction of the edge.
+ ///
+ /// Returns the direction of the edge. Each edge represents an
+ /// undirected edge with a direction. It gives back the
+ /// direction.
+ bool direction(const Edge&) const { return true; }
+
+ /// \brief Returns the directed edge.
+ ///
+ /// Returns the directed edge from its direction and the
+ /// represented undirected edge.
+ Edge direct(const UEdge&, bool) const { return INVALID;}
+
+ /// \brief Returns the directed edge.
+ ///
+ /// Returns the directed edge from its source and the
+ /// represented undirected edge.
+ Edge direct(const UEdge&, const Node&) const { return INVALID;}
+
+ /// \brief Returns the opposite edge.
+ ///
+ /// Returns the opposite edge. It is the edge representing the
+ /// same undirected edge and has opposite direction.
+ Edge oppositeEdge(const Edge&) const { return INVALID;}
+
+ /// \brief Gives back the target node of an undirected edge.
+ ///
+ /// Gives back the target node of an undirected edge. The name
+ /// target is a little confusing because the undirected edge
+ /// does not have target but it just means that one of the end
+ /// node.
+ Node target(const UEdge&) const { return INVALID;}
+
+ /// \brief Gives back the source node of an undirected edge.
+ ///
+ /// Gives back the source node of an undirected edge. The name
+ /// source is a little confusing because the undirected edge
+ /// does not have source but it just means that one of the end
+ /// node.
+ Node source(const UEdge&) const { return INVALID;}
+
+ template <typename _Graph>
+ struct Constraints {
+ typedef typename _Graph::Node Node;
+ typedef typename _Graph::Edge Edge;
+ typedef typename _Graph::UEdge UEdge;
+
+ void constraints() {
+ checkConcept<BaseGraphComponent, _Graph>();
+ checkConcept<GraphItem<'u'>, UEdge>();
+ {
+ Node n;
+ UEdge ue(INVALID);
+ Edge e;
+ n = graph.source(ue);
+ n = graph.target(ue);
+ e = graph.direct(ue, true);
+ e = graph.direct(ue, n);
+ e = graph.oppositeEdge(e);
+ ue = e;
+ bool d = graph.direction(e);
+ ignore_unused_variable_warning(d);
+ }
+ }
+
+ const _Graph& graph;
+ };
+
+ };
+
+ /// \brief An empty base bipartite undirected graph class.
+ ///
+ /// This class provides the minimal set of features needed for an
+ /// bipartite undirected graph structure. All bipartite undirected
+ /// graph concepts have to be conform to this base graph. It just
+ /// provides types for nodes, A-nodes, B-nodes, edges and
+ /// undirected edges and functions to get the source and the
+ /// target of the edges and undirected edges, conversion from
+ /// edges to undirected edges and function to get both direction
+ /// of the undirected edges.
+ class BaseBpUGraphComponent : public BaseUGraphComponent {
+ public:
+ typedef BaseUGraphComponent::Node Node;
+ typedef BaseUGraphComponent::Edge Edge;
+ typedef BaseUGraphComponent::UEdge UEdge;
+
+ /// \brief Helper class for A-nodes.
+ ///
+ /// This class is just a helper class for A-nodes, it is not
+ /// suggested to use it directly. It can be converted easily to
+ /// node and vice versa. The usage of this class is limited
+ /// to use just as template parameters for special map types.
+ class ANode : public Node {
+ public:
+ typedef Node Parent;
+
+ /// \brief Default constructor.
+ ///
+ /// \warning The default constructor is not required to set
+ /// the item to some well-defined value. So you should consider it
+ /// as uninitialized.
+ ANode() {}
+ /// \brief Copy constructor.
+ ///
+ /// Copy constructor.
+ ///
+ ANode(const ANode &) : Parent() {}
+ /// \brief Invalid constructor \& conversion.
+ ///
+ /// This constructor initializes the item to be invalid.
+ /// \sa Invalid for more details.
+ ANode(Invalid) {}
+ /// \brief Converter from node to A-node.
+ ///
+ /// Besides the core graph item functionality each node should
+ /// be convertible to the represented A-node if it is it possible.
+ ANode(const Node&) {}
+ /// \brief Assign node to A-node.
+ ///
+ /// Besides the core graph item functionality each node should
+ /// be convertible to the represented A-node if it is it possible.
+ ANode& operator=(const Node&) { return *this; }
+ };
+
+ /// \brief Helper class for B-nodes.
+ ///
+ /// This class is just a helper class for B-nodes, it is not
+ /// suggested to use it directly. It can be converted easily to
+ /// node and vice versa. The usage of this class is limited
+ /// to use just as template parameters for special map types.
+ class BNode : public Node {
+ public:
+ typedef Node Parent;
+
+ /// \brief Default constructor.
+ ///
+ /// \warning The default constructor is not required to set
+ /// the item to some well-defined value. So you should consider it
+ /// as uninitialized.
+ BNode() {}
+ /// \brief Copy constructor.
+ ///
+ /// Copy constructor.
+ ///
+ BNode(const BNode &) : Parent() {}
+ /// \brief Invalid constructor \& conversion.
+ ///
+ /// This constructor initializes the item to be invalid.
+ /// \sa Invalid for more details.
+ BNode(Invalid) {}
+ /// \brief Converter from node to B-node.
+ ///
+ /// Besides the core graph item functionality each node should
+ /// be convertible to the represented B-node if it is it possible.
+ BNode(const Node&) {}
+ /// \brief Assign node to B-node.
+ ///
+ /// Besides the core graph item functionality each node should
+ /// be convertible to the represented B-node if it is it possible.
+ BNode& operator=(const Node&) { return *this; }
+ };
+
+ /// \brief Gives back %true when the node is A-node.
+ ///
+ /// Gives back %true when the node is A-node.
+ bool aNode(const Node&) const { return false; }
+
+ /// \brief Gives back %true when the node is B-node.
+ ///
+ /// Gives back %true when the node is B-node.
+ bool bNode(const Node&) const { return false; }
+
+ /// \brief Gives back the A-node of the undirected edge.
+ ///
+ /// Gives back the A-node of the undirected edge.
+ Node aNode(const UEdge&) const { return INVALID; }
+
+ /// \brief Gives back the B-node of the undirected edge.
+ ///
+ /// Gives back the B-node of the undirected edge.
+ Node bNode(const UEdge&) const { return INVALID; }
+
+ template <typename _Graph>
+ struct Constraints {
+ typedef typename _Graph::Node Node;
+ typedef typename _Graph::ANode ANode;
+ typedef typename _Graph::BNode BNode;
+ typedef typename _Graph::Edge Edge;
+ typedef typename _Graph::UEdge UEdge;
+
+ void constraints() {
+ checkConcept<BaseUGraphComponent, _Graph>();
+ checkConcept<GraphItem<'a'>, ANode>();
+ checkConcept<GraphItem<'b'>, BNode>();
+ {
+ Node n;
+ UEdge ue(INVALID);
+ bool b;
+ n = graph.aNode(ue);
+ n = graph.bNode(ue);
+ b = graph.aNode(n);
+ b = graph.bNode(n);
+ ANode an;
+ an = n; n = an;
+ BNode bn;
+ bn = n; n = bn;
+ ignore_unused_variable_warning(b);
+ }
+ }
+
+ const _Graph& graph;
+ };
+
+ };
+
+ /// \brief An empty idable base graph class.
+ ///
+ /// This class provides beside the core graph features
+ /// core id functions for the graph structure.
+ /// The most of the base graphs should be conform to this concept.
+ /// The id's are unique and immutable.
+ template <typename _Base = BaseGraphComponent>
+ class IDableGraphComponent : public _Base {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::Edge Edge;
+
+ /// \brief Gives back an unique integer id for the Node.
+ ///
+ /// Gives back an unique integer id for the Node.
+ ///
+ int id(const Node&) const { return -1;}
+
+ /// \brief Gives back the node by the unique id.
+ ///
+ /// Gives back the node by the unique id.
+ /// If the graph does not contain node with the given id
+ /// then the result of the function is undetermined.
+ Node nodeFromId(int) const { return INVALID;}
+
+ /// \brief Gives back an unique integer id for the Edge.
+ ///
+ /// Gives back an unique integer id for the Edge.
+ ///
+ int id(const Edge&) const { return -1;}
+
+ /// \brief Gives back the edge by the unique id.
+ ///
+ /// Gives back the edge by the unique id.
+ /// If the graph does not contain edge with the given id
+ /// then the result of the function is undetermined.
+ Edge edgeFromId(int) const { return INVALID;}
+
+ /// \brief Gives back an integer greater or equal to the maximum
+ /// Node id.
+ ///
+ /// Gives back an integer greater or equal to the maximum Node
+ /// id.
+ int maxNodeId() const { return -1;}
+
+ /// \brief Gives back an integer greater or equal to the maximum
+ /// Edge id.
+ ///
+ /// Gives back an integer greater or equal to the maximum Edge
+ /// id.
+ int maxEdgeId() const { return -1;}
+
+ template <typename _Graph>
+ struct Constraints {
+
+ void constraints() {
+ checkConcept<Base, _Graph >();
+ typename _Graph::Node node;
+ int nid = graph.id(node);
+ nid = graph.id(node);
+ node = graph.nodeFromId(nid);
+ typename _Graph::Edge edge;
+ int eid = graph.id(edge);
+ eid = graph.id(edge);
+ edge = graph.edgeFromId(eid);
+
+ nid = graph.maxNodeId();
+ ignore_unused_variable_warning(nid);
+ eid = graph.maxEdgeId();
+ ignore_unused_variable_warning(eid);
+ }
+
+ const _Graph& graph;
+ };
+ };
+
+ /// \brief An empty idable base undirected graph class.
+ ///
+ /// This class provides beside the core undirected graph features
+ /// core id functions for the undirected graph structure. The
+ /// most of the base undirected graphs should be conform to this
+ /// concept. The id's are unique and immutable.
+ template <typename _Base = BaseUGraphComponent>
+ class IDableUGraphComponent : public IDableGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::UEdge UEdge;
+
+ using IDableGraphComponent<_Base>::id;
+
+ /// \brief Gives back an unique integer id for the UEdge.
+ ///
+ /// Gives back an unique integer id for the UEdge.
+ ///
+ int id(const UEdge&) const { return -1;}
+
+ /// \brief Gives back the undirected edge by the unique id.
+ ///
+ /// Gives back the undirected edge by the unique id. If the
+ /// graph does not contain edge with the given id then the
+ /// result of the function is undetermined.
+ UEdge uEdgeFromId(int) const { return INVALID;}
+
+ /// \brief Gives back an integer greater or equal to the maximum
+ /// UEdge id.
+ ///
+ /// Gives back an integer greater or equal to the maximum UEdge
+ /// id.
+ int maxUEdgeId() const { return -1;}
+
+ template <typename _Graph>
+ struct Constraints {
+
+ void constraints() {
+ checkConcept<Base, _Graph >();
+ checkConcept<IDableGraphComponent<Base>, _Graph >();
+ typename _Graph::UEdge uedge;
+ int ueid = graph.id(uedge);
+ ueid = graph.id(uedge);
+ uedge = graph.uEdgeFromId(ueid);
+ ueid = graph.maxUEdgeId();
+ ignore_unused_variable_warning(ueid);
+ }
+
+ const _Graph& graph;
+ };
+ };
+
+ /// \brief An empty idable base bipartite undirected graph class.
+ ///
+ /// This class provides beside the core bipartite undirected graph
+ /// features core id functions for the bipartite undirected graph
+ /// structure. The most of the base undirected graphs should be
+ /// conform to this concept.
+ template <typename _Base = BaseBpUGraphComponent>
+ class IDableBpUGraphComponent : public IDableUGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+
+ using IDableUGraphComponent<_Base>::id;
+
+ /// \brief Gives back an unique integer id for the ANode.
+ ///
+ /// Gives back an unique integer id for the ANode.
+ ///
+ int aNodeId(const Node&) const { return -1;}
+
+ /// \brief Gives back the undirected edge by the unique id.
+ ///
+ /// Gives back the undirected edge by the unique id. If the
+ /// graph does not contain edge with the given id then the
+ /// result of the function is undetermined.
+ Node nodeFromANodeId(int) const { return INVALID;}
+
+ /// \brief Gives back an integer greater or equal to the maximum
+ /// ANode id.
+ ///
+ /// Gives back an integer greater or equal to the maximum ANode
+ /// id.
+ int maxANodeId() const { return -1;}
+
+ /// \brief Gives back an unique integer id for the BNode.
+ ///
+ /// Gives back an unique integer id for the BNode.
+ ///
+ int bNodeId(const Node&) const { return -1;}
+
+ /// \brief Gives back the undirected edge by the unique id.
+ ///
+ /// Gives back the undirected edge by the unique id. If the
+ /// graph does not contain edge with the given id then the
+ /// result of the function is undetermined.
+ Node nodeFromBNodeId(int) const { return INVALID;}
+
+ /// \brief Gives back an integer greater or equal to the maximum
+ /// BNode id.
+ ///
+ /// Gives back an integer greater or equal to the maximum BNode
+ /// id.
+ int maxBNodeId() const { return -1;}
+
+ template <typename _Graph>
+ struct Constraints {
+
+ void constraints() {
+ checkConcept<Base, _Graph >();
+ checkConcept<IDableGraphComponent<Base>, _Graph >();
+ typename _Graph::Node node(INVALID);
+ int id;
+ id = graph.aNodeId(node);
+ id = graph.bNodeId(node);
+ node = graph.nodeFromANodeId(id);
+ node = graph.nodeFromBNodeId(id);
+ id = graph.maxANodeId();
+ id = graph.maxBNodeId();
+ }
+
+ const _Graph& graph;
+ };
+ };
+
+ /// \brief Skeleton class for graph NodeIt and EdgeIt
+ ///
+ /// Skeleton class for graph NodeIt and EdgeIt.
+ ///
+ template <typename _Graph, typename _Item>
+ class GraphItemIt : public _Item {
+ public:
+ /// \brief Default constructor.
+ ///
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ GraphItemIt() {}
+ /// \brief Copy constructor.
+ ///
+ /// Copy constructor.
+ ///
+ GraphItemIt(const GraphItemIt& ) {}
+ /// \brief Sets the iterator to the first item.
+ ///
+ /// Sets the iterator to the first item of \c the graph.
+ ///
+ explicit GraphItemIt(const _Graph&) {}
+ /// \brief Invalid constructor \& conversion.
+ ///
+ /// This constructor initializes the item to be invalid.
+ /// \sa Invalid for more details.
+ GraphItemIt(Invalid) {}
+ /// \brief Assign operator for items.
+ ///
+ /// The items are assignable.
+ ///
+ GraphItemIt& operator=(const GraphItemIt&) { return *this; }
+ /// \brief Next item.
+ ///
+ /// Assign the iterator to the next item.
+ ///
+ GraphItemIt& operator++() { return *this; }
+ /// \brief Equality operator
+ ///
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(const GraphItemIt&) const { return true;}
+ /// \brief Inequality operator
+ ///
+ /// \sa operator==(Node n)
+ ///
+ bool operator!=(const GraphItemIt&) const { return true;}
+
+ template<typename _GraphItemIt>
+ struct Constraints {
+ void constraints() {
+ _GraphItemIt it1(g);
+ _GraphItemIt it2;
+
+ it2 = ++it1;
+ ++it2 = it1;
+ ++(++it1);
+
+ _Item bi = it1;
+ bi = it2;
+ }
+ _Graph& g;
+ };
+ };
+
+ /// \brief Skeleton class for graph InEdgeIt and OutEdgeIt
+ ///
+ /// \note Because InEdgeIt and OutEdgeIt may not inherit from the same
+ /// base class, the _selector is a additional template parameter. For
+ /// InEdgeIt you should instantiate it with character 'i' and for
+ /// OutEdgeIt with 'o'.
+ template <typename _Graph,
+ typename _Item = typename _Graph::Edge,
+ typename _Base = typename _Graph::Node,
+ char _selector = '0'>
+ class GraphIncIt : public _Item {
+ public:
+ /// \brief Default constructor.
+ ///
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ GraphIncIt() {}
+ /// \brief Copy constructor.
+ ///
+ /// Copy constructor.
+ ///
+ GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
+ /// \brief Sets the iterator to the first edge incoming into or outgoing
+ /// from the node.
+ ///
+ /// Sets the iterator to the first edge incoming into or outgoing
+ /// from the node.
+ ///
+ explicit GraphIncIt(const _Graph&, const _Base&) {}
+ /// \brief Invalid constructor \& conversion.
+ ///
+ /// This constructor initializes the item to be invalid.
+ /// \sa Invalid for more details.
+ GraphIncIt(Invalid) {}
+ /// \brief Assign operator for iterators.
+ ///
+ /// The iterators are assignable.
+ ///
+ GraphIncIt& operator=(GraphIncIt const&) { return *this; }
+ /// \brief Next item.
+ ///
+ /// Assign the iterator to the next item.
+ ///
+ GraphIncIt& operator++() { return *this; }
+
+ /// \brief Equality operator
+ ///
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(const GraphIncIt&) const { return true;}
+
+ /// \brief Inequality operator
+ ///
+ /// \sa operator==(Node n)
+ ///
+ bool operator!=(const GraphIncIt&) const { return true;}
+
+ template <typename _GraphIncIt>
+ struct Constraints {
+ void constraints() {
+ checkConcept<GraphItem<_selector>, _GraphIncIt>();
+ _GraphIncIt it1(graph, node);
+ _GraphIncIt it2;
+
+ it2 = ++it1;
+ ++it2 = it1;
+ ++(++it1);
+ _Item e = it1;
+ e = it2;
+
+ }
+
+ _Item edge;
+ _Base node;
+ _Graph graph;
+ _GraphIncIt it;
+ };
+ };
+
+
+ /// \brief An empty iterable graph class.
+ ///
+ /// This class provides beside the core graph features
+ /// iterator based iterable interface for the graph structure.
+ /// This concept is part of the Graph concept.
+ template <typename _Base = BaseGraphComponent>
+ class IterableGraphComponent : public _Base {
+
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::Edge Edge;
+
+ typedef IterableGraphComponent Graph;
+
+ /// \name Base iteration
+ ///
+ /// This interface provides functions for iteration on graph items
+ ///
+ /// @{
+
+ /// \brief Gives back the first node in the iterating order.
+ ///
+ /// Gives back the first node in the iterating order.
+ ///
+ void first(Node&) const {}
+
+ /// \brief Gives back the next node in the iterating order.
+ ///
+ /// Gives back the next node in the iterating order.
+ ///
+ void next(Node&) const {}
+
+ /// \brief Gives back the first edge in the iterating order.
+ ///
+ /// Gives back the first edge in the iterating order.
+ ///
+ void first(Edge&) const {}
+
+ /// \brief Gives back the next edge in the iterating order.
+ ///
+ /// Gives back the next edge in the iterating order.
+ ///
+ void next(Edge&) const {}
+
+
+ /// \brief Gives back the first of the edges point to the given
+ /// node.
+ ///
+ /// Gives back the first of the edges point to the given node.
+ ///
+ void firstIn(Edge&, const Node&) const {}
+
+ /// \brief Gives back the next of the edges points to the given
+ /// node.
+ ///
+ /// Gives back the next of the edges points to the given node.
+ ///
+ void nextIn(Edge&) const {}
+
+ /// \brief Gives back the first of the edges start from the
+ /// given node.
+ ///
+ /// Gives back the first of the edges start from the given node.
+ ///
+ void firstOut(Edge&, const Node&) const {}
+
+ /// \brief Gives back the next of the edges start from the given
+ /// node.
+ ///
+ /// Gives back the next of the edges start from the given node.
+ ///
+ void nextOut(Edge&) const {}
+
+ /// @}
+
+ /// \name Class based iteration
+ ///
+ /// This interface provides functions for iteration on graph items
+ ///
+ /// @{
+
+ /// \brief This iterator goes through each node.
+ ///
+ /// This iterator goes through each node.
+ ///
+ typedef GraphItemIt<Graph, Node> NodeIt;
+
+ /// \brief This iterator goes through each node.
+ ///
+ /// This iterator goes through each node.
+ ///
+ typedef GraphItemIt<Graph, Edge> EdgeIt;
+
+ /// \brief This iterator goes trough the incoming edges of a node.
+ ///
+ /// This iterator goes trough the \e inccoming edges of a certain node
+ /// of a graph.
+ typedef GraphIncIt<Graph, Edge, Node, 'i'> InEdgeIt;
+
+ /// \brief This iterator goes trough the outgoing edges of a node.
+ ///
+ /// This iterator goes trough the \e outgoing edges of a certain node
+ /// of a graph.
+ typedef GraphIncIt<Graph, Edge, Node, 'o'> OutEdgeIt;
+
+ /// \brief The base node of the iterator.
+ ///
+ /// Gives back the base node of the iterator.
+ /// It is always the target of the pointed edge.
+ Node baseNode(const InEdgeIt&) const { return INVALID; }
+
+ /// \brief The running node of the iterator.
+ ///
+ /// Gives back the running node of the iterator.
+ /// It is always the source of the pointed edge.
+ Node runningNode(const InEdgeIt&) const { return INVALID; }
+
+ /// \brief The base node of the iterator.
+ ///
+ /// Gives back the base node of the iterator.
+ /// It is always the source of the pointed edge.
+ Node baseNode(const OutEdgeIt&) const { return INVALID; }
+
+ /// \brief The running node of the iterator.
+ ///
+ /// Gives back the running node of the iterator.
+ /// It is always the target of the pointed edge.
+ Node runningNode(const OutEdgeIt&) const { return INVALID; }
+
+ /// @}
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<Base, _Graph>();
+
+ {
+ typename _Graph::Node node(INVALID);
+ typename _Graph::Edge edge(INVALID);
+ {
+ graph.first(node);
+ graph.next(node);
+ }
+ {
+ graph.first(edge);
+ graph.next(edge);
+ }
+ {
+ graph.firstIn(edge, node);
+ graph.nextIn(edge);
+ }
+ {
+ graph.firstOut(edge, node);
+ graph.nextOut(edge);
+ }
+ }
+
+ {
+ checkConcept<GraphItemIt<_Graph, typename _Graph::Edge>,
+ typename _Graph::EdgeIt >();
+ checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
+ typename _Graph::NodeIt >();
+ checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
+ typename _Graph::Node, 'i'>, typename _Graph::InEdgeIt>();
+ checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
+ typename _Graph::Node, 'o'>, typename _Graph::OutEdgeIt>();
+
+ typename _Graph::Node n;
+ typename _Graph::InEdgeIt ieit(INVALID);
+ typename _Graph::OutEdgeIt oeit(INVALID);
+ n = graph.baseNode(ieit);
+ n = graph.runningNode(ieit);
+ n = graph.baseNode(oeit);
+ n = graph.runningNode(oeit);
+ ignore_unused_variable_warning(n);
+ }
+ }
+
+ const _Graph& graph;
+
+ };
+ };
+
+ /// \brief An empty iterable undirected graph class.
+ ///
+ /// This class provides beside the core graph features iterator
+ /// based iterable interface for the undirected graph structure.
+ /// This concept is part of the UGraph concept.
+ template <typename _Base = BaseUGraphComponent>
+ class IterableUGraphComponent : public IterableGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::Edge Edge;
+ typedef typename Base::UEdge UEdge;
+
+
+ typedef IterableUGraphComponent Graph;
+
+ /// \name Base iteration
+ ///
+ /// This interface provides functions for iteration on graph items
+ /// @{
+
+ using IterableGraphComponent<_Base>::first;
+ using IterableGraphComponent<_Base>::next;
+
+ /// \brief Gives back the first undirected edge in the iterating
+ /// order.
+ ///
+ /// Gives back the first undirected edge in the iterating order.
+ ///
+ void first(UEdge&) const {}
+
+ /// \brief Gives back the next undirected edge in the iterating
+ /// order.
+ ///
+ /// Gives back the next undirected edge in the iterating order.
+ ///
+ void next(UEdge&) const {}
+
+
+ /// \brief Gives back the first of the undirected edges from the
+ /// given node.
+ ///
+ /// Gives back the first of the undirected edges from the given
+ /// node. The bool parameter gives back that direction which
+ /// gives a good direction of the uedge so the source of the
+ /// directed edge is the given node.
+ void firstInc(UEdge&, bool&, const Node&) const {}
+
+ /// \brief Gives back the next of the undirected edges from the
+ /// given node.
+ ///
+ /// Gives back the next of the undirected edges from the given
+ /// node. The bool parameter should be used as the \c firstInc()
+ /// use it.
+ void nextInc(UEdge&, bool&) const {}
+
+ using IterableGraphComponent<_Base>::baseNode;
+ using IterableGraphComponent<_Base>::runningNode;
+
+ /// @}
+
+ /// \name Class based iteration
+ ///
+ /// This interface provides functions for iteration on graph items
+ ///
+ /// @{
+
+ /// \brief This iterator goes through each node.
+ ///
+ /// This iterator goes through each node.
+ typedef GraphItemIt<Graph, UEdge> UEdgeIt;
+ /// \brief This iterator goes trough the incident edges of a
+ /// node.
+ ///
+ /// This iterator goes trough the incident edges of a certain
+ /// node of a graph.
+ typedef GraphIncIt<Graph, UEdge, Node, 'u'> IncEdgeIt;
+ /// \brief The base node of the iterator.
+ ///
+ /// Gives back the base node of the iterator.
+ Node baseNode(const IncEdgeIt&) const { return INVALID; }
+
+ /// \brief The running node of the iterator.
+ ///
+ /// Gives back the running node of the iterator.
+ Node runningNode(const IncEdgeIt&) const { return INVALID; }
+
+ /// @}
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<IterableGraphComponent<Base>, _Graph>();
+
+ {
+ typename _Graph::Node node(INVALID);
+ typename _Graph::UEdge uedge(INVALID);
+ bool dir;
+ {
+ graph.first(uedge);
+ graph.next(uedge);
+ }
+ {
+ graph.firstInc(uedge, dir, node);
+ graph.nextInc(uedge, dir);
+ }
+
+ }
+
+ {
+ checkConcept<GraphItemIt<_Graph, typename _Graph::UEdge>,
+ typename _Graph::UEdgeIt >();
+ checkConcept<GraphIncIt<_Graph, typename _Graph::UEdge,
+ typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
+
+ typename _Graph::Node n;
+ typename _Graph::IncEdgeIt ueit(INVALID);
+ n = graph.baseNode(ueit);
+ n = graph.runningNode(ueit);
+ }
+ }
+
+ const _Graph& graph;
+
+ };
+ };
+
+ /// \brief An empty iterable bipartite undirected graph class.
+ ///
+ /// This class provides beside the core graph features iterator
+ /// based iterable interface for the bipartite undirected graph
+ /// structure. This concept is part of the BpUGraph concept.
+ template <typename _Base = BaseUGraphComponent>
+ class IterableBpUGraphComponent : public IterableUGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::UEdge UEdge;
+
+ typedef IterableBpUGraphComponent Graph;
+
+ /// \name Base iteration
+ ///
+ /// This interface provides functions for iteration on graph items
+ /// @{
+
+ using IterableUGraphComponent<_Base>::first;
+ using IterableUGraphComponent<_Base>::next;
+
+ /// \brief Gives back the first A-node in the iterating order.
+ ///
+ /// Gives back the first undirected A-node in the iterating
+ /// order.
+ ///
+ void firstANode(Node&) const {}
+
+ /// \brief Gives back the next A-node in the iterating order.
+ ///
+ /// Gives back the next A-node in the iterating order.
+ ///
+ void nextANode(Node&) const {}
+
+ /// \brief Gives back the first B-node in the iterating order.
+ ///
+ /// Gives back the first undirected B-node in the iterating
+ /// order.
+ ///
+ void firstBNode(Node&) const {}
+
+ /// \brief Gives back the next B-node in the iterating order.
+ ///
+ /// Gives back the next B-node in the iterating order.
+ ///
+ void nextBNode(Node&) const {}
+
+
+ /// \brief Gives back the first of the undirected edges start
+ /// from the given A-node.
+ ///
+ /// Gives back the first of the undirected edges start from the
+ /// given A-node.
+ void firstFromANode(UEdge&, const Node&) const {}
+
+ /// \brief Gives back the next of the undirected edges start
+ /// from the given A-node.
+ ///
+ /// Gives back the next of the undirected edges start from the
+ /// given A-node.
+ void nextFromANode(UEdge&) const {}
+
+ /// \brief Gives back the first of the undirected edges start
+ /// from the given B-node.
+ ///
+ /// Gives back the first of the undirected edges start from the
+ /// given B-node.
+ void firstFromBNode(UEdge&, const Node&) const {}
+
+ /// \brief Gives back the next of the undirected edges start
+ /// from the given B-node.
+ ///
+ /// Gives back the next of the undirected edges start from the
+ /// given B-node.
+ void nextFromBNode(UEdge&) const {}
+
+
+ /// @}
+
+ /// \name Class based iteration
+ ///
+ /// This interface provides functions for iteration on graph items
+ ///
+ /// @{
+
+ /// \brief This iterator goes through each A-node.
+ ///
+ /// This iterator goes through each A-node.
+ typedef GraphItemIt<Graph, Node> ANodeIt;
+
+ /// \brief This iterator goes through each B-node.
+ ///
+ /// This iterator goes through each B-node.
+ typedef GraphItemIt<Graph, Node> BNodeIt;
+
+ /// @}
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<IterableUGraphComponent<Base>, _Graph>();
+
+ {
+ typename _Graph::Node node(INVALID);
+ typename _Graph::UEdge uedge(INVALID);
+ graph.firstANode(node);
+ graph.nextANode(node);
+ graph.firstBNode(node);
+ graph.nextBNode(node);
+
+ graph.firstFromANode(uedge, node);
+ graph.nextFromANode(uedge);
+ graph.firstFromBNode(uedge, node);
+ graph.nextFromBNode(uedge);
+ }
+ {
+ checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
+ typename _Graph::ANodeIt >();
+ checkConcept<GraphItemIt<_Graph, typename _Graph::Node>,
+ typename _Graph::BNodeIt >();
+ }
+
+ }
+
+ const _Graph& graph;
+
+ };
+ };
+
+ /// \brief An empty alteration notifier graph class.
+ ///
+ /// This class provides beside the core graph features alteration
+ /// notifier interface for the graph structure. This implements
+ /// an observer-notifier pattern for each graph item. More
+ /// obsevers can be registered into the notifier and whenever an
+ /// alteration occured in the graph all the observers will
+ /// notified about it.
+ template <typename _Base = BaseGraphComponent>
+ class AlterableGraphComponent : public _Base {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::Edge Edge;
+
+
+ /// The node observer registry.
+ typedef AlterationNotifier<AlterableGraphComponent, Node>
+ NodeNotifier;
+ /// The edge observer registry.
+ typedef AlterationNotifier<AlterableGraphComponent, Edge>
+ EdgeNotifier;
+
+ /// \brief Gives back the node alteration notifier.
+ ///
+ /// Gives back the node alteration notifier.
+ NodeNotifier& notifier(Node) const {
+ return NodeNotifier();
+ }
+
+ /// \brief Gives back the edge alteration notifier.
+ ///
+ /// Gives back the edge alteration notifier.
+ EdgeNotifier& notifier(Edge) const {
+ return EdgeNotifier();
+ }
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<Base, _Graph>();
+ typename _Graph::NodeNotifier& nn
+ = graph.notifier(typename _Graph::Node());
+
+ typename _Graph::EdgeNotifier& en
+ = graph.notifier(typename _Graph::Edge());
+
+ ignore_unused_variable_warning(nn);
+ ignore_unused_variable_warning(en);
+ }
+
+ const _Graph& graph;
+
+ };
+
+ };
+
+ /// \brief An empty alteration notifier undirected graph class.
+ ///
+ /// This class provides beside the core graph features alteration
+ /// notifier interface for the graph structure. This implements
+ /// an observer-notifier pattern for each graph item. More
+ /// obsevers can be registered into the notifier and whenever an
+ /// alteration occured in the graph all the observers will
+ /// notified about it.
+ template <typename _Base = BaseUGraphComponent>
+ class AlterableUGraphComponent : public AlterableGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::UEdge UEdge;
+
+
+ /// The edge observer registry.
+ typedef AlterationNotifier<AlterableUGraphComponent, UEdge>
+ UEdgeNotifier;
+
+ /// \brief Gives back the edge alteration notifier.
+ ///
+ /// Gives back the edge alteration notifier.
+ UEdgeNotifier& notifier(UEdge) const {
+ return UEdgeNotifier();
+ }
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<AlterableGraphComponent<Base>, _Graph>();
+ typename _Graph::UEdgeNotifier& uen
+ = graph.notifier(typename _Graph::UEdge());
+ ignore_unused_variable_warning(uen);
+ }
+
+ const _Graph& graph;
+
+ };
+
+ };
+
+ /// \brief An empty alteration notifier bipartite undirected graph
+ /// class.
+ ///
+ /// This class provides beside the core graph features alteration
+ /// notifier interface for the graph structure. This implements
+ /// an observer-notifier pattern for each graph item. More
+ /// obsevers can be registered into the notifier and whenever an
+ /// alteration occured in the graph all the observers will
+ /// notified about it.
+ template <typename _Base = BaseUGraphComponent>
+ class AlterableBpUGraphComponent : public AlterableUGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::ANode ANode;
+ typedef typename Base::BNode BNode;
+
+
+ /// The A-node observer registry.
+ typedef AlterationNotifier<AlterableBpUGraphComponent, ANode>
+ ANodeNotifier;
+
+ /// The B-node observer registry.
+ typedef AlterationNotifier<AlterableBpUGraphComponent, BNode>
+ BNodeNotifier;
+
+ /// \brief Gives back the A-node alteration notifier.
+ ///
+ /// Gives back the A-node alteration notifier.
+ ANodeNotifier& notifier(ANode) const {
+ return ANodeNotifier();
+ }
+
+ /// \brief Gives back the B-node alteration notifier.
+ ///
+ /// Gives back the B-node alteration notifier.
+ BNodeNotifier& notifier(BNode) const {
+ return BNodeNotifier();
+ }
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<AlterableUGraphComponent<Base>, _Graph>();
+ typename _Graph::ANodeNotifier& ann
+ = graph.notifier(typename _Graph::ANode());
+ typename _Graph::BNodeNotifier& bnn
+ = graph.notifier(typename _Graph::BNode());
+ ignore_unused_variable_warning(ann);
+ ignore_unused_variable_warning(bnn);
+ }
+
+ const _Graph& graph;
+
+ };
+
+ };
+
+
+ /// \brief Class describing the concept of graph maps
+ ///
+ /// This class describes the common interface of the graph maps
+ /// (NodeMap, EdgeMap), that is \ref maps-page "maps" which can be used to
+ /// associate data to graph descriptors (nodes or edges).
+ template <typename _Graph, typename _Item, typename _Value>
+ class GraphMap : public ReadWriteMap<_Item, _Value> {
+ public:
+
+ typedef ReadWriteMap<_Item, _Value> Parent;
+
+ /// The graph type of the map.
+ typedef _Graph Graph;
+ /// The key type of the map.
+ typedef _Item Key;
+ /// The value type of the map.
+ typedef _Value Value;
+
+ /// \brief Construct a new map.
+ ///
+ /// Construct a new map for the graph.
+ explicit GraphMap(const Graph&) {}
+ /// \brief Construct a new map with default value.
+ ///
+ /// Construct a new map for the graph and initalise the values.
+ GraphMap(const Graph&, const Value&) {}
+ /// \brief Copy constructor.
+ ///
+ /// Copy Constructor.
+ GraphMap(const GraphMap&) : Parent() {}
+
+ /// \brief Assign operator.
+ ///
+ /// Assign operator. It does not mofify the underlying graph,
+ /// it just iterates on the current item set and set the map
+ /// with the value returned by the assigned map.
+ template <typename CMap>
+ GraphMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Key, Value>, CMap>();
+ return *this;
+ }
+
+ template<typename _Map>
+ struct Constraints {
+ void constraints() {
+ checkConcept<ReadWriteMap<Key, Value>, _Map >();
+ // Construction with a graph parameter
+ _Map a(g);
+ // Constructor with a graph and a default value parameter
+ _Map a2(g,t);
+ // Copy constructor.
+ _Map b(c);
+
+ ReadMap<Key, Value> cmap;
+ b = cmap;
+
+ ignore_unused_variable_warning(a2);
+ ignore_unused_variable_warning(b);
+ }
+
+ const _Map &c;
+ const Graph &g;
+ const typename GraphMap::Value &t;
+ };
+
+ };
+
+ /// \brief An empty mappable graph class.
+ ///
+ /// This class provides beside the core graph features
+ /// map interface for the graph structure.
+ /// This concept is part of the Graph concept.
+ template <typename _Base = BaseGraphComponent>
+ class MappableGraphComponent : public _Base {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::Edge Edge;
+
+ typedef MappableGraphComponent Graph;
+
+ /// \brief ReadWrite map of the nodes.
+ ///
+ /// ReadWrite map of the nodes.
+ ///
+ template <typename _Value>
+ class NodeMap : public GraphMap<Graph, Node, _Value> {
+ public:
+ typedef GraphMap<MappableGraphComponent, Node, _Value> Parent;
+
+ /// \brief Construct a new map.
+ ///
+ /// Construct a new map for the graph.
+ explicit NodeMap(const MappableGraphComponent& graph)
+ : Parent(graph) {}
+
+ /// \brief Construct a new map with default value.
+ ///
+ /// Construct a new map for the graph and initalise the values.
+ NodeMap(const MappableGraphComponent& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ /// \brief Copy constructor.
+ ///
+ /// Copy Constructor.
+ NodeMap(const NodeMap& nm) : Parent(nm) {}
+
+ /// \brief Assign operator.
+ ///
+ /// Assign operator.
+ template <typename CMap>
+ NodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, _Value>, CMap>();
+ return *this;
+ }
+
+ };
+
+ /// \brief ReadWrite map of the edges.
+ ///
+ /// ReadWrite map of the edges.
+ ///
+ template <typename _Value>
+ class EdgeMap : public GraphMap<Graph, Edge, _Value> {
+ public:
+ typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
+
+ /// \brief Construct a new map.
+ ///
+ /// Construct a new map for the graph.
+ explicit EdgeMap(const MappableGraphComponent& graph)
+ : Parent(graph) {}
+
+ /// \brief Construct a new map with default value.
+ ///
+ /// Construct a new map for the graph and initalise the values.
+ EdgeMap(const MappableGraphComponent& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ /// \brief Copy constructor.
+ ///
+ /// Copy Constructor.
+ EdgeMap(const EdgeMap& nm) : Parent(nm) {}
+
+ /// \brief Assign operator.
+ ///
+ /// Assign operator.
+ template <typename CMap>
+ EdgeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Edge, _Value>, CMap>();
+ return *this;
+ }
+
+ };
+
+
+ template <typename _Graph>
+ struct Constraints {
+
+ struct Dummy {
+ int value;
+ Dummy() : value(0) {}
+ Dummy(int _v) : value(_v) {}
+ };
+
+ void constraints() {
+ checkConcept<Base, _Graph>();
+ { // int map test
+ typedef typename _Graph::template NodeMap<int> IntNodeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::Node, int>,
+ IntNodeMap >();
+ } { // bool map test
+ typedef typename _Graph::template NodeMap<bool> BoolNodeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::Node, bool>,
+ BoolNodeMap >();
+ } { // Dummy map test
+ typedef typename _Graph::template NodeMap<Dummy> DummyNodeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::Node, Dummy>,
+ DummyNodeMap >();
+ }
+
+ { // int map test
+ typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
+ IntEdgeMap >();
+ } { // bool map test
+ typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
+ BoolEdgeMap >();
+ } { // Dummy map test
+ typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>,
+ DummyEdgeMap >();
+ }
+ }
+
+ _Graph& graph;
+ };
+ };
+
+ /// \brief An empty mappable base bipartite undirected graph class.
+ ///
+ /// This class provides beside the core graph features
+ /// map interface for the graph structure.
+ /// This concept is part of the UGraph concept.
+ template <typename _Base = BaseUGraphComponent>
+ class MappableUGraphComponent : public MappableGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::UEdge UEdge;
+
+ typedef MappableUGraphComponent Graph;
+
+ /// \brief ReadWrite map of the uedges.
+ ///
+ /// ReadWrite map of the uedges.
+ ///
+ template <typename _Value>
+ class UEdgeMap : public GraphMap<Graph, UEdge, _Value> {
+ public:
+ typedef GraphMap<MappableUGraphComponent, UEdge, _Value> Parent;
+
+ /// \brief Construct a new map.
+ ///
+ /// Construct a new map for the graph.
+ explicit UEdgeMap(const MappableUGraphComponent& graph)
+ : Parent(graph) {}
+
+ /// \brief Construct a new map with default value.
+ ///
+ /// Construct a new map for the graph and initalise the values.
+ UEdgeMap(const MappableUGraphComponent& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ /// \brief Copy constructor.
+ ///
+ /// Copy Constructor.
+ UEdgeMap(const UEdgeMap& nm) : Parent(nm) {}
+
+ /// \brief Assign operator.
+ ///
+ /// Assign operator.
+ template <typename CMap>
+ UEdgeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<UEdge, _Value>, CMap>();
+ return *this;
+ }
+
+ };
+
+
+ template <typename _Graph>
+ struct Constraints {
+
+ struct Dummy {
+ int value;
+ Dummy() : value(0) {}
+ Dummy(int _v) : value(_v) {}
+ };
+
+ void constraints() {
+ checkConcept<MappableGraphComponent<Base>, _Graph>();
+
+ { // int map test
+ typedef typename _Graph::template UEdgeMap<int> IntUEdgeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::UEdge, int>,
+ IntUEdgeMap >();
+ } { // bool map test
+ typedef typename _Graph::template UEdgeMap<bool> BoolUEdgeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::UEdge, bool>,
+ BoolUEdgeMap >();
+ } { // Dummy map test
+ typedef typename _Graph::template UEdgeMap<Dummy> DummyUEdgeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::UEdge, Dummy>,
+ DummyUEdgeMap >();
+ }
+ }
+
+ _Graph& graph;
+ };
+ };
+
+ /// \brief An empty mappable base bipartite undirected graph
+ /// class.
+ ///
+ /// This class provides beside the core graph features
+ /// map interface for the graph structure.
+ /// This concept is part of the BpUGraph concept.
+ template <typename _Base = BaseBpUGraphComponent>
+ class MappableBpUGraphComponent : public MappableUGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+
+ typedef MappableBpUGraphComponent Graph;
+
+ /// \brief ReadWrite map of the A-nodes.
+ ///
+ /// ReadWrite map of the A-nodes.
+ ///
+ template <typename _Value>
+ class ANodeMap : public GraphMap<Graph, Node, _Value> {
+ public:
+ typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
+
+ /// \brief Construct a new map.
+ ///
+ /// Construct a new map for the graph.
+ explicit ANodeMap(const MappableBpUGraphComponent& graph)
+ : Parent(graph) {}
+
+ /// \brief Construct a new map with default value.
+ ///
+ /// Construct a new map for the graph and initalise the values.
+ ANodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ /// \brief Copy constructor.
+ ///
+ /// Copy Constructor.
+ ANodeMap(const ANodeMap& nm) : Parent(nm) {}
+
+ /// \brief Assign operator.
+ ///
+ /// Assign operator.
+ template <typename CMap>
+ ANodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, _Value>, CMap>();
+ return *this;
+ }
+
+ };
+
+ /// \brief ReadWrite map of the B-nodes.
+ ///
+ /// ReadWrite map of the A-nodes.
+ ///
+ template <typename _Value>
+ class BNodeMap : public GraphMap<Graph, Node, _Value> {
+ public:
+ typedef GraphMap<MappableBpUGraphComponent, Node, _Value> Parent;
+
+ /// \brief Construct a new map.
+ ///
+ /// Construct a new map for the graph.
+ explicit BNodeMap(const MappableBpUGraphComponent& graph)
+ : Parent(graph) {}
+
+ /// \brief Construct a new map with default value.
+ ///
+ /// Construct a new map for the graph and initalise the values.
+ BNodeMap(const MappableBpUGraphComponent& graph, const _Value& value)
+ : Parent(graph, value) {}
+
+ /// \brief Copy constructor.
+ ///
+ /// Copy Constructor.
+ BNodeMap(const BNodeMap& nm) : Parent(nm) {}
+
+ /// \brief Assign operator.
+ ///
+ /// Assign operator.
+ template <typename CMap>
+ BNodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, _Value>, CMap>();
+ return *this;
+ }
+
+ };
+
+
+ template <typename _Graph>
+ struct Constraints {
+
+ struct Dummy {
+ int value;
+ Dummy() : value(0) {}
+ Dummy(int _v) : value(_v) {}
+ };
+
+ void constraints() {
+ checkConcept<MappableUGraphComponent<Base>, _Graph>();
+
+ { // int map test
+ typedef typename _Graph::template ANodeMap<int> IntANodeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::ANode, int>,
+ IntANodeMap >();
+ } { // bool map test
+ typedef typename _Graph::template ANodeMap<bool> BoolANodeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::ANode, bool>,
+ BoolANodeMap >();
+ } { // Dummy map test
+ typedef typename _Graph::template ANodeMap<Dummy> DummyANodeMap;
+ checkConcept<GraphMap<_Graph, typename _Graph::ANode, Dummy>,
+ DummyANodeMap >();
+ }
+ }
+
+ _Graph& graph;
+ };
+ };
+
+
+ /// \brief An empty extendable graph class.
+ ///
+ /// This class provides beside the core graph features graph
+ /// extendable interface for the graph structure. The main
+ /// difference between the base and this interface is that the
+ /// graph alterations should handled already on this level.
+ template <typename _Base = BaseGraphComponent>
+ class ExtendableGraphComponent : public _Base {
+ public:
+ typedef _Base Base;
+
+ typedef typename _Base::Node Node;
+ typedef typename _Base::Edge Edge;
+
+ /// \brief Adds a new node to the graph.
+ ///
+ /// Adds a new node to the graph.
+ ///
+ Node addNode() {
+ return INVALID;
+ }
+
+ /// \brief Adds a new edge connects the given two nodes.
+ ///
+ /// Adds a new edge connects the the given two nodes.
+ Edge addEdge(const Node&, const Node&) {
+ return INVALID;
+ }
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<Base, _Graph>();
+ typename _Graph::Node node_a, node_b;
+ node_a = graph.addNode();
+ node_b = graph.addNode();
+ typename _Graph::Edge edge;
+ edge = graph.addEdge(node_a, node_b);
+ }
+
+ _Graph& graph;
+ };
+ };
+
+ /// \brief An empty extendable base undirected graph class.
+ ///
+ /// This class provides beside the core undirected graph features
+ /// core undircted graph extend interface for the graph structure.
+ /// The main difference between the base and this interface is
+ /// that the graph alterations should handled already on this
+ /// level.
+ template <typename _Base = BaseUGraphComponent>
+ class ExtendableUGraphComponent : public _Base {
+ public:
+
+ typedef _Base Base;
+ typedef typename _Base::Node Node;
+ typedef typename _Base::UEdge UEdge;
+
+ /// \brief Adds a new node to the graph.
+ ///
+ /// Adds a new node to the graph.
+ ///
+ Node addNode() {
+ return INVALID;
+ }
+
+ /// \brief Adds a new edge connects the given two nodes.
+ ///
+ /// Adds a new edge connects the the given two nodes.
+ UEdge addEdge(const Node&, const Node&) {
+ return INVALID;
+ }
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<Base, _Graph>();
+ typename _Graph::Node node_a, node_b;
+ node_a = graph.addNode();
+ node_b = graph.addNode();
+ typename _Graph::UEdge uedge;
+ uedge = graph.addUEdge(node_a, node_b);
+ }
+
+ _Graph& graph;
+ };
+ };
+
+ /// \brief An empty extendable base undirected graph class.
+ ///
+ /// This class provides beside the core bipartite undirected graph
+ /// features core undircted graph extend interface for the graph
+ /// structure. The main difference between the base and this
+ /// interface is that the graph alterations should handled already
+ /// on this level.
+ template <typename _Base = BaseBpUGraphComponent>
+ class ExtendableBpUGraphComponent
+ : public ExtendableUGraphComponent<_Base> {
+
+ typedef _Base Base;
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<ExtendableUGraphComponent<Base>, _Graph>();
+ }
+ };
+ };
+
+ /// \brief An empty erasable graph class.
+ ///
+ /// This class provides beside the core graph features core erase
+ /// functions for the graph structure. The main difference between
+ /// the base and this interface is that the graph alterations
+ /// should handled already on this level.
+ template <typename _Base = BaseGraphComponent>
+ class ErasableGraphComponent : public _Base {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::Edge Edge;
+
+ /// \brief Erase a node from the graph.
+ ///
+ /// Erase a node from the graph. This function should
+ /// erase all edges connecting to the node.
+ void erase(const Node&) {}
+
+ /// \brief Erase an edge from the graph.
+ ///
+ /// Erase an edge from the graph.
+ ///
+ void erase(const Edge&) {}
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<Base, _Graph>();
+ typename _Graph::Node node;
+ graph.erase(node);
+ typename _Graph::Edge edge;
+ graph.erase(edge);
+ }
+
+ _Graph& graph;
+ };
+ };
+
+ /// \brief An empty erasable base undirected graph class.
+ ///
+ /// This class provides beside the core undirected graph features
+ /// core erase functions for the undirceted graph structure. The
+ /// main difference between the base and this interface is that
+ /// the graph alterations should handled already on this level.
+ template <typename _Base = BaseUGraphComponent>
+ class ErasableUGraphComponent : public _Base {
+ public:
+
+ typedef _Base Base;
+ typedef typename Base::Node Node;
+ typedef typename Base::UEdge UEdge;
+
+ /// \brief Erase a node from the graph.
+ ///
+ /// Erase a node from the graph. This function should erase
+ /// edges connecting to the node.
+ void erase(const Node&) {}
+
+ /// \brief Erase an edge from the graph.
+ ///
+ /// Erase an edge from the graph.
+ ///
+ void erase(const UEdge&) {}
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<Base, _Graph>();
+ typename _Graph::Node node;
+ graph.erase(node);
+ typename _Graph::Edge edge;
+ graph.erase(edge);
+ }
+
+ _Graph& graph;
+ };
+ };
+
+ /// \brief An empty erasable base bipartite undirected graph class.
+ ///
+ /// This class provides beside the core bipartite undirected graph
+ /// features core erase functions for the undirceted graph
+ /// structure. The main difference between the base and this
+ /// interface is that the graph alterations should handled already
+ /// on this level.
+ template <typename _Base = BaseBpUGraphComponent>
+ class ErasableBpUGraphComponent : public ErasableUGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<ErasableUGraphComponent<Base>, _Graph>();
+ }
+ };
+ };
+
+ /// \brief An empty clearable base graph class.
+ ///
+ /// This class provides beside the core graph features core clear
+ /// functions for the graph structure. The main difference between
+ /// the base and this interface is that the graph alterations
+ /// should handled already on this level.
+ template <typename _Base = BaseGraphComponent>
+ class ClearableGraphComponent : public _Base {
+ public:
+
+ typedef _Base Base;
+
+ /// \brief Erase all nodes and edges from the graph.
+ ///
+ /// Erase all nodes and edges from the graph.
+ ///
+ void clear() {}
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<Base, _Graph>();
+ graph.clear();
+ }
+
+ _Graph graph;
+ };
+ };
+
+ /// \brief An empty clearable base undirected graph class.
+ ///
+ /// This class provides beside the core undirected graph features
+ /// core clear functions for the undirected graph structure. The
+ /// main difference between the base and this interface is that
+ /// the graph alterations should handled already on this level.
+ template <typename _Base = BaseUGraphComponent>
+ class ClearableUGraphComponent : public ClearableGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<ClearableUGraphComponent<Base>, _Graph>();
+ }
+
+ _Graph graph;
+ };
+ };
+
+ /// \brief An empty clearable base bipartite undirected graph
+ /// class.
+ ///
+ /// This class provides beside the core bipartite undirected graph
+ /// features core clear functions for the undirected graph
+ /// structure. The main difference between the base and this
+ /// interface is that the graph alterations should handled already
+ /// on this level.
+ template <typename _Base = BaseUGraphComponent>
+ class ClearableBpUGraphComponent : public ClearableUGraphComponent<_Base> {
+ public:
+
+ typedef _Base Base;
+
+ template <typename _Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<ClearableBpUGraphComponent<Base>, _Graph>();
+ }
+
+ };
+
+ };
+
+ }
+
+}
+
+#endif
diff --git a/src/lemon/concepts/heap.h b/src/lemon/concepts/heap.h
new file mode 100644
index 0000000..90e8cc0
--- /dev/null
+++ b/src/lemon/concepts/heap.h
@@ -0,0 +1,226 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+///\ingroup concept
+///\file
+///\brief Classes for representing heaps.
+///
+
+#ifndef LEMON_CONCEPT_HEAP_H
+#define LEMON_CONCEPT_HEAP_H
+
+#include <lemon/bits/invalid.h>
+
+namespace lemon {
+ namespace concepts {
+ /// \addtogroup concept
+ /// @{
+
+
+ /// \brief A concept structure describes the main interface of heaps.
+ ///
+ /// A concept structure describes the main interface of heaps.
+ ///
+ template <typename Prio, typename ItemIntMap>
+ class Heap {
+ public:
+
+ ///\brief Type of the items stored in the heap.
+ typedef typename ItemIntMap::Key Item;
+
+
+ /// \brief Type to represent the items states.
+ ///
+ /// Each Item element have a state associated to it. It may be "in heap",
+ /// "pre heap" or "post heap". The later two are indifferent from the
+ /// heap's point of view, but may be useful to the user.
+ ///
+ /// The ItemIntMap _should_ be initialized in such way, that it maps
+ /// PRE_HEAP (-1) to any element to be put in the heap...
+ enum State {
+ IN_HEAP = 0,
+ PRE_HEAP = -1,
+ POST_HEAP = -2
+ };
+
+ /// \brief The constructor.
+ ///
+ /// The constructor.
+ /// \param _iim should be given to the constructor, since it is used
+ /// internally to handle the cross references. The value of the map
+ /// should be PRE_HEAP (-1) for each element.
+ explicit Heap(ItemIntMap &_iim) {}
+
+ /// \brief The number of items stored in the heap.
+ ///
+ /// Returns the number of items stored in the heap.
+ int size() const { return 0; }
+
+ /// \brief Checks if the heap stores no items.
+ ///
+ /// Returns \c true if and only if the heap stores no items.
+ bool empty() const { return false; }
+
+ /// \brief Makes empty this heap.
+ ///
+ /// Makes this heap empty.
+ void clear();
+
+ /// \brief Insert an item into the heap with the given heap.
+ ///
+ /// Adds \c i to the heap with priority \c p.
+ /// \param i The item to insert.
+ /// \param p The priority of the item.
+ void push(const Item &i, const Prio &p) {}
+
+ /// \brief Returns the item with minimum priority.
+ ///
+ /// This method returns the item with minimum priority.
+ /// \pre The heap must be nonempty.
+ Item top() const {}
+
+ /// \brief Returns the minimum priority.
+ ///
+ /// It returns the minimum priority.
+ /// \pre The heap must be nonempty.
+ Prio prio() const {}
+
+ /// \brief Deletes the item with minimum priority.
+ ///
+ /// This method deletes the item with minimum priority.
+ /// \pre The heap must be non-empty.
+ void pop() {}
+
+ /// \brief Deletes \c i from the heap.
+ ///
+ /// This method deletes item \c i from the heap, if \c i was
+ /// already stored in the heap.
+ /// \param i The item to erase.
+ void erase(const Item &i) {}
+
+ /// \brief Returns the priority of \c i.
+ ///
+ /// This function returns the priority of item \c i.
+ /// \pre \c i must be in the heap.
+ /// \param i The item.
+ Prio operator[](const Item &i) const {}
+
+ /// \brief \c i gets to the heap with priority \c p independently
+ /// if \c i was already there.
+ ///
+ /// This method calls \ref push(\c i, \c p) if \c i is not stored
+ /// in the heap and sets the priority of \c i to \c p otherwise.
+ /// It may throw an \e UnderFlowPriorityException.
+ /// \param i The item.
+ /// \param p The priority.
+ void set(const Item &i, const Prio &p) {}
+
+ /// \brief Decreases the priority of \c i to \c p.
+ ///
+ /// This method decreases the priority of item \c i to \c p.
+ /// \pre \c i must be stored in the heap with priority at least \c p.
+ /// \param i The item.
+ /// \param p The priority.
+ void decrease(const Item &i, const Prio &p) {}
+
+ /// \brief Increases the priority of \c i to \c p.
+ ///
+ /// This method sets the priority of item \c i to \c p.
+ /// \pre \c i must be stored in the heap with priority at most \c
+ /// p relative to \c Compare.
+ /// \param i The item.
+ /// \param p The priority.
+ void increase(const Item &i, const Prio &p) {}
+
+ /// \brief Returns if \c item is in, has already been in, or has
+ /// never been in the heap.
+ ///
+ /// This method returns PRE_HEAP if \c item has never been in the
+ /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
+ /// otherwise. In the latter case it is possible that \c item will
+ /// get back to the heap again.
+ /// \param i The item.
+ State state(const Item &i) const {}
+
+ /// \brief Sets the state of the \c item in the heap.
+ ///
+ /// Sets the state of the \c item in the heap. It can be used to
+ /// manually clear the heap when it is important to achive the
+ /// better time complexity.
+ /// \param i The item.
+ /// \param st The state. It should not be \c IN_HEAP.
+ void state(const Item& i, State st) {}
+
+
+ template <typename _Heap>
+ struct Constraints {
+ public:
+
+ void constraints() {
+ Item item;
+ Prio prio;
+
+ item=Item();
+ prio=Prio();
+
+ ignore_unused_variable_warning(item);
+ ignore_unused_variable_warning(prio);
+
+ typedef typename _Heap::State State;
+ State state;
+
+ ignore_unused_variable_warning(state);
+
+ _Heap heap1 = _Heap(map);
+
+ ignore_unused_variable_warning(heap1);
+
+ heap.push(item, prio);
+
+ prio = heap.prio();
+ item = heap.top();
+
+ heap.pop();
+
+ heap.set(item, prio);
+ heap.decrease(item, prio);
+ heap.increase(item, prio);
+ prio = heap[item];
+
+ heap.erase(item);
+
+ state = heap.state(item);
+
+ state = _Heap::PRE_HEAP;
+ state = _Heap::IN_HEAP;
+ state = _Heap::POST_HEAP;
+
+ heap.clear();
+ }
+
+ _Heap& heap;
+ ItemIntMap& map;
+
+ Constraints() : heap(0), map(0) {}
+ };
+ };
+
+ /// @}
+ } // namespace lemon
+}
+#endif // LEMON_CONCEPT_PATH_H
diff --git a/src/lemon/concepts/maps.h b/src/lemon/concepts/maps.h
new file mode 100644
index 0000000..6d7ace0
--- /dev/null
+++ b/src/lemon/concepts/maps.h
@@ -0,0 +1,208 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_CONCEPT_MAPS_H
+#define LEMON_CONCEPT_MAPS_H
+
+#include <lemon/bits/utility.h>
+#include <lemon/concept_check.h>
+
+///\ingroup concept
+///\file
+///\brief Map concepts checking classes for testing and documenting.
+
+namespace lemon {
+
+ namespace concepts {
+
+ /// \addtogroup concept
+ /// @{
+
+ /// Readable map concept
+
+ /// Readable map concept.
+ ///
+ template<typename K, typename T>
+ class ReadMap
+ {
+ public:
+ /// The key type of the map.
+ typedef K Key;
+ /// The value type of the map. (The type of objects associated with the keys).
+ typedef T Value;
+
+ /// Returns the value associated with a key.
+
+ /// Returns the value associated with a key.
+ /// \bug Value shouldn't need to be default constructible.
+ ///
+ Value operator[](const Key &) const {return Value();}
+
+ template<typename _ReadMap>
+ struct Constraints {
+
+ void constraints() {
+ Value val = m[key];
+ val = m[key];
+ typename _ReadMap::Value own_val = m[own_key];
+ own_val = m[own_key];
+
+ ignore_unused_variable_warning(val);
+ ignore_unused_variable_warning(own_val);
+ ignore_unused_variable_warning(key);
+ }
+ Key& key;
+ typename _ReadMap::Key& own_key;
+ _ReadMap& m;
+ };
+
+ };
+
+
+ /// Writable map concept
+
+ /// Writable map concept.
+ ///
+ template<typename K, typename T>
+ class WriteMap
+ {
+ public:
+ /// The key type of the map.
+ typedef K Key;
+ /// The value type of the map. (The type of objects associated with the keys).
+ typedef T Value;
+
+ /// Sets the value associated with a key.
+ void set(const Key &,const Value &) {}
+
+ ///Default constructor
+ WriteMap() {}
+
+ template <typename _WriteMap>
+ struct Constraints {
+ void constraints() {
+ // No constraints for constructor.
+ m.set(key, val);
+ m.set(own_key, own_val);
+ ignore_unused_variable_warning(key);
+ ignore_unused_variable_warning(val);
+ ignore_unused_variable_warning(own_key);
+ ignore_unused_variable_warning(own_val);
+ }
+
+ Value& val;
+ typename _WriteMap::Value own_val;
+ Key& key;
+ typename _WriteMap::Key& own_key;
+ _WriteMap& m;
+
+ };
+ };
+
+ /// Read/writable map concept
+
+ /// Read/writable map concept.
+ ///
+ template<typename K, typename T>
+ class ReadWriteMap : public ReadMap<K,T>,
+ public WriteMap<K,T>
+ {
+ public:
+ /// The key type of the map.
+ typedef K Key;
+ /// The value type of the map. (The type of objects associated with the keys).
+ typedef T Value;
+
+ /// Returns the value associated with a key.
+ Value operator[](const Key &) const {return Value();}
+ /// Sets the value associated with a key.
+ void set(const Key & ,const Value &) {}
+
+ template<typename _ReadWriteMap>
+ struct Constraints {
+ void constraints() {
+ checkConcept<ReadMap<K, T>, _ReadWriteMap >();
+ checkConcept<WriteMap<K, T>, _ReadWriteMap >();
+ }
+ };
+ };
+
+
+ ///Dereferable map concept
+
+ /// Dereferable map concept.
+ ///
+ /// \todo Rethink this concept.
+ template<typename K, typename T, typename R, typename CR>
+ class ReferenceMap : public ReadWriteMap<K,T>
+ {
+ public:
+ /// Tag for reference maps.
+ typedef True ReferenceMapTag;
+ /// The key type of the map.
+ typedef K Key;
+ /// The value type of the map. (The type of objects associated with the keys).
+ typedef T Value;
+ /// The reference type of the map.
+ typedef R Reference;
+ /// The const reference type of the map.
+ typedef CR ConstReference;
+
+ protected:
+ Value tmp;
+ public:
+
+ ///Returns a reference to the value associated with a key.
+ Reference operator[](const Key &) { return tmp; }
+ ///Returns a const reference to the value associated with a key.
+ ConstReference operator[](const Key &) const { return tmp; }
+ /// Sets the value associated with a key.
+ void set(const Key &k,const Value &t) { operator[](k)=t; }
+
+ template<typename _ReferenceMap>
+ struct Constraints {
+
+ void constraints() {
+ checkConcept<ReadWriteMap<K, T>, _ReferenceMap >();
+ m[key] = val;
+ val = m[key];
+ m[key] = ref;
+ ref = m[key];
+ m[own_key] = own_val;
+ own_val = m[own_key];
+ m[own_key] = own_ref;
+ own_ref = m[own_key];
+ }
+
+ typename _ReferenceMap::Key& own_key;
+ typename _ReferenceMap::Value& own_val;
+ typename _ReferenceMap::Reference own_ref;
+ Key& key;
+ Value& val;
+ Reference ref;
+ _ReferenceMap& m;
+ };
+ };
+
+ // @}
+
+ } //namespace concepts
+
+} //namespace lemon
+
+#endif // LEMON_CONCEPT_MAPS_H
diff --git a/src/lemon/concepts/matrix_maps.h b/src/lemon/concepts/matrix_maps.h
new file mode 100644
index 0000000..07943e9
--- /dev/null
+++ b/src/lemon/concepts/matrix_maps.h
@@ -0,0 +1,207 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_CONCEPT_MATRIX_MAPS_H
+#define LEMON_CONCEPT_MATRIX_MAPS_H
+
+#include <lemon/bits/utility.h>
+#include <lemon/concept_check.h>
+
+///\ingroup concept
+///\file
+///\brief MatrixMap concepts checking classes for testing and documenting.
+
+namespace lemon {
+
+ namespace concepts {
+
+ /// \addtogroup concept
+ /// @{
+
+ /// Readable matrix map concept
+ template <typename K1, typename K2, typename V>
+ class ReadMatrixMap
+ {
+ public:
+ /// Map's first key type.
+ typedef K1 FirstKey;
+ /// Map's second key type.
+ typedef K2 SecondKey;
+ /// \brief Map's value type.
+ /// (The type of objects associated with the pairs of keys).
+ typedef V Value;
+
+ // \bug Value don't need to be default constructible.
+ /// Returns the value associated with a key.
+ Value operator()(const FirstKey&, const SecondKey&) const {
+ return Value();
+ }
+
+ template <typename _ReadMatrixMap>
+ struct Constraints {
+
+ void constraints() {
+ Value val = m(first_key, second_key);
+ val = m(first_key, second_key);
+ typename _ReadMatrixMap::Value own_val =
+ m(own_first_key, own_second_key);
+ own_val = m(own_first_key, own_second_key);
+ ignore_unused_variable_warning(val);
+ ignore_unused_variable_warning(own_val);
+ }
+
+ FirstKey& first_key;
+ SecondKey& second_key;
+ typename _ReadMatrixMap::FirstKey& own_first_key;
+ typename _ReadMatrixMap::SecondKey& own_second_key;
+ _ReadMatrixMap& m;
+ };
+
+ };
+
+
+ /// Writable map concept
+ template <typename K1, typename K2, typename V>
+ class WriteMatrixMap {
+ public:
+ /// Map's first key type.
+ typedef K1 FirstKey;
+ /// Map's second key type.
+ typedef K2 SecondKey;
+ /// \brief Map's value type.
+ /// (The type of objects associated with the pairs of keys).
+ typedef V Value;
+
+ /// Sets the value associated with the pair of keys.
+ void set(const FirstKey&, const SecondKey& ,const Value&) {}
+
+ template <typename _WriteMatrixMap>
+ struct Constraints {
+ void constraints() {
+ // No constraints for constructor.
+ m.set(first_key, second_key, val);
+ m.set(own_first_key, own_second_key, own_val);
+ }
+
+ Value& val;
+ typename _WriteMatrixMap::Value own_val;
+ FirstKey& first_key;
+ SecondKey& second_key;
+ typename _WriteMatrixMap::FirstKey& own_first_key;
+ typename _WriteMatrixMap::SecondKey& own_second_key;
+ _WriteMatrixMap& m;
+
+ };
+ };
+
+ ///Read/Writable map concept
+ template<typename K1, typename K2, typename V>
+ class ReadWriteMatrixMap
+ : public ReadMatrixMap<K1, K2, V>, public WriteMatrixMap<K1, K2, V> {
+ public:
+ /// Map's first key type.
+ typedef K1 FirstKey;
+ /// Map's second key type.
+ typedef K2 SecondKey;
+ /// \brief Map's value type.
+ /// (The type of objects associated with the pairs of keys).
+ typedef V Value;
+
+ /// Returns the value associated with a pair of keys.
+ Value operator()(const FirstKey&, const SecondKey&) const {
+ return Value();
+ }
+ /// Sets the value associated with the pair of keys.
+ void set(const FirstKey&, const SecondKey& ,const Value&) {}
+
+ template<typename _ReadWriteMatrixMap>
+ struct Constraints {
+ void constraints() {
+ checkConcept<ReadMatrixMap<K1, K2, V>, _ReadWriteMatrixMap >();
+ checkConcept<WriteMatrixMap<K1, K2, V>, _ReadWriteMatrixMap >();
+ }
+ };
+ };
+
+
+ ///Dereferable matrix map concept
+ template<typename K1, typename K2, typename V, typename R, typename CR>
+ class ReferenceMatrixMap : public ReadWriteMatrixMap<K1, K2, V>
+ {
+ public:
+ /// Tag for reference maps.
+ typedef True ReferenceMapTag;
+ /// Map's first key type.
+ typedef K1 FirstKey;
+ /// Map's second key type.
+ typedef K1 SecondKey;
+ /// Map's value type. (The type of objects associated with the keys).
+ typedef V Value;
+ /// Map's reference type.
+ typedef R Reference;
+ /// Map's const reference type.
+ typedef CR ConstReference;
+
+ protected:
+ Value tmp;
+ public:
+
+ ///Returns a reference to the value associated to a pair of keys.
+ Reference operator()(const FirstKey&, const SecondKey&) {
+ return tmp;
+ }
+ ///Returns a const reference to the value associated to a pair of keys.
+ ConstReference operator()(const FirstKey&, const SecondKey&) const {
+ return tmp;
+ }
+ /// Sets the value associated with the pair of keys.
+ void set(const FirstKey&, const SecondKey& ,const Value&) {}
+
+ // \todo rethink this concept
+ template<typename _ReferenceMatrixMap>
+ struct ReferenceMapConcept {
+
+ void constraints() {
+ checkConcept<ReadWriteMatrixMap, _ReferenceMatrixMap >();
+ m(first_key, second_key) = val;
+ val = m(first_key, second_key);
+ m(first_key, second_key) = ref;
+ ref = m(first_key, second_key);
+ m(own_first_key, own_second_key) = own_val;
+ own_val = m(own_first_key, own_second_key);
+ m(own_first_key, own_second_key) = own_ref;
+ own_ref = m(own_first_key, own_second_key);
+ }
+
+ typename _ReferenceMatrixMap::Key& own_first_key;
+ typename _ReferenceMatrixMap::Key& own_second_key;
+ typename _ReferenceMatrixMap::Value& own_val;
+ typename _ReferenceMatrixMap::Reference& own_ref;
+ FirstKey& first_key;
+ SecondKey& second_key;
+ Value& val;
+ Reference& ref;
+ _ReferenceMatrixMap& m;
+ };
+ };
+
+ // @}
+
+ } //namespace concepts
+} //namespace lemon
+#endif // LEMON_CONCEPT_MATRIX_MAPS_H
diff --git a/src/lemon/concepts/path.h b/src/lemon/concepts/path.h
new file mode 100644
index 0000000..d881d0a
--- /dev/null
+++ b/src/lemon/concepts/path.h
@@ -0,0 +1,307 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+///\ingroup concept
+///\file
+///\brief Classes for representing paths in graphs.
+///
+///\todo Iterators have obsolete style
+
+#ifndef LEMON_CONCEPT_PATH_H
+#define LEMON_CONCEPT_PATH_H
+
+#include <lemon/bits/invalid.h>
+#include <lemon/bits/utility.h>
+#include <lemon/concept_check.h>
+
+namespace lemon {
+ namespace concepts {
+
+ /// \addtogroup concept
+ /// @{
+
+ /// \brief A skeleton structure for representing directed paths in
+ /// a graph.
+ ///
+ /// A skeleton structure for representing directed paths in a
+ /// graph.
+ /// \param _Graph The graph type in which the path is.
+ ///
+ /// In a sense, the path can be treated as a list of edges. The
+ /// lemon path type stores just this list. As a consequence it
+ /// cannot enumerate the nodes in the path and the zero length
+ /// paths cannot store the source.
+ ///
+ template <typename _Graph>
+ class Path {
+ public:
+
+ /// Type of the underlying graph.
+ typedef _Graph Graph;
+ /// Edge type of the underlying graph.
+ typedef typename Graph::Edge Edge;
+
+ class EdgeIt;
+
+ /// \brief Default constructor
+ Path() {}
+
+ /// \brief Template constructor
+ template <typename CPath>
+ Path(const CPath& cpath) {}
+
+ /// \brief Template assigment
+ template <typename CPath>
+ Path& operator=(const CPath& cpath) {}
+
+ /// Length of the path ie. the number of edges in the path.
+ int length() const { return 0;}
+
+ /// Returns whether the path is empty.
+ bool empty() const { return true;}
+
+ /// Resets the path to an empty path.
+ void clear() {}
+
+ /// \brief Lemon style iterator for path edges
+ ///
+ /// This class is used to iterate on the edges of the paths.
+ class EdgeIt {
+ public:
+ /// Default constructor
+ EdgeIt() {}
+ /// Invalid constructor
+ EdgeIt(Invalid) {}
+ /// Constructor for first edge
+ EdgeIt(const Path &) {}
+
+ /// Conversion to Edge
+ operator Edge() const { return INVALID; }
+
+ /// Next edge
+ EdgeIt& operator++() {return *this;}
+
+ /// Comparison operator
+ bool operator==(const EdgeIt&) const {return true;}
+ /// Comparison operator
+ bool operator!=(const EdgeIt&) const {return true;}
+ /// Comparison operator
+ bool operator<(const EdgeIt&) const {return false;}
+
+ };
+
+ template <typename _Path>
+ struct Constraints {
+ void constraints() {
+ Path<Graph> pc;
+ _Path p, pp(pc);
+ int l = p.length();
+ int e = p.empty();
+ p.clear();
+
+ p = pc;
+
+ typename _Path::EdgeIt id, ii(INVALID), i(p);
+
+ ++i;
+ typename Graph::Edge ed = i;
+
+ e = (i == ii);
+ e = (i != ii);
+ e = (i < ii);
+
+ ignore_unused_variable_warning(l);
+ ignore_unused_variable_warning(pp);
+ ignore_unused_variable_warning(e);
+ ignore_unused_variable_warning(id);
+ ignore_unused_variable_warning(ii);
+ ignore_unused_variable_warning(ed);
+ }
+ };
+
+ };
+
+ namespace _path_bits {
+
+ template <typename _Graph, typename _Path, typename RevPathTag = void>
+ struct PathDumperConstraints {
+ void constraints() {
+ int l = p.length();
+ int e = p.empty();
+
+ typename _Path::EdgeIt id, i(p);
+
+ ++i;
+ typename _Graph::Edge ed = i;
+
+ e = (i == INVALID);
+ e = (i != INVALID);
+
+ ignore_unused_variable_warning(l);
+ ignore_unused_variable_warning(e);
+ ignore_unused_variable_warning(id);
+ ignore_unused_variable_warning(ed);
+ }
+ _Path& p;
+ };
+
+ template <typename _Graph, typename _Path>
+ struct PathDumperConstraints<
+ _Graph, _Path,
+ typename enable_if<typename _Path::RevPathTag, void>::type
+ > {
+ void constraints() {
+ int l = p.length();
+ int e = p.empty();
+
+ typename _Path::RevEdgeIt id, i(p);
+
+ ++i;
+ typename _Graph::Edge ed = i;
+
+ e = (i == INVALID);
+ e = (i != INVALID);
+
+ ignore_unused_variable_warning(l);
+ ignore_unused_variable_warning(e);
+ ignore_unused_variable_warning(id);
+ ignore_unused_variable_warning(ed);
+ }
+ _Path& p;
+ };
+
+ }
+
+
+ /// \brief A skeleton structure for path dumpers.
+ ///
+ /// A skeleton structure for path dumpers. The path dumpers are
+ /// the generalization of the paths. The path dumpers can
+ /// enumerate the edges of the path wheter in forward or in
+ /// backward order. In most time these classes are not used
+ /// directly rather it used to assign a dumped class to a real
+ /// path type.
+ ///
+ /// The main purpose of this concept is that the shortest path
+ /// algorithms can enumerate easily the edges in reverse order.
+ /// If we would like to give back a real path from these
+ /// algorithms then we should create a temporarly path object. In
+ /// Lemon such algorithms gives back a path dumper what can
+ /// assigned to a real path and the dumpers can be implemented as
+ /// an adaptor class to the predecessor map.
+
+ /// \param _Graph The graph type in which the path is.
+ ///
+ /// The paths can be constructed from any path type by a
+ /// template constructor or a template assignment operator.
+ ///
+ template <typename _Graph>
+ class PathDumper {
+ public:
+
+ /// Type of the underlying graph.
+ typedef _Graph Graph;
+ /// Edge type of the underlying graph.
+ typedef typename Graph::Edge Edge;
+
+ /// Length of the path ie. the number of edges in the path.
+ int length() const { return 0;}
+
+ /// Returns whether the path is empty.
+ bool empty() const { return true;}
+
+ /// \brief Forward or reverse dumping
+ ///
+ /// If the RevPathTag is defined and true then reverse dumping
+ /// is provided in the path dumper. In this case instead of the
+ /// EdgeIt the RevEdgeIt iterator should be implemented in the
+ /// dumper.
+ typedef False RevPathTag;
+
+ /// \brief Lemon style iterator for path edges
+ ///
+ /// This class is used to iterate on the edges of the paths.
+ class EdgeIt {
+ public:
+ /// Default constructor
+ EdgeIt() {}
+ /// Invalid constructor
+ EdgeIt(Invalid) {}
+ /// Constructor for first edge
+ EdgeIt(const PathDumper&) {}
+
+ /// Conversion to Edge
+ operator Edge() const { return INVALID; }
+
+ /// Next edge
+ EdgeIt& operator++() {return *this;}
+
+ /// Comparison operator
+ bool operator==(const EdgeIt&) const {return true;}
+ /// Comparison operator
+ bool operator!=(const EdgeIt&) const {return true;}
+ /// Comparison operator
+ bool operator<(const EdgeIt&) const {return false;}
+
+ };
+
+ /// \brief Lemon style iterator for path edges
+ ///
+ /// This class is used to iterate on the edges of the paths in
+ /// reverse direction.
+ class RevEdgeIt {
+ public:
+ /// Default constructor
+ RevEdgeIt() {}
+ /// Invalid constructor
+ RevEdgeIt(Invalid) {}
+ /// Constructor for first edge
+ RevEdgeIt(const PathDumper &) {}
+
+ /// Conversion to Edge
+ operator Edge() const { return INVALID; }
+
+ /// Next edge
+ RevEdgeIt& operator++() {return *this;}
+
+ /// Comparison operator
+ bool operator==(const RevEdgeIt&) const {return true;}
+ /// Comparison operator
+ bool operator!=(const RevEdgeIt&) const {return true;}
+ /// Comparison operator
+ bool operator<(const RevEdgeIt&) const {return false;}
+
+ };
+
+ template <typename _Path>
+ struct Constraints {
+ void constraints() {
+ function_requires<_path_bits::
+ PathDumperConstraints<Graph, _Path> >();
+ }
+ };
+
+ };
+
+
+ ///@}
+ }
+
+} // namespace lemon
+
+#endif // LEMON_CONCEPT_PATH_H
diff --git a/src/lemon/concepts/ugraph.h b/src/lemon/concepts/ugraph.h
new file mode 100644
index 0000000..7b0e8be
--- /dev/null
+++ b/src/lemon/concepts/ugraph.h
@@ -0,0 +1,702 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+///\ingroup graph_concepts
+///\file
+///\brief The concept of Undirected Graphs.
+
+#ifndef LEMON_CONCEPT_UGRAPH_H
+#define LEMON_CONCEPT_UGRAPH_H
+
+#include <lemon/concepts/graph_components.h>
+#include <lemon/concepts/graph.h>
+#include <lemon/bits/utility.h>
+
+namespace lemon {
+ namespace concepts {
+
+ /// \ingroup graph_concepts
+ ///
+ /// \brief Class describing the concept of Undirected Graphs.
+ ///
+ /// This class describes the common interface of all Undirected
+ /// Graphs.
+ ///
+ /// As all concept describing classes it provides only interface
+ /// without any sensible implementation. So any algorithm for
+ /// undirected graph should compile with this class, but it will not
+ /// run properly, of course.
+ ///
+ /// The LEMON undirected graphs also fulfill the concept of
+ /// directed graphs (\ref lemon::concepts::Graph "Graph
+ /// Concept"). Each undirected edges can be seen as two opposite
+ /// directed edge and consequently the undirected graph can be
+ /// seen as the direceted graph of these directed edges. The
+ /// UGraph has the UEdge inner class for the undirected edges and
+ /// the Edge type for the directed edges. The Edge type is
+ /// convertible to UEdge or inherited from it so from a directed
+ /// edge we can get the represented undirected edge.
+ ///
+ /// In the sense of the LEMON each undirected edge has a default
+ /// direction (it should be in every computer implementation,
+ /// because the order of undirected edge's nodes defines an
+ /// orientation). With the default orientation we can define that
+ /// the directed edge is forward or backward directed. With the \c
+ /// direction() and \c direct() function we can get the direction
+ /// of the directed edge and we can direct an undirected edge.
+ ///
+ /// The UEdgeIt is an iterator for the undirected edges. We can use
+ /// the UEdgeMap to map values for the undirected edges. The InEdgeIt and
+ /// OutEdgeIt iterates on the same undirected edges but with opposite
+ /// direction. The IncEdgeIt iterates also on the same undirected edges
+ /// as the OutEdgeIt and InEdgeIt but it is not convertible to Edge just
+ /// to UEdge.
+ class UGraph {
+ public:
+ /// \brief The undirected graph should be tagged by the
+ /// UndirectedTag.
+ ///
+ /// The undirected graph should be tagged by the UndirectedTag. This
+ /// tag helps the enable_if technics to make compile time
+ /// specializations for undirected graphs.
+ typedef True UndirectedTag;
+
+ /// \brief The base type of node iterators,
+ /// or in other words, the trivial node iterator.
+ ///
+ /// This is the base type of each node iterator,
+ /// thus each kind of node iterator converts to this.
+ /// More precisely each kind of node iterator should be inherited
+ /// from the trivial node iterator.
+ class Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Node() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ Node(const Node&) { }
+
+ /// Invalid constructor \& conversion.
+
+ /// This constructor initializes the iterator to be invalid.
+ /// \sa Invalid for more details.
+ Node(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(Node) const { return true; }
+
+ /// Inequality operator
+
+ /// \sa operator==(Node n)
+ ///
+ bool operator!=(Node) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(Node) const { return false; }
+
+ };
+
+ /// This iterator goes through each node.
+
+ /// This iterator goes through each node.
+ /// Its usage is quite simple, for example you can count the number
+ /// of nodes in graph \c g of type \c Graph like this:
+ ///\code
+ /// int count=0;
+ /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
+ ///\endcode
+ class NodeIt : public Node {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ NodeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ NodeIt(const NodeIt& n) : Node(n) { }
+ /// Invalid constructor \& conversion.
+
+ /// Initialize the iterator to be invalid.
+ /// \sa Invalid for more details.
+ NodeIt(Invalid) { }
+ /// Sets the iterator to the first node.
+
+ /// Sets the iterator to the first node of \c g.
+ ///
+ NodeIt(const UGraph&) { }
+ /// Node -> NodeIt conversion.
+
+ /// Sets the iterator to the node of \c the graph pointed by
+ /// the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ NodeIt(const UGraph&, const Node&) { }
+ /// Next node.
+
+ /// Assign the iterator to the next node.
+ ///
+ NodeIt& operator++() { return *this; }
+ };
+
+
+ /// The base type of the undirected edge iterators.
+
+ /// The base type of the undirected edge iterators.
+ ///
+ class UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ UEdge() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ UEdge(const UEdge&) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ UEdge(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(UEdge) const { return true; }
+ /// Inequality operator
+
+ /// \sa operator==(UEdge n)
+ ///
+ bool operator!=(UEdge) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(UEdge) const { return false; }
+ };
+
+ /// This iterator goes through each undirected edge.
+
+ /// This iterator goes through each undirected edge of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of undirected edges in a graph \c g of type \c Graph as follows:
+ ///\code
+ /// int count=0;
+ /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count;
+ ///\endcode
+ class UEdgeIt : public UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ UEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ UEdgeIt(const UEdgeIt& e) : UEdge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ UEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first undirected edge.
+
+ /// This constructor sets the iterator to the first undirected edge.
+ UEdgeIt(const UGraph&) { }
+ /// UEdge -> UEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the undirected edge-set, the iteration order is the
+ /// same.
+ UEdgeIt(const UGraph&, const UEdge&) { }
+ /// Next undirected edge
+
+ /// Assign the iterator to the next undirected edge.
+ UEdgeIt& operator++() { return *this; }
+ };
+
+ /// \brief This iterator goes trough the incident undirected
+ /// edges of a node.
+ ///
+ /// This iterator goes trough the incident undirected edges
+ /// of a certain node of a graph. You should assume that the
+ /// loop edges will be iterated twice.
+ ///
+ /// Its usage is quite simple, for example you can compute the
+ /// degree (i.e. count the number of incident edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///
+ ///\code
+ /// int count=0;
+ /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+ class IncEdgeIt : public UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ IncEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ IncEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to first incident edge.
+
+ /// This constructor set the iterator to the first incident edge of
+ /// the node.
+ IncEdgeIt(const UGraph&, const Node&) { }
+ /// UEdge -> IncEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ IncEdgeIt(const UGraph&, const UEdge&) { }
+ /// Next incident edge
+
+ /// Assign the iterator to the next incident edge
+ /// of the corresponding node.
+ IncEdgeIt& operator++() { return *this; }
+ };
+
+ /// The directed edge type.
+
+ /// The directed edge type. It can be converted to the
+ /// undirected edge or it should be inherited from the undirected
+ /// edge.
+ class Edge : public UEdge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Edge() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ Edge(const Edge& e) : UEdge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ Edge(Invalid) { }
+ /// Equality operator
+
+ /// Two iterators are equal if and only if they point to the
+ /// same object or both are invalid.
+ bool operator==(Edge) const { return true; }
+ /// Inequality operator
+
+ /// \sa operator==(Edge n)
+ ///
+ bool operator!=(Edge) const { return true; }
+
+ /// Artificial ordering operator.
+
+ /// To allow the use of graph descriptors as key type in std::map or
+ /// similar associative container we require this.
+ ///
+ /// \note This operator only have to define some strict ordering of
+ /// the items; this order has nothing to do with the iteration
+ /// ordering of the items.
+ bool operator<(Edge) const { return false; }
+
+ };
+ /// This iterator goes through each directed edge.
+
+ /// This iterator goes through each edge of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of edges in a graph \c g of type \c Graph as follows:
+ ///\code
+ /// int count=0;
+ /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
+ ///\endcode
+ class EdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ EdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ EdgeIt(const EdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ EdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first edge.
+
+ /// This constructor sets the iterator to the first edge of \c g.
+ ///@param g the graph
+ EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); }
+ /// Edge -> EdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ EdgeIt(const UGraph&, const Edge&) { }
+ ///Next edge
+
+ /// Assign the iterator to the next edge.
+ EdgeIt& operator++() { return *this; }
+ };
+
+ /// This iterator goes trough the outgoing directed edges of a node.
+
+ /// This iterator goes trough the \e outgoing edges of a certain node
+ /// of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of outgoing edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///\code
+ /// int count=0;
+ /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+
+ class OutEdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ OutEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ OutEdgeIt(const OutEdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ OutEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to the first outgoing edge.
+
+ /// This constructor sets the iterator to the first outgoing edge of
+ /// the node.
+ ///@param n the node
+ ///@param g the graph
+ OutEdgeIt(const UGraph& n, const Node& g) {
+ ignore_unused_variable_warning(n);
+ ignore_unused_variable_warning(g);
+ }
+ /// Edge -> OutEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ OutEdgeIt(const UGraph&, const Edge&) { }
+ ///Next outgoing edge
+
+ /// Assign the iterator to the next
+ /// outgoing edge of the corresponding node.
+ OutEdgeIt& operator++() { return *this; }
+ };
+
+ /// This iterator goes trough the incoming directed edges of a node.
+
+ /// This iterator goes trough the \e incoming edges of a certain node
+ /// of a graph.
+ /// Its usage is quite simple, for example you can count the number
+ /// of outgoing edges of a node \c n
+ /// in graph \c g of type \c Graph as follows.
+ ///\code
+ /// int count=0;
+ /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
+ ///\endcode
+
+ class InEdgeIt : public Edge {
+ public:
+ /// Default constructor
+
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ InEdgeIt() { }
+ /// Copy constructor.
+
+ /// Copy constructor.
+ ///
+ InEdgeIt(const InEdgeIt& e) : Edge(e) { }
+ /// Initialize the iterator to be invalid.
+
+ /// Initialize the iterator to be invalid.
+ ///
+ InEdgeIt(Invalid) { }
+ /// This constructor sets the iterator to first incoming edge.
+
+ /// This constructor set the iterator to the first incoming edge of
+ /// the node.
+ ///@param n the node
+ ///@param g the graph
+ InEdgeIt(const UGraph& g, const Node& n) {
+ ignore_unused_variable_warning(n);
+ ignore_unused_variable_warning(g);
+ }
+ /// Edge -> InEdgeIt conversion
+
+ /// Sets the iterator to the value of the trivial iterator \c e.
+ /// This feature necessitates that each time we
+ /// iterate the edge-set, the iteration order is the same.
+ InEdgeIt(const UGraph&, const Edge&) { }
+ /// Next incoming edge
+
+ /// Assign the iterator to the next inedge of the corresponding node.
+ ///
+ InEdgeIt& operator++() { return *this; }
+ };
+
+ /// \brief Read write map of the nodes to type \c T.
+ ///
+ /// ReadWrite map of the nodes to type \c T.
+ /// \sa Reference
+ template<class T>
+ class NodeMap : public ReadWriteMap< Node, T >
+ {
+ public:
+
+ ///\e
+ NodeMap(const UGraph&) { }
+ ///\e
+ NodeMap(const UGraph&, T) { }
+
+ ///Copy constructor
+ NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
+ ///Assignment operator
+ template <typename CMap>
+ NodeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Node, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// \brief Read write map of the directed edges to type \c T.
+ ///
+ /// Reference map of the directed edges to type \c T.
+ /// \sa Reference
+ template<class T>
+ class EdgeMap : public ReadWriteMap<Edge,T>
+ {
+ public:
+
+ ///\e
+ EdgeMap(const UGraph&) { }
+ ///\e
+ EdgeMap(const UGraph&, T) { }
+ ///Copy constructor
+ EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { }
+ ///Assignment operator
+ template <typename CMap>
+ EdgeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<Edge, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// Read write map of the undirected edges to type \c T.
+
+ /// Reference map of the edges to type \c T.
+ /// \sa Reference
+ template<class T>
+ class UEdgeMap : public ReadWriteMap<UEdge,T>
+ {
+ public:
+
+ ///\e
+ UEdgeMap(const UGraph&) { }
+ ///\e
+ UEdgeMap(const UGraph&, T) { }
+ ///Copy constructor
+ UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {}
+ ///Assignment operator
+ template <typename CMap>
+ UEdgeMap& operator=(const CMap&) {
+ checkConcept<ReadMap<UEdge, T>, CMap>();
+ return *this;
+ }
+ };
+
+ /// \brief Direct the given undirected edge.
+ ///
+ /// Direct the given undirected edge. The returned edge source
+ /// will be the given node.
+ Edge direct(const UEdge&, const Node&) const {
+ return INVALID;
+ }
+
+ /// \brief Direct the given undirected edge.
+ ///
+ /// Direct the given undirected edge. The returned edge
+ /// represents the given undirected edge and the direction comes
+ /// from the given bool. The source of the undirected edge and
+ /// the directed edge is the same when the given bool is true.
+ Edge direct(const UEdge&, bool) const {
+ return INVALID;
+ }
+
+ /// \brief Returns true if the edge has default orientation.
+ ///
+ /// Returns whether the given directed edge is same orientation as
+ /// the corresponding undirected edge's default orientation.
+ bool direction(Edge) const { return true; }
+
+ /// \brief Returns the opposite directed edge.
+ ///
+ /// Returns the opposite directed edge.
+ Edge oppositeEdge(Edge) const { return INVALID; }
+
+ /// \brief Opposite node on an edge
+ ///
+ /// \return the opposite of the given Node on the given UEdge
+ Node oppositeNode(Node, UEdge) const { return INVALID; }
+
+ /// \brief First node of the undirected edge.
+ ///
+ /// \return the first node of the given UEdge.
+ ///
+ /// Naturally undirected edges don't have direction and thus
+ /// don't have source and target node. But we use these two methods
+ /// to query the two nodes of the edge. The direction of the edge
+ /// which arises this way is called the inherent direction of the
+ /// undirected edge, and is used to define the "default" direction
+ /// of the directed versions of the edges.
+ /// \sa direction
+ Node source(UEdge) const { return INVALID; }
+
+ /// \brief Second node of the undirected edge.
+ Node target(UEdge) const { return INVALID; }
+
+ /// \brief Source node of the directed edge.
+ Node source(Edge) const { return INVALID; }
+
+ /// \brief Target node of the directed edge.
+ Node target(Edge) const { return INVALID; }
+
+ void first(Node&) const {}
+ void next(Node&) const {}
+
+ void first(UEdge&) const {}
+ void next(UEdge&) const {}
+
+ void first(Edge&) const {}
+ void next(Edge&) const {}
+
+ void firstOut(Edge&, Node) const {}
+ void nextOut(Edge&) const {}
+
+ void firstIn(Edge&, Node) const {}
+ void nextIn(Edge&) const {}
+
+
+ void firstInc(UEdge &, bool &, const Node &) const {}
+ void nextInc(UEdge &, bool &) const {}
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (the source in this case) of the iterator
+ Node baseNode(OutEdgeIt e) const {
+ return source(e);
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (the target in this case) of the
+ /// iterator
+ Node runningNode(OutEdgeIt e) const {
+ return target(e);
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node (the target in this case) of the iterator
+ Node baseNode(InEdgeIt e) const {
+ return target(e);
+ }
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node (the source in this case) of the
+ /// iterator
+ Node runningNode(InEdgeIt e) const {
+ return source(e);
+ }
+
+ /// \brief Base node of the iterator
+ ///
+ /// Returns the base node of the iterator
+ Node baseNode(IncEdgeIt) const {
+ return INVALID;
+ }
+
+ /// \brief Running node of the iterator
+ ///
+ /// Returns the running node of the iterator
+ Node runningNode(IncEdgeIt) const {
+ return INVALID;
+ }
+
+ template <typename Graph>
+ struct Constraints {
+ void constraints() {
+ checkConcept<IterableUGraphComponent<>, Graph>();
+ checkConcept<MappableUGraphComponent<>, Graph>();
+ }
+ };
+
+ };
+
+ }
+
+}
+
+#endif
diff --git a/src/lemon/dfs.h b/src/lemon/dfs.h
new file mode 100644
index 0000000..a003b69
--- /dev/null
+++ b/src/lemon/dfs.h
@@ -0,0 +1,1543 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_DFS_H
+#define LEMON_DFS_H
+
+///\ingroup search
+///\file
+///\brief Dfs algorithm.
+
+#include <lemon/list_graph.h>
+#include <lemon/graph_utils.h>
+#include <lemon/bits/path_dump.h>
+#include <lemon/bits/invalid.h>
+#include <lemon/error.h>
+#include <lemon/maps.h>
+
+#include <lemon/concept_check.h>
+
+namespace lemon {
+
+
+ ///Default traits class of Dfs class.
+
+ ///Default traits class of Dfs class.
+ ///\param GR Graph type.
+ template<class GR>
+ struct DfsDefaultTraits
+ {
+ ///The graph type the algorithm runs on.
+ typedef GR Graph;
+ ///\brief The type of the map that stores the last
+ ///edges of the %DFS paths.
+ ///
+ ///The type of the map that stores the last
+ ///edges of the %DFS paths.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef typename Graph::template NodeMap<typename GR::Edge> PredMap;
+ ///Instantiates a PredMap.
+
+ ///This function instantiates a \ref PredMap.
+ ///\param G is the graph, to which we would like to define the PredMap.
+ ///\todo The graph alone may be insufficient to initialize
+ static PredMap *createPredMap(const GR &G)
+ {
+ return new PredMap(G);
+ }
+
+ ///The type of the map that indicates which nodes are processed.
+
+ ///The type of the map that indicates which nodes are processed.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef NullMap<typename Graph::Node,bool> ProcessedMap;
+ ///Instantiates a ProcessedMap.
+
+ ///This function instantiates a \ref ProcessedMap.
+ ///\param g is the graph, to which
+ ///we would like to define the \ref ProcessedMap
+#ifdef DOXYGEN
+ static ProcessedMap *createProcessedMap(const GR &g)
+#else
+ static ProcessedMap *createProcessedMap(const GR &)
+#endif
+ {
+ return new ProcessedMap();
+ }
+ ///The type of the map that indicates which nodes are reached.
+
+ ///The type of the map that indicates which nodes are reached.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef typename Graph::template NodeMap<bool> ReachedMap;
+ ///Instantiates a ReachedMap.
+
+ ///This function instantiates a \ref ReachedMap.
+ ///\param G is the graph, to which
+ ///we would like to define the \ref ReachedMap.
+ static ReachedMap *createReachedMap(const GR &G)
+ {
+ return new ReachedMap(G);
+ }
+ ///The type of the map that stores the dists of the nodes.
+
+ ///The type of the map that stores the dists of the nodes.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef typename Graph::template NodeMap<int> DistMap;
+ ///Instantiates a DistMap.
+
+ ///This function instantiates a \ref DistMap.
+ ///\param G is the graph, to which we would like to define the \ref DistMap
+ static DistMap *createDistMap(const GR &G)
+ {
+ return new DistMap(G);
+ }
+ };
+
+ ///%DFS algorithm class.
+
+ ///\ingroup search
+ ///This class provides an efficient implementation of the %DFS algorithm.
+ ///
+ ///\param GR The graph type the algorithm runs on. The default value is
+ ///\ref ListGraph. The value of GR is not used directly by Dfs, it
+ ///is only passed to \ref DfsDefaultTraits.
+ ///\param TR Traits class to set various data types used by the algorithm.
+ ///The default traits class is
+ ///\ref DfsDefaultTraits "DfsDefaultTraits<GR>".
+ ///See \ref DfsDefaultTraits for the documentation of
+ ///a Dfs traits class.
+ ///
+ ///\author Jacint Szabo and Alpar Juttner
+#ifdef DOXYGEN
+ template <typename GR,
+ typename TR>
+#else
+ template <typename GR=ListGraph,
+ typename TR=DfsDefaultTraits<GR> >
+#endif
+ class Dfs {
+ public:
+ /**
+ * \brief \ref Exception for uninitialized parameters.
+ *
+ * This error represents problems in the initialization
+ * of the parameters of the algorithms.
+ */
+ class UninitializedParameter : public lemon::UninitializedParameter {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::Dfs::UninitializedParameter";
+ }
+ };
+
+ typedef TR Traits;
+ ///The type of the underlying graph.
+ typedef typename TR::Graph Graph;
+ ///\e
+ typedef typename Graph::Node Node;
+ ///\e
+ typedef typename Graph::NodeIt NodeIt;
+ ///\e
+ typedef typename Graph::Edge Edge;
+ ///\e
+ typedef typename Graph::OutEdgeIt OutEdgeIt;
+
+ ///\brief The type of the map that stores the last
+ ///edges of the %DFS paths.
+ typedef typename TR::PredMap PredMap;
+ ///The type of the map indicating which nodes are reached.
+ typedef typename TR::ReachedMap ReachedMap;
+ ///The type of the map indicating which nodes are processed.
+ typedef typename TR::ProcessedMap ProcessedMap;
+ ///The type of the map that stores the dists of the nodes.
+ typedef typename TR::DistMap DistMap;
+ private:
+ /// Pointer to the underlying graph.
+ const Graph *G;
+ ///Pointer to the map of predecessors edges.
+ PredMap *_pred;
+ ///Indicates if \ref _pred is locally allocated (\c true) or not.
+ bool local_pred;
+ ///Pointer to the map of distances.
+ DistMap *_dist;
+ ///Indicates if \ref _dist is locally allocated (\c true) or not.
+ bool local_dist;
+ ///Pointer to the map of reached status of the nodes.
+ ReachedMap *_reached;
+ ///Indicates if \ref _reached is locally allocated (\c true) or not.
+ bool local_reached;
+ ///Pointer to the map of processed status of the nodes.
+ ProcessedMap *_processed;
+ ///Indicates if \ref _processed is locally allocated (\c true) or not.
+ bool local_processed;
+
+ std::vector<typename Graph::OutEdgeIt> _stack;
+ int _stack_head;
+
+ ///Creates the maps if necessary.
+
+ ///\todo Better memory allocation (instead of new).
+ void create_maps()
+ {
+ if(!_pred) {
+ local_pred = true;
+ _pred = Traits::createPredMap(*G);
+ }
+ if(!_dist) {
+ local_dist = true;
+ _dist = Traits::createDistMap(*G);
+ }
+ if(!_reached) {
+ local_reached = true;
+ _reached = Traits::createReachedMap(*G);
+ }
+ if(!_processed) {
+ local_processed = true;
+ _processed = Traits::createProcessedMap(*G);
+ }
+ }
+
+ protected:
+
+ Dfs() {}
+
+ public:
+
+ typedef Dfs Create;
+
+ ///\name Named template parameters
+
+ ///@{
+
+ template <class T>
+ struct DefPredMapTraits : public Traits {
+ typedef T PredMap;
+ static PredMap *createPredMap(const Graph &G)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///PredMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting PredMap type
+ ///
+ template <class T>
+ struct DefPredMap : public Dfs<Graph, DefPredMapTraits<T> > {
+ typedef Dfs<Graph, DefPredMapTraits<T> > Create;
+ };
+
+
+ template <class T>
+ struct DefDistMapTraits : public Traits {
+ typedef T DistMap;
+ static DistMap *createDistMap(const Graph &)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///DistMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting DistMap
+ ///type
+ template <class T>
+ struct DefDistMap {
+ typedef Dfs<Graph, DefDistMapTraits<T> > Create;
+ };
+
+ template <class T>
+ struct DefReachedMapTraits : public Traits {
+ typedef T ReachedMap;
+ static ReachedMap *createReachedMap(const Graph &)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///ReachedMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting ReachedMap type
+ ///
+ template <class T>
+ struct DefReachedMap : public Dfs< Graph, DefReachedMapTraits<T> > {
+ typedef Dfs< Graph, DefReachedMapTraits<T> > Create;
+ };
+
+ template <class T>
+ struct DefProcessedMapTraits : public Traits {
+ typedef T ProcessedMap;
+ static ProcessedMap *createProcessedMap(const Graph &)
+ {
+ throw UninitializedParameter();
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter" for setting
+ ///ProcessedMap type
+ ///
+ ///\ref named-templ-param "Named parameter" for setting ProcessedMap type
+ ///
+ template <class T>
+ struct DefProcessedMap : public Dfs< Graph, DefProcessedMapTraits<T> > {
+ typedef Dfs< Graph, DefProcessedMapTraits<T> > Create;
+ };
+
+ struct DefGraphProcessedMapTraits : public Traits {
+ typedef typename Graph::template NodeMap<bool> ProcessedMap;
+ static ProcessedMap *createProcessedMap(const Graph &G)
+ {
+ return new ProcessedMap(G);
+ }
+ };
+ ///\brief \ref named-templ-param "Named parameter"
+ ///for setting the ProcessedMap type to be Graph::NodeMap<bool>.
+ ///
+ ///\ref named-templ-param "Named parameter"
+ ///for setting the ProcessedMap type to be Graph::NodeMap<bool>.
+ ///If you don't set it explicitely, it will be automatically allocated.
+ template <class T>
+ class DefProcessedMapToBeDefaultMap :
+ public Dfs< Graph, DefGraphProcessedMapTraits> {
+ typedef Dfs< Graph, DefGraphProcessedMapTraits> Create;
+ };
+
+ ///@}
+
+ public:
+
+ ///Constructor.
+
+ ///\param _G the graph the algorithm will run on.
+ ///
+ Dfs(const Graph& _G) :
+ G(&_G),
+ _pred(NULL), local_pred(false),
+ _dist(NULL), local_dist(false),
+ _reached(NULL), local_reached(false),
+ _processed(NULL), local_processed(false)
+ { }
+
+ ///Destructor.
+ ~Dfs()
+ {
+ if(local_pred) delete _pred;
+ if(local_dist) delete _dist;
+ if(local_reached) delete _reached;
+ if(local_processed) delete _processed;
+ }
+
+ ///Sets the map storing the predecessor edges.
+
+ ///Sets the map storing the predecessor edges.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destuctor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Dfs &predMap(PredMap &m)
+ {
+ if(local_pred) {
+ delete _pred;
+ local_pred=false;
+ }
+ _pred = &m;
+ return *this;
+ }
+
+ ///Sets the map storing the distances calculated by the algorithm.
+
+ ///Sets the map storing the distances calculated by the algorithm.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destuctor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Dfs &distMap(DistMap &m)
+ {
+ if(local_dist) {
+ delete _dist;
+ local_dist=false;
+ }
+ _dist = &m;
+ return *this;
+ }
+
+ ///Sets the map indicating if a node is reached.
+
+ ///Sets the map indicating if a node is reached.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destuctor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Dfs &reachedMap(ReachedMap &m)
+ {
+ if(local_reached) {
+ delete _reached;
+ local_reached=false;
+ }
+ _reached = &m;
+ return *this;
+ }
+
+ ///Sets the map indicating if a node is processed.
+
+ ///Sets the map indicating if a node is processed.
+ ///If you don't use this function before calling \ref run(),
+ ///it will allocate one. The destuctor deallocates this
+ ///automatically allocated map, of course.
+ ///\return <tt> (*this) </tt>
+ Dfs &processedMap(ProcessedMap &m)
+ {
+ if(local_processed) {
+ delete _processed;
+ local_processed=false;
+ }
+ _processed = &m;
+ return *this;
+ }
+
+ public:
+ ///\name Execution control
+ ///The simplest way to execute the algorithm is to use
+ ///one of the member functions called \c run(...).
+ ///\n
+ ///If you need more control on the execution,
+ ///first you must call \ref init(), then you can add a source node
+ ///with \ref addSource().
+ ///Finally \ref start() will perform the actual path
+ ///computation.
+
+ ///@{
+
+ ///Initializes the internal data structures.
+
+ ///Initializes the internal data structures.
+ ///
+ void init()
+ {
+ create_maps();
+ _stack.resize(countNodes(*G));
+ _stack_head=-1;
+ for ( NodeIt u(*G) ; u!=INVALID ; ++u ) {
+ _pred->set(u,INVALID);
+ // _predNode->set(u,INVALID);
+ _reached->set(u,false);
+ _processed->set(u,false);
+ }
+ }
+
+ ///Adds a new source node.
+
+ ///Adds a new source node to the set of nodes to be processed.
+ ///
+ ///\warning dists are wrong (or at least strange)
+ ///in case of multiple sources.
+ void addSource(Node s)
+ {
+ if(!(*_reached)[s])
+ {
+ _reached->set(s,true);
+ _pred->set(s,INVALID);
+ OutEdgeIt e(*G,s);
+ if(e!=INVALID) {
+ _stack[++_stack_head]=e;
+ _dist->set(s,_stack_head);
+ }
+ else {
+ _processed->set(s,true);
+ _dist->set(s,0);
+ }
+ }
+ }
+
+ ///Processes the next edge.
+
+ ///Processes the next edge.
+ ///
+ ///\return The processed edge.
+ ///
+ ///\pre The stack must not be empty!
+ Edge processNextEdge()
+ {
+ Node m;
+ Edge e=_stack[_stack_head];
+ if(!(*_reached)[m=G->target(e)]) {
+ _pred->set(m,e);
+ _reached->set(m,true);
+ ++_stack_head;
+ _stack[_stack_head] = OutEdgeIt(*G, m);
+ _dist->set(m,_stack_head);
+ }
+ else {
+ m=G->source(e);
+ ++_stack[_stack_head];
+ }
+ while(_stack_head>=0 && _stack[_stack_head]==INVALID) {
+ _processed->set(m,true);
+ --_stack_head;
+ if(_stack_head>=0) {
+ m=G->source(_stack[_stack_head]);
+ ++_stack[_stack_head];
+ }
+ }
+ return e;
+ }
+ ///Next edge to be processed.
+
+ ///Next edge to be processed.
+ ///
+ ///\return The next edge to be processed or INVALID if the stack is
+ /// empty.
+ OutEdgeIt nextEdge()
+ {
+ return _stack_head>=0?_stack[_stack_head]:INVALID;
+ }
+
+ ///\brief Returns \c false if there are nodes
+ ///to be processed in the queue
+ ///
+ ///Returns \c false if there are nodes
+ ///to be processed in the queue
+ bool emptyQueue() { return _stack_head<0; }
+ ///Returns the number of the nodes to be processed.
+
+ ///Returns the number of the nodes to be processed in the queue.
+ int queueSize() { return _stack_head+1; }
+
+ ///Executes the algorithm.
+
+ ///Executes the algorithm.
+ ///
+ ///\pre init() must be called and at least one node should be added
+ ///with addSource() before using this function.
+ ///
+ ///This method runs the %DFS algorithm from the root node(s)
+ ///in order to
+ ///compute the
+ ///%DFS path to each node. The algorithm computes
+ ///- The %DFS tree.
+ ///- The distance of each node from the root(s) in the %DFS tree.
+ ///
+ void start()
+ {
+ while ( !emptyQueue() ) processNextEdge();
+ }
+
+ ///Executes the algorithm until \c dest is reached.
+
+ ///Executes the algorithm until \c dest is reached.
+ ///
+ ///\pre init() must be called and at least one node should be added
+ ///with addSource() before using this function.
+ ///
+ ///This method runs the %DFS algorithm from the root node(s)
+ ///in order to
+ ///compute the
+ ///%DFS path to \c dest. The algorithm computes
+ ///- The %DFS path to \c dest.
+ ///- The distance of \c dest from the root(s) in the %DFS tree.
+ ///
+ void start(Node dest)
+ {
+ while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest )
+ processNextEdge();
+ }
+
+ ///Executes the algorithm until a condition is met.
+
+ ///Executes the algorithm until a condition is met.
+ ///
+ ///\pre init() must be called and at least one node should be added
+ ///with addSource() before using this function.
+ ///
+ ///\param em must be a bool (or convertible) edge map. The algorithm
+ ///will stop when it reaches an edge \c e with <tt>em[e]</tt> true.
+ ///
+ ///\return The reached edge \c e with <tt>em[e]</tt> true or
+ ///\c INVALID if no such edge was found.
+ ///
+ ///\warning Contrary to \ref Bfs and \ref Dijkstra, \c em is an edge map,
+ ///not a node map.
+ template<class EM>
+ Edge start(const EM &em)
+ {
+ while ( !emptyQueue() && !em[_stack[_stack_head]] )
+ processNextEdge();
+ return emptyQueue() ? INVALID : _stack[_stack_head];
+ }
+
+ ///Runs %DFS algorithm to visit all nodes in the graph.
+
+ ///This method runs the %DFS algorithm in order to
+ ///compute the
+ ///%DFS path to each node. The algorithm computes
+ ///- The %DFS tree.
+ ///- The distance of each node from the root in the %DFS tree.
+ ///
+ ///\note d.run() is just a shortcut of the following code.
+ ///\code
+ /// d.init();
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!d.reached(it)) {
+ /// d.addSource(it);
+ /// d.start();
+ /// }
+ /// }
+ ///\endcode
+ void run() {
+ init();
+ for (NodeIt it(*G); it != INVALID; ++it) {
+ if (!reached(it)) {
+ addSource(it);
+ start();
+ }
+ }
+ }
+
+ ///Runs %DFS algorithm from node \c s.
+
+ ///This method runs the %DFS algorithm from a root node \c s
+ ///in order to
+ ///compute the
+ ///%DFS path to each node. The algorithm computes
+ ///- The %DFS tree.
+ ///- The distance of each node from the root in the %DFS tree.
+ ///
+ ///\note d.run(s) is just a shortcut of the following code.
+ ///\code
+ /// d.init();
+ /// d.addSource(s);
+ /// d.start();
+ ///\endcode
+ void run(Node s) {
+ init();
+ addSource(s);
+ start();
+ }
+
+ ///Finds the %DFS path between \c s and \c t.
+
+ ///Finds the %DFS path between \c s and \c t.
+ ///
+ ///\return The length of the %DFS s---t path if there exists one,
+ ///0 otherwise.
+ ///\note Apart from the return value, d.run(s,t) is
+ ///just a shortcut of the following code.
+ ///\code
+ /// d.init();
+ /// d.addSource(s);
+ /// d.start(t);
+ ///\endcode
+ int run(Node s,Node t) {
+ init();
+ addSource(s);
+ start(t);
+ return reached(t)?_stack_head+1:0;
+ }
+
+ ///@}
+
+ ///\name Query Functions
+ ///The result of the %DFS algorithm can be obtained using these
+ ///functions.\n
+ ///Before the use of these functions,
+ ///either run() or start() must be called.
+
+ ///@{
+
+ typedef PredMapPath<Graph, PredMap> Path;
+
+ ///Gives back the shortest path.
+
+ ///Gives back the shortest path.
+ ///\pre The \c t should be reachable from the source.
+ Path path(Node t)
+ {
+ return Path(*G, *_pred, t);
+ }
+
+ ///The distance of a node from the root(s).
+
+ ///Returns the distance of a node from the root(s).
+ ///\pre \ref run() must be called before using this function.
+ ///\warning If node \c v is unreachable from the root(s) then the return
+ ///value of this funcion is undefined.
+ int dist(Node v) const { return (*_dist)[v]; }
+
+ ///Returns the 'previous edge' of the %DFS tree.
+
+ ///For a node \c v it returns the 'previous edge'
+ ///of the %DFS path,
+ ///i.e. it returns the last edge of a %DFS path from the root(s) to \c
+ ///v. It is \ref INVALID
+ ///if \c v is unreachable from the root(s) or \c v is a root. The
+ ///%DFS tree used here is equal to the %DFS tree used in
+ ///\ref predNode().
+ ///\pre Either \ref run() or \ref start() must be called before using
+ ///this function.
+ Edge predEdge(Node v) const { return (*_pred)[v];}
+
+ ///Returns the 'previous node' of the %DFS tree.
+
+ ///For a node \c v it returns the 'previous node'
+ ///of the %DFS tree,
+ ///i.e. it returns the last but one node from a %DFS path from the
+ ///root(s) to \c v.
+ ///It is INVALID if \c v is unreachable from the root(s) or
+ ///if \c v itself a root.
+ ///The %DFS tree used here is equal to the %DFS
+ ///tree used in \ref predEdge().
+ ///\pre Either \ref run() or \ref start() must be called before
+ ///using this function.
+ Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID:
+ G->source((*_pred)[v]); }
+
+ ///Returns a reference to the NodeMap of distances.
+
+ ///Returns a reference to the NodeMap of distances.
+ ///\pre Either \ref run() or \ref init() must
+ ///be called before using this function.
+ const DistMap &distMap() const { return *_dist;}
+
+ ///Returns a reference to the %DFS edge-tree map.
+
+ ///Returns a reference to the NodeMap of the edges of the
+ ///%DFS tree.
+ ///\pre Either \ref run() or \ref init()
+ ///must be called before using this function.
+ const PredMap &predMap() const { return *_pred;}
+
+ ///Checks if a node is reachable from the root.
+
+ ///Returns \c true if \c v is reachable from the root(s).
+ ///\warning The source nodes are inditated as unreachable.
+ ///\pre Either \ref run() or \ref start()
+ ///must be called before using this function.
+ ///
+ bool reached(Node v) { return (*_reached)[v]; }
+
+ ///@}
+ };
+
+ ///Default traits class of Dfs function.
+
+ ///Default traits class of Dfs function.
+ ///\param GR Graph type.
+ template<class GR>
+ struct DfsWizardDefaultTraits
+ {
+ ///The graph type the algorithm runs on.
+ typedef GR Graph;
+ ///\brief The type of the map that stores the last
+ ///edges of the %DFS paths.
+ ///
+ ///The type of the map that stores the last
+ ///edges of the %DFS paths.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef NullMap<typename Graph::Node,typename GR::Edge> PredMap;
+ ///Instantiates a PredMap.
+
+ ///This function instantiates a \ref PredMap.
+ ///\param g is the graph, to which we would like to define the PredMap.
+ ///\todo The graph alone may be insufficient to initialize
+#ifdef DOXYGEN
+ static PredMap *createPredMap(const GR &g)
+#else
+ static PredMap *createPredMap(const GR &)
+#endif
+ {
+ return new PredMap();
+ }
+
+ ///The type of the map that indicates which nodes are processed.
+
+ ///The type of the map that indicates which nodes are processed.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef NullMap<typename Graph::Node,bool> ProcessedMap;
+ ///Instantiates a ProcessedMap.
+
+ ///This function instantiates a \ref ProcessedMap.
+ ///\param g is the graph, to which
+ ///we would like to define the \ref ProcessedMap
+#ifdef DOXYGEN
+ static ProcessedMap *createProcessedMap(const GR &g)
+#else
+ static ProcessedMap *createProcessedMap(const GR &)
+#endif
+ {
+ return new ProcessedMap();
+ }
+ ///The type of the map that indicates which nodes are reached.
+
+ ///The type of the map that indicates which nodes are reached.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///\todo named parameter to set this type, function to read and write.
+ typedef typename Graph::template NodeMap<bool> ReachedMap;
+ ///Instantiates a ReachedMap.
+
+ ///This function instantiates a \ref ReachedMap.
+ ///\param G is the graph, to which
+ ///we would like to define the \ref ReachedMap.
+ static ReachedMap *createReachedMap(const GR &G)
+ {
+ return new ReachedMap(G);
+ }
+ ///The type of the map that stores the dists of the nodes.
+
+ ///The type of the map that stores the dists of the nodes.
+ ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ ///
+ typedef NullMap<typename Graph::Node,int> DistMap;
+ ///Instantiates a DistMap.
+
+ ///This function instantiates a \ref DistMap.
+ ///\param g is the graph, to which we would like to define the \ref DistMap
+#ifdef DOXYGEN
+ static DistMap *createDistMap(const GR &g)
+#else
+ static DistMap *createDistMap(const GR &)
+#endif
+ {
+ return new DistMap();
+ }
+ };
+
+ /// Default traits used by \ref DfsWizard
+
+ /// To make it easier to use Dfs algorithm
+ ///we have created a wizard class.
+ /// This \ref DfsWizard class needs default traits,
+ ///as well as the \ref Dfs class.
+ /// The \ref DfsWizardBase is a class to be the default traits of the
+ /// \ref DfsWizard class.
+ template<class GR>
+ class DfsWizardBase : public DfsWizardDefaultTraits<GR>
+ {
+
+ typedef DfsWizardDefaultTraits<GR> Base;
+ protected:
+ /// Type of the nodes in the graph.
+ typedef typename Base::Graph::Node Node;
+
+ /// Pointer to the underlying graph.
+ void *_g;
+ ///Pointer to the map of reached nodes.
+ void *_reached;
+ ///Pointer to the map of processed nodes.
+ void *_processed;
+ ///Pointer to the map of predecessors edges.
+ void *_pred;
+ ///Pointer to the map of distances.
+ void *_dist;
+ ///Pointer to the source node.
+ Node _source;
+
+ public:
+ /// Constructor.
+
+ /// This constructor does not require parameters, therefore it initiates
+ /// all of the attributes to default values (0, INVALID).
+ DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
+ _dist(0), _source(INVALID) {}
+
+ /// Constructor.
+
+ /// This constructor requires some parameters,
+ /// listed in the parameters list.
+ /// Others are initiated to 0.
+ /// \param g is the initial value of \ref _g
+ /// \param s is the initial value of \ref _source
+ DfsWizardBase(const GR &g, Node s=INVALID) :
+ _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
+ _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
+
+ };
+
+ /// A class to make the usage of the Dfs algorithm easier
+
+ /// This class is created to make it easier to use the Dfs algorithm.
+ /// It uses the functions and features of the plain \ref Dfs,
+ /// but it is much simpler to use it.
+ ///
+ /// Simplicity means that the way to change the types defined
+ /// in the traits class is based on functions that returns the new class
+ /// and not on templatable built-in classes.
+ /// When using the plain \ref Dfs
+ /// the new class with the modified type comes from
+ /// the original class by using the ::
+ /// operator. In the case of \ref DfsWizard only
+ /// a function have to be called and it will
+ /// return the needed class.
+ ///
+ /// It does not have own \ref run method. When its \ref run method is called
+ /// it initiates a plain \ref Dfs object, and calls the \ref Dfs::run
+ /// method of it.
+ template<class TR>
+ class DfsWizard : public TR
+ {
+ typedef TR Base;
+
+ ///The type of the underlying graph.
+ typedef typename TR::Graph Graph;
+ //\e
+ typedef typename Graph::Node Node;
+ //\e
+ typedef typename Graph::NodeIt NodeIt;
+ //\e
+ typedef typename Graph::Edge Edge;
+ //\e
+ typedef typename Graph::OutEdgeIt OutEdgeIt;
+
+ ///\brief The type of the map that stores
+ ///the reached nodes
+ typedef typename TR::ReachedMap ReachedMap;
+ ///\brief The type of the map that stores
+ ///the processed nodes
+ typedef typename TR::ProcessedMap ProcessedMap;
+ ///\brief The type of the map that stores the last
+ ///edges of the %DFS paths.
+ typedef typename TR::PredMap PredMap;
+ ///The type of the map that stores the distances of the nodes.
+ typedef typename TR::DistMap DistMap;
+
+ public:
+ /// Constructor.
+ DfsWizard() : TR() {}
+
+ /// Constructor that requires parameters.
+
+ /// Constructor that requires parameters.
+ /// These parameters will be the default values for the traits class.
+ DfsWizard(const Graph &g, Node s=INVALID) :
+ TR(g,s) {}
+
+ ///Copy constructor
+ DfsWizard(const TR &b) : TR(b) {}
+
+ ~DfsWizard() {}
+
+ ///Runs Dfs algorithm from a given node.
+
+ ///Runs Dfs algorithm from a given node.
+ ///The node can be given by the \ref source function.
+ void run()
+ {
+ if(Base::_source==INVALID) throw UninitializedParameter();
+ Dfs<Graph,TR> alg(*reinterpret_cast<const Graph*>(Base::_g));
+ if(Base::_reached)
+ alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
+ if(Base::_processed)
+ alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
+ if(Base::_pred)
+ alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+ if(Base::_dist)
+ alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
+ alg.run(Base::_source);
+ }
+
+ ///Runs Dfs algorithm from the given node.
+
+ ///Runs Dfs algorithm from the given node.
+ ///\param s is the given source.
+ void run(Node s)
+ {
+ Base::_source=s;
+ run();
+ }
+
+ template<class T>
+ struct DefPredMapBase : public Base {
+ typedef T PredMap;
+ static PredMap *createPredMap(const Graph &) { return 0; };
+ DefPredMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting PredMap type
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting PredMap type
+ ///
+ template<class T>
+ DfsWizard<DefPredMapBase<T> > predMap(const T &t)
+ {
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return DfsWizard<DefPredMapBase<T> >(*this);
+ }
+
+
+ template<class T>
+ struct DefReachedMapBase : public Base {
+ typedef T ReachedMap;
+ static ReachedMap *createReachedMap(const Graph &) { return 0; };
+ DefReachedMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting ReachedMap
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting ReachedMap
+ ///
+ template<class T>
+ DfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
+ {
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return DfsWizard<DefReachedMapBase<T> >(*this);
+ }
+
+
+ template<class T>
+ struct DefProcessedMapBase : public Base {
+ typedef T ProcessedMap;
+ static ProcessedMap *createProcessedMap(const Graph &) { return 0; };
+ DefProcessedMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting ProcessedMap
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting ProcessedMap
+ ///
+ template<class T>
+ DfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
+ {
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return DfsWizard<DefProcessedMapBase<T> >(*this);
+ }
+
+ template<class T>
+ struct DefDistMapBase : public Base {
+ typedef T DistMap;
+ static DistMap *createDistMap(const Graph &) { return 0; };
+ DefDistMapBase(const TR &b) : TR(b) {}
+ };
+
+ ///\brief \ref named-templ-param "Named parameter"
+ ///function for setting DistMap type
+ ///
+ /// \ref named-templ-param "Named parameter"
+ ///function for setting DistMap type
+ ///
+ template<class T>
+ DfsWizard<DefDistMapBase<T> > distMap(const T &t)
+ {
+ Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
+ return DfsWizard<DefDistMapBase<T> >(*this);
+ }
+
+ /// Sets the source node, from which the Dfs algorithm runs.
+
+ /// Sets the source node, from which the Dfs algorithm runs.
+ /// \param s is the source node.
+ DfsWizard<TR> &source(Node s)
+ {
+ Base::_source=s;
+ return *this;
+ }
+
+ };
+
+ ///Function type interface for Dfs algorithm.
+
+ ///\ingroup search
+ ///Function type interface for Dfs algorithm.
+ ///
+ ///This function also has several
+ ///\ref named-templ-func-param "named parameters",
+ ///they are declared as the members of class \ref DfsWizard.
+ ///The following
+ ///example shows how to use these parameters.
+ ///\code
+ /// dfs(g,source).predMap(preds).run();
+ ///\endcode
+ ///\warning Don't forget to put the \ref DfsWizard::run() "run()"
+ ///to the end of the parameter list.
+ ///\sa DfsWizard
+ ///\sa Dfs
+ template<class GR>
+ DfsWizard<DfsWizardBase<GR> >
+ dfs(const GR &g,typename GR::Node s=INVALID)
+ {
+ return DfsWizard<DfsWizardBase<GR> >(g,s);
+ }
+
+#ifdef DOXYGEN
+ /// \brief Visitor class for dfs.
+ ///
+ /// It gives a simple interface for a functional interface for dfs
+ /// traversal. The traversal on a linear data structure.
+ template <typename _Graph>
+ struct DfsVisitor {
+ typedef _Graph Graph;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::Node Node;
+ /// \brief Called when the edge reach a node.
+ ///
+ /// It is called when the dfs find an edge which target is not
+ /// reached yet.
+ void discover(const Edge& edge) {}
+ /// \brief Called when the node reached first time.
+ ///
+ /// It is Called when the node reached first time.
+ void reach(const Node& node) {}
+ /// \brief Called when we step back on an edge.
+ ///
+ /// It is called when the dfs should step back on the edge.
+ void backtrack(const Edge& edge) {}
+ /// \brief Called when we step back from the node.
+ ///
+ /// It is called when we step back from the node.
+ void leave(const Node& node) {}
+ /// \brief Called when the edge examined but target of the edge
+ /// already discovered.
+ ///
+ /// It called when the edge examined but the target of the edge
+ /// already discovered.
+ void examine(const Edge& edge) {}
+ /// \brief Called for the source node of the dfs.
+ ///
+ /// It is called for the source node of the dfs.
+ void start(const Node& node) {}
+ /// \brief Called when we leave the source node of the dfs.
+ ///
+ /// It is called when we leave the source node of the dfs.
+ void stop(const Node& node) {}
+
+ };
+#else
+ template <typename _Graph>
+ struct DfsVisitor {
+ typedef _Graph Graph;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::Node Node;
+ void discover(const Edge&) {}
+ void reach(const Node&) {}
+ void backtrack(const Edge&) {}
+ void leave(const Node&) {}
+ void examine(const Edge&) {}
+ void start(const Node&) {}
+ void stop(const Node&) {}
+
+ template <typename _Visitor>
+ struct Constraints {
+ void constraints() {
+ Edge edge;
+ Node node;
+ visitor.discover(edge);
+ visitor.reach(node);
+ visitor.backtrack(edge);
+ visitor.leave(node);
+ visitor.examine(edge);
+ visitor.start(node);
+ visitor.stop(edge);
+ }
+ _Visitor& visitor;
+ };
+ };
+#endif
+
+ /// \brief Default traits class of DfsVisit class.
+ ///
+ /// Default traits class of DfsVisit class.
+ /// \param _Graph Graph type.
+ template<class _Graph>
+ struct DfsVisitDefaultTraits {
+
+ /// \brief The graph type the algorithm runs on.
+ typedef _Graph Graph;
+
+ /// \brief The type of the map that indicates which nodes are reached.
+ ///
+ /// The type of the map that indicates which nodes are reached.
+ /// It must meet the \ref concepts::WriteMap "WriteMap" concept.
+ /// \todo named parameter to set this type, function to read and write.
+ typedef typename Graph::template NodeMap<bool> ReachedMap;
+
+ /// \brief Instantiates a ReachedMap.
+ ///
+ /// This function instantiates a \ref ReachedMap.
+ /// \param graph is the graph, to which
+ /// we would like to define the \ref ReachedMap.
+ static ReachedMap *createReachedMap(const Graph &graph) {
+ return new ReachedMap(graph);
+ }
+
+ };
+
+ /// %DFS Visit algorithm class.
+
+ /// \ingroup search
+ /// This class provides an efficient implementation of the %DFS algorithm
+ /// with visitor interface.
+ ///
+ /// The %DfsVisit class provides an alternative interface to the Dfs
+ /// class. It works with callback mechanism, the DfsVisit object calls
+ /// on every dfs event the \c Visitor class member functions.
+ ///
+ /// \param _Graph The graph type the algorithm runs on. The default value is
+ /// \ref ListGraph. The value of _Graph is not used directly by Dfs, it
+ /// is only passed to \ref DfsDefaultTraits.
+ /// \param _Visitor The Visitor object for the algorithm. The
+ /// \ref DfsVisitor "DfsVisitor<_Graph>" is an empty Visitor which
+ /// does not observe the Dfs events. If you want to observe the dfs
+ /// events you should implement your own Visitor class.
+ /// \param _Traits Traits class to set various data types used by the
+ /// algorithm. The default traits class is
+ /// \ref DfsVisitDefaultTraits "DfsVisitDefaultTraits<_Graph>".
+ /// See \ref DfsVisitDefaultTraits for the documentation of
+ /// a Dfs visit traits class.
+ ///
+ /// \author Jacint Szabo, Alpar Juttner and Balazs Dezso
+#ifdef DOXYGEN
+ template <typename _Graph, typename _Visitor, typename _Traits>
+#else
+ template <typename _Graph = ListGraph,
+ typename _Visitor = DfsVisitor<_Graph>,
+ typename _Traits = DfsDefaultTraits<_Graph> >
+#endif
+ class DfsVisit {
+ public:
+
+ /// \brief \ref Exception for uninitialized parameters.
+ ///
+ /// This error represents problems in the initialization
+ /// of the parameters of the algorithms.
+ class UninitializedParameter : public lemon::UninitializedParameter {
+ public:
+ virtual const char* what() const throw()
+ {
+ return "lemon::DfsVisit::UninitializedParameter";
+ }
+ };
+
+ typedef _Traits Traits;
+
+ typedef typename Traits::Graph Graph;
+
+ typedef _Visitor Visitor;
+
+ ///The type of the map indicating which nodes are reached.
+ typedef typename Traits::ReachedMap ReachedMap;
+
+ private:
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::OutEdgeIt OutEdgeIt;
+
+ /// Pointer to the underlying graph.
+ const Graph *_graph;
+ /// Pointer to the visitor object.
+ Visitor *_visitor;
+ ///Pointer to the map of reached status of the nodes.
+ ReachedMap *_reached;
+ ///Indicates if \ref _reached is locally allocated (\c true) or not.
+ bool local_reached;
+
+ std::vector<typename Graph::Edge> _stack;
+ int _stack_head;
+
+ /// \brief Creates the maps if necessary.
+ ///
+ /// Creates the maps if necessary.
+ void create_maps() {
+ if(!_reached) {
+ local_reached = true;
+ _reached = Traits::createReachedMap(*_graph);
+ }
+ }
+
+ protected:
+
+ DfsVisit() {}
+
+ public:
+
+ typedef DfsVisit Create;
+
+ /// \name Named template parameters
+
+ ///@{
+ template <class T>
+ struct DefReachedMapTraits : public Traits {
+ typedef T ReachedMap;
+ static ReachedMap *createReachedMap(const Graph &graph) {
+ throw UninitializedParameter();
+ }
+ };
+ /// \brief \ref named-templ-param "Named parameter" for setting
+ /// ReachedMap type
+ ///
+ /// \ref named-templ-param "Named parameter" for setting ReachedMap type
+ template <class T>
+ struct DefReachedMap : public DfsVisit< Graph, Visitor,
+ DefReachedMapTraits<T> > {
+ typedef DfsVisit< Graph, Visitor, DefReachedMapTraits<T> > Create;
+ };
+ ///@}
+
+ public:
+
+ /// \brief Constructor.
+ ///
+ /// Constructor.
+ ///
+ /// \param graph the graph the algorithm will run on.
+ /// \param visitor The visitor of the algorithm.
+ ///
+ DfsVisit(const Graph& graph, Visitor& visitor)
+ : _graph(&graph), _visitor(&visitor),
+ _reached(0), local_reached(false) {}
+
+ /// \brief Destructor.
+ ///
+ /// Destructor.
+ ~DfsVisit() {
+ if(local_reached) delete _reached;
+ }
+
+ /// \brief Sets the map indicating if a node is reached.
+ ///
+ /// Sets the map indicating if a node is reached.
+ /// If you don't use this function before calling \ref run(),
+ /// it will allocate one. The destuctor deallocates this
+ /// automatically allocated map, of course.
+ /// \return <tt> (*this) </tt>
+ DfsVisit &reachedMap(ReachedMap &m) {
+ if(local_reached) {
+ delete _reached;
+ local_reached=false;
+ }
+ _reached = &m;
+ return *this;
+ }
+
+ public:
+ /// \name Execution control
+ /// The simplest way to execute the algorithm is to use
+ /// one of the member functions called \c run(...).
+ /// \n
+ /// If you need more control on the execution,
+ /// first you must call \ref init(), then you can adda source node
+ /// with \ref addSource().
+ /// Finally \ref start() will perform the actual path
+ /// computation.
+
+ /// @{
+ /// \brief Initializes the internal data structures.
+ ///
+ /// Initializes the internal data structures.
+ ///
+ void init() {
+ create_maps();
+ _stack.resize(countNodes(*_graph));
+ _stack_head = -1;
+ for (NodeIt u(*_graph) ; u != INVALID ; ++u) {
+ _reached->set(u, false);
+ }
+ }
+
+ /// \brief Adds a new source node.
+ ///
+ /// Adds a new source node to the set of nodes to be processed.
+ void addSource(Node s) {
+ if(!(*_reached)[s]) {
+ _reached->set(s,true);
+ _visitor->start(s);
+ _visitor->reach(s);
+ Edge e;
+ _graph->firstOut(e, s);
+ if (e != INVALID) {
+ _stack[++_stack_head] = e;
+ } else {
+ _visitor->leave(s);
+ }
+ }
+ }
+
+ /// \brief Processes the next edge.
+ ///
+ /// Processes the next edge.
+ ///
+ /// \return The processed edge.
+ ///
+ /// \pre The stack must not be empty!
+ Edge processNextEdge() {
+ Edge e = _stack[_stack_head];
+ Node m = _graph->target(e);
+ if(!(*_reached)[m]) {
+ _visitor->discover(e);
+ _visitor->reach(m);
+ _reached->set(m, true);
+ _graph->firstOut(_stack[++_stack_head], m);
+ } else {
+ _visitor->examine(e);
+ m = _graph->source(e);
+ _graph->nextOut(_stack[_stack_head]);
+ }
+ while (_stack_head>=0 && _stack[_stack_head] == INVALID) {
+ _visitor->leave(m);
+ --_stack_head;
+ if (_stack_head >= 0) {
+ _visitor->backtrack(_stack[_stack_head]);
+ m = _graph->source(_stack[_stack_head]);
+ _graph->nextOut(_stack[_stack_head]);
+ } else {
+ _visitor->stop(m);
+ }
+ }
+ return e;
+ }
+
+ /// \brief Next edge to be processed.
+ ///
+ /// Next edge to be processed.
+ ///
+ /// \return The next edge to be processed or INVALID if the stack is
+ /// empty.
+ Edge nextEdge() {
+ return _stack_head >= 0 ? _stack[_stack_head] : INVALID;
+ }
+
+ /// \brief Returns \c false if there are nodes
+ /// to be processed in the queue
+ ///
+ /// Returns \c false if there are nodes
+ /// to be processed in the queue
+ bool emptyQueue() { return _stack_head < 0; }
+
+ /// \brief Returns the number of the nodes to be processed.
+ ///
+ /// Returns the number of the nodes to be processed in the queue.
+ int queueSize() { return _stack_head + 1; }
+
+ /// \brief Executes the algorithm.
+ ///
+ /// Executes the algorithm.
+ ///
+ /// \pre init() must be called and at least one node should be added
+ /// with addSource() before using this function.
+ void start() {
+ while ( !emptyQueue() ) processNextEdge();
+ }
+
+ /// \brief Executes the algorithm until \c dest is reached.
+ ///
+ /// Executes the algorithm until \c dest is reached.
+ ///
+ /// \pre init() must be called and at least one node should be added
+ /// with addSource() before using this function.
+ void start(Node dest) {
+ while ( !emptyQueue() && _graph->target(_stack[_stack_head]) != dest )
+ processNextEdge();
+ }
+
+ /// \brief Executes the algorithm until a condition is met.
+ ///
+ /// Executes the algorithm until a condition is met.
+ ///
+ /// \pre init() must be called and at least one node should be added
+ /// with addSource() before using this function.
+ ///
+ /// \param em must be a bool (or convertible) edge map. The algorithm
+ /// will stop when it reaches an edge \c e with <tt>em[e]</tt> true.
+ ///
+ ///\return The reached edge \c e with <tt>em[e]</tt> true or
+ ///\c INVALID if no such edge was found.
+ ///
+ /// \warning Contrary to \ref Bfs and \ref Dijkstra, \c em is an edge map,
+ /// not a node map.
+ template <typename EM>
+ Edge start(const EM &em) {
+ while ( !emptyQueue() && !em[_stack[_stack_head]] )
+ processNextEdge();
+ return emptyQueue() ? INVALID : _stack[_stack_head];
+ }
+
+ /// \brief Runs %DFSVisit algorithm from node \c s.
+ ///
+ /// This method runs the %DFS algorithm from a root node \c s.
+ /// \note d.run(s) is just a shortcut of the following code.
+ ///\code
+ /// d.init();
+ /// d.addSource(s);
+ /// d.start();
+ ///\endcode
+ void run(Node s) {
+ init();
+ addSource(s);
+ start();
+ }
+
+ /// \brief Runs %DFSVisit algorithm to visit all nodes in the graph.
+
+ /// This method runs the %DFS algorithm in order to
+ /// compute the %DFS path to each node. The algorithm computes
+ /// - The %DFS tree.
+ /// - The distance of each node from the root in the %DFS tree.
+ ///
+ ///\note d.run() is just a shortcut of the following code.
+ ///\code
+ /// d.init();
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!d.reached(it)) {
+ /// d.addSource(it);
+ /// d.start();
+ /// }
+ /// }
+ ///\endcode
+ void run() {
+ init();
+ for (NodeIt it(*_graph); it != INVALID; ++it) {
+ if (!reached(it)) {
+ addSource(it);
+ start();
+ }
+ }
+ }
+ ///@}
+
+ /// \name Query Functions
+ /// The result of the %DFS algorithm can be obtained using these
+ /// functions.\n
+ /// Before the use of these functions,
+ /// either run() or start() must be called.
+ ///@{
+ /// \brief Checks if a node is reachable from the root.
+ ///
+ /// Returns \c true if \c v is reachable from the root(s).
+ /// \warning The source nodes are inditated as unreachable.
+ /// \pre Either \ref run() or \ref start()
+ /// must be called before using this function.
+ ///
+ bool reached(Node v) { return (*_reached)[v]; }
+ ///@}
+ };
+
+
+} //END OF NAMESPACE LEMON
+
+#endif
+
diff --git a/src/lemon/error.h b/src/lemon/error.h
new file mode 100644
index 0000000..01931d8
--- /dev/null
+++ b/src/lemon/error.h
@@ -0,0 +1,683 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_ERROR_H
+#define LEMON_ERROR_H
+
+//! \ingroup exceptions
+//! \file
+//! \brief Basic exception classes and error handling.
+
+#include <exception>
+#include <string>
+#include <sstream>
+#include <iostream>
+#include <cstdlib>
+#include <memory>
+
+namespace lemon {
+
+ /// \addtogroup exceptions
+ /// @{
+
+ /// \brief Exception safe wrapper class.
+ ///
+ /// Exception safe wrapper class to implement the members of exceptions.
+ template <typename _Type>
+ class ExceptionMember {
+ public:
+ typedef _Type Type;
+
+ ExceptionMember() throw () {
+ try {
+ ptr.reset(new Type());
+ } catch (...) {}
+ }
+
+ ExceptionMember(const Type& type) throw () {
+ try {
+ ptr.reset(new Type());
+ if (ptr.get() == 0) return;
+ *ptr = type;
+ } catch (...) {}
+ }
+
+ ExceptionMember(const ExceptionMember& copy) throw() {
+ try {
+ if (!copy.valid()) return;
+ ptr.reset(new Type());
+ if (ptr.get() == 0) return;
+ *ptr = copy.get();
+ } catch (...) {}
+ }
+
+ ExceptionMember& operator=(const ExceptionMember& copy) {
+ if (ptr.get() == 0) return;
+ try {
+ if (!copy.valid()) return;
+ *ptr = copy.get();
+ } catch (...) {}
+ }
+
+ void set(const Type& type) {
+ if (ptr.get() == 0) return;
+ try {
+ *ptr = type;
+ } catch (...) {}
+ }
+
+ const Type& get() const {
+ return *ptr;
+ }
+
+ bool valid() const {
+ return ptr.get() != 0;
+ }
+
+ private:
+ std::auto_ptr<_Type> ptr;
+ };
+
+ /// Exception-safe convenient "error message" class.
+
+ /// Helper class which provides a convenient ostream-like (operator <<
+ /// based) interface to create a string message. Mostly useful in
+ /// exception classes (therefore the name).
+ class ErrorMessage {
+ protected:
+ ///\e
+
+ ///\todo The good solution is boost::shared_ptr...
+ ///
+ mutable
+ std::auto_ptr<std::ostringstream> buf;
+
+ ///\e
+ bool init() throw() {
+ try {
+ buf.reset(new std::ostringstream);
+ }
+ catch(...) {
+ buf.reset();
+ }
+ return buf.get();
+ }
+
+ public:
+
+ ///\e
+ ErrorMessage() throw() { init(); }
+
+ ErrorMessage(const ErrorMessage& em) throw() : buf(em.buf) { }
+
+ ///\e
+ ErrorMessage(const char *msg) throw() {
+ init();
+ *this << msg;
+ }
+
+ ///\e
+ ErrorMessage(const std::string &msg) throw() {
+ init();
+ *this << msg;
+ }
+
+ ///\e
+ template <typename T>
+ ErrorMessage& operator<<(const T &t) throw() {
+ if( ! buf.get() ) return *this;
+
+ try {
+ *buf << t;
+ }
+ catch(...) {
+ buf.reset();
+ }
+ return *this;
+ }
+
+ ///\e
+ const char* message() throw() {
+ if( ! buf.get() ) return 0;
+
+ const char* mes = 0;
+ try {
+ mes = buf->str().c_str();
+ }
+ catch(...) {}
+ return mes;
+ }
+
+ };
+
+ /**
+ * \brief Generic exception class.
+ *
+ * Base class for exceptions used in LEMON.
+ */
+ class Exception : public std::exception {
+ public:
+ ///\e
+ Exception() {}
+ ///\e
+ virtual ~Exception() throw() {}
+ ///\e
+ virtual const char* what() const throw() {
+ return "lemon::Exception";
+ }
+ };
+
+ /**
+ * \brief One of the two main subclasses of \ref Exception.
+ *
+ * Logic errors represent problems in the internal logic of a program;
+ * in theory, these are preventable, and even detectable before the
+ * program runs (e.g., violations of class invariants).
+ *
+ * A typical example for this is \ref UninitializedParameter.
+ */
+ class LogicError : public Exception {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::LogicError";
+ }
+ };
+
+ /**
+ * \brief \ref Exception for uninitialized parameters.
+ *
+ * This error represents problems in the initialization
+ * of the parameters of the algorithms.
+ */
+ class UninitializedParameter : public LogicError {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::UninitializedParameter";
+ }
+ };
+
+
+ /**
+ * \brief One of the two main subclasses of \ref Exception.
+ *
+ * Runtime errors represent problems outside the scope of a program;
+ * they cannot be easily predicted and can generally only be caught as
+ * the program executes.
+ */
+ class RuntimeError : public Exception {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::RuntimeError";
+ }
+ };
+
+ ///\e
+ class RangeError : public RuntimeError {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::RangeError";
+ }
+ };
+
+ ///\e
+ class IoError : public RuntimeError {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::IoError";
+ }
+ };
+
+ ///\e
+ class DataFormatError : public IoError {
+ protected:
+ ExceptionMember<std::string> _message;
+ ExceptionMember<std::string> _file;
+ int _line;
+
+ mutable ExceptionMember<std::string> _message_holder;
+ public:
+
+ DataFormatError(const DataFormatError &dfe) :
+ IoError(dfe), _message(dfe._message), _file(dfe._file),
+ _line(dfe._line) {}
+
+ ///\e
+ explicit DataFormatError(const char *the_message)
+ : _message(the_message), _line(0) {}
+
+ ///\e
+ DataFormatError(const std::string &file_name, int line_num,
+ const char *the_message)
+ : _message(the_message), _line(line_num) { file(file_name); }
+
+ ///\e
+ void line(int ln) { _line = ln; }
+ ///\e
+ void message(const std::string& msg) { _message.set(msg); }
+ ///\e
+ void file(const std::string &fl) { _file.set(fl); }
+
+ ///\e
+ int line() const { return _line; }
+ ///\e
+ const char* message() const {
+ if (_message.valid() && !_message.get().empty()) {
+ return _message.get().c_str();
+ } else {
+ return 0;
+ }
+ }
+
+ /// \brief Returns the filename.
+ ///
+ /// Returns \e null if the filename was not specified.
+ const char* file() const {
+ if (_file.valid() && !_file.get().empty()) {
+ return _file.get().c_str();
+ } else {
+ return 0;
+ }
+ }
+
+ ///\e
+ virtual const char* what() const throw() {
+ try {
+ std::ostringstream ostr;
+ ostr << "lemon:DataFormatError" << ": ";
+ if (message()) ostr << message();
+ if( file() || line() != 0 ) {
+ ostr << " (";
+ if( file() ) ostr << "in file '" << file() << "'";
+ if( file() && line() != 0 ) ostr << " ";
+ if( line() != 0 ) ostr << "at line " << line();
+ ostr << ")";
+ }
+ _message_holder.set(ostr.str());
+ }
+ catch (...) {}
+ if( _message_holder.valid()) return _message_holder.get().c_str();
+ return "lemon:DataFormatError";
+ }
+
+ virtual ~DataFormatError() throw() {}
+ };
+
+ ///\e
+ class FileOpenError : public IoError {
+ protected:
+ ExceptionMember<std::string> _file;
+
+ mutable ExceptionMember<std::string> _message_holder;
+ public:
+
+ FileOpenError(const FileOpenError &foe) :
+ IoError(foe), _file(foe._file) {}
+
+ ///\e
+ explicit FileOpenError(const std::string& fl)
+ : _file(fl) {}
+
+
+ ///\e
+ void file(const std::string &fl) { _file.set(fl); }
+
+ /// \brief Returns the filename.
+ ///
+ /// Returns \e null if the filename was not specified.
+ const char* file() const {
+ if (_file.valid() && !_file.get().empty()) {
+ return _file.get().c_str();
+ } else {
+ return 0;
+ }
+ }
+
+ ///\e
+ virtual const char* what() const throw() {
+ try {
+ std::ostringstream ostr;
+ ostr << "lemon::FileOpenError" << ": ";
+ ostr << "Cannot open file - " << file();
+ _message_holder.set(ostr.str());
+ }
+ catch (...) {}
+ if( _message_holder.valid()) return _message_holder.get().c_str();
+ return "lemon::FileOpenError";
+ }
+ virtual ~FileOpenError() throw() {}
+ };
+
+ class IoParameterError : public IoError {
+ protected:
+ ExceptionMember<std::string> _message;
+ ExceptionMember<std::string> _file;
+
+ mutable ExceptionMember<std::string> _message_holder;
+ public:
+
+ IoParameterError(const IoParameterError &ile) :
+ IoError(ile), _message(ile._message), _file(ile._file) {}
+
+ ///\e
+ explicit IoParameterError(const char *the_message)
+ : _message(the_message) {}
+
+ ///\e
+ IoParameterError(const char *file_name, const char *the_message)
+ : _message(the_message), _file(file_name) {}
+
+ ///\e
+ void message(const std::string& msg) { _message.set(msg); }
+ ///\e
+ void file(const std::string &fl) { _file.set(fl); }
+
+ ///\e
+ const char* message() const {
+ if (_message.valid()) {
+ return _message.get().c_str();
+ } else {
+ return 0;
+ }
+ }
+
+ /// \brief Returns the filename.
+ ///
+ /// Returns \e null if the filename was not specified.
+ const char* file() const {
+ if (_file.valid()) {
+ return _file.get().c_str();
+ } else {
+ return 0;
+ }
+ }
+
+ ///\e
+ virtual const char* what() const throw() {
+ try {
+ std::ostringstream ostr;
+ if (message()) ostr << message();
+ if (file()) ostr << "(when reading file '" << file() << "')";
+ _message_holder.set(ostr.str());
+ }
+ catch (...) {}
+ if( _message_holder.valid() ) return _message_holder.get().c_str();
+ return "lemon:IoParameterError";
+ }
+ virtual ~IoParameterError() throw() {}
+ };
+
+
+ ///\e
+ class AssertionFailedError : public LogicError {
+ protected:
+ const char *assertion;
+ const char *file;
+ int line;
+ const char *function;
+ const char *message;
+
+ mutable ExceptionMember<std::string> _message_holder;
+ public:
+ ///\e
+ AssertionFailedError(const char *_file, int _line, const char *func,
+ const char *msg, const char *_assertion = 0) :
+ assertion(_assertion), file(_file), line(_line), function(func),
+ message(msg) {}
+
+ ///\e
+ const char* get_assertion() const { return assertion; }
+ ///\e
+ const char* get_message() const { return message; }
+ ///\e
+ const char* get_file() const { return file; }
+ ///\e
+ const char* get_function() const { return function; }
+ ///\e
+ int get_line() const { return line; }
+
+
+ virtual const char* what() const throw() {
+ try {
+ std::ostringstream ostr;
+ ostr << file << ":" << line << ": ";
+ if( function )
+ ostr << function << ": ";
+ ostr << message;
+ if( assertion )
+ ostr << " (assertion '" << assertion << "' failed)";
+ _message_holder.set(ostr.str());
+ return ostr.str().c_str();
+ }
+ catch(...) {}
+ if( _message_holder.valid() ) return _message_holder.get().c_str();
+ return "lemon::AssertionFailedError";
+ }
+ virtual ~AssertionFailedError() throw() {}
+ };
+
+
+ /**************** Macros ****************/
+
+
+ template <typename Exception>
+ inline void assert_fail(const char *file, int line,
+ const char *func,
+ Exception exception,
+ const char *assertion = 0,
+ bool do_abort=true)
+ {
+ using namespace std;
+ cerr << file << ":" << line << ": ";
+ if( func )
+ cerr << func << ": ";
+ cerr << exception.what();
+ if( assertion )
+ cerr << " (assertion '" << assertion << "' failed)";
+ cerr << endl;
+ if(do_abort)
+ abort();
+ }
+
+ template <>
+ inline void assert_fail<const char *>(const char *file, int line,
+ const char *func,
+ const char *message,
+ const char *assertion,
+ bool do_abort)
+ {
+ using namespace std;
+ cerr << file << ":" << line << ": ";
+ if( func )
+ cerr << func << ": ";
+ cerr << message;
+ if( assertion )
+ cerr << " (assertion '" << assertion << "' failed)";
+ cerr << endl;
+ if(do_abort)
+ abort();
+ }
+
+ template <>
+ inline void assert_fail<std::string>(const char *file, int line,
+ const char *func,
+ std::string message,
+ const char *assertion,
+ bool do_abort)
+ {
+ assert_fail(file, line, func, message.c_str(), assertion, do_abort);
+ }
+
+ template <typename Exception>
+ inline void assert_fail_failure(const char *file, int line, const char *func,
+ Exception exception,
+ const char *assertion = 0,
+ bool = true)
+ {
+ throw AssertionFailedError(file, line, func, exception.what(), assertion);
+ }
+
+ template <>
+ inline void assert_fail_failure<const char *>(const char *file, int line,
+ const char *func,
+ const char *message,
+ const char *assertion,
+ bool)
+ {
+ throw AssertionFailedError(file, line, func, message, assertion);
+ }
+
+ template <>
+ inline void assert_fail_failure<std::string>(const char *file, int line,
+ const char *func,
+ std::string message,
+ const char *assertion,
+ bool)
+ {
+ assert_fail_failure(file, line, func, message.c_str(), assertion, true);
+ }
+
+ template <typename Exception>
+ inline void assert_fail_exception(const char *file, int line, const char *func,
+ Exception exception,
+ const char *assertion = 0, bool = true)
+ {
+ throw exception;
+ }
+
+ template <>
+ inline void assert_fail_exception<const char *>(const char *file, int line,
+ const char *func,
+ const char *message,
+ const char *assertion,
+ bool)
+ {
+ throw AssertionFailedError(file, line, func, message, assertion);
+ }
+
+ template <>
+ inline void assert_fail_exception<std::string>(const char *file, int line,
+ const char *func,
+ std::string message,
+ const char *assertion,
+ bool)
+ {
+ assert_fail_exception(file, line, func, message.c_str(), assertion, true);
+ }
+
+/// @}
+
+}
+#endif // LEMON_ERROR_H
+
+#undef LEMON_ASSERT
+#undef LEMON_FIXME
+
+#ifdef LEMON_ENABLE_ASSERTS
+# define LEMON_ASSERT_ABORT
+#endif
+
+#ifndef LEMON_ASSERT_DO_ABORT
+# define LEMON_ASSERT_DO_ABORT 1
+#endif
+
+#ifndef LEMON_ASSERT_HANDLER
+# if defined LEMON_ASSERT_EXCEPTION
+# define LEMON_ASSERT_HANDLER ::lemon::assert_fail_exception
+# elif defined LEMON_ASSERT_FAILURE
+# define LEMON_ASSERT_HANDLER ::lemon::assert_fail_failure
+# elif defined LEMON_ASSERT_ABORT
+# define LEMON_ASSERT_HANDLER ::lemon::assert_fail
+# else
+# define LEMON_DISABLE_ASSERTS
+# endif
+#endif
+
+#ifdef DOXYGEN
+
+/// \brief Macro for assertions with customizable message
+///
+/// Macro for assertions with customizable message.
+///
+/// The assertions are disabled in the default behaviour. You can
+/// enable the assertions with the
+/// \code
+/// #define LEMON_ENABLE_ASSERTS
+/// \endcode
+/// Then an assert
+/// provides a log on the standard error about the assertion and aborts
+/// the program if LEMON_ASSERT_DO_ABORT is also defined (otherwise the
+/// program keeps on running).
+/// By defining LEMON_ASSERT_FAILURE or
+/// LEMON_ASSERT_EXCEPTION, you can set other behaviour to the
+/// assertions. In case LEMON_ASSERT_FAILURE is given, LEMON_ASSERT
+/// will always throw an \c AssertionFailedError exception with
+/// the \c msg error message. By using
+/// LEMON_ASSERT_EXCEPTION, one can define an arbitrary exception to be thrown.
+///
+/// The LEMON_ASSERT macro should be called with the \c exp parameter
+/// which should be an expression convertible to bool. If the given
+/// parameter is false the assertion is raised and one of the assertion
+/// behaviour will be activated. The \c msg should be either a const
+/// char* message or an exception. When the \c msg is an exception the
+/// \ref lemon::Exception::what() "what()" function is called to retrieve and
+/// display the error message.
+///
+/// \todo We should provide some way to reset to the default behaviour,
+/// shouldn't we?
+///
+/// \todo This whole 'assert' business should be placed in a separate
+/// include file. The boost assert is not guarded by header sentries
+/// which may help to change the behaviour of the assertions in
+/// the files.
+///
+/// \todo __PRETTY_FUNCTION__ should be replaced by something
+/// compiler-independent, like BOOST_CURRENT_FUNCTION
+
+# define LEMON_ASSERT(exp, msg) \
+ (static_cast<void> (!!(exp) ? 0 : ( \
+ LEMON_ASSERT_HANDLER(__FILE__, __LINE__, \
+ __PRETTY_FUNCTION__, \
+ msg, #exp, LEMON_ASSERT_DO_ABORT), 0)))
+
+#else
+# if defined LEMON_DISABLE_ASSERTS
+
+# define LEMON_ASSERT(exp, msg) (static_cast<void> (0))
+
+# else
+# define LEMON_ASSERT(exp, msg) \
+ (static_cast<void> (!!(exp) ? 0 : ( \
+ LEMON_ASSERT_HANDLER(__FILE__, __LINE__, \
+ __PRETTY_FUNCTION__, \
+ msg, #exp, LEMON_ASSERT_DO_ABORT), 0)))
+# endif
+#endif
+
+/**
+ * \brief Macro for mark not yet implemented features.
+ *
+ * \todo Is this the right place for this? It should be used only in
+ * modules under development.
+ *
+ * \todo __PRETTY_FUNCTION__ should be replaced by something
+ * compiler-independent, like BOOST_CURRENT_FUNCTION
+ */
+
+# define LEMON_FIXME(msg) \
+ (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
+ "FIXME: " msg))
diff --git a/src/lemon/fib_heap.h b/src/lemon/fib_heap.h
new file mode 100644
index 0000000..c0d632b
--- /dev/null
+++ b/src/lemon/fib_heap.h
@@ -0,0 +1,464 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_FIB_HEAP_H
+#define LEMON_FIB_HEAP_H
+
+///\file
+///\ingroup auxdat
+///\brief Fibonacci Heap implementation.
+
+#include <vector>
+#include <functional>
+#include <lemon/math.h>
+
+namespace lemon {
+
+ /// \ingroup auxdat
+ ///
+ ///\brief Fibonacci Heap.
+ ///
+ ///This class implements the \e Fibonacci \e heap data structure. A \e heap
+ ///is a data structure for storing items with specified values called \e
+ ///priorities in such a way that finding the item with minimum priority is
+ ///efficient. \c Compare specifies the ordering of the priorities. In a heap
+ ///one can change the priority of an item, add or erase an item, etc.
+ ///
+ ///The methods \ref increase and \ref erase are not efficient in a Fibonacci
+ ///heap. In case of many calls to these operations, it is better to use a
+ ///\ref BinHeap "binary heap".
+ ///
+ ///\param _Prio Type of the priority of the items.
+ ///\param _ItemIntMap A read and writable Item int map, used internally
+ ///to handle the cross references.
+ ///\param _Compare A class for the ordering of the priorities. The
+ ///default is \c std::less<_Prio>.
+ ///
+ ///\sa BinHeap
+ ///\sa Dijkstra
+ ///\author Jacint Szabo
+
+#ifdef DOXYGEN
+ template <typename _Prio,
+ typename _ItemIntMap,
+ typename _Compare>
+#else
+ template <typename _Prio,
+ typename _ItemIntMap,
+ typename _Compare = std::less<_Prio> >
+#endif
+ class FibHeap {
+ public:
+ typedef _ItemIntMap ItemIntMap;
+ typedef _Prio Prio;
+ typedef typename ItemIntMap::Key Item;
+ typedef std::pair<Item,Prio> Pair;
+ typedef _Compare Compare;
+
+ private:
+ class store;
+
+ std::vector<store> container;
+ int minimum;
+ ItemIntMap &iimap;
+ Compare comp;
+ int num_items;
+
+ public:
+ ///Status of the nodes
+ enum State {
+ ///The node is in the heap
+ IN_HEAP = 0,
+ ///The node has never been in the heap
+ PRE_HEAP = -1,
+ ///The node was in the heap but it got out of it
+ POST_HEAP = -2
+ };
+
+ /// \brief The constructor
+ ///
+ /// \c _iimap should be given to the constructor, since it is
+ /// used internally to handle the cross references.
+ explicit FibHeap(ItemIntMap &_iimap)
+ : minimum(0), iimap(_iimap), num_items() {}
+
+ /// \brief The constructor
+ ///
+ /// \c _iimap should be given to the constructor, since it is used
+ /// internally to handle the cross references. \c _comp is an
+ /// object for ordering of the priorities.
+ FibHeap(ItemIntMap &_iimap, const Compare &_comp)
+ : minimum(0), iimap(_iimap), comp(_comp), num_items() {}
+
+ /// \brief The number of items stored in the heap.
+ ///
+ /// Returns the number of items stored in the heap.
+ int size() const { return num_items; }
+
+ /// \brief Checks if the heap stores no items.
+ ///
+ /// Returns \c true if and only if the heap stores no items.
+ bool empty() const { return num_items==0; }
+
+ /// \brief Make empty this heap.
+ ///
+ /// Make empty this heap. It does not change the cross reference
+ /// map. If you want to reuse a heap what is not surely empty you
+ /// should first clear the heap and after that you should set the
+ /// cross reference map for each item to \c PRE_HEAP.
+ void clear() {
+ container.clear(); minimum = 0; num_items = 0;
+ }
+
+ /// \brief \c item gets to the heap with priority \c value independently
+ /// if \c item was already there.
+ ///
+ /// This method calls \ref push(\c item, \c value) if \c item is not
+ /// stored in the heap and it calls \ref decrease(\c item, \c value) or
+ /// \ref increase(\c item, \c value) otherwise.
+ void set (const Item& item, const Prio& value) {
+ int i=iimap[item];
+ if ( i >= 0 && container[i].in ) {
+ if ( comp(value, container[i].prio) ) decrease(item, value);
+ if ( comp(container[i].prio, value) ) increase(item, value);
+ } else push(item, value);
+ }
+
+ /// \brief Adds \c item to the heap with priority \c value.
+ ///
+ /// Adds \c item to the heap with priority \c value.
+ /// \pre \c item must not be stored in the heap.
+ void push (const Item& item, const Prio& value) {
+ int i=iimap[item];
+ if ( i < 0 ) {
+ int s=container.size();
+ iimap.set( item, s );
+ store st;
+ st.name=item;
+ container.push_back(st);
+ i=s;
+ } else {
+ container[i].parent=container[i].child=-1;
+ container[i].degree=0;
+ container[i].in=true;
+ container[i].marked=false;
+ }
+
+ if ( num_items ) {
+ container[container[minimum].right_neighbor].left_neighbor=i;
+ container[i].right_neighbor=container[minimum].right_neighbor;
+ container[minimum].right_neighbor=i;
+ container[i].left_neighbor=minimum;
+ if ( comp( value, container[minimum].prio) ) minimum=i;
+ } else {
+ container[i].right_neighbor=container[i].left_neighbor=i;
+ minimum=i;
+ }
+ container[i].prio=value;
+ ++num_items;
+ }
+
+ /// \brief Returns the item with minimum priority relative to \c Compare.
+ ///
+ /// This method returns the item with minimum priority relative to \c
+ /// Compare.
+ /// \pre The heap must be nonempty.
+ Item top() const { return container[minimum].name; }
+
+ /// \brief Returns the minimum priority relative to \c Compare.
+ ///
+ /// It returns the minimum priority relative to \c Compare.
+ /// \pre The heap must be nonempty.
+ const Prio& prio() const { return container[minimum].prio; }
+
+ /// \brief Returns the priority of \c item.
+ ///
+ /// It returns the priority of \c item.
+ /// \pre \c item must be in the heap.
+ const Prio& operator[](const Item& item) const {
+ return container[iimap[item]].prio;
+ }
+
+ /// \brief Deletes the item with minimum priority relative to \c Compare.
+ ///
+ /// This method deletes the item with minimum priority relative to \c
+ /// Compare from the heap.
+ /// \pre The heap must be non-empty.
+ void pop() {
+ /*The first case is that there are only one root.*/
+ if ( container[minimum].left_neighbor==minimum ) {
+ container[minimum].in=false;
+ if ( container[minimum].degree!=0 ) {
+ makeroot(container[minimum].child);
+ minimum=container[minimum].child;
+ balance();
+ }
+ } else {
+ int right=container[minimum].right_neighbor;
+ unlace(minimum);
+ container[minimum].in=false;
+ if ( container[minimum].degree > 0 ) {
+ int left=container[minimum].left_neighbor;
+ int child=container[minimum].child;
+ int last_child=container[child].left_neighbor;
+
+ makeroot(child);
+
+ container[left].right_neighbor=child;
+ container[child].left_neighbor=left;
+ container[right].left_neighbor=last_child;
+ container[last_child].right_neighbor=right;
+ }
+ minimum=right;
+ balance();
+ } // the case where there are more roots
+ --num_items;
+ }
+
+ /// \brief Deletes \c item from the heap.
+ ///
+ /// This method deletes \c item from the heap, if \c item was already
+ /// stored in the heap. It is quite inefficient in Fibonacci heaps.
+ void erase (const Item& item) {
+ int i=iimap[item];
+
+ if ( i >= 0 && container[i].in ) {
+ if ( container[i].parent!=-1 ) {
+ int p=container[i].parent;
+ cut(i,p);
+ cascade(p);
+ }
+ minimum=i; //As if its prio would be -infinity
+ pop();
+ }
+ }
+
+ /// \brief Decreases the priority of \c item to \c value.
+ ///
+ /// This method decreases the priority of \c item to \c value.
+ /// \pre \c item must be stored in the heap with priority at least \c
+ /// value relative to \c Compare.
+ void decrease (Item item, const Prio& value) {
+ int i=iimap[item];
+ container[i].prio=value;
+ int p=container[i].parent;
+
+ if ( p!=-1 && comp(value, container[p].prio) ) {
+ cut(i,p);
+ cascade(p);
+ }
+ if ( comp(value, container[minimum].prio) ) minimum=i;
+ }
+
+ /// \brief Increases the priority of \c item to \c value.
+ ///
+ /// This method sets the priority of \c item to \c value. Though
+ /// there is no precondition on the priority of \c item, this
+ /// method should be used only if it is indeed necessary to increase
+ /// (relative to \c Compare) the priority of \c item, because this
+ /// method is inefficient.
+ void increase (Item item, const Prio& value) {
+ erase(item);
+ push(item, value);
+ }
+
+
+ /// \brief Returns if \c item is in, has already been in, or has never
+ /// been in the heap.
+ ///
+ /// This method returns PRE_HEAP if \c item has never been in the
+ /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
+ /// otherwise. In the latter case it is possible that \c item will
+ /// get back to the heap again.
+ State state(const Item &item) const {
+ int i=iimap[item];
+ if( i>=0 ) {
+ if ( container[i].in ) i=0;
+ else i=-2;
+ }
+ return State(i);
+ }
+
+ /// \brief Sets the state of the \c item in the heap.
+ ///
+ /// Sets the state of the \c item in the heap. It can be used to
+ /// manually clear the heap when it is important to achive the
+ /// better time complexity.
+ /// \param i The item.
+ /// \param st The state. It should not be \c IN_HEAP.
+ void state(const Item& i, State st) {
+ switch (st) {
+ case POST_HEAP:
+ case PRE_HEAP:
+ if (state(i) == IN_HEAP) {
+ erase(i);
+ }
+ iimap[i] = st;
+ break;
+ case IN_HEAP:
+ break;
+ }
+ }
+
+ private:
+
+ void balance() {
+
+ int maxdeg=int( std::floor( 2.08*log(double(container.size()))))+1;
+
+ std::vector<int> A(maxdeg,-1);
+
+ /*
+ *Recall that now minimum does not point to the minimum prio element.
+ *We set minimum to this during balance().
+ */
+ int anchor=container[minimum].left_neighbor;
+ int next=minimum;
+ bool end=false;
+
+ do {
+ int active=next;
+ if ( anchor==active ) end=true;
+ int d=container[active].degree;
+ next=container[active].right_neighbor;
+
+ while (A[d]!=-1) {
+ if( comp(container[active].prio, container[A[d]].prio) ) {
+ fuse(active,A[d]);
+ } else {
+ fuse(A[d],active);
+ active=A[d];
+ }
+ A[d]=-1;
+ ++d;
+ }
+ A[d]=active;
+ } while ( !end );
+
+
+ while ( container[minimum].parent >=0 )
+ minimum=container[minimum].parent;
+ int s=minimum;
+ int m=minimum;
+ do {
+ if ( comp(container[s].prio, container[minimum].prio) ) minimum=s;
+ s=container[s].right_neighbor;
+ } while ( s != m );
+ }
+
+ void makeroot(int c) {
+ int s=c;
+ do {
+ container[s].parent=-1;
+ s=container[s].right_neighbor;
+ } while ( s != c );
+ }
+
+ void cut(int a, int b) {
+ /*
+ *Replacing a from the children of b.
+ */
+ --container[b].degree;
+
+ if ( container[b].degree !=0 ) {
+ int child=container[b].child;
+ if ( child==a )
+ container[b].child=container[child].right_neighbor;
+ unlace(a);
+ }
+
+
+ /*Lacing a to the roots.*/
+ int right=container[minimum].right_neighbor;
+ container[minimum].right_neighbor=a;
+ container[a].left_neighbor=minimum;
+ container[a].right_neighbor=right;
+ container[right].left_neighbor=a;
+
+ container[a].parent=-1;
+ container[a].marked=false;
+ }
+
+ void cascade(int a) {
+ if ( container[a].parent!=-1 ) {
+ int p=container[a].parent;
+
+ if ( container[a].marked==false ) container[a].marked=true;
+ else {
+ cut(a,p);
+ cascade(p);
+ }
+ }
+ }
+
+ void fuse(int a, int b) {
+ unlace(b);
+
+ /*Lacing b under a.*/
+ container[b].parent=a;
+
+ if (container[a].degree==0) {
+ container[b].left_neighbor=b;
+ container[b].right_neighbor=b;
+ container[a].child=b;
+ } else {
+ int child=container[a].child;
+ int last_child=container[child].left_neighbor;
+ container[child].left_neighbor=b;
+ container[b].right_neighbor=child;
+ container[last_child].right_neighbor=b;
+ container[b].left_neighbor=last_child;
+ }
+
+ ++container[a].degree;
+
+ container[b].marked=false;
+ }
+
+ /*
+ *It is invoked only if a has siblings.
+ */
+ void unlace(int a) {
+ int leftn=container[a].left_neighbor;
+ int rightn=container[a].right_neighbor;
+ container[leftn].right_neighbor=rightn;
+ container[rightn].left_neighbor=leftn;
+ }
+
+
+ class store {
+ friend class FibHeap;
+
+ Item name;
+ int parent;
+ int left_neighbor;
+ int right_neighbor;
+ int child;
+ int degree;
+ bool marked;
+ bool in;
+ Prio prio;
+
+ store() : parent(-1), child(-1), degree(), marked(false), in(true) {}
+ };
+ };
+
+} //namespace lemon
+
+#endif //LEMON_FIB_HEAP_H
+
diff --git a/src/lemon/graph_adaptor.h b/src/lemon/graph_adaptor.h
new file mode 100644
index 0000000..66e75f1
--- /dev/null
+++ b/src/lemon/graph_adaptor.h
@@ -0,0 +1,2720 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_GRAPH_ADAPTOR_H
+#define LEMON_GRAPH_ADAPTOR_H
+
+///\ingroup graph_adaptors
+///\file
+///\brief Several graph adaptors.
+///
+///This file contains several useful graph adaptor functions.
+///
+///\author Marton Makai and Balazs Dezso
+
+#include <lemon/bits/invalid.h>
+#include <lemon/bits/variant.h>
+#include <lemon/maps.h>
+
+#include <lemon/bits/base_extender.h>
+#include <lemon/bits/graph_adaptor_extender.h>
+#include <lemon/bits/graph_extender.h>
+#include <lemon/tolerance.h>
+
+#include <algorithm>
+
+namespace lemon {
+
+ ///\brief Base type for the Graph Adaptors
+ ///
+ ///Base type for the Graph Adaptors
+ ///
+ ///This is the base type for most of LEMON graph adaptors.
+ ///This class implements a trivial graph adaptor i.e. it only wraps the
+ ///functions and types of the graph. The purpose of this class is to
+ ///make easier implementing graph adaptors. E.g. if an adaptor is
+ ///considered which differs from the wrapped graph only in some of its
+ ///functions or types, then it can be derived from GraphAdaptor,
+ ///and only the
+ ///differences should be implemented.
+ ///
+ ///author Marton Makai
+ template<typename _Graph>
+ class GraphAdaptorBase {
+ public:
+ typedef _Graph Graph;
+ typedef GraphAdaptorBase Adaptor;
+ typedef Graph ParentGraph;
+
+ protected:
+ Graph* graph;
+ GraphAdaptorBase() : graph(0) { }
+ void setGraph(Graph& _graph) { graph=&_graph; }
+
+ public:
+ GraphAdaptorBase(Graph& _graph) : graph(&_graph) { }
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+
+ void first(Node& i) const { graph->first(i); }
+ void first(Edge& i) const { graph->first(i); }
+ void firstIn(Edge& i, const Node& n) const { graph->firstIn(i, n); }
+ void firstOut(Edge& i, const Node& n ) const { graph->firstOut(i, n); }
+
+ void next(Node& i) const { graph->next(i); }
+ void next(Edge& i) const { graph->next(i); }
+ void nextIn(Edge& i) const { graph->nextIn(i); }
+ void nextOut(Edge& i) const { graph->nextOut(i); }
+
+ Node source(const Edge& e) const { return graph->source(e); }
+ Node target(const Edge& e) const { return graph->target(e); }
+
+ typedef NodeNumTagIndicator<Graph> NodeNumTag;
+ int nodeNum() const { return graph->nodeNum(); }
+
+ typedef EdgeNumTagIndicator<Graph> EdgeNumTag;
+ int edgeNum() const { return graph->edgeNum(); }
+
+ typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+ Edge findEdge(const Node& u, const Node& v,
+ const Edge& prev = INVALID) {
+ return graph->findEdge(u, v, prev);
+ }
+
+ Node addNode() const {
+ return Node(graph->addNode());
+ }
+
+ Edge addEdge(const Node& u, const Node& v) const {
+ return Edge(graph->addEdge(u, v));
+ }
+
+ void erase(const Node& i) const { graph->erase(i); }
+ void erase(const Edge& i) const { graph->erase(i); }
+
+ void clear() const { graph->clear(); }
+
+ int id(const Node& v) const { return graph->id(v); }
+ int id(const Edge& e) const { return graph->id(e); }
+
+ Node fromNodeId(int ix) const {
+ return graph->fromNodeId(ix);
+ }
+
+ Edge fromEdgeId(int ix) const {
+ return graph->fromEdgeId(ix);
+ }
+
+ int maxNodeId() const {
+ return graph->maxNodeId();
+ }
+
+ int maxEdgeId() const {
+ return graph->maxEdgeId();
+ }
+
+ typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
+
+ NodeNotifier& notifier(Node) const {
+ return graph->notifier(Node());
+ }
+
+ typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier;
+
+ EdgeNotifier& notifier(Edge) const {
+ return graph->notifier(Edge());
+ }
+
+ template <typename _Value>
+ class NodeMap : public Graph::template NodeMap<_Value> {
+ public:
+
+ typedef typename Graph::template NodeMap<_Value> Parent;
+
+ explicit NodeMap(const Adaptor& ga)
+ : Parent(*ga.graph) {}
+
+ NodeMap(const Adaptor& ga, const _Value& value)
+ : Parent(*ga.graph, value) { }
+
+ NodeMap& operator=(const NodeMap& cmap) {
+ return operator=<NodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ NodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ template <typename _Value>
+ class EdgeMap : public Graph::template EdgeMap<_Value> {
+ public:
+
+ typedef typename Graph::template EdgeMap<_Value> Parent;
+
+ explicit EdgeMap(const Adaptor& ga)
+ : Parent(*ga.graph) {}
+
+ EdgeMap(const Adaptor& ga, const _Value& value)
+ : Parent(*ga.graph, value) {}
+
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ };
+
+ ///\ingroup graph_adaptors
+ ///
+ ///\brief Trivial Graph Adaptor
+ ///
+ /// This class is an adaptor which does not change the adapted graph.
+ /// It can be used only to test the graph adaptors.
+ template <typename _Graph>
+ class GraphAdaptor :
+ public GraphAdaptorExtender<GraphAdaptorBase<_Graph> > {
+ public:
+ typedef _Graph Graph;
+ typedef GraphAdaptorExtender<GraphAdaptorBase<_Graph> > Parent;
+ protected:
+ GraphAdaptor() : Parent() { }
+
+ public:
+ explicit GraphAdaptor(Graph& _graph) { setGraph(_graph); }
+ };
+
+ /// \brief Just gives back a graph adaptor
+ ///
+ /// Just gives back a graph adaptor which
+ /// should be provide original graph
+ template<typename Graph>
+ GraphAdaptor<const Graph>
+ graphAdaptor(const Graph& graph) {
+ return GraphAdaptor<const Graph>(graph);
+ }
+
+
+ template <typename _Graph>
+ class RevGraphAdaptorBase : public GraphAdaptorBase<_Graph> {
+ public:
+ typedef _Graph Graph;
+ typedef GraphAdaptorBase<_Graph> Parent;
+ protected:
+ RevGraphAdaptorBase() : Parent() { }
+ public:
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ void firstIn(Edge& i, const Node& n) const { Parent::firstOut(i, n); }
+ void firstOut(Edge& i, const Node& n ) const { Parent::firstIn(i, n); }
+
+ void nextIn(Edge& i) const { Parent::nextOut(i); }
+ void nextOut(Edge& i) const { Parent::nextIn(i); }
+
+ Node source(const Edge& e) const { return Parent::target(e); }
+ Node target(const Edge& e) const { return Parent::source(e); }
+
+ typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+ Edge findEdge(const Node& u, const Node& v,
+ const Edge& prev = INVALID) {
+ return Parent::findEdge(v, u, prev);
+ }
+
+ };
+
+
+ ///\ingroup graph_adaptors
+ ///
+ ///\brief A graph adaptor which reverses the orientation of the edges.
+ ///
+ /// If \c g is defined as
+ ///\code
+ /// ListGraph g;
+ ///\endcode
+ /// then
+ ///\code
+ /// RevGraphAdaptor<ListGraph> ga(g);
+ ///\endcode
+ /// implements the graph obtained from \c g by
+ /// reversing the orientation of its edges.
+ ///
+ /// A good example of using RevGraphAdaptor is to decide that the
+ /// directed graph is wheter strongly connected or not. If from one
+ /// node each node is reachable and from each node is reachable this
+ /// node then and just then the graph is strongly connected. Instead of
+ /// this condition we use a little bit different. From one node each node
+ /// ahould be reachable in the graph and in the reversed graph. Now this
+ /// condition can be checked with the Dfs algorithm class and the
+ /// RevGraphAdaptor algorithm class.
+ ///
+ /// And look at the code:
+ ///
+ ///\code
+ /// bool stronglyConnected(const Graph& graph) {
+ /// if (NodeIt(graph) == INVALID) return true;
+ /// Dfs<Graph> dfs(graph);
+ /// dfs.run(NodeIt(graph));
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!dfs.reached(it)) {
+ /// return false;
+ /// }
+ /// }
+ /// typedef RevGraphAdaptor<const Graph> RGraph;
+ /// RGraph rgraph(graph);
+ /// DfsVisit<RGraph> rdfs(rgraph);
+ /// rdfs.run(NodeIt(graph));
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!rdfs.reached(it)) {
+ /// return false;
+ /// }
+ /// }
+ /// return true;
+ /// }
+ ///\endcode
+ template<typename _Graph>
+ class RevGraphAdaptor :
+ public GraphAdaptorExtender<RevGraphAdaptorBase<_Graph> > {
+ public:
+ typedef _Graph Graph;
+ typedef GraphAdaptorExtender<
+ RevGraphAdaptorBase<_Graph> > Parent;
+ protected:
+ RevGraphAdaptor() { }
+ public:
+ explicit RevGraphAdaptor(_Graph& _graph) { setGraph(_graph); }
+ };
+
+ /// \brief Just gives back a reverse graph adaptor
+ ///
+ /// Just gives back a reverse graph adaptor
+ template<typename Graph>
+ RevGraphAdaptor<const Graph>
+ revGraphAdaptor(const Graph& graph) {
+ return RevGraphAdaptor<const Graph>(graph);
+ }
+
+ template <typename _Graph, typename NodeFilterMap,
+ typename EdgeFilterMap, bool checked = true>
+ class SubGraphAdaptorBase : public GraphAdaptorBase<_Graph> {
+ public:
+ typedef _Graph Graph;
+ typedef SubGraphAdaptorBase Adaptor;
+ typedef GraphAdaptorBase<_Graph> Parent;
+ protected:
+ NodeFilterMap* node_filter_map;
+ EdgeFilterMap* edge_filter_map;
+ SubGraphAdaptorBase() : Parent(),
+ node_filter_map(0), edge_filter_map(0) { }
+
+ void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
+ node_filter_map=&_node_filter_map;
+ }
+ void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
+ edge_filter_map=&_edge_filter_map;
+ }
+
+ public:
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ void first(Node& i) const {
+ Parent::first(i);
+ while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i);
+ }
+
+ void first(Edge& i) const {
+ Parent::first(i);
+ while (i!=INVALID && (!(*edge_filter_map)[i]
+ || !(*node_filter_map)[Parent::source(i)]
+ || !(*node_filter_map)[Parent::target(i)])) Parent::next(i);
+ }
+
+ void firstIn(Edge& i, const Node& n) const {
+ Parent::firstIn(i, n);
+ while (i!=INVALID && (!(*edge_filter_map)[i]
+ || !(*node_filter_map)[Parent::source(i)])) Parent::nextIn(i);
+ }
+
+ void firstOut(Edge& i, const Node& n) const {
+ Parent::firstOut(i, n);
+ while (i!=INVALID && (!(*edge_filter_map)[i]
+ || !(*node_filter_map)[Parent::target(i)])) Parent::nextOut(i);
+ }
+
+ void next(Node& i) const {
+ Parent::next(i);
+ while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i);
+ }
+
+ void next(Edge& i) const {
+ Parent::next(i);
+ while (i!=INVALID && (!(*edge_filter_map)[i]
+ || !(*node_filter_map)[Parent::source(i)]
+ || !(*node_filter_map)[Parent::target(i)])) Parent::next(i);
+ }
+
+ void nextIn(Edge& i) const {
+ Parent::nextIn(i);
+ while (i!=INVALID && (!(*edge_filter_map)[i]
+ || !(*node_filter_map)[Parent::source(i)])) Parent::nextIn(i);
+ }
+
+ void nextOut(Edge& i) const {
+ Parent::nextOut(i);
+ while (i!=INVALID && (!(*edge_filter_map)[i]
+ || !(*node_filter_map)[Parent::target(i)])) Parent::nextOut(i);
+ }
+
+ ///\e
+
+ /// This function hides \c n in the graph, i.e. the iteration
+ /// jumps over it. This is done by simply setting the value of \c n
+ /// to be false in the corresponding node-map.
+ void hide(const Node& n) const { node_filter_map->set(n, false); }
+
+ ///\e
+
+ /// This function hides \c e in the graph, i.e. the iteration
+ /// jumps over it. This is done by simply setting the value of \c e
+ /// to be false in the corresponding edge-map.
+ void hide(const Edge& e) const { edge_filter_map->set(e, false); }
+
+ ///\e
+
+ /// The value of \c n is set to be true in the node-map which stores
+ /// hide information. If \c n was hidden previuosly, then it is shown
+ /// again
+ void unHide(const Node& n) const { node_filter_map->set(n, true); }
+
+ ///\e
+
+ /// The value of \c e is set to be true in the edge-map which stores
+ /// hide information. If \c e was hidden previuosly, then it is shown
+ /// again
+ void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
+
+ /// Returns true if \c n is hidden.
+
+ ///\e
+ ///
+ bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
+
+ /// Returns true if \c n is hidden.
+
+ ///\e
+ ///
+ bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
+
+ typedef False NodeNumTag;
+ typedef False EdgeNumTag;
+
+ typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+ Edge findEdge(const Node& source, const Node& target,
+ const Edge& prev = INVALID) {
+ if (!(*node_filter_map)[source] || !(*node_filter_map)[target]) {
+ return INVALID;
+ }
+ Edge edge = Parent::findEdge(source, target, prev);
+ while (edge != INVALID && !(*edge_filter_map)[edge]) {
+ edge = Parent::findEdge(source, target, edge);
+ }
+ return edge;
+ }
+
+ template <typename _Value>
+ class NodeMap
+ : public SubMapExtender<Adaptor,
+ typename Parent::template NodeMap<_Value> >
+ {
+ public:
+ typedef Adaptor Graph;
+ //typedef SubMapExtender<Adaptor, typename Parent::
+ // template NodeMap<_Value> > Parent;
+
+ NodeMap(const Graph& g)
+ : Parent(g) {}
+ NodeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
+
+ NodeMap& operator=(const NodeMap& cmap) {
+ return operator=<NodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ NodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+ template <typename _Value>
+ class EdgeMap
+ : public SubMapExtender<Adaptor,
+ typename Parent::template EdgeMap<_Value> >
+ {
+ public:
+ typedef Adaptor Graph;
+ //typedef SubMapExtender<Adaptor, typename Parent::
+ // template EdgeMap<_Value> > Parent;
+
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
+
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+ };
+
+ template <typename _Graph, typename NodeFilterMap, typename EdgeFilterMap>
+ class SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap, false>
+ : public GraphAdaptorBase<_Graph> {
+ public:
+ typedef _Graph Graph;
+ typedef SubGraphAdaptorBase Adaptor;
+ typedef GraphAdaptorBase<_Graph> Parent;
+ protected:
+ NodeFilterMap* node_filter_map;
+ EdgeFilterMap* edge_filter_map;
+ SubGraphAdaptorBase() : Parent(),
+ node_filter_map(0), edge_filter_map(0) { }
+
+ void setNodeFilterMap(NodeFilterMap& _node_filter_map) {
+ node_filter_map=&_node_filter_map;
+ }
+ void setEdgeFilterMap(EdgeFilterMap& _edge_filter_map) {
+ edge_filter_map=&_edge_filter_map;
+ }
+
+ public:
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ void first(Node& i) const {
+ Parent::first(i);
+ while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i);
+ }
+
+ void first(Edge& i) const {
+ Parent::first(i);
+ while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i);
+ }
+
+ void firstIn(Edge& i, const Node& n) const {
+ Parent::firstIn(i, n);
+ while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i);
+ }
+
+ void firstOut(Edge& i, const Node& n) const {
+ Parent::firstOut(i, n);
+ while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i);
+ }
+
+ void next(Node& i) const {
+ Parent::next(i);
+ while (i!=INVALID && !(*node_filter_map)[i]) Parent::next(i);
+ }
+ void next(Edge& i) const {
+ Parent::next(i);
+ while (i!=INVALID && !(*edge_filter_map)[i]) Parent::next(i);
+ }
+ void nextIn(Edge& i) const {
+ Parent::nextIn(i);
+ while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextIn(i);
+ }
+
+ void nextOut(Edge& i) const {
+ Parent::nextOut(i);
+ while (i!=INVALID && !(*edge_filter_map)[i]) Parent::nextOut(i);
+ }
+
+ ///\e
+
+ /// This function hides \c n in the graph, i.e. the iteration
+ /// jumps over it. This is done by simply setting the value of \c n
+ /// to be false in the corresponding node-map.
+ void hide(const Node& n) const { node_filter_map->set(n, false); }
+
+ ///\e
+
+ /// This function hides \c e in the graph, i.e. the iteration
+ /// jumps over it. This is done by simply setting the value of \c e
+ /// to be false in the corresponding edge-map.
+ void hide(const Edge& e) const { edge_filter_map->set(e, false); }
+
+ ///\e
+
+ /// The value of \c n is set to be true in the node-map which stores
+ /// hide information. If \c n was hidden previuosly, then it is shown
+ /// again
+ void unHide(const Node& n) const { node_filter_map->set(n, true); }
+
+ ///\e
+
+ /// The value of \c e is set to be true in the edge-map which stores
+ /// hide information. If \c e was hidden previuosly, then it is shown
+ /// again
+ void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
+
+ /// Returns true if \c n is hidden.
+
+ ///\e
+ ///
+ bool hidden(const Node& n) const { return !(*node_filter_map)[n]; }
+
+ /// Returns true if \c n is hidden.
+
+ ///\e
+ ///
+ bool hidden(const Edge& e) const { return !(*edge_filter_map)[e]; }
+
+ typedef False NodeNumTag;
+ typedef False EdgeNumTag;
+
+ typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
+ Edge findEdge(const Node& source, const Node& target,
+ const Edge& prev = INVALID) {
+ if (!(*node_filter_map)[source] || !(*node_filter_map)[target]) {
+ return INVALID;
+ }
+ Edge edge = Parent::findEdge(source, target, prev);
+ while (edge != INVALID && !(*edge_filter_map)[edge]) {
+ edge = Parent::findEdge(source, target, edge);
+ }
+ return edge;
+ }
+
+ template <typename _Value>
+ class NodeMap
+ : public SubMapExtender<Adaptor,
+ typename Parent::template NodeMap<_Value> >
+ {
+ public:
+ typedef Adaptor Graph;
+ //typedef SubMapExtender<Adaptor, typename Parent::
+ // template NodeMap<_Value> > Parent;
+
+ NodeMap(const Graph& g)
+ : Parent(g) {}
+ NodeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
+
+ NodeMap& operator=(const NodeMap& cmap) {
+ return operator=<NodeMap>(cmap);
+ }
+
+ template <typename CMap>
+ NodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+ template <typename _Value>
+ class EdgeMap
+ : public SubMapExtender<Adaptor,
+ typename Parent::template EdgeMap<_Value> >
+ {
+ public:
+ typedef Adaptor Graph;
+ //typedef SubMapExtender<Adaptor, typename Parent::
+ // template EdgeMap<_Value> > Parent;
+
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
+
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+ };
+
+ /// \ingroup graph_adaptors
+ ///
+ /// \brief A graph adaptor for hiding nodes and edges from a graph.
+ ///
+ /// SubGraphAdaptor shows the graph with filtered node-set and
+ /// edge-set. If the \c checked parameter is true then it filters the edgeset
+ /// to do not get invalid edges without source or target.
+ /// Let \f$ G=(V, A) \f$ be a directed graph
+ /// and suppose that the graph instance \c g of type ListGraph
+ /// implements \f$ G \f$.
+ /// Let moreover \f$ b_V \f$ and \f$ b_A \f$ be bool-valued functions resp.
+ /// on the node-set and edge-set.
+ /// SubGraphAdaptor<...>::NodeIt iterates
+ /// on the node-set \f$ \{v\in V : b_V(v)=true\} \f$ and
+ /// SubGraphAdaptor<...>::EdgeIt iterates
+ /// on the edge-set \f$ \{e\in A : b_A(e)=true\} \f$. Similarly,
+ /// SubGraphAdaptor<...>::OutEdgeIt and
+ /// SubGraphAdaptor<...>::InEdgeIt iterates
+ /// only on edges leaving and entering a specific node which have true value.
+ ///
+ /// If the \c checked template parameter is false then we have to note that
+ /// the node-iterator cares only the filter on the node-set, and the
+ /// edge-iterator cares only the filter on the edge-set.
+ /// This way the edge-map
+ /// should filter all edges which's source or target is filtered by the
+ /// node-filter.
+ ///\code
+ /// typedef ListGraph Graph;
+ /// Graph g;
+ /// typedef Graph::Node Node;
+ /// typedef Graph::Edge Edge;
+ /// Node u=g.addNode(); //node of id 0
+ /// Node v=g.addNode(); //node of id 1
+ /// Node e=g.addEdge(u, v); //edge of id 0
+ /// Node f=g.addEdge(v, u); //edge of id 1
+ /// Graph::NodeMap<bool> nm(g, true);
+ /// nm.set(u, false);
+ /// Graph::EdgeMap<bool> em(g, true);
+ /// em.set(e, false);
+ /// typedef SubGraphAdaptor<Graph, Graph::NodeMap<bool>, Graph::EdgeMap<bool> > SubGA;
+ /// SubGA ga(g, nm, em);
+ /// for (SubGA::NodeIt n(ga); n!=INVALID; ++n) std::cout << g.id(n) << std::endl;
+ /// std::cout << ":-)" << std::endl;
+ /// for (SubGA::EdgeIt e(ga); e!=INVALID; ++e) std::cout << g.id(e) << std::endl;
+ ///\endcode
+ /// The output of the above code is the following.
+ ///\code
+ /// 1
+ /// :-)
+ /// 1
+ ///\endcode
+ /// Note that \c n is of type \c SubGA::NodeIt, but it can be converted to
+ /// \c Graph::Node that is why \c g.id(n) can be applied.
+ ///
+ /// For other examples see also the documentation of NodeSubGraphAdaptor and
+ /// EdgeSubGraphAdaptor.
+ ///
+ /// \author Marton Makai
+
+ template<typename _Graph, typename NodeFilterMap,
+ typename EdgeFilterMap, bool checked = true>
+ class SubGraphAdaptor :
+ public GraphAdaptorExtender<
+ SubGraphAdaptorBase<_Graph, NodeFilterMap, EdgeFilterMap, checked> > {
+ public:
+ typedef _Graph Graph;
+ typedef GraphAdaptorExtender< SubGraphAdaptorBase<_Graph, NodeFilterMap,
+ EdgeFilterMap, checked> >
+ Parent;
+
+ protected:
+ SubGraphAdaptor() { }
+ public:
+
+ SubGraphAdaptor(_Graph& _graph, NodeFilterMap& _node_filter_map,
+ EdgeFilterMap& _edge_filter_map) {
+ setGraph(_graph);
+ setNodeFilterMap(_node_filter_map);
+ setEdgeFilterMap(_edge_filter_map);
+ }
+
+ };
+
+ /// \brief Just gives back a sub graph adaptor
+ ///
+ /// Just gives back a sub graph adaptor
+ template<typename Graph, typename NodeFilterMap, typename EdgeFilterMap>
+ SubGraphAdaptor<const Graph, NodeFilterMap, EdgeFilterMap>
+ subGraphAdaptor(const Graph& graph,
+ NodeFilterMap& nfm, EdgeFilterMap& efm) {
+ return SubGraphAdaptor<const Graph, NodeFilterMap, EdgeFilterMap>
+ (graph, nfm, efm);
+ }
+
+ template<typename Graph, typename NodeFilterMap, typename EdgeFilterMap>
+ SubGraphAdaptor<const Graph, const NodeFilterMap, EdgeFilterMap>
+ subGraphAdaptor(const Graph& graph,
+ NodeFilterMap& nfm, EdgeFilterMap& efm) {
+ return SubGraphAdaptor<const Graph, const NodeFilterMap, EdgeFilterMap>
+ (graph, nfm, efm);
+ }
+
+ template<typename Graph, typename NodeFilterMap, typename EdgeFilterMap>
+ SubGraphAdaptor<const Graph, NodeFilterMap, const EdgeFilterMap>
+ subGraphAdaptor(const Graph& graph,
+ NodeFilterMap& nfm, EdgeFilterMap& efm) {
+ return SubGraphAdaptor<const Graph, NodeFilterMap, const EdgeFilterMap>
+ (graph, nfm, efm);
+ }
+
+ template<typename Graph, typename NodeFilterMap, typename EdgeFilterMap>
+ SubGraphAdaptor<const Graph, const NodeFilterMap, const EdgeFilterMap>
+ subGraphAdaptor(const Graph& graph,
+ NodeFilterMap& nfm, EdgeFilterMap& efm) {
+ return SubGraphAdaptor<const Graph, const NodeFilterMap,
+ const EdgeFilterMap>(graph, nfm, efm);
+ }
+
+
+
+ ///\ingroup graph_adaptors
+ ///
+ ///\brief An adaptor for hiding nodes from a graph.
+ ///
+ ///An adaptor for hiding nodes from a graph.
+ ///This adaptor specializes SubGraphAdaptor in the way that only
+ ///the node-set
+ ///can be filtered. In usual case the checked parameter is true, we get the
+ ///induced subgraph. But if the checked parameter is false then we can
+ ///filter only isolated nodes.
+ ///\author Marton Makai
+ template<typename Graph, typename NodeFilterMap, bool checked = true>
+ class NodeSubGraphAdaptor :
+ public SubGraphAdaptor<Graph, NodeFilterMap,
+ ConstMap<typename Graph::Edge,bool>, checked> {
+ public:
+
+ typedef SubGraphAdaptor<Graph, NodeFilterMap,
+ ConstMap<typename Graph::Edge,bool>, checked >
+ Parent;
+
+ protected:
+ ConstMap<typename Graph::Edge, bool> const_true_map;
+
+ NodeSubGraphAdaptor() : const_true_map(true) {
+ Parent::setEdgeFilterMap(const_true_map);
+ }
+
+ public:
+
+ NodeSubGraphAdaptor(Graph& _graph, NodeFilterMap& _node_filter_map) :
+ Parent(), const_true_map(true) {
+ Parent::setGraph(_graph);
+ Parent::setNodeFilterMap(_node_filter_map);
+ Parent::setEdgeFilterMap(const_true_map);
+ }
+
+ };
+
+
+ /// \brief Just gives back a node sub graph adaptor
+ ///
+ /// Just gives back a node sub graph adaptor
+ template<typename Graph, typename NodeFilterMap>
+ NodeSubGraphAdaptor<const Graph, NodeFilterMap>
+ nodeSubGraphAdaptor(const Graph& graph, NodeFilterMap& nfm) {
+ return NodeSubGraphAdaptor<const Graph, NodeFilterMap>(graph, nfm);
+ }
+
+ template<typename Graph, typename NodeFilterMap>
+ NodeSubGraphAdaptor<const Graph, const NodeFilterMap>
+ nodeSubGraphAdaptor(const Graph& graph, const NodeFilterMap& nfm) {
+ return NodeSubGraphAdaptor<const Graph, const NodeFilterMap>(graph, nfm);
+ }
+
+ ///\ingroup graph_adaptors
+ ///
+ ///\brief An adaptor for hiding edges from a graph.
+ ///
+ ///An adaptor for hiding edges from a graph.
+ ///This adaptor specializes SubGraphAdaptor in the way that
+ ///only the edge-set
+ ///can be filtered. The usefulness of this adaptor is demonstrated in the
+ ///problem of searching a maximum number of edge-disjoint shortest paths
+ ///between
+ ///two nodes \c s and \c t. Shortest here means being shortest w.r.t.
+ ///non-negative edge-lengths. Note that
+ ///the comprehension of the presented solution
+ ///need's some elementary knowledge from combinatorial optimization.
+ ///
+ ///If a single shortest path is to be
+ ///searched between \c s and \c t, then this can be done easily by
+ ///applying the Dijkstra algorithm. What happens, if a maximum number of
+ ///edge-disjoint shortest paths is to be computed. It can be proved that an
+ ///edge can be in a shortest path if and only
+ ///if it is tight with respect to
+ ///the potential function computed by Dijkstra.
+ ///Moreover, any path containing
+ ///only such edges is a shortest one.
+ ///Thus we have to compute a maximum number
+ ///of edge-disjoint paths between \c s and \c t in
+ ///the graph which has edge-set
+ ///all the tight edges. The computation will be demonstrated
+ ///on the following
+ ///graph, which is read from the dimacs file \c sub_graph_adaptor_demo.dim.
+ ///The full source code is available in \ref sub_graph_adaptor_demo.cc.
+ ///If you are interested in more demo programs, you can use
+ ///\ref dim_to_dot.cc to generate .dot files from dimacs files.
+ ///The .dot file of the following figure was generated by
+ ///the demo program \ref dim_to_dot.cc.
+ ///
+ ///\dot
+ ///digraph lemon_dot_example {
+ ///node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];
+ ///n0 [ label="0 (s)" ];
+ ///n1 [ label="1" ];
+ ///n2 [ label="2" ];
+ ///n3 [ label="3" ];
+ ///n4 [ label="4" ];
+ ///n5 [ label="5" ];
+ ///n6 [ label="6 (t)" ];
+ ///edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];
+ ///n5 -> n6 [ label="9, length:4" ];
+ ///n4 -> n6 [ label="8, length:2" ];
+ ///n3 -> n5 [ label="7, length:1" ];
+ ///n2 -> n5 [ label="6, length:3" ];
+ ///n2 -> n6 [ label="5, length:5" ];
+ ///n2 -> n4 [ label="4, length:2" ];
+ ///n1 -> n4 [ label="3, length:3" ];
+ ///n0 -> n3 [ label="2, length:1" ];
+ ///n0 -> n2 [ label="1, length:2" ];
+ ///n0 -> n1 [ label="0, length:3" ];
+ ///}
+ ///\enddot
+ ///
+ ///\code
+ ///Graph g;
+ ///Node s, t;
+ ///LengthMap length(g);
+ ///
+ ///readDimacs(std::cin, g, length, s, t);
+ ///
+ ///cout << "edges with lengths (of form id, source--length->target): " << endl;
+ ///for(EdgeIt e(g); e!=INVALID; ++e)
+ /// cout << g.id(e) << ", " << g.id(g.source(e)) << "--"
+ /// << length[e] << "->" << g.id(g.target(e)) << endl;
+ ///
+ ///cout << "s: " << g.id(s) << " t: " << g.id(t) << endl;
+ ///\endcode
+ ///Next, the potential function is computed with Dijkstra.
+ ///\code
+ ///typedef Dijkstra<Graph, LengthMap> Dijkstra;
+ ///Dijkstra dijkstra(g, length);
+ ///dijkstra.run(s);
+ ///\endcode
+ ///Next, we consrtruct a map which filters the edge-set to the tight edges.
+ ///\code
+ ///typedef TightEdgeFilterMap<Graph, const Dijkstra::DistMap, LengthMap>
+ /// TightEdgeFilter;
+ ///TightEdgeFilter tight_edge_filter(g, dijkstra.distMap(), length);
+ ///
+ ///typedef EdgeSubGraphAdaptor<Graph, TightEdgeFilter> SubGA;
+ ///SubGA ga(g, tight_edge_filter);
+ ///\endcode
+ ///Then, the maximum nimber of edge-disjoint \c s-\c t paths are computed
+ ///with a max flow algorithm Preflow.
+ ///\code
+ ///ConstMap<Edge, int> const_1_map(1);
+ ///Graph::EdgeMap<int> flow(g, 0);
+ ///
+ ///Preflow<SubGA, ConstMap<Edge, int>, Graph::EdgeMap<int> >
+ /// preflow(ga, const_1_map, s, t);
+ ///preflow.run();
+ ///\endcode
+ ///Last, the output is:
+ ///\code
+ ///cout << "maximum number of edge-disjoint shortest path: "
+ /// << preflow.flowValue() << endl;
+ ///cout << "edges of the maximum number of edge-disjoint shortest s-t paths: "
+ /// << endl;
+ ///for(EdgeIt e(g); e!=INVALID; ++e)
+ /// if (preflow.flow(e))
+ /// cout << " " << g.id(g.source(e)) << "--"
+ /// << length[e] << "->" << g.id(g.target(e)) << endl;
+ ///\endcode
+ ///The program has the following (expected :-)) output:
+ ///\code
+ ///edges with lengths (of form id, source--length->target):
+ /// 9, 5--4->6
+ /// 8, 4--2->6
+ /// 7, 3--1->5
+ /// 6, 2--3->5
+ /// 5, 2--5->6
+ /// 4, 2--2->4
+ /// 3, 1--3->4
+ /// 2, 0--1->3
+ /// 1, 0--2->2
+ /// 0, 0--3->1
+ ///s: 0 t: 6
+ ///maximum number of edge-disjoint shortest path: 2
+ ///edges of the maximum number of edge-disjoint shortest s-t paths:
+ /// 9, 5--4->6
+ /// 8, 4--2->6
+ /// 7, 3--1->5
+ /// 4, 2--2->4
+ /// 2, 0--1->3
+ /// 1, 0--2->2
+ ///\endcode
+ ///
+ ///\author Marton Makai
+ template<typename Graph, typename EdgeFilterMap>
+ class EdgeSubGraphAdaptor :
+ public SubGraphAdaptor<Graph, ConstMap<typename Graph::Node,bool>,
+ EdgeFilterMap, false> {
+ public:
+ typedef SubGraphAdaptor<Graph, ConstMap<typename Graph::Node,bool>,
+ EdgeFilterMap, false> Parent;
+ protected:
+ ConstMap<typename Graph::Node, bool> const_true_map;
+
+ EdgeSubGraphAdaptor() : const_true_map(true) {
+ Parent::setNodeFilterMap(const_true_map);
+ }
+
+ public:
+
+ EdgeSubGraphAdaptor(Graph& _graph, EdgeFilterMap& _edge_filter_map) :
+ Parent(), const_true_map(true) {
+ Parent::setGraph(_graph);
+ Parent::setNodeFilterMap(const_true_map);
+ Parent::setEdgeFilterMap(_edge_filter_map);
+ }
+
+ };
+
+ /// \brief Just gives back an edge sub graph adaptor
+ ///
+ /// Just gives back an edge sub graph adaptor
+ template<typename Graph, typename EdgeFilterMap>
+ EdgeSubGraphAdaptor<const Graph, EdgeFilterMap>
+ edgeSubGraphAdaptor(const Graph& graph, EdgeFilterMap& efm) {
+ return EdgeSubGraphAdaptor<const Graph, EdgeFilterMap>(graph, efm);
+ }
+
+ template<typename Graph, typename EdgeFilterMap>
+ EdgeSubGraphAdaptor<const Graph, const EdgeFilterMap>
+ edgeSubGraphAdaptor(const Graph& graph, const EdgeFilterMap& efm) {
+ return EdgeSubGraphAdaptor<const Graph, const EdgeFilterMap>(graph, efm);
+ }
+
+ template <typename _Graph>
+ class UndirGraphAdaptorBase :
+ public UndirGraphExtender<GraphAdaptorBase<_Graph> > {
+ public:
+ typedef _Graph Graph;
+ typedef UndirGraphAdaptorBase Adaptor;
+ typedef UndirGraphExtender<GraphAdaptorBase<_Graph> > Parent;
+
+ protected:
+
+ UndirGraphAdaptorBase() : Parent() {}
+
+ public:
+
+ typedef typename Parent::UEdge UEdge;
+ typedef typename Parent::Edge Edge;
+
+ private:
+
+ template <typename _Value>
+ class EdgeMapBase {
+ private:
+
+ typedef typename _Graph::template EdgeMap<_Value> MapImpl;
+
+ public:
+
+ typedef typename MapTraits<MapImpl>::ReferenceMapTag ReferenceMapTag;
+
+ typedef _Value Value;
+ typedef Edge Key;
+
+ EdgeMapBase(const Adaptor& adaptor) :
+ forward_map(*adaptor.graph), backward_map(*adaptor.graph) {}
+
+ EdgeMapBase(const Adaptor& adaptor, const Value& v)
+ : forward_map(*adaptor.graph, v), backward_map(*adaptor.graph, v) {}
+
+ void set(const Edge& e, const Value& a) {
+ if (Parent::direction(e)) {
+ forward_map.set(e, a);
+ } else {
+ backward_map.set(e, a);
+ }
+ }
+
+ typename MapTraits<MapImpl>::ConstReturnValue operator[](Edge e) const {
+ if (Parent::direction(e)) {
+ return forward_map[e];
+ } else {
+ return backward_map[e];
+ }
+ }
+
+ typename MapTraits<MapImpl>::ReturnValue operator[](Edge e) {
+ if (Parent::direction(e)) {
+ return forward_map[e];
+ } else {
+ return backward_map[e];
+ }
+ }
+
+ protected:
+
+ MapImpl forward_map, backward_map;
+
+ };
+
+ public:
+
+ template <typename _Value>
+ class EdgeMap
+ : public SubMapExtender<Adaptor, EdgeMapBase<_Value> >
+ {
+ public:
+ typedef Adaptor Graph;
+ typedef SubMapExtender<Adaptor, EdgeMapBase<_Value> > Parent;
+
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
+
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+ };
+
+ template <typename _Value>
+ class UEdgeMap : public Graph::template EdgeMap<_Value> {
+ public:
+
+ typedef typename Graph::template EdgeMap<_Value> Parent;
+
+ explicit UEdgeMap(const Adaptor& ga)
+ : Parent(*ga.graph) {}
+
+ UEdgeMap(const Adaptor& ga, const _Value& value)
+ : Parent(*ga.graph, value) {}
+
+ UEdgeMap& operator=(const UEdgeMap& cmap) {
+ return operator=<UEdgeMap>(cmap);
+ }
+
+ template <typename CMap>
+ UEdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ };
+
+ };
+
+ template <typename _Graph, typename Enable = void>
+ class AlterableUndirGraphAdaptor
+ : public UGraphAdaptorExtender<UndirGraphAdaptorBase<_Graph> > {
+ public:
+ typedef UGraphAdaptorExtender<UndirGraphAdaptorBase<_Graph> > Parent;
+
+ protected:
+
+ AlterableUndirGraphAdaptor() : Parent() {}
+
+ public:
+
+ typedef typename Parent::EdgeNotifier UEdgeNotifier;
+ typedef InvalidType EdgeNotifier;
+
+ };
+
+ template <typename _Graph>
+ class AlterableUndirGraphAdaptor<
+ _Graph,
+ typename enable_if<typename _Graph::EdgeNotifier::Notifier>::type >
+ : public UGraphAdaptorExtender<UndirGraphAdaptorBase<_Graph> > {
+ public:
+
+ typedef UGraphAdaptorExtender<UndirGraphAdaptorBase<_Graph> > Parent;
+ typedef _Graph Graph;
+ typedef typename _Graph::Edge GraphEdge;
+
+ protected:
+
+ AlterableUndirGraphAdaptor()
+ : Parent(), edge_notifier(*this), edge_notifier_proxy(*this) {}
+
+ void setGraph(_Graph& g) {
+ Parent::setGraph(g);
+ edge_notifier_proxy.setNotifier(g.notifier(GraphEdge()));
+ }
+
+ public:
+
+ ~AlterableUndirGraphAdaptor() {
+ edge_notifier.clear();
+ }
+
+ typedef typename Parent::UEdge UEdge;
+ typedef typename Parent::Edge Edge;
+
+ typedef typename Parent::EdgeNotifier UEdgeNotifier;
+
+ using Parent::notifier;
+
+ typedef AlterationNotifier<AlterableUndirGraphAdaptor,
+ Edge> EdgeNotifier;
+ EdgeNotifier& notifier(Edge) const { return edge_notifier; }
+
+ protected:
+
+ class NotifierProxy : public Graph::EdgeNotifier::ObserverBase {
+ public:
+
+ typedef typename Graph::EdgeNotifier::ObserverBase Parent;
+ typedef AlterableUndirGraphAdaptor AdaptorBase;
+
+ NotifierProxy(const AdaptorBase& _adaptor)
+ : Parent(), adaptor(&_adaptor) {
+ }
+
+ virtual ~NotifierProxy() {
+ if (Parent::attached()) {
+ Parent::detach();
+ }
+ }
+
+ void setNotifier(typename Graph::EdgeNotifier& nf) {
+ Parent::attach(nf);
+ }
+
+
+ protected:
+
+ virtual void add(const GraphEdge& ge) {
+ std::vector<Edge> edges;
+ edges.push_back(AdaptorBase::Parent::direct(ge, true));
+ edges.push_back(AdaptorBase::Parent::direct(ge, false));
+ adaptor->notifier(Edge()).add(edges);
+ }
+ virtual void add(const std::vector<GraphEdge>& ge) {
+ std::vector<Edge> edges;
+ for (int i = 0; i < int(ge.size()); ++i) {
+ edges.push_back(AdaptorBase::Parent::direct(ge[i], true));
+ edges.push_back(AdaptorBase::Parent::direct(ge[i], false));
+ }
+ adaptor->notifier(Edge()).add(edges);
+ }
+ virtual void erase(const GraphEdge& ge) {
+ std::vector<Edge> edges;
+ edges.push_back(AdaptorBase::Parent::direct(ge, true));
+ edges.push_back(AdaptorBase::Parent::direct(ge, false));
+ adaptor->notifier(Edge()).erase(edges);
+ }
+ virtual void erase(const std::vector<GraphEdge>& ge) {
+ std::vector<Edge> edges;
+ for (int i = 0; i < int(ge.size()); ++i) {
+ edges.push_back(AdaptorBase::Parent::direct(ge[i], true));
+ edges.push_back(AdaptorBase::Parent::direct(ge[i], false));
+ }
+ adaptor->notifier(Edge()).erase(edges);
+ }
+ virtual void build() {
+ adaptor->notifier(Edge()).build();
+ }
+ virtual void clear() {
+ adaptor->notifier(Edge()).clear();
+ }
+
+ const AdaptorBase* adaptor;
+ };
+
+
+ mutable EdgeNotifier edge_notifier;
+ NotifierProxy edge_notifier_proxy;
+
+ };
+
+
+ ///\ingroup graph_adaptors
+ ///
+ /// \brief An undirected graph is made from a directed graph by an adaptor
+ ///
+ /// This adaptor makes an undirected graph from a directed
+ /// graph. All edge of the underlying will be showed in the adaptor
+ /// as an undirected edge. Let's see an informal example about using
+ /// this adaptor:
+ ///
+ /// There is a network of the streets of a town. Of course there are
+ /// some one-way street in the town hence the network is a directed
+ /// one. There is a crazy driver who go oppositely in the one-way
+ /// street without moral sense. Of course he can pass this streets
+ /// slower than the regular way, in fact his speed is half of the
+ /// normal speed. How long should he drive to get from a source
+ /// point to the target? Let see the example code which calculate it:
+ ///
+ ///\code
+ /// typedef UndirGraphAdaptor<Graph> UGraph;
+ /// UGraph ugraph(graph);
+ ///
+ /// typedef SimpleMap<LengthMap> FLengthMap;
+ /// FLengthMap flength(length);
+ ///
+ /// typedef ScaleMap<LengthMap> RLengthMap;
+ /// RLengthMap rlength(length, 2.0);
+ ///
+ /// typedef UGraph::CombinedEdgeMap<FLengthMap, RLengthMap > ULengthMap;
+ /// ULengthMap ulength(flength, rlength);
+ ///
+ /// Dijkstra<UGraph, ULengthMap> dijkstra(ugraph, ulength);
+ /// std::cout << "Driving time : " << dijkstra.run(src, trg) << std::endl;
+ ///\endcode
+ ///
+ /// The combined edge map makes the length map for the undirected
+ /// graph. It is created from a forward and reverse map. The forward
+ /// map is created from the original length map with a SimpleMap
+ /// adaptor which just makes a read-write map from the reference map
+ /// i.e. it forgets that it can be return reference to values. The
+ /// reverse map is just the scaled original map with the ScaleMap
+ /// adaptor. The combination solves that passing the reverse way
+ /// takes double time than the original. To get the driving time we
+ /// run the dijkstra algorithm on the undirected graph.
+ ///
+ /// \author Marton Makai and Balazs Dezso
+ template<typename _Graph>
+ class UndirGraphAdaptor : public AlterableUndirGraphAdaptor<_Graph> {
+ public:
+ typedef _Graph Graph;
+ typedef AlterableUndirGraphAdaptor<_Graph> Parent;
+ protected:
+ UndirGraphAdaptor() { }
+ public:
+
+ /// \brief Constructor
+ ///
+ /// Constructor
+ UndirGraphAdaptor(_Graph& _graph) {
+ setGraph(_graph);
+ }
+
+ /// \brief EdgeMap combined from two original EdgeMap
+ ///
+ /// This class adapts two original graph EdgeMap to
+ /// get an edge map on the adaptor.
+ template <typename _ForwardMap, typename _BackwardMap>
+ class CombinedEdgeMap {
+ public:
+
+ typedef _ForwardMap ForwardMap;
+ typedef _BackwardMap BackwardMap;
+
+ typedef typename MapTraits<ForwardMap>::ReferenceMapTag ReferenceMapTag;
+
+ typedef typename ForwardMap::Value Value;
+ typedef typename Parent::Edge Key;
+
+ /// \brief Constructor
+ ///
+ /// Constructor
+ CombinedEdgeMap() : forward_map(0), backward_map(0) {}
+
+ /// \brief Constructor
+ ///
+ /// Constructor
+ CombinedEdgeMap(ForwardMap& _forward_map, BackwardMap& _backward_map)
+ : forward_map(&_forward_map), backward_map(&_backward_map) {}
+
+
+ /// \brief Sets the value associated with a key.
+ ///
+ /// Sets the value associated with a key.
+ void set(const Key& e, const Value& a) {
+ if (Parent::direction(e)) {
+ forward_map->set(e, a);
+ } else {
+ backward_map->set(e, a);
+ }
+ }
+
+ /// \brief Returns the value associated with a key.
+ ///
+ /// Returns the value associated with a key.
+ typename MapTraits<ForwardMap>::ConstReturnValue
+ operator[](const Key& e) const {
+ if (Parent::direction(e)) {
+ return (*forward_map)[e];
+ } else {
+ return (*backward_map)[e];
+ }
+ }
+
+ /// \brief Returns the value associated with a key.
+ ///
+ /// Returns the value associated with a key.
+ typename MapTraits<ForwardMap>::ReturnValue
+ operator[](const Key& e) {
+ if (Parent::direction(e)) {
+ return (*forward_map)[e];
+ } else {
+ return (*backward_map)[e];
+ }
+ }
+
+ /// \brief Sets the forward map
+ ///
+ /// Sets the forward map
+ void setForwardMap(ForwardMap& _forward_map) {
+ forward_map = &_forward_map;
+ }
+
+ /// \brief Sets the backward map
+ ///
+ /// Sets the backward map
+ void setBackwardMap(BackwardMap& _backward_map) {
+ backward_map = &_backward_map;
+ }
+
+ protected:
+
+ ForwardMap* forward_map;
+ BackwardMap* backward_map;
+
+ };
+
+ };
+
+ /// \brief Just gives back an undir graph adaptor
+ ///
+ /// Just gives back an undir graph adaptor
+ template<typename Graph>
+ UndirGraphAdaptor<const Graph>
+ undirGraphAdaptor(const Graph& graph) {
+ return UndirGraphAdaptor<const Graph>(graph);
+ }
+
+ template<typename Graph, typename Number,
+ typename CapacityMap, typename FlowMap,
+ typename Tol = Tolerance<Number> >
+ class ResForwardFilter {
+ const CapacityMap* capacity;
+ const FlowMap* flow;
+ Tol tolerance;
+ public:
+ typedef typename Graph::Edge Key;
+ typedef bool Value;
+
+ ResForwardFilter(const CapacityMap& _capacity, const FlowMap& _flow,
+ const Tol& _tolerance = Tol())
+ : capacity(&_capacity), flow(&_flow), tolerance(_tolerance) { }
+
+ ResForwardFilter(const Tol& _tolerance)
+ : capacity(0), flow(0), tolerance(_tolerance) { }
+
+ void setCapacity(const CapacityMap& _capacity) { capacity = &_capacity; }
+ void setFlow(const FlowMap& _flow) { flow = &_flow; }
+
+ bool operator[](const typename Graph::Edge& e) const {
+ return tolerance.positive((*capacity)[e] - (*flow)[e]);
+ }
+ };
+
+ template<typename Graph, typename Number,
+ typename CapacityMap, typename FlowMap,
+ typename Tol = Tolerance<Number> >
+ class ResBackwardFilter {
+ const CapacityMap* capacity;
+ const FlowMap* flow;
+ Tol tolerance;
+ public:
+ typedef typename Graph::Edge Key;
+ typedef bool Value;
+
+ ResBackwardFilter(const CapacityMap& _capacity, const FlowMap& _flow,
+ const Tol& _tolerance = Tol())
+ : capacity(&_capacity), flow(&_flow), tolerance(_tolerance) { }
+ ResBackwardFilter(const Tol& _tolerance = Tol())
+ : capacity(0), flow(0), tolerance(_tolerance) { }
+ void setCapacity(const CapacityMap& _capacity) { capacity = &_capacity; }
+ void setFlow(const FlowMap& _flow) { flow = &_flow; }
+ bool operator[](const typename Graph::Edge& e) const {
+ return tolerance.positive((*flow)[e]);
+ }
+ };
+
+
+ ///\ingroup graph_adaptors
+ ///
+ ///\brief An adaptor for composing the residual
+ ///graph for directed flow and circulation problems.
+ ///
+ ///An adaptor for composing the residual graph for directed flow and
+ ///circulation problems. Let \f$ G=(V, A) \f$ be a directed graph
+ ///and let \f$ F \f$ be a number type. Let moreover \f$ f,c:A\to F \f$,
+ ///be functions on the edge-set.
+ ///
+ ///In the appications of ResGraphAdaptor, \f$ f \f$ usually stands
+ ///for a flow and \f$ c \f$ for a capacity function. Suppose that a
+ ///graph instange \c g of type \c ListGraph implements \f$ G \f$.
+ ///
+ ///\code
+ /// ListGraph g;
+ ///\endcode
+ ///
+ ///Then ResGraphAdaptor implements the graph structure with node-set
+ /// \f$ V \f$ and edge-set \f$ A_{forward}\cup A_{backward} \f$,
+ ///where \f$ A_{forward}=\{uv : uv\in A, f(uv)<c(uv)\} \f$ and
+ /// \f$ A_{backward}=\{vu : uv\in A, f(uv)>0\} \f$, i.e. the so called
+ ///residual graph. When we take the union
+ /// \f$ A_{forward}\cup A_{backward} \f$, multilicities are counted, i.e.
+ ///if an edge is in both \f$ A_{forward} \f$ and \f$ A_{backward} \f$,
+ ///then in the adaptor it appears twice. The following code shows how
+ ///such an instance can be constructed.
+ ///
+ ///\code
+ /// typedef ListGraph Graph;
+ /// Graph::EdgeMap<int> f(g);
+ /// Graph::EdgeMap<int> c(g);
+ /// ResGraphAdaptor<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> > ga(g);
+ ///\endcode
+ ///\author Marton Makai
+ ///
+ template<typename Graph, typename Number,
+ typename CapacityMap, typename FlowMap,
+ typename Tol = Tolerance<Number> >
+ class ResGraphAdaptor :
+ public EdgeSubGraphAdaptor<
+ UndirGraphAdaptor<const Graph>,
+ typename UndirGraphAdaptor<const Graph>::template CombinedEdgeMap<
+ ResForwardFilter<const Graph, Number, CapacityMap, FlowMap>,
+ ResBackwardFilter<const Graph, Number, CapacityMap, FlowMap> > > {
+ public:
+
+ typedef UndirGraphAdaptor<const Graph> UGraph;
+
+ typedef ResForwardFilter<const Graph, Number, CapacityMap, FlowMap>
+ ForwardFilter;
+
+ typedef ResBackwardFilter<const Graph, Number, CapacityMap, FlowMap>
+ BackwardFilter;
+
+ typedef typename UGraph::
+ template CombinedEdgeMap<ForwardFilter, BackwardFilter>
+ EdgeFilter;
+
+ typedef EdgeSubGraphAdaptor<UGraph, EdgeFilter> Parent;
+
+ protected:
+
+ const CapacityMap* capacity;
+ FlowMap* flow;
+
+ UGraph ugraph;
+ ForwardFilter forward_filter;
+ BackwardFilter backward_filter;
+ EdgeFilter edge_filter;
+
+ void setCapacityMap(const CapacityMap& _capacity) {
+ capacity=&_capacity;
+ forward_filter.setCapacity(_capacity);
+ backward_filter.setCapacity(_capacity);
+ }
+
+ void setFlowMap(FlowMap& _flow) {
+ flow=&_flow;
+ forward_filter.setFlow(_flow);
+ backward_filter.setFlow(_flow);
+ }
+
+ public:
+
+ /// \brief Constructor of the residual graph.
+ ///
+ /// Constructor of the residual graph. The parameters are the graph type,
+ /// the flow map, the capacity map and a tolerance object.
+ ResGraphAdaptor(const Graph& _graph, const CapacityMap& _capacity,
+ FlowMap& _flow, const Tol& _tolerance = Tol())
+ : Parent(), capacity(&_capacity), flow(&_flow), ugraph(_graph),
+ forward_filter(_capacity, _flow, _tolerance),
+ backward_filter(_capacity, _flow, _tolerance),
+ edge_filter(forward_filter, backward_filter)
+ {
+ Parent::setGraph(ugraph);
+ Parent::setEdgeFilterMap(edge_filter);
+ }
+
+ typedef typename Parent::Edge Edge;
+
+ /// \brief Gives back the residual capacity of the edge.
+ ///
+ /// Gives back the residual capacity of the edge.
+ Number rescap(const Edge& edge) const {
+ if (UGraph::direction(edge)) {
+ return (*capacity)[edge]-(*flow)[edge];
+ } else {
+ return (*flow)[edge];
+ }
+ }
+
+ /// \brief Augment on the given edge in the residual graph.
+ ///
+ /// Augment on the given edge in the residual graph. It increase
+ /// or decrease the flow on the original edge depend on the direction
+ /// of the residual edge.
+ void augment(const Edge& e, Number a) const {
+ if (UGraph::direction(e)) {
+ flow->set(e, (*flow)[e] + a);
+ } else {
+ flow->set(e, (*flow)[e] - a);
+ }
+ }
+
+ /// \brief Returns the direction of the edge.
+ ///
+ /// Returns true when the edge is same oriented as the original edge.
+ static bool forward(const Edge& e) {
+ return UGraph::direction(e);
+ }
+
+ /// \brief Returns the direction of the edge.
+ ///
+ /// Returns true when the edge is opposite oriented as the original edge.
+ static bool backward(const Edge& e) {
+ return !UGraph::direction(e);
+ }
+
+ /// \brief Gives back the forward oriented residual edge.
+ ///
+ /// Gives back the forward oriented residual edge.
+ static Edge forward(const typename Graph::Edge& e) {
+ return UGraph::direct(e, true);
+ }
+
+ /// \brief Gives back the backward oriented residual edge.
+ ///
+ /// Gives back the backward oriented residual edge.
+ static Edge backward(const typename Graph::Edge& e) {
+ return UGraph::direct(e, false);
+ }
+
+ /// \brief Residual capacity map.
+ ///
+ /// In generic residual graphs the residual capacity can be obtained
+ /// as a map.
+ class ResCap {
+ protected:
+ const ResGraphAdaptor* res_graph;
+ public:
+ typedef Number Value;
+ typedef Edge Key;
+ ResCap(const ResGraphAdaptor& _res_graph)
+ : res_graph(&_res_graph) {}
+
+ Number operator[](const Edge& e) const {
+ return res_graph->rescap(e);
+ }
+
+ };
+
+ };
+
+
+
+ template <typename _Graph, typename FirstOutEdgesMap>
+ class ErasingFirstGraphAdaptorBase : public GraphAdaptorBase<_Graph> {
+ public:
+ typedef _Graph Graph;
+ typedef GraphAdaptorBase<_Graph> Parent;
+ protected:
+ FirstOutEdgesMap* first_out_edges;
+ ErasingFirstGraphAdaptorBase() : Parent(),
+ first_out_edges(0) { }
+
+ void setFirstOutEdgesMap(FirstOutEdgesMap& _first_out_edges) {
+ first_out_edges=&_first_out_edges;
+ }
+
+ public:
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ void firstOut(Edge& i, const Node& n) const {
+ i=(*first_out_edges)[n];
+ }
+
+ void erase(const Edge& e) const {
+ Node n=source(e);
+ Edge f=e;
+ Parent::nextOut(f);
+ first_out_edges->set(n, f);
+ }
+ };
+
+
+ ///\ingroup graph_adaptors
+ ///
+ ///\brief For blocking flows.
+ ///
+ ///This graph adaptor is used for on-the-fly
+ ///Dinits blocking flow computations.
+ ///For each node, an out-edge is stored which is used when the
+ ///\code
+ ///OutEdgeIt& first(OutEdgeIt&, const Node&)
+ ///\endcode
+ ///is called.
+ ///
+ ///\author Marton Makai
+ ///
+ template <typename _Graph, typename FirstOutEdgesMap>
+ class ErasingFirstGraphAdaptor :
+ public GraphAdaptorExtender<
+ ErasingFirstGraphAdaptorBase<_Graph, FirstOutEdgesMap> > {
+ public:
+ typedef _Graph Graph;
+ typedef GraphAdaptorExtender<
+ ErasingFirstGraphAdaptorBase<_Graph, FirstOutEdgesMap> > Parent;
+ ErasingFirstGraphAdaptor(Graph& _graph,
+ FirstOutEdgesMap& _first_out_edges) {
+ setGraph(_graph);
+ setFirstOutEdgesMap(_first_out_edges);
+ }
+
+ };
+
+ /// \brief Base class for split graph adaptor
+ ///
+ /// Base class of split graph adaptor. In most case you do not need to
+ /// use it directly but the documented member functions of this class can
+ /// be used with the SplitGraphAdaptor class.
+ /// \sa SplitGraphAdaptor
+ template <typename _Graph>
+ class SplitGraphAdaptorBase
+ : public GraphAdaptorBase<const _Graph> {
+ public:
+
+ typedef _Graph Graph;
+
+ typedef GraphAdaptorBase<const _Graph> Parent;
+
+ typedef typename Graph::Node GraphNode;
+ typedef typename Graph::Edge GraphEdge;
+
+ class Node;
+ class Edge;
+
+ template <typename T> class NodeMap;
+ template <typename T> class EdgeMap;
+
+
+ class Node : public GraphNode {
+ friend class SplitGraphAdaptorBase;
+ template <typename T> friend class NodeMap;
+ private:
+
+ bool in_node;
+ Node(GraphNode _node, bool _in_node)
+ : GraphNode(_node), in_node(_in_node) {}
+
+ public:
+
+ Node() {}
+ Node(Invalid) : GraphNode(INVALID), in_node(true) {}
+
+ bool operator==(const Node& node) const {
+ return GraphNode::operator==(node) && in_node == node.in_node;
+ }
+
+ bool operator!=(const Node& node) const {
+ return !(*this == node);
+ }
+
+ bool operator<(const Node& node) const {
+ return GraphNode::operator<(node) ||
+ (GraphNode::operator==(node) && in_node < node.in_node);
+ }
+ };
+
+ class Edge {
+ friend class SplitGraphAdaptorBase;
+ template <typename T> friend class EdgeMap;
+ private:
+ typedef BiVariant<GraphEdge, GraphNode> EdgeImpl;
+
+ explicit Edge(const GraphEdge& edge) : item(edge) {}
+ explicit Edge(const GraphNode& node) : item(node) {}
+
+ EdgeImpl item;
+
+ public:
+ Edge() {}
+ Edge(Invalid) : item(GraphEdge(INVALID)) {}
+
+ bool operator==(const Edge& edge) const {
+ if (item.firstState()) {
+ if (edge.item.firstState()) {
+ return item.first() == edge.item.first();
+ }
+ } else {
+ if (edge.item.secondState()) {
+ return item.second() == edge.item.second();
+ }
+ }
+ return false;
+ }
+
+ bool operator!=(const Edge& edge) const {
+ return !(*this == edge);
+ }
+
+ bool operator<(const Edge& edge) const {
+ if (item.firstState()) {
+ if (edge.item.firstState()) {
+ return item.first() < edge.item.first();
+ }
+ return false;
+ } else {
+ if (edge.item.secondState()) {
+ return item.second() < edge.item.second();
+ }
+ return true;
+ }
+ }
+
+ operator GraphEdge() const { return item.first(); }
+ operator GraphNode() const { return item.second(); }
+
+ };
+
+ void first(Node& n) const {
+ Parent::first(n);
+ n.in_node = true;
+ }
+
+ void next(Node& n) const {
+ if (n.in_node) {
+ n.in_node = false;
+ } else {
+ n.in_node = true;
+ Parent::next(n);
+ }
+ }
+
+ void first(Edge& e) const {
+ e.item.setSecond();
+ Parent::first(e.item.second());
+ if (e.item.second() == INVALID) {
+ e.item.setFirst();
+ Parent::first(e.item.first());
+ }
+ }
+
+ void next(Edge& e) const {
+ if (e.item.secondState()) {
+ Parent::next(e.item.second());
+ if (e.item.second() == INVALID) {
+ e.item.setFirst();
+ Parent::first(e.item.first());
+ }
+ } else {
+ Parent::next(e.item.first());
+ }
+ }
+
+ void firstOut(Edge& e, const Node& n) const {
+ if (n.in_node) {
+ e.item.setSecond(n);
+ } else {
+ e.item.setFirst();
+ Parent::firstOut(e.item.first(), n);
+ }
+ }
+
+ void nextOut(Edge& e) const {
+ if (!e.item.firstState()) {
+ e.item.setFirst(INVALID);
+ } else {
+ Parent::nextOut(e.item.first());
+ }
+ }
+
+ void firstIn(Edge& e, const Node& n) const {
+ if (!n.in_node) {
+ e.item.setSecond(n);
+ } else {
+ e.item.setFirst();
+ Parent::firstIn(e.item.first(), n);
+ }
+ }
+
+ void nextIn(Edge& e) const {
+ if (!e.item.firstState()) {
+ e.item.setFirst(INVALID);
+ } else {
+ Parent::nextIn(e.item.first());
+ }
+ }
+
+ Node source(const Edge& e) const {
+ if (e.item.firstState()) {
+ return Node(Parent::source(e.item.first()), false);
+ } else {
+ return Node(e.item.second(), true);
+ }
+ }
+
+ Node target(const Edge& e) const {
+ if (e.item.firstState()) {
+ return Node(Parent::target(e.item.first()), true);
+ } else {
+ return Node(e.item.second(), false);
+ }
+ }
+
+ int id(const Node& n) const {
+ return (Parent::id(n) << 1) | (n.in_node ? 0 : 1);
+ }
+ Node nodeFromId(int ix) const {
+ return Node(Parent::nodeFromId(ix >> 1), (ix & 1) == 0);
+ }
+ int maxNodeId() const {
+ return 2 * Parent::maxNodeId() + 1;
+ }
+
+ int id(const Edge& e) const {
+ if (e.item.firstState()) {
+ return Parent::id(e.item.first()) << 1;
+ } else {
+ return (Parent::id(e.item.second()) << 1) | 1;
+ }
+ }
+ Edge edgeFromId(int ix) const {
+ if ((ix & 1) == 0) {
+ return Edge(Parent::edgeFromId(ix >> 1));
+ } else {
+ return Edge(Parent::nodeFromId(ix >> 1));
+ }
+ }
+ int maxEdgeId() const {
+ return std::max(Parent::maxNodeId() << 1,
+ (Parent::maxEdgeId() << 1) | 1);
+ }
+
+ /// \brief Returns true when the node is in-node.
+ ///
+ /// Returns true when the node is in-node.
+ static bool inNode(const Node& n) {
+ return n.in_node;
+ }
+
+ /// \brief Returns true when the node is out-node.
+ ///
+ /// Returns true when the node is out-node.
+ static bool outNode(const Node& n) {
+ return !n.in_node;
+ }
+
+ /// \brief Returns true when the edge is edge in the original graph.
+ ///
+ /// Returns true when the edge is edge in the original graph.
+ static bool origEdge(const Edge& e) {
+ return e.item.firstState();
+ }
+
+ /// \brief Returns true when the edge binds an in-node and an out-node.
+ ///
+ /// Returns true when the edge binds an in-node and an out-node.
+ static bool bindEdge(const Edge& e) {
+ return e.item.secondState();
+ }
+
+ /// \brief Gives back the in-node created from the \c node.
+ ///
+ /// Gives back the in-node created from the \c node.
+ static Node inNode(const GraphNode& n) {
+ return Node(n, true);
+ }
+
+ /// \brief Gives back the out-node created from the \c node.
+ ///
+ /// Gives back the out-node created from the \c node.
+ static Node outNode(const GraphNode& n) {
+ return Node(n, false);
+ }
+
+ /// \brief Gives back the edge binds the two part of the node.
+ ///
+ /// Gives back the edge binds the two part of the node.
+ static Edge edge(const GraphNode& n) {
+ return Edge(n);
+ }
+
+ /// \brief Gives back the edge of the original edge.
+ ///
+ /// Gives back the edge of the original edge.
+ static Edge edge(const GraphEdge& e) {
+ return Edge(e);
+ }
+
+ typedef True NodeNumTag;
+
+ int nodeNum() const {
+ return 2 * countNodes(*Parent::graph);
+ }
+
+ typedef True EdgeNumTag;
+
+ int edgeNum() const {
+ return countEdges(*Parent::graph) + countNodes(*Parent::graph);
+ }
+
+ typedef True FindEdgeTag;
+
+ Edge findEdge(const Node& u, const Node& v,
+ const Edge& prev = INVALID) const {
+ if (inNode(u)) {
+ if (outNode(v)) {
+ if (static_cast<const GraphNode&>(u) ==
+ static_cast<const GraphNode&>(v) && prev == INVALID) {
+ return Edge(u);
+ }
+ }
+ } else {
+ if (inNode(v)) {
+ return Edge(findEdge(*Parent::graph, u, v, prev));
+ }
+ }
+ return INVALID;
+ }
+
+
+ template <typename T>
+ class NodeMap : public MapBase<Node, T> {
+ typedef typename Parent::template NodeMap<T> NodeImpl;
+ public:
+ NodeMap(const SplitGraphAdaptorBase& _graph)
+ : inNodeMap(_graph), outNodeMap(_graph) {}
+ NodeMap(const SplitGraphAdaptorBase& _graph, const T& t)
+ : inNodeMap(_graph, t), outNodeMap(_graph, t) {}
+ NodeMap& operator=(const NodeMap& cmap) {
+ return operator=<NodeMap>(cmap);
+ }
+ template <typename CMap>
+ NodeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ void set(const Node& key, const T& val) {
+ if (SplitGraphAdaptorBase::inNode(key)) { inNodeMap.set(key, val); }
+ else {outNodeMap.set(key, val); }
+ }
+
+ typename MapTraits<NodeImpl>::ReturnValue
+ operator[](const Node& key) {
+ if (SplitGraphAdaptorBase::inNode(key)) { return inNodeMap[key]; }
+ else { return outNodeMap[key]; }
+ }
+
+ typename MapTraits<NodeImpl>::ConstReturnValue
+ operator[](const Node& key) const {
+ if (SplitGraphAdaptorBase::inNode(key)) { return inNodeMap[key]; }
+ else { return outNodeMap[key]; }
+ }
+
+ private:
+ NodeImpl inNodeMap, outNodeMap;
+ };
+
+ template <typename T>
+ class EdgeMap : public MapBase<Edge, T> {
+ typedef typename Parent::template EdgeMap<T> EdgeMapImpl;
+ typedef typename Parent::template NodeMap<T> NodeMapImpl;
+ public:
+
+ EdgeMap(const SplitGraphAdaptorBase& _graph)
+ : edge_map(_graph), node_map(_graph) {}
+ EdgeMap(const SplitGraphAdaptorBase& _graph, const T& t)
+ : edge_map(_graph, t), node_map(_graph, t) {}
+ EdgeMap& operator=(const EdgeMap& cmap) {
+ return operator=<EdgeMap>(cmap);
+ }
+ template <typename CMap>
+ EdgeMap& operator=(const CMap& cmap) {
+ Parent::operator=(cmap);
+ return *this;
+ }
+
+ void set(const Edge& key, const T& val) {
+ if (SplitGraphAdaptorBase::origEdge(key)) {
+ edge_map.set(key.item.first(), val);
+ } else {
+ node_map.set(key.item.second(), val);
+ }
+ }
+
+ typename MapTraits<EdgeMapImpl>::ReturnValue
+ operator[](const Edge& key) {
+ if (SplitGraphAdaptorBase::origEdge(key)) {
+ return edge_map[key.item.first()];
+ } else {
+ return node_map[key.item.second()];
+ }
+ }
+
+ typename MapTraits<EdgeMapImpl>::ConstReturnValue
+ operator[](const Edge& key) const {
+ if (SplitGraphAdaptorBase::origEdge(key)) {
+ return edge_map[key.item.first()];
+ } else {
+ return node_map[key.item.second()];
+ }
+ }
+
+ private:
+ typename Parent::template EdgeMap<T> edge_map;
+ typename Parent::template NodeMap<T> node_map;
+ };
+
+
+ };
+
+ template <typename _Graph, typename NodeEnable = void,
+ typename EdgeEnable = void>
+ class AlterableSplitGraphAdaptor
+ : public GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > {
+ public:
+
+ typedef GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > Parent;
+ typedef _Graph Graph;
+
+ typedef typename Graph::Node GraphNode;
+ typedef typename Graph::Node GraphEdge;
+
+ protected:
+
+ AlterableSplitGraphAdaptor() : Parent() {}
+
+ public:
+
+ typedef InvalidType NodeNotifier;
+ typedef InvalidType EdgeNotifier;
+
+ };
+
+ template <typename _Graph, typename EdgeEnable>
+ class AlterableSplitGraphAdaptor<
+ _Graph,
+ typename enable_if<typename _Graph::NodeNotifier::Notifier>::type,
+ EdgeEnable>
+ : public GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > {
+ public:
+
+ typedef GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > Parent;
+ typedef _Graph Graph;
+
+ typedef typename Graph::Node GraphNode;
+ typedef typename Graph::Edge GraphEdge;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ protected:
+
+ AlterableSplitGraphAdaptor()
+ : Parent(), node_notifier(*this), node_notifier_proxy(*this) {}
+
+ void setGraph(_Graph& graph) {
+ Parent::setGraph(graph);
+ node_notifier_proxy.setNotifier(graph.notifier(GraphNode()));
+ }
+
+ public:
+
+ ~AlterableSplitGraphAdaptor() {
+ node_notifier.clear();
+ }
+
+ typedef AlterationNotifier<AlterableSplitGraphAdaptor, Node> NodeNotifier;
+ typedef InvalidType EdgeNotifier;
+
+ NodeNotifier& notifier(Node) const { return node_notifier; }
+
+ protected:
+
+ class NodeNotifierProxy : public Graph::NodeNotifier::ObserverBase {
+ public:
+
+ typedef typename Graph::NodeNotifier::ObserverBase Parent;
+ typedef AlterableSplitGraphAdaptor AdaptorBase;
+
+ NodeNotifierProxy(const AdaptorBase& _adaptor)
+ : Parent(), adaptor(&_adaptor) {
+ }
+
+ virtual ~NodeNotifierProxy() {
+ if (Parent::attached()) {
+ Parent::detach();
+ }
+ }
+
+ void setNotifier(typename Graph::NodeNotifier& graph_notifier) {
+ Parent::attach(graph_notifier);
+ }
+
+
+ protected:
+
+ virtual void add(const GraphNode& gn) {
+ std::vector<Node> nodes;
+ nodes.push_back(AdaptorBase::Parent::inNode(gn));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn));
+ adaptor->notifier(Node()).add(nodes);
+ }
+
+ virtual void add(const std::vector<GraphNode>& gn) {
+ std::vector<Node> nodes;
+ for (int i = 0; i < int(gn.size()); ++i) {
+ nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
+ }
+ adaptor->notifier(Node()).add(nodes);
+ }
+
+ virtual void erase(const GraphNode& gn) {
+ std::vector<Node> nodes;
+ nodes.push_back(AdaptorBase::Parent::inNode(gn));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn));
+ adaptor->notifier(Node()).erase(nodes);
+ }
+
+ virtual void erase(const std::vector<GraphNode>& gn) {
+ std::vector<Node> nodes;
+ for (int i = 0; i < int(gn.size()); ++i) {
+ nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
+ }
+ adaptor->notifier(Node()).erase(nodes);
+ }
+ virtual void build() {
+ adaptor->notifier(Node()).build();
+ }
+ virtual void clear() {
+ adaptor->notifier(Node()).clear();
+ }
+
+ const AdaptorBase* adaptor;
+ };
+
+
+ mutable NodeNotifier node_notifier;
+
+ NodeNotifierProxy node_notifier_proxy;
+
+ };
+
+ template <typename _Graph>
+ class AlterableSplitGraphAdaptor<
+ _Graph,
+ typename enable_if<typename _Graph::NodeNotifier::Notifier>::type,
+ typename enable_if<typename _Graph::EdgeNotifier::Notifier>::type>
+ : public GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > {
+ public:
+
+ typedef GraphAdaptorExtender<SplitGraphAdaptorBase<_Graph> > Parent;
+ typedef _Graph Graph;
+
+ typedef typename Graph::Node GraphNode;
+ typedef typename Graph::Edge GraphEdge;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ protected:
+
+ AlterableSplitGraphAdaptor()
+ : Parent(), node_notifier(*this), edge_notifier(*this),
+ node_notifier_proxy(*this), edge_notifier_proxy(*this) {}
+
+ void setGraph(_Graph& g) {
+ Parent::setGraph(g);
+ node_notifier_proxy.setNotifier(g.notifier(GraphNode()));
+ edge_notifier_proxy.setNotifier(g.notifier(GraphEdge()));
+ }
+
+ public:
+
+ ~AlterableSplitGraphAdaptor() {
+ node_notifier.clear();
+ edge_notifier.clear();
+ }
+
+ typedef AlterationNotifier<AlterableSplitGraphAdaptor, Node> NodeNotifier;
+ typedef AlterationNotifier<AlterableSplitGraphAdaptor, Edge> EdgeNotifier;
+
+ NodeNotifier& notifier(Node) const { return node_notifier; }
+ EdgeNotifier& notifier(Edge) const { return edge_notifier; }
+
+ protected:
+
+ class NodeNotifierProxy : public Graph::NodeNotifier::ObserverBase {
+ public:
+
+ typedef typename Graph::NodeNotifier::ObserverBase Parent;
+ typedef AlterableSplitGraphAdaptor AdaptorBase;
+
+ NodeNotifierProxy(const AdaptorBase& _adaptor)
+ : Parent(), adaptor(&_adaptor) {
+ }
+
+ virtual ~NodeNotifierProxy() {
+ if (Parent::attached()) {
+ Parent::detach();
+ }
+ }
+
+ void setNotifier(typename Graph::NodeNotifier& graph_notifier) {
+ Parent::attach(graph_notifier);
+ }
+
+
+ protected:
+
+ virtual void add(const GraphNode& gn) {
+ std::vector<Node> nodes;
+ nodes.push_back(AdaptorBase::Parent::inNode(gn));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn));
+ adaptor->notifier(Node()).add(nodes);
+ adaptor->notifier(Edge()).add(AdaptorBase::Parent::edge(gn));
+ }
+ virtual void add(const std::vector<GraphNode>& gn) {
+ std::vector<Node> nodes;
+ std::vector<Edge> edges;
+ for (int i = 0; i < int(gn.size()); ++i) {
+ edges.push_back(AdaptorBase::Parent::edge(gn[i]));
+ nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
+ }
+ adaptor->notifier(Node()).add(nodes);
+ adaptor->notifier(Edge()).add(edges);
+ }
+ virtual void erase(const GraphNode& gn) {
+ adaptor->notifier(Edge()).erase(AdaptorBase::Parent::edge(gn));
+ std::vector<Node> nodes;
+ nodes.push_back(AdaptorBase::Parent::inNode(gn));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn));
+ adaptor->notifier(Node()).erase(nodes);
+ }
+ virtual void erase(const std::vector<GraphNode>& gn) {
+ std::vector<Node> nodes;
+ std::vector<Edge> edges;
+ for (int i = 0; i < int(gn.size()); ++i) {
+ edges.push_back(AdaptorBase::Parent::edge(gn[i]));
+ nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
+ nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
+ }
+ adaptor->notifier(Edge()).erase(edges);
+ adaptor->notifier(Node()).erase(nodes);
+ }
+ virtual void build() {
+ std::vector<Edge> edges;
+ const typename Parent::Notifier* nf = Parent::notifier();
+ GraphNode it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ edges.push_back(AdaptorBase::Parent::edge(it));
+ }
+ adaptor->notifier(Node()).build();
+ adaptor->notifier(Edge()).add(edges);
+ }
+ virtual void clear() {
+ std::vector<Edge> edges;
+ const typename Parent::Notifier* nf = Parent::notifier();
+ GraphNode it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ edges.push_back(AdaptorBase::Parent::edge(it));
+ }
+ adaptor->notifier(Edge()).erase(edges);
+ adaptor->notifier(Node()).clear();
+ }
+
+ const AdaptorBase* adaptor;
+ };
+
+ class EdgeNotifierProxy : public Graph::EdgeNotifier::ObserverBase {
+ public:
+
+ typedef typename Graph::EdgeNotifier::ObserverBase Parent;
+ typedef AlterableSplitGraphAdaptor AdaptorBase;
+
+ EdgeNotifierProxy(const AdaptorBase& _adaptor)
+ : Parent(), adaptor(&_adaptor) {
+ }
+
+ virtual ~EdgeNotifierProxy() {
+ if (Parent::attached()) {
+ Parent::detach();
+ }
+ }
+
+ void setNotifier(typename Graph::EdgeNotifier& graph_notifier) {
+ Parent::attach(graph_notifier);
+ }
+
+
+ protected:
+
+ virtual void add(const GraphEdge& ge) {
+ adaptor->notifier(Edge()).add(AdaptorBase::edge(ge));
+ }
+ virtual void add(const std::vector<GraphEdge>& ge) {
+ std::vector<Edge> edges;
+ for (int i = 0; i < int(ge.size()); ++i) {
+ edges.push_back(AdaptorBase::edge(ge[i]));
+ }
+ adaptor->notifier(Edge()).add(edges);
+ }
+ virtual void erase(const GraphEdge& ge) {
+ adaptor->notifier(Edge()).erase(AdaptorBase::edge(ge));
+ }
+ virtual void erase(const std::vector<GraphEdge>& ge) {
+ std::vector<Edge> edges;
+ for (int i = 0; i < int(ge.size()); ++i) {
+ edges.push_back(AdaptorBase::edge(ge[i]));
+ }
+ adaptor->notifier(Edge()).erase(edges);
+ }
+ virtual void build() {
+ std::vector<Edge> edges;
+ const typename Parent::Notifier* nf = Parent::notifier();
+ GraphEdge it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ edges.push_back(AdaptorBase::Parent::edge(it));
+ }
+ adaptor->notifier(Edge()).add(edges);
+ }
+ virtual void clear() {
+ std::vector<Edge> edges;
+ const typename Parent::Notifier* nf = Parent::notifier();
+ GraphEdge it;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ edges.push_back(AdaptorBase::Parent::edge(it));
+ }
+ adaptor->notifier(Edge()).erase(edges);
+ }
+
+ const AdaptorBase* adaptor;
+ };
+
+
+ mutable NodeNotifier node_notifier;
+ mutable EdgeNotifier edge_notifier;
+
+ NodeNotifierProxy node_notifier_proxy;
+ EdgeNotifierProxy edge_notifier_proxy;
+
+ };
+
+ /// \ingroup graph_adaptors
+ ///
+ /// \brief Split graph adaptor class
+ ///
+ /// This is an graph adaptor which splits all node into an in-node
+ /// and an out-node. Formaly, the adaptor replaces each \f$ u \f$
+ /// node in the graph with two node, \f$ u_{in} \f$ node and
+ /// \f$ u_{out} \f$ node. If there is an \f$ (v, u) \f$ edge in the
+ /// original graph the new target of the edge will be \f$ u_{in} \f$ and
+ /// similarly the source of the original \f$ (u, v) \f$ edge will be
+ /// \f$ u_{out} \f$. The adaptor will add for each node in the
+ /// original graph an additional edge which will connect
+ /// \f$ (u_{in}, u_{out}) \f$.
+ ///
+ /// The aim of this class is to run algorithm with node costs if the
+ /// algorithm can use directly just edge costs. In this case we should use
+ /// a \c SplitGraphAdaptor and set the node cost of the graph to the
+ /// bind edge in the adapted graph.
+ ///
+ /// By example a maximum flow algoritm can compute how many edge
+ /// disjoint paths are in the graph. But we would like to know how
+ /// many node disjoint paths are in the graph. First we have to
+ /// adapt the graph with the \c SplitGraphAdaptor. Then run the flow
+ /// algorithm on the adapted graph. The bottleneck of the flow will
+ /// be the bind edges which bounds the flow with the count of the
+ /// node disjoint paths.
+ ///
+ ///\code
+ ///
+ /// typedef SplitGraphAdaptor<SmartGraph> SGraph;
+ ///
+ /// SGraph sgraph(graph);
+ ///
+ /// typedef ConstMap<SGraph::Edge, int> SCapacity;
+ /// SCapacity scapacity(1);
+ ///
+ /// SGraph::EdgeMap<int> sflow(sgraph);
+ ///
+ /// Preflow<SGraph, SCapacity>
+ /// spreflow(sgraph, scapacity,
+ /// SGraph::outNode(source), SGraph::inNode(target));
+ ///
+ /// spreflow.run();
+ ///
+ ///\endcode
+ ///
+ /// The result of the mamixum flow on the original graph
+ /// shows the next figure:
+ ///
+ /// \image html edge_disjoint.png
+ /// \image latex edge_disjoint.eps "Edge disjoint paths" width=\textwidth
+ ///
+ /// And the maximum flow on the adapted graph:
+ ///
+ /// \image html node_disjoint.png
+ /// \image latex node_disjoint.eps "Node disjoint paths" width=\textwidth
+ ///
+ /// The second solution contains just 3 disjoint paths while the first 4.
+ /// The full code can be found in the \ref disjoint_paths_demo.cc demo file.
+ ///
+ /// This graph adaptor is fully conform to the
+ /// \ref concepts::Graph "Graph" concept and
+ /// contains some additional member functions and types. The
+ /// documentation of some member functions may be found just in the
+ /// SplitGraphAdaptorBase class.
+ ///
+ /// \sa SplitGraphAdaptorBase
+ template <typename _Graph>
+ class SplitGraphAdaptor : public AlterableSplitGraphAdaptor<_Graph> {
+ public:
+ typedef AlterableSplitGraphAdaptor<_Graph> Parent;
+
+ typedef typename Parent::Node Node;
+ typedef typename Parent::Edge Edge;
+
+ /// \brief Constructor of the adaptor.
+ ///
+ /// Constructor of the adaptor.
+ SplitGraphAdaptor(_Graph& g) {
+ Parent::setGraph(g);
+ }
+
+ /// \brief NodeMap combined from two original NodeMap
+ ///
+ /// This class adapt two of the original graph NodeMap to
+ /// get a node map on the adapted graph.
+ template <typename InNodeMap, typename OutNodeMap>
+ class CombinedNodeMap {
+ public:
+
+ typedef Node Key;
+ typedef typename InNodeMap::Value Value;
+
+ /// \brief Constructor
+ ///
+ /// Constructor.
+ CombinedNodeMap(InNodeMap& _inNodeMap, OutNodeMap& _outNodeMap)
+ : inNodeMap(_inNodeMap), outNodeMap(_outNodeMap) {}
+
+ /// \brief The subscript operator.
+ ///
+ /// The subscript operator.
+ Value& operator[](const Key& key) {
+ if (Parent::inNode(key)) {
+ return inNodeMap[key];
+ } else {
+ return outNodeMap[key];
+ }
+ }
+
+ /// \brief The const subscript operator.
+ ///
+ /// The const subscript operator.
+ Value operator[](const Key& key) const {
+ if (Parent::inNode(key)) {
+ return inNodeMap[key];
+ } else {
+ return outNodeMap[key];
+ }
+ }
+
+ /// \brief The setter function of the map.
+ ///
+ /// The setter function of the map.
+ void set(const Key& key, const Value& value) {
+ if (Parent::inNode(key)) {
+ inNodeMap.set(key, value);
+ } else {
+ outNodeMap.set(key, value);
+ }
+ }
+
+ private:
+
+ InNodeMap& inNodeMap;
+ OutNodeMap& outNodeMap;
+
+ };
+
+
+ /// \brief Just gives back a combined node map.
+ ///
+ /// Just gives back a combined node map.
+ template <typename InNodeMap, typename OutNodeMap>
+ static CombinedNodeMap<InNodeMap, OutNodeMap>
+ combinedNodeMap(InNodeMap& in_map, OutNodeMap& out_map) {
+ return CombinedNodeMap<InNodeMap, OutNodeMap>(in_map, out_map);
+ }
+
+ template <typename InNodeMap, typename OutNodeMap>
+ static CombinedNodeMap<const InNodeMap, OutNodeMap>
+ combinedNodeMap(const InNodeMap& in_map, OutNodeMap& out_map) {
+ return CombinedNodeMap<const InNodeMap, OutNodeMap>(in_map, out_map);
+ }
+
+ template <typename InNodeMap, typename OutNodeMap>
+ static CombinedNodeMap<InNodeMap, const OutNodeMap>
+ combinedNodeMap(InNodeMap& in_map, const OutNodeMap& out_map) {
+ return CombinedNodeMap<InNodeMap, const OutNodeMap>(in_map, out_map);
+ }
+
+ template <typename InNodeMap, typename OutNodeMap>
+ static CombinedNodeMap<const InNodeMap, const OutNodeMap>
+ combinedNodeMap(const InNodeMap& in_map, const OutNodeMap& out_map) {
+ return CombinedNodeMap<const InNodeMap,
+ const OutNodeMap>(in_map, out_map);
+ }
+
+ /// \brief EdgeMap combined from an original EdgeMap and NodeMap
+ ///
+ /// This class adapt an original graph EdgeMap and NodeMap to
+ /// get an edge map on the adapted graph.
+ template <typename GraphEdgeMap, typename GraphNodeMap>
+ class CombinedEdgeMap {
+ public:
+
+ typedef Edge Key;
+ typedef typename GraphEdgeMap::Value Value;
+
+ /// \brief Constructor
+ ///
+ /// Constructor.
+ CombinedEdgeMap(GraphEdgeMap& _edge_map, GraphNodeMap& _node_map)
+ : edge_map(_edge_map), node_map(_node_map) {}
+
+ /// \brief The subscript operator.
+ ///
+ /// The subscript operator.
+ void set(const Edge& edge, const Value& val) {
+ if (Parent::origEdge(edge)) {
+ edge_map.set(edge, val);
+ } else {
+ node_map.set(edge, val);
+ }
+ }
+
+ /// \brief The const subscript operator.
+ ///
+ /// The const subscript operator.
+ Value operator[](const Key& edge) const {
+ if (Parent::origEdge(edge)) {
+ return edge_map[edge];
+ } else {
+ return node_map[edge];
+ }
+ }
+
+ /// \brief The const subscript operator.
+ ///
+ /// The const subscript operator.
+ Value& operator[](const Key& edge) {
+ if (Parent::origEdge(edge)) {
+ return edge_map[edge];
+ } else {
+ return node_map[edge];
+ }
+ }
+
+ private:
+ GraphEdgeMap& edge_map;
+ GraphNodeMap& node_map;
+ };
+
+ /// \brief Just gives back a combined edge map.
+ ///
+ /// Just gives back a combined edge map.
+ template <typename GraphEdgeMap, typename GraphNodeMap>
+ static CombinedEdgeMap<GraphEdgeMap, GraphNodeMap>
+ combinedEdgeMap(GraphEdgeMap& edge_map, GraphNodeMap& node_map) {
+ return CombinedEdgeMap<GraphEdgeMap, GraphNodeMap>(edge_map, node_map);
+ }
+
+ template <typename GraphEdgeMap, typename GraphNodeMap>
+ static CombinedEdgeMap<const GraphEdgeMap, GraphNodeMap>
+ combinedEdgeMap(const GraphEdgeMap& edge_map, GraphNodeMap& node_map) {
+ return CombinedEdgeMap<const GraphEdgeMap,
+ GraphNodeMap>(edge_map, node_map);
+ }
+
+ template <typename GraphEdgeMap, typename GraphNodeMap>
+ static CombinedEdgeMap<GraphEdgeMap, const GraphNodeMap>
+ combinedEdgeMap(GraphEdgeMap& edge_map, const GraphNodeMap& node_map) {
+ return CombinedEdgeMap<GraphEdgeMap,
+ const GraphNodeMap>(edge_map, node_map);
+ }
+
+ template <typename GraphEdgeMap, typename GraphNodeMap>
+ static CombinedEdgeMap<const GraphEdgeMap, const GraphNodeMap>
+ combinedEdgeMap(const GraphEdgeMap& edge_map,
+ const GraphNodeMap& node_map) {
+ return CombinedEdgeMap<const GraphEdgeMap,
+ const GraphNodeMap>(edge_map, node_map);
+ }
+
+ };
+
+ /// \brief Just gives back a split graph adaptor
+ ///
+ /// Just gives back a split graph adaptor
+ template<typename Graph>
+ SplitGraphAdaptor<Graph>
+ splitGraphAdaptor(const Graph& graph) {
+ return SplitGraphAdaptor<Graph>(graph);
+ }
+
+
+} //namespace lemon
+
+#endif //LEMON_GRAPH_ADAPTOR_H
+
diff --git a/src/lemon/graph_utils.h b/src/lemon/graph_utils.h
new file mode 100644
index 0000000..5d11b46
--- /dev/null
+++ b/src/lemon/graph_utils.h
@@ -0,0 +1,3179 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_GRAPH_UTILS_H
+#define LEMON_GRAPH_UTILS_H
+
+#include <iterator>
+#include <vector>
+#include <map>
+#include <lemon/math.h>
+#include <algorithm>
+
+#include <lemon/bits/invalid.h>
+#include <lemon/bits/utility.h>
+#include <lemon/maps.h>
+#include <lemon/bits/traits.h>
+
+#include <lemon/bits/alteration_notifier.h>
+#include <lemon/bits/default_map.h>
+
+///\ingroup gutils
+///\file
+///\brief Graph utilities.
+
+namespace lemon {
+
+ /// \addtogroup gutils
+ /// @{
+
+ ///Creates convenience typedefs for the graph types and iterators
+
+ ///This \c \#define creates convenience typedefs for the following types
+ ///of \c Graph: \c Node, \c NodeIt, \c Edge, \c EdgeIt, \c InEdgeIt,
+ ///\c OutEdgeIt
+ ///\note If \c G it a template parameter, it should be used in this way.
+ ///\code
+ /// GRAPH_TYPEDEFS(typename G);
+ ///\endcode
+ ///
+ ///\warning There are no typedefs for the graph maps because of the lack of
+ ///template typedefs in C++.
+#define GRAPH_TYPEDEFS(Graph) \
+ typedef Graph:: Node Node; \
+ typedef Graph:: NodeIt NodeIt; \
+ typedef Graph:: Edge Edge; \
+ typedef Graph:: EdgeIt EdgeIt; \
+ typedef Graph:: InEdgeIt InEdgeIt; \
+ typedef Graph::OutEdgeIt OutEdgeIt
+
+ ///Creates convenience typedefs for the undirected graph types and iterators
+
+ ///This \c \#define creates the same convenience typedefs as defined by
+ ///\ref GRAPH_TYPEDEFS(Graph) and three more, namely it creates
+ ///\c UEdge, \c UEdgeIt, \c IncEdgeIt,
+ ///
+ ///\note If \c G it a template parameter, it should be used in this way.
+ ///\code
+ /// UGRAPH_TYPEDEFS(typename G);
+ ///\endcode
+ ///
+ ///\warning There are no typedefs for the graph maps because of the lack of
+ ///template typedefs in C++.
+#define UGRAPH_TYPEDEFS(Graph) \
+ GRAPH_TYPEDEFS(Graph); \
+ typedef Graph:: UEdge UEdge; \
+ typedef Graph:: UEdgeIt UEdgeIt; \
+ typedef Graph:: IncEdgeIt IncEdgeIt
+
+ ///\brief Creates convenience typedefs for the bipartite undirected graph
+ ///types and iterators
+
+ ///This \c \#define creates the same convenience typedefs as defined by
+ ///\ref UGRAPH_TYPEDEFS(Graph) and two more, namely it creates
+ ///\c ANodeIt, \c BNodeIt,
+ ///
+ ///\note If \c G it a template parameter, it should be used in this way.
+ ///\code
+ /// BPUGRAPH_TYPEDEFS(typename G);
+ ///\endcode
+ ///
+ ///\warning There are no typedefs for the graph maps because of the lack of
+ ///template typedefs in C++.
+#define BPUGRAPH_TYPEDEFS(Graph) \
+ UGRAPH_TYPEDEFS(Graph); \
+ typedef Graph::ANode ANode; \
+ typedef Graph::BNode BNode; \
+ typedef Graph::ANodeIt ANodeIt; \
+ typedef Graph::BNodeIt BNodeIt
+
+ /// \brief Function to count the items in the graph.
+ ///
+ /// This function counts the items (nodes, edges etc) in the graph.
+ /// The complexity of the function is O(n) because
+ /// it iterates on all of the items.
+
+ template <typename Graph, typename Item>
+ inline int countItems(const Graph& g) {
+ typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+ int num = 0;
+ for (ItemIt it(g); it != INVALID; ++it) {
+ ++num;
+ }
+ return num;
+ }
+
+ // Node counting:
+
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Enable = void>
+ struct CountNodesSelector {
+ static int count(const Graph &g) {
+ return countItems<Graph, typename Graph::Node>(g);
+ }
+ };
+
+ template <typename Graph>
+ struct CountNodesSelector<
+ Graph, typename
+ enable_if<typename Graph::NodeNumTag, void>::type>
+ {
+ static int count(const Graph &g) {
+ return g.nodeNum();
+ }
+ };
+ }
+
+ /// \brief Function to count the nodes in the graph.
+ ///
+ /// This function counts the nodes in the graph.
+ /// The complexity of the function is O(n) but for some
+ /// graph structures it is specialized to run in O(1).
+ ///
+ /// If the graph contains a \e nodeNum() member function and a
+ /// \e NodeNumTag tag then this function calls directly the member
+ /// function to query the cardinality of the node set.
+ template <typename Graph>
+ inline int countNodes(const Graph& g) {
+ return _graph_utils_bits::CountNodesSelector<Graph>::count(g);
+ }
+
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Enable = void>
+ struct CountANodesSelector {
+ static int count(const Graph &g) {
+ return countItems<Graph, typename Graph::ANode>(g);
+ }
+ };
+
+ template <typename Graph>
+ struct CountANodesSelector<
+ Graph, typename
+ enable_if<typename Graph::NodeNumTag, void>::type>
+ {
+ static int count(const Graph &g) {
+ return g.aNodeNum();
+ }
+ };
+ }
+
+ /// \brief Function to count the anodes in the graph.
+ ///
+ /// This function counts the anodes in the graph.
+ /// The complexity of the function is O(an) but for some
+ /// graph structures it is specialized to run in O(1).
+ ///
+ /// If the graph contains an \e aNodeNum() member function and a
+ /// \e NodeNumTag tag then this function calls directly the member
+ /// function to query the cardinality of the A-node set.
+ template <typename Graph>
+ inline int countANodes(const Graph& g) {
+ return _graph_utils_bits::CountANodesSelector<Graph>::count(g);
+ }
+
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Enable = void>
+ struct CountBNodesSelector {
+ static int count(const Graph &g) {
+ return countItems<Graph, typename Graph::BNode>(g);
+ }
+ };
+
+ template <typename Graph>
+ struct CountBNodesSelector<
+ Graph, typename
+ enable_if<typename Graph::NodeNumTag, void>::type>
+ {
+ static int count(const Graph &g) {
+ return g.bNodeNum();
+ }
+ };
+ }
+
+ /// \brief Function to count the bnodes in the graph.
+ ///
+ /// This function counts the bnodes in the graph.
+ /// The complexity of the function is O(bn) but for some
+ /// graph structures it is specialized to run in O(1).
+ ///
+ /// If the graph contains a \e bNodeNum() member function and a
+ /// \e NodeNumTag tag then this function calls directly the member
+ /// function to query the cardinality of the B-node set.
+ template <typename Graph>
+ inline int countBNodes(const Graph& g) {
+ return _graph_utils_bits::CountBNodesSelector<Graph>::count(g);
+ }
+
+
+ // Edge counting:
+
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Enable = void>
+ struct CountEdgesSelector {
+ static int count(const Graph &g) {
+ return countItems<Graph, typename Graph::Edge>(g);
+ }
+ };
+
+ template <typename Graph>
+ struct CountEdgesSelector<
+ Graph,
+ typename enable_if<typename Graph::EdgeNumTag, void>::type>
+ {
+ static int count(const Graph &g) {
+ return g.edgeNum();
+ }
+ };
+ }
+
+ /// \brief Function to count the edges in the graph.
+ ///
+ /// This function counts the edges in the graph.
+ /// The complexity of the function is O(e) but for some
+ /// graph structures it is specialized to run in O(1).
+ ///
+ /// If the graph contains a \e edgeNum() member function and a
+ /// \e EdgeNumTag tag then this function calls directly the member
+ /// function to query the cardinality of the edge set.
+ template <typename Graph>
+ inline int countEdges(const Graph& g) {
+ return _graph_utils_bits::CountEdgesSelector<Graph>::count(g);
+ }
+
+ // Undirected edge counting:
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Enable = void>
+ struct CountUEdgesSelector {
+ static int count(const Graph &g) {
+ return countItems<Graph, typename Graph::UEdge>(g);
+ }
+ };
+
+ template <typename Graph>
+ struct CountUEdgesSelector<
+ Graph,
+ typename enable_if<typename Graph::EdgeNumTag, void>::type>
+ {
+ static int count(const Graph &g) {
+ return g.uEdgeNum();
+ }
+ };
+ }
+
+ /// \brief Function to count the undirected edges in the graph.
+ ///
+ /// This function counts the undirected edges in the graph.
+ /// The complexity of the function is O(e) but for some
+ /// graph structures it is specialized to run in O(1).
+ ///
+ /// If the graph contains a \e uEdgeNum() member function and a
+ /// \e EdgeNumTag tag then this function calls directly the member
+ /// function to query the cardinality of the undirected edge set.
+ template <typename Graph>
+ inline int countUEdges(const Graph& g) {
+ return _graph_utils_bits::CountUEdgesSelector<Graph>::count(g);
+
+ }
+
+
+ template <typename Graph, typename DegIt>
+ inline int countNodeDegree(const Graph& _g, const typename Graph::Node& _n) {
+ int num = 0;
+ for (DegIt it(_g, _n); it != INVALID; ++it) {
+ ++num;
+ }
+ return num;
+ }
+
+ /// \brief Function to count the number of the out-edges from node \c n.
+ ///
+ /// This function counts the number of the out-edges from node \c n
+ /// in the graph.
+ template <typename Graph>
+ inline int countOutEdges(const Graph& _g, const typename Graph::Node& _n) {
+ return countNodeDegree<Graph, typename Graph::OutEdgeIt>(_g, _n);
+ }
+
+ /// \brief Function to count the number of the in-edges to node \c n.
+ ///
+ /// This function counts the number of the in-edges to node \c n
+ /// in the graph.
+ template <typename Graph>
+ inline int countInEdges(const Graph& _g, const typename Graph::Node& _n) {
+ return countNodeDegree<Graph, typename Graph::InEdgeIt>(_g, _n);
+ }
+
+ /// \brief Function to count the number of the inc-edges to node \c n.
+ ///
+ /// This function counts the number of the inc-edges to node \c n
+ /// in the graph.
+ template <typename Graph>
+ inline int countIncEdges(const Graph& _g, const typename Graph::Node& _n) {
+ return countNodeDegree<Graph, typename Graph::IncEdgeIt>(_g, _n);
+ }
+
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Enable = void>
+ struct FindEdgeSelector {
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ static Edge find(const Graph &g, Node u, Node v, Edge e) {
+ if (e == INVALID) {
+ g.firstOut(e, u);
+ } else {
+ g.nextOut(e);
+ }
+ while (e != INVALID && g.target(e) != v) {
+ g.nextOut(e);
+ }
+ return e;
+ }
+ };
+
+ template <typename Graph>
+ struct FindEdgeSelector<
+ Graph,
+ typename enable_if<typename Graph::FindEdgeTag, void>::type>
+ {
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ static Edge find(const Graph &g, Node u, Node v, Edge prev) {
+ return g.findEdge(u, v, prev);
+ }
+ };
+ }
+
+ /// \brief Finds an edge between two nodes of a graph.
+ ///
+ /// Finds an edge from node \c u to node \c v in graph \c g.
+ ///
+ /// If \c prev is \ref INVALID (this is the default value), then
+ /// it finds the first edge from \c u to \c v. Otherwise it looks for
+ /// the next edge from \c u to \c v after \c prev.
+ /// \return The found edge or \ref INVALID if there is no such an edge.
+ ///
+ /// Thus you can iterate through each edge from \c u to \c v as it follows.
+ ///\code
+ /// for(Edge e=findEdge(g,u,v);e!=INVALID;e=findEdge(g,u,v,e)) {
+ /// ...
+ /// }
+ ///\endcode
+ ///
+ ///\sa EdgeLookUp
+ ///\sa AllEdgeLookUp
+ ///\sa DynEdgeLookUp
+ ///\sa ConEdgeIt
+ template <typename Graph>
+ inline typename Graph::Edge
+ findEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
+ typename Graph::Edge prev = INVALID) {
+ return _graph_utils_bits::FindEdgeSelector<Graph>::find(g, u, v, prev);
+ }
+
+ /// \brief Iterator for iterating on edges connected the same nodes.
+ ///
+ /// Iterator for iterating on edges connected the same nodes. It is
+ /// higher level interface for the findEdge() function. You can
+ /// use it the following way:
+ ///\code
+ /// for (ConEdgeIt<Graph> it(g, src, trg); it != INVALID; ++it) {
+ /// ...
+ /// }
+ ///\endcode
+ ///
+ ///\sa findEdge()
+ ///\sa EdgeLookUp
+ ///\sa AllEdgeLookUp
+ ///\sa DynEdgeLookUp
+ ///
+ /// \author Balazs Dezso
+ template <typename _Graph>
+ class ConEdgeIt : public _Graph::Edge {
+ public:
+
+ typedef _Graph Graph;
+ typedef typename Graph::Edge Parent;
+
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::Node Node;
+
+ /// \brief Constructor.
+ ///
+ /// Construct a new ConEdgeIt iterating on the edges which
+ /// connects the \c u and \c v node.
+ ConEdgeIt(const Graph& g, Node u, Node v) : graph(g) {
+ Parent::operator=(findEdge(graph, u, v));
+ }
+
+ /// \brief Constructor.
+ ///
+ /// Construct a new ConEdgeIt which continues the iterating from
+ /// the \c e edge.
+ ConEdgeIt(const Graph& g, Edge e) : Parent(e), graph(g) {}
+
+ /// \brief Increment operator.
+ ///
+ /// It increments the iterator and gives back the next edge.
+ ConEdgeIt& operator++() {
+ Parent::operator=(findEdge(graph, graph.source(*this),
+ graph.target(*this), *this));
+ return *this;
+ }
+ private:
+ const Graph& graph;
+ };
+
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Enable = void>
+ struct FindUEdgeSelector {
+ typedef typename Graph::Node Node;
+ typedef typename Graph::UEdge UEdge;
+ static UEdge find(const Graph &g, Node u, Node v, UEdge e) {
+ bool b;
+ if (u != v) {
+ if (e == INVALID) {
+ g.firstInc(e, b, u);
+ } else {
+ b = g.source(e) == u;
+ g.nextInc(e, b);
+ }
+ while (e != INVALID && (b ? g.target(e) : g.source(e)) != v) {
+ g.nextInc(e, b);
+ }
+ } else {
+ if (e == INVALID) {
+ g.firstInc(e, b, u);
+ } else {
+ b = true;
+ g.nextInc(e, b);
+ }
+ while (e != INVALID && (!b || g.target(e) != v)) {
+ g.nextInc(e, b);
+ }
+ }
+ return e;
+ }
+ };
+
+ template <typename Graph>
+ struct FindUEdgeSelector<
+ Graph,
+ typename enable_if<typename Graph::FindEdgeTag, void>::type>
+ {
+ typedef typename Graph::Node Node;
+ typedef typename Graph::UEdge UEdge;
+ static UEdge find(const Graph &g, Node u, Node v, UEdge prev) {
+ return g.findUEdge(u, v, prev);
+ }
+ };
+ }
+
+ /// \brief Finds an uedge between two nodes of a graph.
+ ///
+ /// Finds an uedge from node \c u to node \c v in graph \c g.
+ /// If the node \c u and node \c v is equal then each loop edge
+ /// will be enumerated.
+ ///
+ /// If \c prev is \ref INVALID (this is the default value), then
+ /// it finds the first edge from \c u to \c v. Otherwise it looks for
+ /// the next edge from \c u to \c v after \c prev.
+ /// \return The found edge or \ref INVALID if there is no such an edge.
+ ///
+ /// Thus you can iterate through each edge from \c u to \c v as it follows.
+ ///\code
+ /// for(UEdge e = findUEdge(g,u,v); e != INVALID;
+ /// e = findUEdge(g,u,v,e)) {
+ /// ...
+ /// }
+ ///\endcode
+ ///
+ ///\sa ConEdgeIt
+
+ template <typename Graph>
+ inline typename Graph::UEdge
+ findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
+ typename Graph::UEdge p = INVALID) {
+ return _graph_utils_bits::FindUEdgeSelector<Graph>::find(g, u, v, p);
+ }
+
+ /// \brief Iterator for iterating on uedges connected the same nodes.
+ ///
+ /// Iterator for iterating on uedges connected the same nodes. It is
+ /// higher level interface for the findUEdge() function. You can
+ /// use it the following way:
+ ///\code
+ /// for (ConUEdgeIt<Graph> it(g, src, trg); it != INVALID; ++it) {
+ /// ...
+ /// }
+ ///\endcode
+ ///
+ ///\sa findUEdge()
+ ///
+ /// \author Balazs Dezso
+ template <typename _Graph>
+ class ConUEdgeIt : public _Graph::UEdge {
+ public:
+
+ typedef _Graph Graph;
+ typedef typename Graph::UEdge Parent;
+
+ typedef typename Graph::UEdge UEdge;
+ typedef typename Graph::Node Node;
+
+ /// \brief Constructor.
+ ///
+ /// Construct a new ConUEdgeIt iterating on the edges which
+ /// connects the \c u and \c v node.
+ ConUEdgeIt(const Graph& g, Node u, Node v) : graph(g) {
+ Parent::operator=(findUEdge(graph, u, v));
+ }
+
+ /// \brief Constructor.
+ ///
+ /// Construct a new ConUEdgeIt which continues the iterating from
+ /// the \c e edge.
+ ConUEdgeIt(const Graph& g, UEdge e) : Parent(e), graph(g) {}
+
+ /// \brief Increment operator.
+ ///
+ /// It increments the iterator and gives back the next edge.
+ ConUEdgeIt& operator++() {
+ Parent::operator=(findUEdge(graph, graph.source(*this),
+ graph.target(*this), *this));
+ return *this;
+ }
+ private:
+ const Graph& graph;
+ };
+
+ /// \brief Copy a map.
+ ///
+ /// This function copies the \c from map to the \c to map. It uses the
+ /// given iterator to iterate on the data structure and it uses the \c ref
+ /// mapping to convert the from's keys to the to's keys.
+ template <typename To, typename From,
+ typename ItemIt, typename Ref>
+ void copyMap(To& to, const From& from,
+ ItemIt it, const Ref& ref) {
+ for (; it != INVALID; ++it) {
+ to[ref[it]] = from[it];
+ }
+ }
+
+ /// \brief Copy the from map to the to map.
+ ///
+ /// Copy the \c from map to the \c to map. It uses the given iterator
+ /// to iterate on the data structure.
+ template <typename To, typename From, typename ItemIt>
+ void copyMap(To& to, const From& from, ItemIt it) {
+ for (; it != INVALID; ++it) {
+ to[it] = from[it];
+ }
+ }
+
+ namespace _graph_utils_bits {
+
+ template <typename Graph, typename Item, typename RefMap>
+ class MapCopyBase {
+ public:
+ virtual void copy(const Graph& from, const RefMap& refMap) = 0;
+
+ virtual ~MapCopyBase() {}
+ };
+
+ template <typename Graph, typename Item, typename RefMap,
+ typename ToMap, typename FromMap>
+ class MapCopy : public MapCopyBase<Graph, Item, RefMap> {
+ public:
+
+ MapCopy(ToMap& tmap, const FromMap& map)
+ : _tmap(tmap), _map(map) {}
+
+ virtual void copy(const Graph& graph, const RefMap& refMap) {
+ typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+ for (ItemIt it(graph); it != INVALID; ++it) {
+ _tmap.set(refMap[it], _map[it]);
+ }
+ }
+
+ private:
+ ToMap& _tmap;
+ const FromMap& _map;
+ };
+
+ template <typename Graph, typename Item, typename RefMap, typename It>
+ class ItemCopy : public MapCopyBase<Graph, Item, RefMap> {
+ public:
+
+ ItemCopy(It& it, const Item& item) : _it(it), _item(item) {}
+
+ virtual void copy(const Graph&, const RefMap& refMap) {
+ _it = refMap[_item];
+ }
+
+ private:
+ It& _it;
+ Item _item;
+ };
+
+ template <typename Graph, typename Item, typename RefMap, typename Ref>
+ class RefCopy : public MapCopyBase<Graph, Item, RefMap> {
+ public:
+
+ RefCopy(Ref& map) : _map(map) {}
+
+ virtual void copy(const Graph& graph, const RefMap& refMap) {
+ typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+ for (ItemIt it(graph); it != INVALID; ++it) {
+ _map.set(it, refMap[it]);
+ }
+ }
+
+ private:
+ Ref& _map;
+ };
+
+ template <typename Graph, typename Item, typename RefMap,
+ typename CrossRef>
+ class CrossRefCopy : public MapCopyBase<Graph, Item, RefMap> {
+ public:
+
+ CrossRefCopy(CrossRef& cmap) : _cmap(cmap) {}
+
+ virtual void copy(const Graph& graph, const RefMap& refMap) {
+ typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+ for (ItemIt it(graph); it != INVALID; ++it) {
+ _cmap.set(refMap[it], it);
+ }
+ }
+
+ private:
+ CrossRef& _cmap;
+ };
+
+ template <typename Graph, typename Enable = void>
+ struct GraphCopySelector {
+ template <typename From, typename NodeRefMap, typename EdgeRefMap>
+ static void copy(Graph &to, const From& from,
+ NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
+ for (typename From::NodeIt it(from); it != INVALID; ++it) {
+ nodeRefMap[it] = to.addNode();
+ }
+ for (typename From::EdgeIt it(from); it != INVALID; ++it) {
+ edgeRefMap[it] = to.addEdge(nodeRefMap[from.source(it)],
+ nodeRefMap[from.target(it)]);
+ }
+ }
+ };
+
+ template <typename Graph>
+ struct GraphCopySelector<
+ Graph,
+ typename enable_if<typename Graph::BuildTag, void>::type>
+ {
+ template <typename From, typename NodeRefMap, typename EdgeRefMap>
+ static void copy(Graph &to, const From& from,
+ NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
+ to.build(from, nodeRefMap, edgeRefMap);
+ }
+ };
+
+ template <typename UGraph, typename Enable = void>
+ struct UGraphCopySelector {
+ template <typename From, typename NodeRefMap, typename UEdgeRefMap>
+ static void copy(UGraph &to, const From& from,
+ NodeRefMap& nodeRefMap, UEdgeRefMap& uEdgeRefMap) {
+ for (typename From::NodeIt it(from); it != INVALID; ++it) {
+ nodeRefMap[it] = to.addNode();
+ }
+ for (typename From::UEdgeIt it(from); it != INVALID; ++it) {
+ uEdgeRefMap[it] = to.addEdge(nodeRefMap[from.source(it)],
+ nodeRefMap[from.target(it)]);
+ }
+ }
+ };
+
+ template <typename UGraph>
+ struct UGraphCopySelector<
+ UGraph,
+ typename enable_if<typename UGraph::BuildTag, void>::type>
+ {
+ template <typename From, typename NodeRefMap, typename UEdgeRefMap>
+ static void copy(UGraph &to, const From& from,
+ NodeRefMap& nodeRefMap, UEdgeRefMap& uEdgeRefMap) {
+ to.build(from, nodeRefMap, uEdgeRefMap);
+ }
+ };
+
+ template <typename BpUGraph, typename Enable = void>
+ struct BpUGraphCopySelector {
+ template <typename From, typename ANodeRefMap,
+ typename BNodeRefMap, typename UEdgeRefMap>
+ static void copy(BpUGraph &to, const From& from,
+ ANodeRefMap& aNodeRefMap, BNodeRefMap& bNodeRefMap,
+ UEdgeRefMap& uEdgeRefMap) {
+ for (typename From::ANodeIt it(from); it != INVALID; ++it) {
+ aNodeRefMap[it] = to.addANode();
+ }
+ for (typename From::BNodeIt it(from); it != INVALID; ++it) {
+ bNodeRefMap[it] = to.addBNode();
+ }
+ for (typename From::UEdgeIt it(from); it != INVALID; ++it) {
+ uEdgeRefMap[it] = to.addEdge(aNodeRefMap[from.aNode(it)],
+ bNodeRefMap[from.bNode(it)]);
+ }
+ }
+ };
+
+ template <typename BpUGraph>
+ struct BpUGraphCopySelector<
+ BpUGraph,
+ typename enable_if<typename BpUGraph::BuildTag, void>::type>
+ {
+ template <typename From, typename ANodeRefMap,
+ typename BNodeRefMap, typename UEdgeRefMap>
+ static void copy(BpUGraph &to, const From& from,
+ ANodeRefMap& aNodeRefMap, BNodeRefMap& bNodeRefMap,
+ UEdgeRefMap& uEdgeRefMap) {
+ to.build(from, aNodeRefMap, bNodeRefMap, uEdgeRefMap);
+ }
+ };
+
+
+ }
+
+ /// \brief Class to copy a graph.
+ ///
+ /// Class to copy a graph to another graph (duplicate a graph). The
+ /// simplest way of using it is through the \c copyGraph() function.
+ template <typename To, typename From>
+ class GraphCopy {
+ private:
+
+ typedef typename From::Node Node;
+ typedef typename From::NodeIt NodeIt;
+ typedef typename From::Edge Edge;
+ typedef typename From::EdgeIt EdgeIt;
+
+ typedef typename To::Node TNode;
+ typedef typename To::Edge TEdge;
+
+ typedef typename From::template NodeMap<TNode> NodeRefMap;
+ typedef typename From::template EdgeMap<TEdge> EdgeRefMap;
+
+
+ public:
+
+
+ /// \brief Constructor for the GraphCopy.
+ ///
+ /// It copies the content of the \c _from graph into the
+ /// \c _to graph.
+ GraphCopy(To& _to, const From& _from)
+ : from(_from), to(_to) {}
+
+ /// \brief Destructor of the GraphCopy
+ ///
+ /// Destructor of the GraphCopy
+ ~GraphCopy() {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
+ delete nodeMapCopies[i];
+ }
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
+ delete edgeMapCopies[i];
+ }
+
+ }
+
+ /// \brief Copies the node references into the given map.
+ ///
+ /// Copies the node references into the given map.
+ template <typename NodeRef>
+ GraphCopy& nodeRef(NodeRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Node,
+ NodeRefMap, NodeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the node cross references into the given map.
+ ///
+ /// Copies the node cross references (reverse references) into
+ /// the given map.
+ template <typename NodeCrossRef>
+ GraphCopy& nodeCrossRef(NodeCrossRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
+ NodeRefMap, NodeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's node type,
+ /// and the copied map's key type is the from graph's node
+ /// type.
+ template <typename ToMap, typename FromMap>
+ GraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Node,
+ NodeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given node.
+ ///
+ /// Make a copy of the given node.
+ GraphCopy& node(TNode& tnode, const Node& snode) {
+ nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Node,
+ NodeRefMap, TNode>(tnode, snode));
+ return *this;
+ }
+
+ /// \brief Copies the edge references into the given map.
+ ///
+ /// Copies the edge references into the given map.
+ template <typename EdgeRef>
+ GraphCopy& edgeRef(EdgeRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Edge,
+ EdgeRefMap, EdgeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the edge cross references into the given map.
+ ///
+ /// Copies the edge cross references (reverse references) into
+ /// the given map.
+ template <typename EdgeCrossRef>
+ GraphCopy& edgeCrossRef(EdgeCrossRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Edge,
+ EdgeRefMap, EdgeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's edge type,
+ /// and the copied map's key type is the from graph's edge
+ /// type.
+ template <typename ToMap, typename FromMap>
+ GraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Edge,
+ EdgeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given edge.
+ ///
+ /// Make a copy of the given edge.
+ GraphCopy& edge(TEdge& tedge, const Edge& sedge) {
+ edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Edge,
+ EdgeRefMap, TEdge>(tedge, sedge));
+ return *this;
+ }
+
+ /// \brief Executes the copies.
+ ///
+ /// Executes the copies.
+ void run() {
+ NodeRefMap nodeRefMap(from);
+ EdgeRefMap edgeRefMap(from);
+ _graph_utils_bits::GraphCopySelector<To>::
+ copy(to, from, nodeRefMap, edgeRefMap);
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
+ nodeMapCopies[i]->copy(from, nodeRefMap);
+ }
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
+ edgeMapCopies[i]->copy(from, edgeRefMap);
+ }
+ }
+
+ protected:
+
+
+ const From& from;
+ To& to;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
+ nodeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
+ edgeMapCopies;
+
+ };
+
+ /// \brief Copy a graph to another graph.
+ ///
+ /// Copy a graph to another graph.
+ /// The usage of the function:
+ ///
+ ///\code
+ /// copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run();
+ ///\endcode
+ ///
+ /// After the copy the \c nr map will contain the mapping from the
+ /// nodes of the \c from graph to the nodes of the \c to graph and
+ /// \c ecr will contain the mapping from the edges of the \c to graph
+ /// to the edges of the \c from graph.
+ ///
+ /// \see GraphCopy
+ template <typename To, typename From>
+ GraphCopy<To, From> copyGraph(To& to, const From& from) {
+ return GraphCopy<To, From>(to, from);
+ }
+
+ /// \brief Class to copy an undirected graph.
+ ///
+ /// Class to copy an undirected graph to another graph (duplicate a graph).
+ /// The simplest way of using it is through the \c copyUGraph() function.
+ template <typename To, typename From>
+ class UGraphCopy {
+ private:
+
+ typedef typename From::Node Node;
+ typedef typename From::NodeIt NodeIt;
+ typedef typename From::Edge Edge;
+ typedef typename From::EdgeIt EdgeIt;
+ typedef typename From::UEdge UEdge;
+ typedef typename From::UEdgeIt UEdgeIt;
+
+ typedef typename To::Node TNode;
+ typedef typename To::Edge TEdge;
+ typedef typename To::UEdge TUEdge;
+
+ typedef typename From::template NodeMap<TNode> NodeRefMap;
+ typedef typename From::template UEdgeMap<TUEdge> UEdgeRefMap;
+
+ struct EdgeRefMap {
+ EdgeRefMap(const To& _to, const From& _from,
+ const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref)
+ : to(_to), from(_from),
+ uedge_ref(_uedge_ref), node_ref(_node_ref) {}
+
+ typedef typename From::Edge Key;
+ typedef typename To::Edge Value;
+
+ Value operator[](const Key& key) const {
+ bool forward =
+ (from.direction(key) ==
+ (node_ref[from.source(static_cast<const UEdge&>(key))] ==
+ to.source(uedge_ref[static_cast<const UEdge&>(key)])));
+ return to.direct(uedge_ref[key], forward);
+ }
+
+ const To& to;
+ const From& from;
+ const UEdgeRefMap& uedge_ref;
+ const NodeRefMap& node_ref;
+ };
+
+
+ public:
+
+
+ /// \brief Constructor for the GraphCopy.
+ ///
+ /// It copies the content of the \c _from graph into the
+ /// \c _to graph.
+ UGraphCopy(To& _to, const From& _from)
+ : from(_from), to(_to) {}
+
+ /// \brief Destructor of the GraphCopy
+ ///
+ /// Destructor of the GraphCopy
+ ~UGraphCopy() {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
+ delete nodeMapCopies[i];
+ }
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
+ delete edgeMapCopies[i];
+ }
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
+ delete uEdgeMapCopies[i];
+ }
+
+ }
+
+ /// \brief Copies the node references into the given map.
+ ///
+ /// Copies the node references into the given map.
+ template <typename NodeRef>
+ UGraphCopy& nodeRef(NodeRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Node,
+ NodeRefMap, NodeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the node cross references into the given map.
+ ///
+ /// Copies the node cross references (reverse references) into
+ /// the given map.
+ template <typename NodeCrossRef>
+ UGraphCopy& nodeCrossRef(NodeCrossRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
+ NodeRefMap, NodeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's node type,
+ /// and the copied map's key type is the from graph's node
+ /// type.
+ template <typename ToMap, typename FromMap>
+ UGraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Node,
+ NodeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given node.
+ ///
+ /// Make a copy of the given node.
+ UGraphCopy& node(TNode& tnode, const Node& snode) {
+ nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Node,
+ NodeRefMap, TNode>(tnode, snode));
+ return *this;
+ }
+
+ /// \brief Copies the edge references into the given map.
+ ///
+ /// Copies the edge references into the given map.
+ template <typename EdgeRef>
+ UGraphCopy& edgeRef(EdgeRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Edge,
+ EdgeRefMap, EdgeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the edge cross references into the given map.
+ ///
+ /// Copies the edge cross references (reverse references) into
+ /// the given map.
+ template <typename EdgeCrossRef>
+ UGraphCopy& edgeCrossRef(EdgeCrossRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Edge,
+ EdgeRefMap, EdgeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's edge type,
+ /// and the copied map's key type is the from graph's edge
+ /// type.
+ template <typename ToMap, typename FromMap>
+ UGraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Edge,
+ EdgeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given edge.
+ ///
+ /// Make a copy of the given edge.
+ UGraphCopy& edge(TEdge& tedge, const Edge& sedge) {
+ edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Edge,
+ EdgeRefMap, TEdge>(tedge, sedge));
+ return *this;
+ }
+
+ /// \brief Copies the undirected edge references into the given map.
+ ///
+ /// Copies the undirected edge references into the given map.
+ template <typename UEdgeRef>
+ UGraphCopy& uEdgeRef(UEdgeRef& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, UEdge,
+ UEdgeRefMap, UEdgeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the undirected edge cross references into the given map.
+ ///
+ /// Copies the undirected edge cross references (reverse
+ /// references) into the given map.
+ template <typename UEdgeCrossRef>
+ UGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
+ UEdge, UEdgeRefMap, UEdgeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's undirected edge type,
+ /// and the copied map's key type is the from graph's undirected edge
+ /// type.
+ template <typename ToMap, typename FromMap>
+ UGraphCopy& uEdgeMap(ToMap& tmap, const FromMap& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, UEdge,
+ UEdgeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given undirected edge.
+ ///
+ /// Make a copy of the given undirected edge.
+ UGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, UEdge,
+ UEdgeRefMap, TUEdge>(tuedge, suedge));
+ return *this;
+ }
+
+ /// \brief Executes the copies.
+ ///
+ /// Executes the copies.
+ void run() {
+ NodeRefMap nodeRefMap(from);
+ UEdgeRefMap uEdgeRefMap(from);
+ EdgeRefMap edgeRefMap(to, from, uEdgeRefMap, nodeRefMap);
+ _graph_utils_bits::UGraphCopySelector<To>::
+ copy(to, from, nodeRefMap, uEdgeRefMap);
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
+ nodeMapCopies[i]->copy(from, nodeRefMap);
+ }
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
+ uEdgeMapCopies[i]->copy(from, uEdgeRefMap);
+ }
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
+ edgeMapCopies[i]->copy(from, edgeRefMap);
+ }
+ }
+
+ private:
+
+ const From& from;
+ To& to;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
+ nodeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
+ edgeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, UEdge, UEdgeRefMap>* >
+ uEdgeMapCopies;
+
+ };
+
+ /// \brief Copy an undirected graph to another graph.
+ ///
+ /// Copy an undirected graph to another graph.
+ /// The usage of the function:
+ ///
+ ///\code
+ /// copyUGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run();
+ ///\endcode
+ ///
+ /// After the copy the \c nr map will contain the mapping from the
+ /// nodes of the \c from graph to the nodes of the \c to graph and
+ /// \c ecr will contain the mapping from the edges of the \c to graph
+ /// to the edges of the \c from graph.
+ ///
+ /// \see UGraphCopy
+ template <typename To, typename From>
+ UGraphCopy<To, From>
+ copyUGraph(To& to, const From& from) {
+ return UGraphCopy<To, From>(to, from);
+ }
+
+ /// \brief Class to copy a bipartite undirected graph.
+ ///
+ /// Class to copy a bipartite undirected graph to another graph
+ /// (duplicate a graph). The simplest way of using it is through
+ /// the \c copyBpUGraph() function.
+ template <typename To, typename From>
+ class BpUGraphCopy {
+ private:
+
+ typedef typename From::Node Node;
+ typedef typename From::ANode ANode;
+ typedef typename From::BNode BNode;
+ typedef typename From::NodeIt NodeIt;
+ typedef typename From::Edge Edge;
+ typedef typename From::EdgeIt EdgeIt;
+ typedef typename From::UEdge UEdge;
+ typedef typename From::UEdgeIt UEdgeIt;
+
+ typedef typename To::Node TNode;
+ typedef typename To::Edge TEdge;
+ typedef typename To::UEdge TUEdge;
+
+ typedef typename From::template ANodeMap<TNode> ANodeRefMap;
+ typedef typename From::template BNodeMap<TNode> BNodeRefMap;
+ typedef typename From::template UEdgeMap<TUEdge> UEdgeRefMap;
+
+ struct NodeRefMap {
+ NodeRefMap(const From& _from, const ANodeRefMap& _anode_ref,
+ const BNodeRefMap& _bnode_ref)
+ : from(_from), anode_ref(_anode_ref), bnode_ref(_bnode_ref) {}
+
+ typedef typename From::Node Key;
+ typedef typename To::Node Value;
+
+ Value operator[](const Key& key) const {
+ return from.aNode(key) ? anode_ref[key] : bnode_ref[key];
+ }
+
+ const From& from;
+ const ANodeRefMap& anode_ref;
+ const BNodeRefMap& bnode_ref;
+ };
+
+ struct EdgeRefMap {
+ EdgeRefMap(const To& _to, const From& _from,
+ const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref)
+ : to(_to), from(_from),
+ uedge_ref(_uedge_ref), node_ref(_node_ref) {}
+
+ typedef typename From::Edge Key;
+ typedef typename To::Edge Value;
+
+ Value operator[](const Key& key) const {
+ bool forward =
+ (from.direction(key) ==
+ (node_ref[from.source(static_cast<const UEdge&>(key))] ==
+ to.source(uedge_ref[static_cast<const UEdge&>(key)])));
+ return to.direct(uedge_ref[key], forward);
+ }
+
+ const To& to;
+ const From& from;
+ const UEdgeRefMap& uedge_ref;
+ const NodeRefMap& node_ref;
+ };
+
+ public:
+
+
+ /// \brief Constructor for the GraphCopy.
+ ///
+ /// It copies the content of the \c _from graph into the
+ /// \c _to graph.
+ BpUGraphCopy(To& _to, const From& _from)
+ : from(_from), to(_to) {}
+
+ /// \brief Destructor of the GraphCopy
+ ///
+ /// Destructor of the GraphCopy
+ ~BpUGraphCopy() {
+ for (int i = 0; i < int(aNodeMapCopies.size()); ++i) {
+ delete aNodeMapCopies[i];
+ }
+ for (int i = 0; i < int(bNodeMapCopies.size()); ++i) {
+ delete bNodeMapCopies[i];
+ }
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
+ delete nodeMapCopies[i];
+ }
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
+ delete edgeMapCopies[i];
+ }
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
+ delete uEdgeMapCopies[i];
+ }
+
+ }
+
+ /// \brief Copies the A-node references into the given map.
+ ///
+ /// Copies the A-node references into the given map.
+ template <typename ANodeRef>
+ BpUGraphCopy& aNodeRef(ANodeRef& map) {
+ aNodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, ANode,
+ ANodeRefMap, ANodeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the A-node cross references into the given map.
+ ///
+ /// Copies the A-node cross references (reverse references) into
+ /// the given map.
+ template <typename ANodeCrossRef>
+ BpUGraphCopy& aNodeCrossRef(ANodeCrossRef& map) {
+ aNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
+ ANode, ANodeRefMap, ANodeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given A-node map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's node type,
+ /// and the copied map's key type is the from graph's node
+ /// type.
+ template <typename ToMap, typename FromMap>
+ BpUGraphCopy& aNodeMap(ToMap& tmap, const FromMap& map) {
+ aNodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, ANode,
+ ANodeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Copies the B-node references into the given map.
+ ///
+ /// Copies the B-node references into the given map.
+ template <typename BNodeRef>
+ BpUGraphCopy& bNodeRef(BNodeRef& map) {
+ bNodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, BNode,
+ BNodeRefMap, BNodeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the B-node cross references into the given map.
+ ///
+ /// Copies the B-node cross references (reverse references) into
+ /// the given map.
+ template <typename BNodeCrossRef>
+ BpUGraphCopy& bNodeCrossRef(BNodeCrossRef& map) {
+ bNodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
+ BNode, BNodeRefMap, BNodeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given B-node map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's node type,
+ /// and the copied map's key type is the from graph's node
+ /// type.
+ template <typename ToMap, typename FromMap>
+ BpUGraphCopy& bNodeMap(ToMap& tmap, const FromMap& map) {
+ bNodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, BNode,
+ BNodeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+ /// \brief Copies the node references into the given map.
+ ///
+ /// Copies the node references into the given map.
+ template <typename NodeRef>
+ BpUGraphCopy& nodeRef(NodeRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Node,
+ NodeRefMap, NodeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the node cross references into the given map.
+ ///
+ /// Copies the node cross references (reverse references) into
+ /// the given map.
+ template <typename NodeCrossRef>
+ BpUGraphCopy& nodeCrossRef(NodeCrossRef& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
+ NodeRefMap, NodeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's node type,
+ /// and the copied map's key type is the from graph's node
+ /// type.
+ template <typename ToMap, typename FromMap>
+ BpUGraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
+ nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Node,
+ NodeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given node.
+ ///
+ /// Make a copy of the given node.
+ BpUGraphCopy& node(TNode& tnode, const Node& snode) {
+ nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Node,
+ NodeRefMap, TNode>(tnode, snode));
+ return *this;
+ }
+
+ /// \brief Copies the edge references into the given map.
+ ///
+ /// Copies the edge references into the given map.
+ template <typename EdgeRef>
+ BpUGraphCopy& edgeRef(EdgeRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, Edge,
+ EdgeRefMap, EdgeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the edge cross references into the given map.
+ ///
+ /// Copies the edge cross references (reverse references) into
+ /// the given map.
+ template <typename EdgeCrossRef>
+ BpUGraphCopy& edgeCrossRef(EdgeCrossRef& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From, Edge,
+ EdgeRefMap, EdgeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's edge type,
+ /// and the copied map's key type is the from graph's edge
+ /// type.
+ template <typename ToMap, typename FromMap>
+ BpUGraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
+ edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, Edge,
+ EdgeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given edge.
+ ///
+ /// Make a copy of the given edge.
+ BpUGraphCopy& edge(TEdge& tedge, const Edge& sedge) {
+ edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, Edge,
+ EdgeRefMap, TEdge>(tedge, sedge));
+ return *this;
+ }
+
+ /// \brief Copies the undirected edge references into the given map.
+ ///
+ /// Copies the undirected edge references into the given map.
+ template <typename UEdgeRef>
+ BpUGraphCopy& uEdgeRef(UEdgeRef& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<From, UEdge,
+ UEdgeRefMap, UEdgeRef>(map));
+ return *this;
+ }
+
+ /// \brief Copies the undirected edge cross references into the given map.
+ ///
+ /// Copies the undirected edge cross references (reverse
+ /// references) into the given map.
+ template <typename UEdgeCrossRef>
+ BpUGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<From,
+ UEdge, UEdgeRefMap, UEdgeCrossRef>(map));
+ return *this;
+ }
+
+ /// \brief Make copy of the given map.
+ ///
+ /// Makes copy of the given map for the newly created graph.
+ /// The new map's key type is the to graph's undirected edge type,
+ /// and the copied map's key type is the from graph's undirected edge
+ /// type.
+ template <typename ToMap, typename FromMap>
+ BpUGraphCopy& uEdgeMap(ToMap& tmap, const FromMap& map) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<From, UEdge,
+ UEdgeRefMap, ToMap, FromMap>(tmap, map));
+ return *this;
+ }
+
+ /// \brief Make a copy of the given undirected edge.
+ ///
+ /// Make a copy of the given undirected edge.
+ BpUGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) {
+ uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<From, UEdge,
+ UEdgeRefMap, TUEdge>(tuedge, suedge));
+ return *this;
+ }
+
+ /// \brief Executes the copies.
+ ///
+ /// Executes the copies.
+ void run() {
+ ANodeRefMap aNodeRefMap(from);
+ BNodeRefMap bNodeRefMap(from);
+ NodeRefMap nodeRefMap(from, aNodeRefMap, bNodeRefMap);
+ UEdgeRefMap uEdgeRefMap(from);
+ EdgeRefMap edgeRefMap(to, from, uEdgeRefMap, nodeRefMap);
+ _graph_utils_bits::BpUGraphCopySelector<To>::
+ copy(to, from, aNodeRefMap, bNodeRefMap, uEdgeRefMap);
+ for (int i = 0; i < int(aNodeMapCopies.size()); ++i) {
+ aNodeMapCopies[i]->copy(from, aNodeRefMap);
+ }
+ for (int i = 0; i < int(bNodeMapCopies.size()); ++i) {
+ bNodeMapCopies[i]->copy(from, bNodeRefMap);
+ }
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
+ nodeMapCopies[i]->copy(from, nodeRefMap);
+ }
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
+ uEdgeMapCopies[i]->copy(from, uEdgeRefMap);
+ }
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
+ edgeMapCopies[i]->copy(from, edgeRefMap);
+ }
+ }
+
+ private:
+
+ const From& from;
+ To& to;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, ANode, ANodeRefMap>* >
+ aNodeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, BNode, BNodeRefMap>* >
+ bNodeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
+ nodeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
+ edgeMapCopies;
+
+ std::vector<_graph_utils_bits::MapCopyBase<From, UEdge, UEdgeRefMap>* >
+ uEdgeMapCopies;
+
+ };
+
+ /// \brief Copy a bipartite undirected graph to another graph.
+ ///
+ /// Copy a bipartite undirected graph to another graph.
+ /// The usage of the function:
+ ///
+ ///\code
+ /// copyBpUGraph(trg, src).aNodeRef(anr).edgeCrossRef(ecr).run();
+ ///\endcode
+ ///
+ /// After the copy the \c nr map will contain the mapping from the
+ /// nodes of the \c from graph to the nodes of the \c to graph and
+ /// \c ecr will contain the mapping from the edges of the \c to graph
+ /// to the edges of the \c from graph.
+ ///
+ /// \see BpUGraphCopy
+ template <typename To, typename From>
+ BpUGraphCopy<To, From>
+ copyBpUGraph(To& to, const From& from) {
+ return BpUGraphCopy<To, From>(to, from);
+ }
+
+
+ /// @}
+
+ /// \addtogroup graph_maps
+ /// @{
+
+ /// Provides an immutable and unique id for each item in the graph.
+
+ /// The IdMap class provides a unique and immutable id for each item of the
+ /// same type (e.g. node) in the graph. This id is <ul><li>\b unique:
+ /// different items (nodes) get different ids <li>\b immutable: the id of an
+ /// item (node) does not change (even if you delete other nodes). </ul>
+ /// Through this map you get access (i.e. can read) the inner id values of
+ /// the items stored in the graph. This map can be inverted with its member
+ /// class \c InverseMap.
+ ///
+ template <typename _Graph, typename _Item>
+ class IdMap {
+ public:
+ typedef _Graph Graph;
+ typedef int Value;
+ typedef _Item Item;
+ typedef _Item Key;
+
+ /// \brief Constructor.
+ ///
+ /// Constructor of the map.
+ explicit IdMap(const Graph& _graph) : graph(&_graph) {}
+
+ /// \brief Gives back the \e id of the item.
+ ///
+ /// Gives back the immutable and unique \e id of the item.
+ int operator[](const Item& item) const { return graph->id(item);}
+
+ /// \brief Gives back the item by its id.
+ ///
+ /// Gives back the item by its id.
+ Item operator()(int id) { return graph->fromId(id, Item()); }
+
+ private:
+ const Graph* graph;
+
+ public:
+
+ /// \brief The class represents the inverse of its owner (IdMap).
+ ///
+ /// The class represents the inverse of its owner (IdMap).
+ /// \see inverse()
+ class InverseMap {
+ public:
+
+ /// \brief Constructor.
+ ///
+ /// Constructor for creating an id-to-item map.
+ explicit InverseMap(const Graph& _graph) : graph(&_graph) {}
+
+ /// \brief Constructor.
+ ///
+ /// Constructor for creating an id-to-item map.
+ explicit InverseMap(const IdMap& idMap) : graph(idMap.graph) {}
+
+ /// \brief Gives back the given item from its id.
+ ///
+ /// Gives back the given item from its id.
+ ///
+ Item operator[](int id) const { return graph->fromId(id, Item());}
+
+ private:
+ const Graph* graph;
+ };
+
+ /// \brief Gives back the inverse of the map.
+ ///
+ /// Gives back the inverse of the IdMap.
+ InverseMap inverse() const { return InverseMap(*graph);}
+
+ };
+
+
+ /// \brief General invertable graph-map type.
+
+ /// This type provides simple invertable graph-maps.
+ /// The InvertableMap wraps an arbitrary ReadWriteMap
+ /// and if a key is set to a new value then store it
+ /// in the inverse map.
+ ///
+ /// The values of the map can be accessed
+ /// with stl compatible forward iterator.
+ ///
+ /// \param _Graph The graph type.
+ /// \param _Item The item type of the graph.
+ /// \param _Value The value type of the map.
+ ///
+ /// \see IterableValueMap
+ template <typename _Graph, typename _Item, typename _Value>
+ class InvertableMap : protected DefaultMap<_Graph, _Item, _Value> {
+ private:
+
+ typedef DefaultMap<_Graph, _Item, _Value> Map;
+ typedef _Graph Graph;
+
+ typedef std::map<_Value, _Item> Container;
+ Container invMap;
+
+ public:
+
+ /// The key type of InvertableMap (Node, Edge, UEdge).
+ typedef typename Map::Key Key;
+ /// The value type of the InvertableMap.
+ typedef typename Map::Value Value;
+
+
+
+ /// \brief Constructor.
+ ///
+ /// Construct a new InvertableMap for the graph.
+ ///
+ explicit InvertableMap(const Graph& graph) : Map(graph) {}
+
+ /// \brief Forward iterator for values.
+ ///
+ /// This iterator is an stl compatible forward
+ /// iterator on the values of the map. The values can
+ /// be accessed in the [beginValue, endValue) range.
+ ///
+ class ValueIterator
+ : public std::iterator<std::forward_iterator_tag, Value> {
+ friend class InvertableMap;
+ private:
+ ValueIterator(typename Container::const_iterator _it)
+ : it(_it) {}
+ public:
+
+ ValueIterator() {}
+
+ ValueIterator& operator++() { ++it; return *this; }
+ ValueIterator operator++(int) {
+ ValueIterator tmp(*this);
+ operator++();
+ return tmp;
+ }
+
+ const Value& operator*() const { return it->first; }
+ const Value* operator->() const { return &(it->first); }
+
+ bool operator==(ValueIterator jt) const { return it == jt.it; }
+ bool operator!=(ValueIterator jt) const { return it != jt.it; }
+
+ private:
+ typename Container::const_iterator it;
+ };
+
+ /// \brief Returns an iterator to the first value.
+ ///
+ /// Returns an stl compatible iterator to the
+ /// first value of the map. The values of the
+ /// map can be accessed in the [beginValue, endValue)
+ /// range.
+ ValueIterator beginValue() const {
+ return ValueIterator(invMap.begin());
+ }
+
+ /// \brief Returns an iterator after the last value.
+ ///
+ /// Returns an stl compatible iterator after the
+ /// last value of the map. The values of the
+ /// map can be accessed in the [beginValue, endValue)
+ /// range.
+ ValueIterator endValue() const {
+ return ValueIterator(invMap.end());
+ }
+
+ /// \brief The setter function of the map.
+ ///
+ /// Sets the mapped value.
+ void set(const Key& key, const Value& val) {
+ Value oldval = Map::operator[](key);
+ typename Container::iterator it = invMap.find(oldval);
+ if (it != invMap.end() && it->second == key) {
+ invMap.erase(it);
+ }
+ invMap.insert(make_pair(val, key));
+ Map::set(key, val);
+ }
+
+ /// \brief The getter function of the map.
+ ///
+ /// It gives back the value associated with the key.
+ typename MapTraits<Map>::ConstReturnValue
+ operator[](const Key& key) const {
+ return Map::operator[](key);
+ }
+
+ /// \brief Gives back the item by its value.
+ ///
+ /// Gives back the item by its value.
+ Key operator()(const Value& key) const {
+ typename Container::const_iterator it = invMap.find(key);
+ return it != invMap.end() ? it->second : INVALID;
+ }
+
+ protected:
+
+ /// \brief Erase the key from the map.
+ ///
+ /// Erase the key to the map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void erase(const Key& key) {
+ Value val = Map::operator[](key);
+ typename Container::iterator it = invMap.find(val);
+ if (it != invMap.end() && it->second == key) {
+ invMap.erase(it);
+ }
+ Map::erase(key);
+ }
+
+ /// \brief Erase more keys from the map.
+ ///
+ /// Erase more keys from the map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void erase(const std::vector<Key>& keys) {
+ for (int i = 0; i < int(keys.size()); ++i) {
+ Value val = Map::operator[](keys[i]);
+ typename Container::iterator it = invMap.find(val);
+ if (it != invMap.end() && it->second == keys[i]) {
+ invMap.erase(it);
+ }
+ }
+ Map::erase(keys);
+ }
+
+ /// \brief Clear the keys from the map and inverse map.
+ ///
+ /// Clear the keys from the map and inverse map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void clear() {
+ invMap.clear();
+ Map::clear();
+ }
+
+ public:
+
+ /// \brief The inverse map type.
+ ///
+ /// The inverse of this map. The subscript operator of the map
+ /// gives back always the item what was last assigned to the value.
+ class InverseMap {
+ public:
+ /// \brief Constructor of the InverseMap.
+ ///
+ /// Constructor of the InverseMap.
+ explicit InverseMap(const InvertableMap& _inverted)
+ : inverted(_inverted) {}
+
+ /// The value type of the InverseMap.
+ typedef typename InvertableMap::Key Value;
+ /// The key type of the InverseMap.
+ typedef typename InvertableMap::Value Key;
+
+ /// \brief Subscript operator.
+ ///
+ /// Subscript operator. It gives back always the item
+ /// what was last assigned to the value.
+ Value operator[](const Key& key) const {
+ return inverted(key);
+ }
+
+ private:
+ const InvertableMap& inverted;
+ };
+
+ /// \brief It gives back the just readable inverse map.
+ ///
+ /// It gives back the just readable inverse map.
+ InverseMap inverse() const {
+ return InverseMap(*this);
+ }
+
+
+
+ };
+
+ /// \brief Provides a mutable, continuous and unique descriptor for each
+ /// item in the graph.
+ ///
+ /// The DescriptorMap class provides a unique and continuous (but mutable)
+ /// descriptor (id) for each item of the same type (e.g. node) in the
+ /// graph. This id is <ul><li>\b unique: different items (nodes) get
+ /// different ids <li>\b continuous: the range of the ids is the set of
+ /// integers between 0 and \c n-1, where \c n is the number of the items of
+ /// this type (e.g. nodes) (so the id of a node can change if you delete an
+ /// other node, i.e. this id is mutable). </ul> This map can be inverted
+ /// with its member class \c InverseMap.
+ ///
+ /// \param _Graph The graph class the \c DescriptorMap belongs to.
+ /// \param _Item The Item is the Key of the Map. It may be Node, Edge or
+ /// UEdge.
+ template <typename _Graph, typename _Item>
+ class DescriptorMap : protected DefaultMap<_Graph, _Item, int> {
+
+ typedef _Item Item;
+ typedef DefaultMap<_Graph, _Item, int> Map;
+
+ public:
+ /// The graph class of DescriptorMap.
+ typedef _Graph Graph;
+
+ /// The key type of DescriptorMap (Node, Edge, UEdge).
+ typedef typename Map::Key Key;
+ /// The value type of DescriptorMap.
+ typedef typename Map::Value Value;
+
+ /// \brief Constructor.
+ ///
+ /// Constructor for descriptor map.
+ explicit DescriptorMap(const Graph& _graph) : Map(_graph) {
+ Item it;
+ const typename Map::Notifier* nf = Map::notifier();
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ Map::set(it, invMap.size());
+ invMap.push_back(it);
+ }
+ }
+
+ protected:
+
+ /// \brief Add a new key to the map.
+ ///
+ /// Add a new key to the map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void add(const Item& item) {
+ Map::add(item);
+ Map::set(item, invMap.size());
+ invMap.push_back(item);
+ }
+
+ /// \brief Add more new keys to the map.
+ ///
+ /// Add more new keys to the map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void add(const std::vector<Item>& items) {
+ Map::add(items);
+ for (int i = 0; i < int(items.size()); ++i) {
+ Map::set(items[i], invMap.size());
+ invMap.push_back(items[i]);
+ }
+ }
+
+ /// \brief Erase the key from the map.
+ ///
+ /// Erase the key from the map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void erase(const Item& item) {
+ Map::set(invMap.back(), Map::operator[](item));
+ invMap[Map::operator[](item)] = invMap.back();
+ invMap.pop_back();
+ Map::erase(item);
+ }
+
+ /// \brief Erase more keys from the map.
+ ///
+ /// Erase more keys from the map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void erase(const std::vector<Item>& items) {
+ for (int i = 0; i < int(items.size()); ++i) {
+ Map::set(invMap.back(), Map::operator[](items[i]));
+ invMap[Map::operator[](items[i])] = invMap.back();
+ invMap.pop_back();
+ }
+ Map::erase(items);
+ }
+
+ /// \brief Build the unique map.
+ ///
+ /// Build the unique map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void build() {
+ Map::build();
+ Item it;
+ const typename Map::Notifier* nf = Map::notifier();
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ Map::set(it, invMap.size());
+ invMap.push_back(it);
+ }
+ }
+
+ /// \brief Clear the keys from the map.
+ ///
+ /// Clear the keys from the map. It is called by the
+ /// \c AlterationNotifier.
+ virtual void clear() {
+ invMap.clear();
+ Map::clear();
+ }
+
+ public:
+
+ /// \brief Returns the maximal value plus one.
+ ///
+ /// Returns the maximal value plus one in the map.
+ unsigned int size() const {
+ return invMap.size();
+ }
+
+ /// \brief Swaps the position of the two items in the map.
+ ///
+ /// Swaps the position of the two items in the map.
+ void swap(const Item& p, const Item& q) {
+ int pi = Map::operator[](p);
+ int qi = Map::operator[](q);
+ Map::set(p, qi);
+ invMap[qi] = p;
+ Map::set(q, pi);
+ invMap[pi] = q;
+ }
+
+ /// \brief Gives back the \e descriptor of the item.
+ ///
+ /// Gives back the mutable and unique \e descriptor of the map.
+ int operator[](const Item& item) const {
+ return Map::operator[](item);
+ }
+
+ /// \brief Gives back the item by its descriptor.
+ ///
+ /// Gives back th item by its descriptor.
+ Item operator()(int id) const {
+ return invMap[id];
+ }
+
+ private:
+
+ typedef std::vector<Item> Container;
+ Container invMap;
+
+ public:
+ /// \brief The inverse map type of DescriptorMap.
+ ///
+ /// The inverse map type of DescriptorMap.
+ class InverseMap {
+ public:
+ /// \brief Constructor of the InverseMap.
+ ///
+ /// Constructor of the InverseMap.
+ explicit InverseMap(const DescriptorMap& _inverted)
+ : inverted(_inverted) {}
+
+
+ /// The value type of the InverseMap.
+ typedef typename DescriptorMap::Key Value;
+ /// The key type of the InverseMap.
+ typedef typename DescriptorMap::Value Key;
+
+ /// \brief Subscript operator.
+ ///
+ /// Subscript operator. It gives back the item
+ /// that the descriptor belongs to currently.
+ Value operator[](const Key& key) const {
+ return inverted(key);
+ }
+
+ /// \brief Size of the map.
+ ///
+ /// Returns the size of the map.
+ unsigned int size() const {
+ return inverted.size();
+ }
+
+ private:
+ const DescriptorMap& inverted;
+ };
+
+ /// \brief Gives back the inverse of the map.
+ ///
+ /// Gives back the inverse of the map.
+ const InverseMap inverse() const {
+ return InverseMap(*this);
+ }
+ };
+
+ /// \brief Returns the source of the given edge.
+ ///
+ /// The SourceMap gives back the source Node of the given edge.
+ /// \see TargetMap
+ /// \author Balazs Dezso
+ template <typename Graph>
+ class SourceMap {
+ public:
+
+ typedef typename Graph::Node Value;
+ typedef typename Graph::Edge Key;
+
+ /// \brief Constructor
+ ///
+ /// Constructor
+ /// \param _graph The graph that the map belongs to.
+ explicit SourceMap(const Graph& _graph) : graph(_graph) {}
+
+ /// \brief The subscript operator.
+ ///
+ /// The subscript operator.
+ /// \param edge The edge
+ /// \return The source of the edge
+ Value operator[](const Key& edge) const {
+ return graph.source(edge);
+ }
+
+ private:
+ const Graph& graph;
+ };
+
+ /// \brief Returns a \ref SourceMap class.
+ ///
+ /// This function just returns an \ref SourceMap class.
+ /// \relates SourceMap
+ template <typename Graph>
+ inline SourceMap<Graph> sourceMap(const Graph& graph) {
+ return SourceMap<Graph>(graph);
+ }
+
+ /// \brief Returns the target of the given edge.
+ ///
+ /// The TargetMap gives back the target Node of the given edge.
+ /// \see SourceMap
+ /// \author Balazs Dezso
+ template <typename Graph>
+ class TargetMap {
+ public:
+
+ typedef typename Graph::Node Value;
+ typedef typename Graph::Edge Key;
+
+ /// \brief Constructor
+ ///
+ /// Constructor
+ /// \param _graph The graph that the map belongs to.
+ explicit TargetMap(const Graph& _graph) : graph(_graph) {}
+
+ /// \brief The subscript operator.
+ ///
+ /// The subscript operator.
+ /// \param e The edge
+ /// \return The target of the edge
+ Value operator[](const Key& e) const {
+ return graph.target(e);
+ }
+
+ private:
+ const Graph& graph;
+ };
+
+ /// \brief Returns a \ref TargetMap class.
+ ///
+ /// This function just returns a \ref TargetMap class.
+ /// \relates TargetMap
+ template <typename Graph>
+ inline TargetMap<Graph> targetMap(const Graph& graph) {
+ return TargetMap<Graph>(graph);
+ }
+
+ /// \brief Returns the "forward" directed edge view of an undirected edge.
+ ///
+ /// Returns the "forward" directed edge view of an undirected edge.
+ /// \see BackwardMap
+ /// \author Balazs Dezso
+ template <typename Graph>
+ class ForwardMap {
+ public:
+
+ typedef typename Graph::Edge Value;
+ typedef typename Graph::UEdge Key;
+
+ /// \brief Constructor
+ ///
+ /// Constructor
+ /// \param _graph The graph that the map belongs to.
+ explicit ForwardMap(const Graph& _graph) : graph(_graph) {}
+
+ /// \brief The subscript operator.
+ ///
+ /// The subscript operator.
+ /// \param key An undirected edge
+ /// \return The "forward" directed edge view of undirected edge
+ Value operator[](const Key& key) const {
+ return graph.direct(key, true);
+ }
+
+ private:
+ const Graph& graph;
+ };
+
+ /// \brief Returns a \ref ForwardMap class.
+ ///
+ /// This function just returns an \ref ForwardMap class.
+ /// \relates ForwardMap
+ template <typename Graph>
+ inline ForwardMap<Graph> forwardMap(const Graph& graph) {
+ return ForwardMap<Graph>(graph);
+ }
+
+ /// \brief Returns the "backward" directed edge view of an undirected edge.
+ ///
+ /// Returns the "backward" directed edge view of an undirected edge.
+ /// \see ForwardMap
+ /// \author Balazs Dezso
+ template <typename Graph>
+ class BackwardMap {
+ public:
+
+ typedef typename Graph::Edge Value;
+ typedef typename Graph::UEdge Key;
+
+ /// \brief Constructor
+ ///
+ /// Constructor
+ /// \param _graph The graph that the map belongs to.
+ explicit BackwardMap(const Graph& _graph) : graph(_graph) {}
+
+ /// \brief The subscript operator.
+ ///
+ /// The subscript operator.
+ /// \param key An undirected edge
+ /// \return The "backward" directed edge view of undirected edge
+ Value operator[](const Key& key) const {
+ return graph.direct(key, false);
+ }
+
+ private:
+ const Graph& graph;
+ };
+
+ /// \brief Returns a \ref BackwardMap class
+
+ /// This function just returns a \ref BackwardMap class.
+ /// \relates BackwardMap
+ template <typename Graph>
+ inline BackwardMap<Graph> backwardMap(const Graph& graph) {
+ return BackwardMap<Graph>(graph);
+ }
+
+ /// \brief Potential difference map
+ ///
+ /// If there is an potential map on the nodes then we
+ /// can get an edge map as we get the substraction of the
+ /// values of the target and source.
+ template <typename Graph, typename NodeMap>
+ class PotentialDifferenceMap {
+ public:
+ typedef typename Graph::Edge Key;
+ typedef typename NodeMap::Value Value;
+
+ /// \brief Constructor
+ ///
+ /// Contructor of the map
+ explicit PotentialDifferenceMap(const Graph& _graph,
+ const NodeMap& _potential)
+ : graph(_graph), potential(_potential) {}
+
+ /// \brief Const subscription operator
+ ///
+ /// Const subscription operator
+ Value operator[](const Key& edge) const {
+ return potential[graph.target(edge)] - potential[graph.source(edge)];
+ }
+
+ private:
+ const Graph& graph;
+ const NodeMap& potential;
+ };
+
+ /// \brief Returns a PotentialDifferenceMap.
+ ///
+ /// This function just returns a PotentialDifferenceMap.
+ /// \relates PotentialDifferenceMap
+ template <typename Graph, typename NodeMap>
+ PotentialDifferenceMap<Graph, NodeMap>
+ potentialDifferenceMap(const Graph& graph, const NodeMap& potential) {
+ return PotentialDifferenceMap<Graph, NodeMap>(graph, potential);
+ }
+
+ /// \brief Map of the node in-degrees.
+ ///
+ /// This map returns the in-degree of a node. Once it is constructed,
+ /// the degrees are stored in a standard NodeMap, so each query is done
+ /// in constant time. On the other hand, the values are updated automatically
+ /// whenever the graph changes.
+ ///
+ /// \warning Besides addNode() and addEdge(), a graph structure may provide
+ /// alternative ways to modify the graph. The correct behavior of InDegMap
+ /// is not guarantied if these additional features are used. For example
+ /// the functions \ref ListGraph::changeSource() "changeSource()",
+ /// \ref ListGraph::changeTarget() "changeTarget()" and
+ /// \ref ListGraph::reverseEdge() "reverseEdge()"
+ /// of \ref ListGraph will \e not update the degree values correctly.
+ ///
+ /// \sa OutDegMap
+
+ template <typename _Graph>
+ class InDegMap
+ : protected ItemSetTraits<_Graph, typename _Graph::Edge>
+ ::ItemNotifier::ObserverBase {
+
+ public:
+
+ typedef _Graph Graph;
+ typedef int Value;
+ typedef typename Graph::Node Key;
+
+ typedef typename ItemSetTraits<_Graph, typename _Graph::Edge>
+ ::ItemNotifier::ObserverBase Parent;
+
+ private:
+
+ class AutoNodeMap : public DefaultMap<_Graph, Key, int> {
+ public:
+
+ typedef DefaultMap<_Graph, Key, int> Parent;
+ typedef typename Parent::Graph Graph;
+
+ AutoNodeMap(const Graph& graph) : Parent(graph, 0) {}
+
+ virtual void add(const Key& key) {
+ Parent::add(key);
+ Parent::set(key, 0);
+ }
+
+ virtual void add(const std::vector<Key>& keys) {
+ Parent::add(keys);
+ for (int i = 0; i < int(keys.size()); ++i) {
+ Parent::set(keys[i], 0);
+ }
+ }
+
+ virtual void build() {
+ Parent::build();
+ Key it;
+ typename Parent::Notifier* nf = Parent::notifier();
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ Parent::set(it, 0);
+ }
+ }
+ };
+
+ public:
+
+ /// \brief Constructor.
+ ///
+ /// Constructor for creating in-degree map.
+ explicit InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
+ Parent::attach(graph.notifier(typename _Graph::Edge()));
+
+ for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
+ deg[it] = countInEdges(graph, it);
+ }
+ }
+
+ /// Gives back the in-degree of a Node.
+ int operator[](const Key& key) const {
+ return deg[key];
+ }
+
+ protected:
+
+ typedef typename Graph::Edge Edge;
+
+ virtual void add(const Edge& edge) {
+ ++deg[graph.target(edge)];
+ }
+
+ virtual void add(const std::vector<Edge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ ++deg[graph.target(edges[i])];
+ }
+ }
+
+ virtual void erase(const Edge& edge) {
+ --deg[graph.target(edge)];
+ }
+
+ virtual void erase(const std::vector<Edge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ --deg[graph.target(edges[i])];
+ }
+ }
+
+ virtual void build() {
+ for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
+ deg[it] = countInEdges(graph, it);
+ }
+ }
+
+ virtual void clear() {
+ for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
+ deg[it] = 0;
+ }
+ }
+ private:
+
+ const _Graph& graph;
+ AutoNodeMap deg;
+ };
+
+ /// \brief Map of the node out-degrees.
+ ///
+ /// This map returns the out-degree of a node. Once it is constructed,
+ /// the degrees are stored in a standard NodeMap, so each query is done
+ /// in constant time. On the other hand, the values are updated automatically
+ /// whenever the graph changes.
+ ///
+ /// \warning Besides addNode() and addEdge(), a graph structure may provide
+ /// alternative ways to modify the graph. The correct behavior of OutDegMap
+ /// is not guarantied if these additional features are used. For example
+ /// the functions \ref ListGraph::changeSource() "changeSource()",
+ /// \ref ListGraph::changeTarget() "changeTarget()" and
+ /// \ref ListGraph::reverseEdge() "reverseEdge()"
+ /// of \ref ListGraph will \e not update the degree values correctly.
+ ///
+ /// \sa InDegMap
+
+ template <typename _Graph>
+ class OutDegMap
+ : protected ItemSetTraits<_Graph, typename _Graph::Edge>
+ ::ItemNotifier::ObserverBase {
+
+ public:
+
+ typedef typename ItemSetTraits<_Graph, typename _Graph::Edge>
+ ::ItemNotifier::ObserverBase Parent;
+
+ typedef _Graph Graph;
+ typedef int Value;
+ typedef typename Graph::Node Key;
+
+ private:
+
+ class AutoNodeMap : public DefaultMap<_Graph, Key, int> {
+ public:
+
+ typedef DefaultMap<_Graph, Key, int> Parent;
+ typedef typename Parent::Graph Graph;
+
+ AutoNodeMap(const Graph& graph) : Parent(graph, 0) {}
+
+ virtual void add(const Key& key) {
+ Parent::add(key);
+ Parent::set(key, 0);
+ }
+ virtual void add(const std::vector<Key>& keys) {
+ Parent::add(keys);
+ for (int i = 0; i < int(keys.size()); ++i) {
+ Parent::set(keys[i], 0);
+ }
+ }
+ virtual void build() {
+ Parent::build();
+ Key it;
+ typename Parent::Notifier* nf = Parent::notifier();
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ Parent::set(it, 0);
+ }
+ }
+ };
+
+ public:
+
+ /// \brief Constructor.
+ ///
+ /// Constructor for creating out-degree map.
+ explicit OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
+ Parent::attach(graph.notifier(typename _Graph::Edge()));
+
+ for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
+ deg[it] = countOutEdges(graph, it);
+ }
+ }
+
+ /// Gives back the out-degree of a Node.
+ int operator[](const Key& key) const {
+ return deg[key];
+ }
+
+ protected:
+
+ typedef typename Graph::Edge Edge;
+
+ virtual void add(const Edge& edge) {
+ ++deg[graph.source(edge)];
+ }
+
+ virtual void add(const std::vector<Edge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ ++deg[graph.source(edges[i])];
+ }
+ }
+
+ virtual void erase(const Edge& edge) {
+ --deg[graph.source(edge)];
+ }
+
+ virtual void erase(const std::vector<Edge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ --deg[graph.source(edges[i])];
+ }
+ }
+
+ virtual void build() {
+ for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
+ deg[it] = countOutEdges(graph, it);
+ }
+ }
+
+ virtual void clear() {
+ for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) {
+ deg[it] = 0;
+ }
+ }
+ private:
+
+ const _Graph& graph;
+ AutoNodeMap deg;
+ };
+
+
+ ///Dynamic edge look up between given endpoints.
+
+ ///\ingroup gutils
+ ///Using this class, you can find an edge in a graph from a given
+ ///source to a given target in amortized time <em>O(log d)</em>,
+ ///where <em>d</em> is the out-degree of the source node.
+ ///
+ ///It is possible to find \e all parallel edges between two nodes with
+ ///the \c findFirst() and \c findNext() members.
+ ///
+ ///See the \ref EdgeLookUp and \ref AllEdgeLookUp classes if your
+ ///graph do not changed so frequently.
+ ///
+ ///This class uses a self-adjusting binary search tree, Sleator's
+ ///and Tarjan's Splay tree for guarantee the logarithmic amortized
+ ///time bound for edge lookups. This class also guarantees the
+ ///optimal time bound in a constant factor for any distribution of
+ ///queries.
+ ///
+ ///\param G The type of the underlying graph.
+ ///
+ ///\sa EdgeLookUp
+ ///\sa AllEdgeLookUp
+ template<class G>
+ class DynEdgeLookUp
+ : protected ItemSetTraits<G, typename G::Edge>::ItemNotifier::ObserverBase
+ {
+ public:
+ typedef typename ItemSetTraits<G, typename G::Edge>
+ ::ItemNotifier::ObserverBase Parent;
+
+ GRAPH_TYPEDEFS(typename G);
+ typedef G Graph;
+
+ protected:
+
+ class AutoNodeMap : public DefaultMap<G, Node, Edge> {
+ public:
+
+ typedef DefaultMap<G, Node, Edge> Parent;
+
+ AutoNodeMap(const G& graph) : Parent(graph, INVALID) {}
+
+ virtual void add(const Node& node) {
+ Parent::add(node);
+ Parent::set(node, INVALID);
+ }
+
+ virtual void add(const std::vector<Node>& nodes) {
+ Parent::add(nodes);
+ for (int i = 0; i < int(nodes.size()); ++i) {
+ Parent::set(nodes[i], INVALID);
+ }
+ }
+
+ virtual void build() {
+ Parent::build();
+ Node it;
+ typename Parent::Notifier* nf = Parent::notifier();
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ Parent::set(it, INVALID);
+ }
+ }
+ };
+
+ const Graph &_g;
+ AutoNodeMap _head;
+ typename Graph::template EdgeMap<Edge> _parent;
+ typename Graph::template EdgeMap<Edge> _left;
+ typename Graph::template EdgeMap<Edge> _right;
+
+ class EdgeLess {
+ const Graph &g;
+ public:
+ EdgeLess(const Graph &_g) : g(_g) {}
+ bool operator()(Edge a,Edge b) const
+ {
+ return g.target(a)<g.target(b);
+ }
+ };
+
+ public:
+
+ ///Constructor
+
+ ///Constructor.
+ ///
+ ///It builds up the search database.
+ DynEdgeLookUp(const Graph &g)
+ : _g(g),_head(g),_parent(g),_left(g),_right(g)
+ {
+ Parent::attach(_g.notifier(typename Graph::Edge()));
+ refresh();
+ }
+
+ protected:
+
+ virtual void add(const Edge& edge) {
+ insert(edge);
+ }
+
+ virtual void add(const std::vector<Edge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ insert(edges[i]);
+ }
+ }
+
+ virtual void erase(const Edge& edge) {
+ remove(edge);
+ }
+
+ virtual void erase(const std::vector<Edge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ remove(edges[i]);
+ }
+ }
+
+ virtual void build() {
+ refresh();
+ }
+
+ virtual void clear() {
+ for(NodeIt n(_g);n!=INVALID;++n) {
+ _head.set(n, INVALID);
+ }
+ }
+
+ void insert(Edge edge) {
+ Node s = _g.source(edge);
+ Node t = _g.target(edge);
+ _left.set(edge, INVALID);
+ _right.set(edge, INVALID);
+
+ Edge e = _head[s];
+ if (e == INVALID) {
+ _head.set(s, edge);
+ _parent.set(edge, INVALID);
+ return;
+ }
+ while (true) {
+ if (t < _g.target(e)) {
+ if (_left[e] == INVALID) {
+ _left.set(e, edge);
+ _parent.set(edge, e);
+ splay(edge);
+ return;
+ } else {
+ e = _left[e];
+ }
+ } else {
+ if (_right[e] == INVALID) {
+ _right.set(e, edge);
+ _parent.set(edge, e);
+ splay(edge);
+ return;
+ } else {
+ e = _right[e];
+ }
+ }
+ }
+ }
+
+ void remove(Edge edge) {
+ if (_left[edge] == INVALID) {
+ if (_right[edge] != INVALID) {
+ _parent.set(_right[edge], _parent[edge]);
+ }
+ if (_parent[edge] != INVALID) {
+ if (_left[_parent[edge]] == edge) {
+ _left.set(_parent[edge], _right[edge]);
+ } else {
+ _right.set(_parent[edge], _right[edge]);
+ }
+ } else {
+ _head.set(_g.source(edge), _right[edge]);
+ }
+ } else if (_right[edge] == INVALID) {
+ _parent.set(_left[edge], _parent[edge]);
+ if (_parent[edge] != INVALID) {
+ if (_left[_parent[edge]] == edge) {
+ _left.set(_parent[edge], _left[edge]);
+ } else {
+ _right.set(_parent[edge], _left[edge]);
+ }
+ } else {
+ _head.set(_g.source(edge), _left[edge]);
+ }
+ } else {
+ Edge e = _left[edge];
+ if (_right[e] != INVALID) {
+ e = _right[e];
+ while (_right[e] != INVALID) {
+ e = _right[e];
+ }
+ Edge s = _parent[e];
+ _right.set(_parent[e], _left[e]);
+ if (_left[e] != INVALID) {
+ _parent.set(_left[e], _parent[e]);
+ }
+
+ _left.set(e, _left[edge]);
+ _parent.set(_left[edge], e);
+ _right.set(e, _right[edge]);
+ _parent.set(_right[edge], e);
+
+ _parent.set(e, _parent[edge]);
+ if (_parent[edge] != INVALID) {
+ if (_left[_parent[edge]] == edge) {
+ _left.set(_parent[edge], e);
+ } else {
+ _right.set(_parent[edge], e);
+ }
+ }
+ splay(s);
+ } else {
+ _right.set(e, _right[edge]);
+ _parent.set(_right[edge], e);
+
+ if (_parent[edge] != INVALID) {
+ if (_left[_parent[edge]] == edge) {
+ _left.set(_parent[edge], e);
+ } else {
+ _right.set(_parent[edge], e);
+ }
+ } else {
+ _head.set(_g.source(edge), e);
+ }
+ }
+ }
+ }
+
+ Edge refreshRec(std::vector<Edge> &v,int a,int b)
+ {
+ int m=(a+b)/2;
+ Edge me=v[m];
+ if (a < m) {
+ Edge left = refreshRec(v,a,m-1);
+ _left.set(me, left);
+ _parent.set(left, me);
+ } else {
+ _left.set(me, INVALID);
+ }
+ if (m < b) {
+ Edge right = refreshRec(v,m+1,b);
+ _right.set(me, right);
+ _parent.set(right, me);
+ } else {
+ _right.set(me, INVALID);
+ }
+ return me;
+ }
+
+ void refresh() {
+ for(NodeIt n(_g);n!=INVALID;++n) {
+ std::vector<Edge> v;
+ for(OutEdgeIt e(_g,n);e!=INVALID;++e) v.push_back(e);
+ if(v.size()) {
+ std::sort(v.begin(),v.end(),EdgeLess(_g));
+ Edge head = refreshRec(v,0,v.size()-1);
+ _head.set(n, head);
+ _parent.set(head, INVALID);
+ }
+ else _head.set(n, INVALID);
+ }
+ }
+
+ void zig(Edge v) {
+ Edge w = _parent[v];
+ _parent.set(v, _parent[w]);
+ _parent.set(w, v);
+ _left.set(w, _right[v]);
+ _right.set(v, w);
+ if (_parent[v] != INVALID) {
+ if (_right[_parent[v]] == w) {
+ _right.set(_parent[v], v);
+ } else {
+ _left.set(_parent[v], v);
+ }
+ }
+ if (_left[w] != INVALID){
+ _parent.set(_left[w], w);
+ }
+ }
+
+ void zag(Edge v) {
+ Edge w = _parent[v];
+ _parent.set(v, _parent[w]);
+ _parent.set(w, v);
+ _right.set(w, _left[v]);
+ _left.set(v, w);
+ if (_parent[v] != INVALID){
+ if (_left[_parent[v]] == w) {
+ _left.set(_parent[v], v);
+ } else {
+ _right.set(_parent[v], v);
+ }
+ }
+ if (_right[w] != INVALID){
+ _parent.set(_right[w], w);
+ }
+ }
+
+ void splay(Edge v) {
+ while (_parent[v] != INVALID) {
+ if (v == _left[_parent[v]]) {
+ if (_parent[_parent[v]] == INVALID) {
+ zig(v);
+ } else {
+ if (_parent[v] == _left[_parent[_parent[v]]]) {
+ zig(_parent[v]);
+ zig(v);
+ } else {
+ zig(v);
+ zag(v);
+ }
+ }
+ } else {
+ if (_parent[_parent[v]] == INVALID) {
+ zag(v);
+ } else {
+ if (_parent[v] == _left[_parent[_parent[v]]]) {
+ zag(v);
+ zig(v);
+ } else {
+ zag(_parent[v]);
+ zag(v);
+ }
+ }
+ }
+ }
+ _head[_g.source(v)] = v;
+ }
+
+
+ public:
+
+ ///Find an edge between two nodes.
+
+ ///Find an edge between two nodes in time <em>O(</em>log<em>d)</em>, where
+ /// <em>d</em> is the number of outgoing edges of \c s.
+ ///\param s The source node
+ ///\param t The target node
+ ///\return An edge from \c s to \c t if there exists,
+ ///\ref INVALID otherwise.
+ Edge operator()(Node s, Node t) const
+ {
+ Edge e = _head[s];
+ while (true) {
+ if (_g.target(e) == t) {
+ const_cast<DynEdgeLookUp&>(*this).splay(e);
+ return e;
+ } else if (t < _g.target(e)) {
+ if (_left[e] == INVALID) {
+ const_cast<DynEdgeLookUp&>(*this).splay(e);
+ return INVALID;
+ } else {
+ e = _left[e];
+ }
+ } else {
+ if (_right[e] == INVALID) {
+ const_cast<DynEdgeLookUp&>(*this).splay(e);
+ return INVALID;
+ } else {
+ e = _right[e];
+ }
+ }
+ }
+ }
+
+ ///Find the first edge between two nodes.
+
+ ///Find the first edge between two nodes in time
+ /// <em>O(</em>log<em>d)</em>, where <em>d</em> is the number of
+ /// outgoing edges of \c s.
+ ///\param s The source node
+ ///\param t The target node
+ ///\return An edge from \c s to \c t if there exists, \ref INVALID
+ /// otherwise.
+ Edge findFirst(Node s, Node t) const
+ {
+ Edge e = _head[s];
+ Edge r = INVALID;
+ while (true) {
+ if (_g.target(e) < t) {
+ if (_right[e] == INVALID) {
+ const_cast<DynEdgeLookUp&>(*this).splay(e);
+ return r;
+ } else {
+ e = _right[e];
+ }
+ } else {
+ if (_g.target(e) == t) {
+ r = e;
+ }
+ if (_left[e] == INVALID) {
+ const_cast<DynEdgeLookUp&>(*this).splay(e);
+ return r;
+ } else {
+ e = _left[e];
+ }
+ }
+ }
+ }
+
+ ///Find the next edge between two nodes.
+
+ ///Find the next edge between two nodes in time
+ /// <em>O(</em>log<em>d)</em>, where <em>d</em> is the number of
+ /// outgoing edges of \c s.
+ ///\param s The source node
+ ///\param t The target node
+ ///\return An edge from \c s to \c t if there exists, \ref INVALID
+ /// otherwise.
+
+ ///\note If \c e is not the result of the previous \c findFirst()
+ ///operation then the amorized time bound can not be guaranteed.
+#ifdef DOXYGEN
+ Edge findNext(Node s, Node t, Edge e) const
+#else
+ Edge findNext(Node, Node t, Edge e) const
+#endif
+ {
+ if (_right[e] != INVALID) {
+ e = _right[e];
+ while (_left[e] != INVALID) {
+ e = _left[e];
+ }
+ const_cast<DynEdgeLookUp&>(*this).splay(e);
+ } else {
+ while (_parent[e] != INVALID && _right[_parent[e]] == e) {
+ e = _parent[e];
+ }
+ if (_parent[e] == INVALID) {
+ return INVALID;
+ } else {
+ e = _parent[e];
+ const_cast<DynEdgeLookUp&>(*this).splay(e);
+ }
+ }
+ if (_g.target(e) == t) return e;
+ else return INVALID;
+ }
+
+ };
+
+ ///Fast edge look up between given endpoints.
+
+ ///\ingroup gutils
+ ///Using this class, you can find an edge in a graph from a given
+ ///source to a given target in time <em>O(log d)</em>,
+ ///where <em>d</em> is the out-degree of the source node.
+ ///
+ ///It is not possible to find \e all parallel edges between two nodes.
+ ///Use \ref AllEdgeLookUp for this purpose.
+ ///
+ ///\warning This class is static, so you should refresh() (or at least
+ ///refresh(Node)) this data structure
+ ///whenever the graph changes. This is a time consuming (superlinearly
+ ///proportional (<em>O(m</em>log<em>m)</em>) to the number of edges).
+ ///
+ ///\param G The type of the underlying graph.
+ ///
+ ///\sa DynEdgeLookUp
+ ///\sa AllEdgeLookUp
+ template<class G>
+ class EdgeLookUp
+ {
+ public:
+ GRAPH_TYPEDEFS(typename G);
+ typedef G Graph;
+
+ protected:
+ const Graph &_g;
+ typename Graph::template NodeMap<Edge> _head;
+ typename Graph::template EdgeMap<Edge> _left;
+ typename Graph::template EdgeMap<Edge> _right;
+
+ class EdgeLess {
+ const Graph &g;
+ public:
+ EdgeLess(const Graph &_g) : g(_g) {}
+ bool operator()(Edge a,Edge b) const
+ {
+ return g.target(a)<g.target(b);
+ }
+ };
+
+ public:
+
+ ///Constructor
+
+ ///Constructor.
+ ///
+ ///It builds up the search database, which remains valid until the graph
+ ///changes.
+ EdgeLookUp(const Graph &g) :_g(g),_head(g),_left(g),_right(g) {refresh();}
+
+ private:
+ Edge refreshRec(std::vector<Edge> &v,int a,int b)
+ {
+ int m=(a+b)/2;
+ Edge me=v[m];
+ _left[me] = a<m?refreshRec(v,a,m-1):INVALID;
+ _right[me] = m<b?refreshRec(v,m+1,b):INVALID;
+ return me;
+ }
+ public:
+ ///Refresh the data structure at a node.
+
+ ///Build up the search database of node \c n.
+ ///
+ ///It runs in time <em>O(d</em>log<em>d)</em>, where <em>d</em> is
+ ///the number of the outgoing edges of \c n.
+ void refresh(Node n)
+ {
+ std::vector<Edge> v;
+ for(OutEdgeIt e(_g,n);e!=INVALID;++e) v.push_back(e);
+ if(v.size()) {
+ std::sort(v.begin(),v.end(),EdgeLess(_g));
+ _head[n]=refreshRec(v,0,v.size()-1);
+ }
+ else _head[n]=INVALID;
+ }
+ ///Refresh the full data structure.
+
+ ///Build up the full search database. In fact, it simply calls
+ ///\ref refresh(Node) "refresh(n)" for each node \c n.
+ ///
+ ///It runs in time <em>O(m</em>log<em>D)</em>, where <em>m</em> is
+ ///the number of the edges of \c n and <em>D</em> is the maximum
+ ///out-degree of the graph.
+
+ void refresh()
+ {
+ for(NodeIt n(_g);n!=INVALID;++n) refresh(n);
+ }
+
+ ///Find an edge between two nodes.
+
+ ///Find an edge between two nodes in time <em>O(</em>log<em>d)</em>, where
+ /// <em>d</em> is the number of outgoing edges of \c s.
+ ///\param s The source node
+ ///\param t The target node
+ ///\return An edge from \c s to \c t if there exists,
+ ///\ref INVALID otherwise.
+ ///
+ ///\warning If you change the graph, refresh() must be called before using
+ ///this operator. If you change the outgoing edges of
+ ///a single node \c n, then
+ ///\ref refresh(Node) "refresh(n)" is enough.
+ ///
+ Edge operator()(Node s, Node t) const
+ {
+ Edge e;
+ for(e=_head[s];
+ e!=INVALID&&_g.target(e)!=t;
+ e = t < _g.target(e)?_left[e]:_right[e]) ;
+ return e;
+ }
+
+ };
+
+ ///Fast look up of all edges between given endpoints.
+
+ ///\ingroup gutils
+ ///This class is the same as \ref EdgeLookUp, with the addition
+ ///that it makes it possible to find all edges between given endpoints.
+ ///
+ ///\warning This class is static, so you should refresh() (or at least
+ ///refresh(Node)) this data structure
+ ///whenever the graph changes. This is a time consuming (superlinearly
+ ///proportional (<em>O(m</em>log<em>m)</em>) to the number of edges).
+ ///
+ ///\param G The type of the underlying graph.
+ ///
+ ///\sa DynEdgeLookUp
+ ///\sa EdgeLookUp
+ template<class G>
+ class AllEdgeLookUp : public EdgeLookUp<G>
+ {
+ using EdgeLookUp<G>::_g;
+ using EdgeLookUp<G>::_right;
+ using EdgeLookUp<G>::_left;
+ using EdgeLookUp<G>::_head;
+
+ GRAPH_TYPEDEFS(typename G);
+ typedef G Graph;
+
+ typename Graph::template EdgeMap<Edge> _next;
+
+ Edge refreshNext(Edge head,Edge next=INVALID)
+ {
+ if(head==INVALID) return next;
+ else {
+ next=refreshNext(_right[head],next);
+// _next[head]=next;
+ _next[head]=( next!=INVALID && _g.target(next)==_g.target(head))
+ ? next : INVALID;
+ return refreshNext(_left[head],head);
+ }
+ }
+
+ void refreshNext()
+ {
+ for(NodeIt n(_g);n!=INVALID;++n) refreshNext(_head[n]);
+ }
+
+ public:
+ ///Constructor
+
+ ///Constructor.
+ ///
+ ///It builds up the search database, which remains valid until the graph
+ ///changes.
+ AllEdgeLookUp(const Graph &g) : EdgeLookUp<G>(g), _next(g) {refreshNext();}
+
+ ///Refresh the data structure at a node.
+
+ ///Build up the search database of node \c n.
+ ///
+ ///It runs in time <em>O(d</em>log<em>d)</em>, where <em>d</em> is
+ ///the number of the outgoing edges of \c n.
+
+ void refresh(Node n)
+ {
+ EdgeLookUp<G>::refresh(n);
+ refreshNext(_head[n]);
+ }
+
+ ///Refresh the full data structure.
+
+ ///Build up the full search database. In fact, it simply calls
+ ///\ref refresh(Node) "refresh(n)" for each node \c n.
+ ///
+ ///It runs in time <em>O(m</em>log<em>D)</em>, where <em>m</em> is
+ ///the number of the edges of \c n and <em>D</em> is the maximum
+ ///out-degree of the graph.
+
+ void refresh()
+ {
+ for(NodeIt n(_g);n!=INVALID;++n) refresh(_head[n]);
+ }
+
+ ///Find an edge between two nodes.
+
+ ///Find an edge between two nodes.
+ ///\param s The source node
+ ///\param t The target node
+ ///\param prev The previous edge between \c s and \c t. It it is INVALID or
+ ///not given, the operator finds the first appropriate edge.
+ ///\return An edge from \c s to \c t after \c prev or
+ ///\ref INVALID if there is no more.
+ ///
+ ///For example, you can count the number of edges from \c u to \c v in the
+ ///following way.
+ ///\code
+ ///AllEdgeLookUp<ListGraph> ae(g);
+ ///...
+ ///int n=0;
+ ///for(Edge e=ae(u,v);e!=INVALID;e=ae(u,v,e)) n++;
+ ///\endcode
+ ///
+ ///Finding the first edge take <em>O(</em>log<em>d)</em> time, where
+ /// <em>d</em> is the number of outgoing edges of \c s. Then, the
+ ///consecutive edges are found in constant time.
+ ///
+ ///\warning If you change the graph, refresh() must be called before using
+ ///this operator. If you change the outgoing edges of
+ ///a single node \c n, then
+ ///\ref refresh(Node) "refresh(n)" is enough.
+ ///
+#ifdef DOXYGEN
+ Edge operator()(Node s, Node t, Edge prev=INVALID) const {}
+#else
+ using EdgeLookUp<G>::operator() ;
+ Edge operator()(Node s, Node t, Edge prev) const
+ {
+ return prev==INVALID?(*this)(s,t):_next[prev];
+ }
+#endif
+
+ };
+
+ /// @}
+
+} //END OF NAMESPACE LEMON
+
+#endif
diff --git a/src/lemon/list_graph.h b/src/lemon/list_graph.h
new file mode 100644
index 0000000..86d033a
--- /dev/null
+++ b/src/lemon/list_graph.h
@@ -0,0 +1,2249 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_LIST_GRAPH_H
+#define LEMON_LIST_GRAPH_H
+
+///\ingroup graphs
+///\file
+///\brief ListGraph, ListUGraph classes.
+
+#include <lemon/bits/base_extender.h>
+#include <lemon/bits/graph_extender.h>
+
+#include <lemon/error.h>
+
+#include <vector>
+#include <list>
+
+namespace lemon {
+
+ class ListGraphBase {
+
+ protected:
+ struct NodeT {
+ int first_in, first_out;
+ int prev, next;
+ };
+
+ struct EdgeT {
+ int target, source;
+ int prev_in, prev_out;
+ int next_in, next_out;
+ };
+
+ std::vector<NodeT> nodes;
+
+ int first_node;
+
+ int first_free_node;
+
+ std::vector<EdgeT> edges;
+
+ int first_free_edge;
+
+ public:
+
+ typedef ListGraphBase Graph;
+
+ class Node {
+ friend class ListGraphBase;
+ protected:
+
+ int id;
+ explicit Node(int pid) { id = pid;}
+
+ public:
+ Node() {}
+ Node (Invalid) { id = -1; }
+ bool operator==(const Node& node) const {return id == node.id;}
+ bool operator!=(const Node& node) const {return id != node.id;}
+ bool operator<(const Node& node) const {return id < node.id;}
+ };
+
+ class Edge {
+ friend class ListGraphBase;
+ protected:
+
+ int id;
+ explicit Edge(int pid) { id = pid;}
+
+ public:
+ Edge() {}
+ Edge (Invalid) { id = -1; }
+ bool operator==(const Edge& edge) const {return id == edge.id;}
+ bool operator!=(const Edge& edge) const {return id != edge.id;}
+ bool operator<(const Edge& edge) const {return id < edge.id;}
+ };
+
+
+
+ ListGraphBase()
+ : nodes(), first_node(-1),
+ first_free_node(-1), edges(), first_free_edge(-1) {}
+
+
+ int maxNodeId() const { return nodes.size()-1; }
+ int maxEdgeId() const { return edges.size()-1; }
+
+ Node source(Edge e) const { return Node(edges[e.id].source); }
+ Node target(Edge e) const { return Node(edges[e.id].target); }
+
+
+ void first(Node& node) const {
+ node.id = first_node;
+ }
+
+ void next(Node& node) const {
+ node.id = nodes[node.id].next;
+ }
+
+
+ void first(Edge& e) const {
+ int n;
+ for(n = first_node;
+ n!=-1 && nodes[n].first_in == -1;
+ n = nodes[n].next);
+ e.id = (n == -1) ? -1 : nodes[n].first_in;
+ }
+
+ void next(Edge& edge) const {
+ if (edges[edge.id].next_in != -1) {
+ edge.id = edges[edge.id].next_in;
+ } else {
+ int n;
+ for(n = nodes[edges[edge.id].target].next;
+ n!=-1 && nodes[n].first_in == -1;
+ n = nodes[n].next);
+ edge.id = (n == -1) ? -1 : nodes[n].first_in;
+ }
+ }
+
+ void firstOut(Edge &e, const Node& v) const {
+ e.id = nodes[v.id].first_out;
+ }
+ void nextOut(Edge &e) const {
+ e.id=edges[e.id].next_out;
+ }
+
+ void firstIn(Edge &e, const Node& v) const {
+ e.id = nodes[v.id].first_in;
+ }
+ void nextIn(Edge &e) const {
+ e.id=edges[e.id].next_in;
+ }
+
+
+ static int id(Node v) { return v.id; }
+ static int id(Edge e) { return e.id; }
+
+ static Node nodeFromId(int id) { return Node(id);}
+ static Edge edgeFromId(int id) { return Edge(id);}
+
+ Node addNode() {
+ int n;
+
+ if(first_free_node==-1) {
+ n = nodes.size();
+ nodes.push_back(NodeT());
+ } else {
+ n = first_free_node;
+ first_free_node = nodes[n].next;
+ }
+
+ nodes[n].next = first_node;
+ if(first_node != -1) nodes[first_node].prev = n;
+ first_node = n;
+ nodes[n].prev = -1;
+
+ nodes[n].first_in = nodes[n].first_out = -1;
+
+ return Node(n);
+ }
+
+ Edge addEdge(Node u, Node v) {
+ int n;
+
+ if (first_free_edge == -1) {
+ n = edges.size();
+ edges.push_back(EdgeT());
+ } else {
+ n = first_free_edge;
+ first_free_edge = edges[n].next_in;
+ }
+
+ edges[n].source = u.id;
+ edges[n].target = v.id;
+
+ edges[n].next_out = nodes[u.id].first_out;
+ if(nodes[u.id].first_out != -1) {
+ edges[nodes[u.id].first_out].prev_out = n;
+ }
+
+ edges[n].next_in = nodes[v.id].first_in;
+ if(nodes[v.id].first_in != -1) {
+ edges[nodes[v.id].first_in].prev_in = n;
+ }
+
+ edges[n].prev_in = edges[n].prev_out = -1;
+
+ nodes[u.id].first_out = nodes[v.id].first_in = n;
+
+ return Edge(n);
+ }
+
+ void erase(const Node& node) {
+ int n = node.id;
+
+ if(nodes[n].next != -1) {
+ nodes[nodes[n].next].prev = nodes[n].prev;
+ }
+
+ if(nodes[n].prev != -1) {
+ nodes[nodes[n].prev].next = nodes[n].next;
+ } else {
+ first_node = nodes[n].next;
+ }
+
+ nodes[n].next = first_free_node;
+ first_free_node = n;
+
+ }
+
+ void erase(const Edge& edge) {
+ int n = edge.id;
+
+ if(edges[n].next_in!=-1) {
+ edges[edges[n].next_in].prev_in = edges[n].prev_in;
+ }
+
+ if(edges[n].prev_in!=-1) {
+ edges[edges[n].prev_in].next_in = edges[n].next_in;
+ } else {
+ nodes[edges[n].target].first_in = edges[n].next_in;
+ }
+
+
+ if(edges[n].next_out!=-1) {
+ edges[edges[n].next_out].prev_out = edges[n].prev_out;
+ }
+
+ if(edges[n].prev_out!=-1) {
+ edges[edges[n].prev_out].next_out = edges[n].next_out;
+ } else {
+ nodes[edges[n].source].first_out = edges[n].next_out;
+ }
+
+ edges[n].next_in = first_free_edge;
+ first_free_edge = n;
+
+ }
+
+ void clear() {
+ edges.clear();
+ nodes.clear();
+ first_node = first_free_node = first_free_edge = -1;
+ }
+
+ protected:
+ void changeTarget(Edge e, Node n)
+ {
+ if(edges[e.id].next_in != -1)
+ edges[edges[e.id].next_in].prev_in = edges[e.id].prev_in;
+ if(edges[e.id].prev_in != -1)
+ edges[edges[e.id].prev_in].next_in = edges[e.id].next_in;
+ else nodes[edges[e.id].target].first_in = edges[e.id].next_in;
+ if (nodes[n.id].first_in != -1) {
+ edges[nodes[n.id].first_in].prev_in = e.id;
+ }
+ edges[e.id].target = n.id;
+ edges[e.id].prev_in = -1;
+ edges[e.id].next_in = nodes[n.id].first_in;
+ nodes[n.id].first_in = e.id;
+ }
+ void changeSource(Edge e, Node n)
+ {
+ if(edges[e.id].next_out != -1)
+ edges[edges[e.id].next_out].prev_out = edges[e.id].prev_out;
+ if(edges[e.id].prev_out != -1)
+ edges[edges[e.id].prev_out].next_out = edges[e.id].next_out;
+ else nodes[edges[e.id].source].first_out = edges[e.id].next_out;
+ if (nodes[n.id].first_out != -1) {
+ edges[nodes[n.id].first_out].prev_out = e.id;
+ }
+ edges[e.id].source = n.id;
+ edges[e.id].prev_out = -1;
+ edges[e.id].next_out = nodes[n.id].first_out;
+ nodes[n.id].first_out = e.id;
+ }
+
+ };
+
+ typedef GraphExtender<ListGraphBase> ExtendedListGraphBase;
+
+ /// \addtogroup graphs
+ /// @{
+
+ ///A list graph class.
+
+ ///This is a simple and fast graph implementation.
+ ///
+ ///It conforms to the \ref concepts::Graph "Graph concept" and it
+ ///also provides several additional useful extra functionalities.
+ ///The most of the member functions and nested classes are
+ ///documented only in the concept class.
+ ///
+ ///An important extra feature of this graph implementation is that
+ ///its maps are real \ref concepts::ReferenceMap "reference map"s.
+ ///
+ ///\sa concepts::Graph.
+
+ class ListGraph : public ExtendedListGraphBase {
+ private:
+ ///ListGraph is \e not copy constructible. Use GraphCopy() instead.
+
+ ///ListGraph is \e not copy constructible. Use GraphCopy() instead.
+ ///
+ ListGraph(const ListGraph &) :ExtendedListGraphBase() {};
+ ///\brief Assignment of ListGraph to another one is \e not allowed.
+ ///Use GraphCopy() instead.
+
+ ///Assignment of ListGraph to another one is \e not allowed.
+ ///Use GraphCopy() instead.
+ void operator=(const ListGraph &) {}
+ public:
+
+ typedef ExtendedListGraphBase Parent;
+
+ /// Constructor
+
+ /// Constructor.
+ ///
+ ListGraph() {}
+
+ ///Add a new node to the graph.
+
+ /// \return the new node.
+ ///
+ Node addNode() { return Parent::addNode(); }
+
+ ///Add a new edge to the graph.
+
+ ///Add a new edge to the graph with source node \c s
+ ///and target node \c t.
+ ///\return the new edge.
+ Edge addEdge(const Node& s, const Node& t) {
+ return Parent::addEdge(s, t);
+ }
+
+ /// Changes the target of \c e to \c n
+
+ /// Changes the target of \c e to \c n
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>OutEdgeIt</tt>s referencing
+ ///the changed edge remain valid. However <tt>InEdgeIt</tt>s are
+ ///invalidated.
+ ///\warning This functionality cannot be used together with the Snapshot
+ ///feature.
+ void changeTarget(Edge e, Node n) {
+ Parent::changeTarget(e,n);
+ }
+ /// Changes the source of \c e to \c n
+
+ /// Changes the source of \c e to \c n
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>InEdgeIt</tt>s referencing
+ ///the changed edge remain valid. However <tt>OutEdgeIt</tt>s are
+ ///invalidated.
+ ///\warning This functionality cannot be used together with the Snapshot
+ ///feature.
+ void changeSource(Edge e, Node n) {
+ Parent::changeSource(e,n);
+ }
+
+ /// Invert the direction of an edge.
+
+ ///\note The <tt>EdgeIt</tt>s referencing the changed edge remain
+ ///valid. However <tt>OutEdgeIt</tt>s and <tt>InEdgeIt</tt>s are
+ ///invalidated.
+ ///\warning This functionality cannot be used together with the Snapshot
+ ///feature.
+ void reverseEdge(Edge e) {
+ Node t=target(e);
+ changeTarget(e,source(e));
+ changeSource(e,t);
+ }
+
+ /// Using this it is possible to avoid the superfluous memory
+ /// allocation: if you know that the graph you want to build will
+ /// be very large (e.g. it will contain millions of nodes and/or edges)
+ /// then it is worth reserving space for this amount before starting
+ /// to build the graph.
+ /// \sa reserveEdge
+ void reserveNode(int n) { nodes.reserve(n); };
+
+ /// \brief Using this it is possible to avoid the superfluous memory
+ /// allocation.
+
+ /// Using this it is possible to avoid the superfluous memory
+ /// allocation: if you know that the graph you want to build will
+ /// be very large (e.g. it will contain millions of nodes and/or edges)
+ /// then it is worth reserving space for this amount before starting
+ /// to build the graph.
+ /// \sa reserveNode
+ void reserveEdge(int m) { edges.reserve(m); };
+
+ ///Contract two nodes.
+
+ ///This function contracts two nodes.
+ ///
+ ///Node \p b will be removed but instead of deleting
+ ///incident edges, they will be joined to \p a.
+ ///The last parameter \p r controls whether to remove loops. \c true
+ ///means that loops will be removed.
+ ///
+ ///\note The <tt>EdgeIt</tt>s
+ ///referencing a moved edge remain
+ ///valid. However <tt>InEdgeIt</tt>s and <tt>OutEdgeIt</tt>s
+ ///may be invalidated.
+ ///\warning This functionality cannot be used together with the Snapshot
+ ///feature.
+ void contract(Node a, Node b, bool r = true)
+ {
+ for(OutEdgeIt e(*this,b);e!=INVALID;) {
+ OutEdgeIt f=e;
+ ++f;
+ if(r && target(e)==a) erase(e);
+ else changeSource(e,a);
+ e=f;
+ }
+ for(InEdgeIt e(*this,b);e!=INVALID;) {
+ InEdgeIt f=e;
+ ++f;
+ if(r && source(e)==a) erase(e);
+ else changeTarget(e,a);
+ e=f;
+ }
+ erase(b);
+ }
+
+ ///Split a node.
+
+ ///This function splits a node. First a new node is added to the graph,
+ ///then the source of each outgoing edge of \c n is moved to this new node.
+ ///If \c connect is \c true (this is the default value), then a new edge
+ ///from \c n to the newly created node is also added.
+ ///\return The newly created node.
+ ///
+ ///\note The <tt>EdgeIt</tt>s referencing a moved edge remain
+ ///valid. However <tt>InEdgeIt</tt>s and <tt>OutEdgeIt</tt>s may
+ ///be invalidated.
+ ///
+ ///\warning This functionality cannot be used together with the
+ ///Snapshot feature. \todo It could be implemented in a bit
+ ///faster way.
+ Node split(Node n, bool connect = true) {
+ Node b = addNode();
+ for(OutEdgeIt e(*this,n);e!=INVALID;) {
+ OutEdgeIt f=e;
+ ++f;
+ changeSource(e,b);
+ e=f;
+ }
+ if (connect) addEdge(n,b);
+ return b;
+ }
+
+ ///Split an edge.
+
+ ///This function splits an edge. First a new node \c b is added to
+ ///the graph, then the original edge is re-targeted to \c
+ ///b. Finally an edge from \c b to the original target is added.
+ ///\return The newly created node.
+ ///\warning This functionality
+ ///cannot be used together with the Snapshot feature.
+ Node split(Edge e) {
+ Node b = addNode();
+ addEdge(b,target(e));
+ changeTarget(e,b);
+ return b;
+ }
+
+ /// \brief Class to make a snapshot of the graph and restore
+ /// to it later.
+ ///
+ /// Class to make a snapshot of the graph and to restore it
+ /// later.
+ ///
+ /// The newly added nodes and edges can be removed using the
+ /// restore() function.
+ ///
+ /// \warning Edge and node deletions cannot be restored. This
+ /// events invalidate the snapshot.
+ class Snapshot {
+ protected:
+
+ typedef Parent::NodeNotifier NodeNotifier;
+
+ class NodeObserverProxy : public NodeNotifier::ObserverBase {
+ public:
+
+ NodeObserverProxy(Snapshot& _snapshot)
+ : snapshot(_snapshot) {}
+
+ using NodeNotifier::ObserverBase::attach;
+ using NodeNotifier::ObserverBase::detach;
+ using NodeNotifier::ObserverBase::attached;
+
+ protected:
+
+ virtual void add(const Node& node) {
+ snapshot.addNode(node);
+ }
+ virtual void add(const std::vector<Node>& nodes) {
+ for (int i = nodes.size() - 1; i >= 0; ++i) {
+ snapshot.addNode(nodes[i]);
+ }
+ }
+ virtual void erase(const Node& node) {
+ snapshot.eraseNode(node);
+ }
+ virtual void erase(const std::vector<Node>& nodes) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
+ snapshot.eraseNode(nodes[i]);
+ }
+ }
+ virtual void build() {
+ Node node;
+ std::vector<Node> nodes;
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
+ nodes.push_back(node);
+ }
+ for (int i = nodes.size() - 1; i >= 0; --i) {
+ snapshot.addNode(nodes[i]);
+ }
+ }
+ virtual void clear() {
+ Node node;
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
+ snapshot.eraseNode(node);
+ }
+ }
+
+ Snapshot& snapshot;
+ };
+
+ class EdgeObserverProxy : public EdgeNotifier::ObserverBase {
+ public:
+
+ EdgeObserverProxy(Snapshot& _snapshot)
+ : snapshot(_snapshot) {}
+
+ using EdgeNotifier::ObserverBase::attach;
+ using EdgeNotifier::ObserverBase::detach;
+ using EdgeNotifier::ObserverBase::attached;
+
+ protected:
+
+ virtual void add(const Edge& edge) {
+ snapshot.addEdge(edge);
+ }
+ virtual void add(const std::vector<Edge>& edges) {
+ for (int i = edges.size() - 1; i >= 0; ++i) {
+ snapshot.addEdge(edges[i]);
+ }
+ }
+ virtual void erase(const Edge& edge) {
+ snapshot.eraseEdge(edge);
+ }
+ virtual void erase(const std::vector<Edge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ snapshot.eraseEdge(edges[i]);
+ }
+ }
+ virtual void build() {
+ Edge edge;
+ std::vector<Edge> edges;
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
+ edges.push_back(edge);
+ }
+ for (int i = edges.size() - 1; i >= 0; --i) {
+ snapshot.addEdge(edges[i]);
+ }
+ }
+ virtual void clear() {
+ Edge edge;
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
+ snapshot.eraseEdge(edge);
+ }
+ }
+
+ Snapshot& snapshot;
+ };
+
+ ListGraph *graph;
+
+ NodeObserverProxy node_observer_proxy;
+ EdgeObserverProxy edge_observer_proxy;
+
+ std::list<Node> added_nodes;
+ std::list<Edge> added_edges;
+
+
+ void addNode(const Node& node) {
+ added_nodes.push_front(node);
+ }
+ void eraseNode(const Node& node) {
+ std::list<Node>::iterator it =
+ std::find(added_nodes.begin(), added_nodes.end(), node);
+ if (it == added_nodes.end()) {
+ clear();
+ edge_observer_proxy.detach();
+ throw NodeNotifier::ImmediateDetach();
+ } else {
+ added_nodes.erase(it);
+ }
+ }
+
+ void addEdge(const Edge& edge) {
+ added_edges.push_front(edge);
+ }
+ void eraseEdge(const Edge& edge) {
+ std::list<Edge>::iterator it =
+ std::find(added_edges.begin(), added_edges.end(), edge);
+ if (it == added_edges.end()) {
+ clear();
+ node_observer_proxy.detach();
+ throw EdgeNotifier::ImmediateDetach();
+ } else {
+ added_edges.erase(it);
+ }
+ }
+
+ void attach(ListGraph &_graph) {
+ graph = &_graph;
+ node_observer_proxy.attach(graph->notifier(Node()));
+ edge_observer_proxy.attach(graph->notifier(Edge()));
+ }
+
+ void detach() {
+ node_observer_proxy.detach();
+ edge_observer_proxy.detach();
+ }
+
+ bool attached() const {
+ return node_observer_proxy.attached();
+ }
+
+ void clear() {
+ added_nodes.clear();
+ added_edges.clear();
+ }
+
+ public:
+
+ /// \brief Default constructor.
+ ///
+ /// Default constructor.
+ /// To actually make a snapshot you must call save().
+ Snapshot()
+ : graph(0), node_observer_proxy(*this),
+ edge_observer_proxy(*this) {}
+
+ /// \brief Constructor that immediately makes a snapshot.
+ ///
+ /// This constructor immediately makes a snapshot of the graph.
+ /// \param _graph The graph we make a snapshot of.
+ Snapshot(ListGraph &_graph)
+ : node_observer_proxy(*this),
+ edge_observer_proxy(*this) {
+ attach(_graph);
+ }
+
+ /// \brief Make a snapshot.
+ ///
+ /// Make a snapshot of the graph.
+ ///
+ /// This function can be called more than once. In case of a repeated
+ /// call, the previous snapshot gets lost.
+ /// \param _graph The graph we make the snapshot of.
+ void save(ListGraph &_graph) {
+ if (attached()) {
+ detach();
+ clear();
+ }
+ attach(_graph);
+ }
+
+ /// \brief Undo the changes until the last snapshot.
+ //
+ /// Undo the changes until the last snapshot created by save().
+ void restore() {
+ detach();
+ for(std::list<Edge>::iterator it = added_edges.begin();
+ it != added_edges.end(); ++it) {
+ graph->erase(*it);
+ }
+ for(std::list<Node>::iterator it = added_nodes.begin();
+ it != added_nodes.end(); ++it) {
+ graph->erase(*it);
+ }
+ clear();
+ }
+
+ /// \brief Gives back true when the snapshot is valid.
+ ///
+ /// Gives back true when the snapshot is valid.
+ bool valid() const {
+ return attached();
+ }
+ };
+
+ };
+
+ ///@}
+
+ class ListUGraphBase {
+
+ protected:
+
+ struct NodeT {
+ int first_out;
+ int prev, next;
+ };
+
+ struct EdgeT {
+ int target;
+ int prev_out, next_out;
+ };
+
+ std::vector<NodeT> nodes;
+
+ int first_node;
+
+ int first_free_node;
+
+ std::vector<EdgeT> edges;
+
+ int first_free_edge;
+
+ public:
+
+ typedef ListUGraphBase Graph;
+
+ class Node;
+ class Edge;
+ class UEdge;
+
+ class Node {
+ friend class ListUGraphBase;
+ protected:
+
+ int id;
+ explicit Node(int pid) { id = pid;}
+
+ public:
+ Node() {}
+ Node (Invalid) { id = -1; }
+ bool operator==(const Node& node) const {return id == node.id;}
+ bool operator!=(const Node& node) const {return id != node.id;}
+ bool operator<(const Node& node) const {return id < node.id;}
+ };
+
+ class UEdge {
+ friend class ListUGraphBase;
+ protected:
+
+ int id;
+ explicit UEdge(int pid) { id = pid;}
+
+ public:
+ UEdge() {}
+ UEdge (Invalid) { id = -1; }
+ bool operator==(const UEdge& edge) const {return id == edge.id;}
+ bool operator!=(const UEdge& edge) const {return id != edge.id;}
+ bool operator<(const UEdge& edge) const {return id < edge.id;}
+ };
+
+ class Edge {
+ friend class ListUGraphBase;
+ protected:
+
+ int id;
+ explicit Edge(int pid) { id = pid;}
+
+ public:
+ operator UEdge() const { return uEdgeFromId(id / 2); }
+
+ Edge() {}
+ Edge (Invalid) { id = -1; }
+ bool operator==(const Edge& edge) const {return id == edge.id;}
+ bool operator!=(const Edge& edge) const {return id != edge.id;}
+ bool operator<(const Edge& edge) const {return id < edge.id;}
+ };
+
+
+
+ ListUGraphBase()
+ : nodes(), first_node(-1),
+ first_free_node(-1), edges(), first_free_edge(-1) {}
+
+
+ int maxNodeId() const { return nodes.size()-1; }
+ int maxUEdgeId() const { return edges.size() / 2 - 1; }
+ int maxEdgeId() const { return edges.size()-1; }
+
+ Node source(Edge e) const { return Node(edges[e.id ^ 1].target); }
+ Node target(Edge e) const { return Node(edges[e.id].target); }
+
+ Node source(UEdge e) const { return Node(edges[2 * e.id].target); }
+ Node target(UEdge e) const { return Node(edges[2 * e.id + 1].target); }
+
+ static bool direction(Edge e) {
+ return (e.id & 1) == 1;
+ }
+
+ static Edge direct(UEdge e, bool d) {
+ return Edge(e.id * 2 + (d ? 1 : 0));
+ }
+
+ void first(Node& node) const {
+ node.id = first_node;
+ }
+
+ void next(Node& node) const {
+ node.id = nodes[node.id].next;
+ }
+
+ void first(Edge& e) const {
+ int n = first_node;
+ while (n != -1 && nodes[n].first_out == -1) {
+ n = nodes[n].next;
+ }
+ e.id = (n == -1) ? -1 : nodes[n].first_out;
+ }
+
+ void next(Edge& e) const {
+ if (edges[e.id].next_out != -1) {
+ e.id = edges[e.id].next_out;
+ } else {
+ int n = nodes[edges[e.id ^ 1].target].next;
+ while(n != -1 && nodes[n].first_out == -1) {
+ n = nodes[n].next;
+ }
+ e.id = (n == -1) ? -1 : nodes[n].first_out;
+ }
+ }
+
+ void first(UEdge& e) const {
+ int n = first_node;
+ while (n != -1) {
+ e.id = nodes[n].first_out;
+ while ((e.id & 1) != 1) {
+ e.id = edges[e.id].next_out;
+ }
+ if (e.id != -1) {
+ e.id /= 2;
+ return;
+ }
+ n = nodes[n].next;
+ }
+ e.id = -1;
+ }
+
+ void next(UEdge& e) const {
+ int n = edges[e.id * 2].target;
+ e.id = edges[(e.id * 2) | 1].next_out;
+ while ((e.id & 1) != 1) {
+ e.id = edges[e.id].next_out;
+ }
+ if (e.id != -1) {
+ e.id /= 2;
+ return;
+ }
+ n = nodes[n].next;
+ while (n != -1) {
+ e.id = nodes[n].first_out;
+ while ((e.id & 1) != 1) {
+ e.id = edges[e.id].next_out;
+ }
+ if (e.id != -1) {
+ e.id /= 2;
+ return;
+ }
+ n = nodes[n].next;
+ }
+ e.id = -1;
+ }
+
+ void firstOut(Edge &e, const Node& v) const {
+ e.id = nodes[v.id].first_out;
+ }
+ void nextOut(Edge &e) const {
+ e.id = edges[e.id].next_out;
+ }
+
+ void firstIn(Edge &e, const Node& v) const {
+ e.id = ((nodes[v.id].first_out) ^ 1);
+ if (e.id == -2) e.id = -1;
+ }
+ void nextIn(Edge &e) const {
+ e.id = ((edges[e.id ^ 1].next_out) ^ 1);
+ if (e.id == -2) e.id = -1;
+ }
+
+ void firstInc(UEdge &e, bool& d, const Node& v) const {
+ int de = nodes[v.id].first_out;
+ if (de != -1 ) {
+ e.id = de / 2;
+ d = ((de & 1) == 1);
+ } else {
+ e.id = -1;
+ d = true;
+ }
+ }
+ void nextInc(UEdge &e, bool& d) const {
+ int de = (edges[(e.id * 2) | (d ? 1 : 0)].next_out);
+ if (de != -1 ) {
+ e.id = de / 2;
+ d = ((de & 1) == 1);
+ } else {
+ e.id = -1;
+ d = true;
+ }
+ }
+
+ static int id(Node v) { return v.id; }
+ static int id(Edge e) { return e.id; }
+ static int id(UEdge e) { return e.id; }
+
+ static Node nodeFromId(int id) { return Node(id);}
+ static Edge edgeFromId(int id) { return Edge(id);}
+ static UEdge uEdgeFromId(int id) { return UEdge(id);}
+
+ Node addNode() {
+ int n;
+
+ if(first_free_node==-1) {
+ n = nodes.size();
+ nodes.push_back(NodeT());
+ } else {
+ n = first_free_node;
+ first_free_node = nodes[n].next;
+ }
+
+ nodes[n].next = first_node;
+ if (first_node != -1) nodes[first_node].prev = n;
+ first_node = n;
+ nodes[n].prev = -1;
+
+ nodes[n].first_out = -1;
+
+ return Node(n);
+ }
+
+ UEdge addEdge(Node u, Node v) {
+ int n;
+
+ if (first_free_edge == -1) {
+ n = edges.size();
+ edges.push_back(EdgeT());
+ edges.push_back(EdgeT());
+ } else {
+ n = first_free_edge;
+ first_free_edge = edges[n].next_out;
+ }
+
+ edges[n].target = u.id;
+ edges[n | 1].target = v.id;
+
+ edges[n].next_out = nodes[v.id].first_out;
+ if (nodes[v.id].first_out != -1) {
+ edges[nodes[v.id].first_out].prev_out = n;
+ }
+ edges[n].prev_out = -1;
+ nodes[v.id].first_out = n;
+
+ edges[n | 1].next_out = nodes[u.id].first_out;
+ if (nodes[u.id].first_out != -1) {
+ edges[nodes[u.id].first_out].prev_out = (n | 1);
+ }
+ edges[n | 1].prev_out = -1;
+ nodes[u.id].first_out = (n | 1);
+
+ return UEdge(n / 2);
+ }
+
+ void erase(const Node& node) {
+ int n = node.id;
+
+ if(nodes[n].next != -1) {
+ nodes[nodes[n].next].prev = nodes[n].prev;
+ }
+
+ if(nodes[n].prev != -1) {
+ nodes[nodes[n].prev].next = nodes[n].next;
+ } else {
+ first_node = nodes[n].next;
+ }
+
+ nodes[n].next = first_free_node;
+ first_free_node = n;
+
+ }
+
+ void erase(const UEdge& edge) {
+ int n = edge.id * 2;
+
+ if (edges[n].next_out != -1) {
+ edges[edges[n].next_out].prev_out = edges[n].prev_out;
+ }
+
+ if (edges[n].prev_out != -1) {
+ edges[edges[n].prev_out].next_out = edges[n].next_out;
+ } else {
+ nodes[edges[n | 1].target].first_out = edges[n].next_out;
+ }
+
+ if (edges[n | 1].next_out != -1) {
+ edges[edges[n | 1].next_out].prev_out = edges[n | 1].prev_out;
+ }
+
+ if (edges[n | 1].prev_out != -1) {
+ edges[edges[n | 1].prev_out].next_out = edges[n | 1].next_out;
+ } else {
+ nodes[edges[n].target].first_out = edges[n | 1].next_out;
+ }
+
+ edges[n].next_out = first_free_edge;
+ first_free_edge = n;
+
+ }
+
+ void clear() {
+ edges.clear();
+ nodes.clear();
+ first_node = first_free_node = first_free_edge = -1;
+ }
+
+ protected:
+
+ void changeTarget(UEdge e, Node n) {
+ if(edges[2 * e.id].next_out != -1) {
+ edges[edges[2 * e.id].next_out].prev_out = edges[2 * e.id].prev_out;
+ }
+ if(edges[2 * e.id].prev_out != -1) {
+ edges[edges[2 * e.id].prev_out].next_out =
+ edges[2 * e.id].next_out;
+ } else {
+ nodes[edges[(2 * e.id) | 1].target].first_out =
+ edges[2 * e.id].next_out;
+ }
+
+ if (nodes[n.id].first_out != -1) {
+ edges[nodes[n.id].first_out].prev_out = 2 * e.id;
+ }
+ edges[(2 * e.id) | 1].target = n.id;
+ edges[2 * e.id].prev_out = -1;
+ edges[2 * e.id].next_out = nodes[n.id].first_out;
+ nodes[n.id].first_out = 2 * e.id;
+ }
+
+ void changeSource(UEdge e, Node n) {
+ if(edges[(2 * e.id) | 1].next_out != -1) {
+ edges[edges[(2 * e.id) | 1].next_out].prev_out =
+ edges[(2 * e.id) | 1].prev_out;
+ }
+ if(edges[(2 * e.id) | 1].prev_out != -1) {
+ edges[edges[(2 * e.id) | 1].prev_out].next_out =
+ edges[(2 * e.id) | 1].next_out;
+ } else {
+ nodes[edges[2 * e.id].target].first_out =
+ edges[(2 * e.id) | 1].next_out;
+ }
+
+ if (nodes[n.id].first_out != -1) {
+ edges[nodes[n.id].first_out].prev_out = ((2 * e.id) | 1);
+ }
+ edges[2 * e.id].target = n.id;
+ edges[(2 * e.id) | 1].prev_out = -1;
+ edges[(2 * e.id) | 1].next_out = nodes[n.id].first_out;
+ nodes[n.id].first_out = ((2 * e.id) | 1);
+ }
+
+ };
+
+// typedef UGraphExtender<UndirGraphExtender<ListGraphBase> >
+// ExtendedListUGraphBase;
+
+ typedef UGraphExtender<ListUGraphBase> ExtendedListUGraphBase;
+
+
+
+ /// \addtogroup graphs
+ /// @{
+
+ ///An undirected list graph class.
+
+ ///This is a simple and fast undirected graph implementation.
+ ///
+ ///An important extra feature of this graph implementation is that
+ ///its maps are real \ref concepts::ReferenceMap "reference map"s.
+ ///
+ ///It conforms to the
+ ///\ref concepts::UGraph "UGraph concept".
+ ///
+ ///\sa concepts::UGraph.
+ ///
+ class ListUGraph : public ExtendedListUGraphBase {
+ private:
+ ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead.
+
+ ///ListUGraph is \e not copy constructible. Use UGraphCopy() instead.
+ ///
+ ListUGraph(const ListUGraph &) :ExtendedListUGraphBase() {};
+ ///\brief Assignment of ListUGraph to another one is \e not allowed.
+ ///Use UGraphCopy() instead.
+
+ ///Assignment of ListUGraph to another one is \e not allowed.
+ ///Use UGraphCopy() instead.
+ void operator=(const ListUGraph &) {}
+ public:
+ /// Constructor
+
+ /// Constructor.
+ ///
+ ListUGraph() {}
+
+ typedef ExtendedListUGraphBase Parent;
+
+ typedef Parent::OutEdgeIt IncEdgeIt;
+
+ /// \brief Add a new node to the graph.
+ ///
+ /// \return the new node.
+ ///
+ Node addNode() { return Parent::addNode(); }
+
+ /// \brief Add a new edge to the graph.
+ ///
+ /// Add a new edge to the graph with source node \c s
+ /// and target node \c t.
+ /// \return the new undirected edge.
+ UEdge addEdge(const Node& s, const Node& t) {
+ return Parent::addEdge(s, t);
+ }
+ /// \brief Changes the source of \c e to \c n
+ ///
+ /// Changes the source of \c e to \c n
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>InEdgeIt</tt>s
+ ///referencing the changed edge remain
+ ///valid. However <tt>OutEdgeIt</tt>s are invalidated.
+ void changeSource(UEdge e, Node n) {
+ Parent::changeSource(e,n);
+ }
+ /// \brief Changes the target of \c e to \c n
+ ///
+ /// Changes the target of \c e to \c n
+ ///
+ /// \note The <tt>EdgeIt</tt>s referencing the changed edge remain
+ /// valid. However the other iterators may be invalidated.
+ void changeTarget(UEdge e, Node n) {
+ Parent::changeTarget(e,n);
+ }
+ /// \brief Changes the source of \c e to \c n
+ ///
+ /// Changes the source of \c e to \c n. It changes the proper
+ /// node of the represented undirected edge.
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>InEdgeIt</tt>s
+ ///referencing the changed edge remain
+ ///valid. However <tt>OutEdgeIt</tt>s are invalidated.
+ void changeSource(Edge e, Node n) {
+ if (Parent::direction(e)) {
+ Parent::changeSource(e,n);
+ } else {
+ Parent::changeTarget(e,n);
+ }
+ }
+ /// \brief Changes the target of \c e to \c n
+ ///
+ /// Changes the target of \c e to \c n. It changes the proper
+ /// node of the represented undirected edge.
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>OutEdgeIt</tt>s
+ ///referencing the changed edge remain
+ ///valid. However <tt>InEdgeIt</tt>s are invalidated.
+ void changeTarget(Edge e, Node n) {
+ if (Parent::direction(e)) {
+ Parent::changeTarget(e,n);
+ } else {
+ Parent::changeSource(e,n);
+ }
+ }
+ /// \brief Contract two nodes.
+ ///
+ /// This function contracts two nodes.
+ ///
+ /// Node \p b will be removed but instead of deleting
+ /// its neighboring edges, they will be joined to \p a.
+ /// The last parameter \p r controls whether to remove loops. \c true
+ /// means that loops will be removed.
+ ///
+ /// \note The <tt>EdgeIt</tt>s referencing a moved edge remain
+ /// valid.
+ void contract(Node a, Node b, bool r = true) {
+ for(IncEdgeIt e(*this, b); e!=INVALID;) {
+ IncEdgeIt f = e; ++f;
+ if (r && runningNode(e) == a) {
+ erase(e);
+ } else if (source(e) == b) {
+ changeSource(e, a);
+ } else {
+ changeTarget(e, a);
+ }
+ e = f;
+ }
+ erase(b);
+ }
+
+
+ /// \brief Class to make a snapshot of the graph and restore
+ /// to it later.
+ ///
+ /// Class to make a snapshot of the graph and to restore it
+ /// later.
+ ///
+ /// The newly added nodes and undirected edges can be removed
+ /// using the restore() function.
+ ///
+ /// \warning Edge and node deletions cannot be restored. This
+ /// events invalidate the snapshot.
+ class Snapshot {
+ protected:
+
+ typedef Parent::NodeNotifier NodeNotifier;
+
+ class NodeObserverProxy : public NodeNotifier::ObserverBase {
+ public:
+
+ NodeObserverProxy(Snapshot& _snapshot)
+ : snapshot(_snapshot) {}
+
+ using NodeNotifier::ObserverBase::attach;
+ using NodeNotifier::ObserverBase::detach;
+ using NodeNotifier::ObserverBase::attached;
+
+ protected:
+
+ virtual void add(const Node& node) {
+ snapshot.addNode(node);
+ }
+ virtual void add(const std::vector<Node>& nodes) {
+ for (int i = nodes.size() - 1; i >= 0; ++i) {
+ snapshot.addNode(nodes[i]);
+ }
+ }
+ virtual void erase(const Node& node) {
+ snapshot.eraseNode(node);
+ }
+ virtual void erase(const std::vector<Node>& nodes) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
+ snapshot.eraseNode(nodes[i]);
+ }
+ }
+ virtual void build() {
+ Node node;
+ std::vector<Node> nodes;
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
+ nodes.push_back(node);
+ }
+ for (int i = nodes.size() - 1; i >= 0; --i) {
+ snapshot.addNode(nodes[i]);
+ }
+ }
+ virtual void clear() {
+ Node node;
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
+ snapshot.eraseNode(node);
+ }
+ }
+
+ Snapshot& snapshot;
+ };
+
+ class UEdgeObserverProxy : public UEdgeNotifier::ObserverBase {
+ public:
+
+ UEdgeObserverProxy(Snapshot& _snapshot)
+ : snapshot(_snapshot) {}
+
+ using UEdgeNotifier::ObserverBase::attach;
+ using UEdgeNotifier::ObserverBase::detach;
+ using UEdgeNotifier::ObserverBase::attached;
+
+ protected:
+
+ virtual void add(const UEdge& edge) {
+ snapshot.addUEdge(edge);
+ }
+ virtual void add(const std::vector<UEdge>& edges) {
+ for (int i = edges.size() - 1; i >= 0; ++i) {
+ snapshot.addUEdge(edges[i]);
+ }
+ }
+ virtual void erase(const UEdge& edge) {
+ snapshot.eraseUEdge(edge);
+ }
+ virtual void erase(const std::vector<UEdge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ snapshot.eraseUEdge(edges[i]);
+ }
+ }
+ virtual void build() {
+ UEdge edge;
+ std::vector<UEdge> edges;
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
+ edges.push_back(edge);
+ }
+ for (int i = edges.size() - 1; i >= 0; --i) {
+ snapshot.addUEdge(edges[i]);
+ }
+ }
+ virtual void clear() {
+ UEdge edge;
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
+ snapshot.eraseUEdge(edge);
+ }
+ }
+
+ Snapshot& snapshot;
+ };
+
+ ListUGraph *graph;
+
+ NodeObserverProxy node_observer_proxy;
+ UEdgeObserverProxy edge_observer_proxy;
+
+ std::list<Node> added_nodes;
+ std::list<UEdge> added_edges;
+
+
+ void addNode(const Node& node) {
+ added_nodes.push_front(node);
+ }
+ void eraseNode(const Node& node) {
+ std::list<Node>::iterator it =
+ std::find(added_nodes.begin(), added_nodes.end(), node);
+ if (it == added_nodes.end()) {
+ clear();
+ edge_observer_proxy.detach();
+ throw NodeNotifier::ImmediateDetach();
+ } else {
+ added_nodes.erase(it);
+ }
+ }
+
+ void addUEdge(const UEdge& edge) {
+ added_edges.push_front(edge);
+ }
+ void eraseUEdge(const UEdge& edge) {
+ std::list<UEdge>::iterator it =
+ std::find(added_edges.begin(), added_edges.end(), edge);
+ if (it == added_edges.end()) {
+ clear();
+ node_observer_proxy.detach();
+ throw UEdgeNotifier::ImmediateDetach();
+ } else {
+ added_edges.erase(it);
+ }
+ }
+
+ void attach(ListUGraph &_graph) {
+ graph = &_graph;
+ node_observer_proxy.attach(graph->notifier(Node()));
+ edge_observer_proxy.attach(graph->notifier(UEdge()));
+ }
+
+ void detach() {
+ node_observer_proxy.detach();
+ edge_observer_proxy.detach();
+ }
+
+ bool attached() const {
+ return node_observer_proxy.attached();
+ }
+
+ void clear() {
+ added_nodes.clear();
+ added_edges.clear();
+ }
+
+ public:
+
+ /// \brief Default constructor.
+ ///
+ /// Default constructor.
+ /// To actually make a snapshot you must call save().
+ Snapshot()
+ : graph(0), node_observer_proxy(*this),
+ edge_observer_proxy(*this) {}
+
+ /// \brief Constructor that immediately makes a snapshot.
+ ///
+ /// This constructor immediately makes a snapshot of the graph.
+ /// \param _graph The graph we make a snapshot of.
+ Snapshot(ListUGraph &_graph)
+ : node_observer_proxy(*this),
+ edge_observer_proxy(*this) {
+ attach(_graph);
+ }
+
+ /// \brief Make a snapshot.
+ ///
+ /// Make a snapshot of the graph.
+ ///
+ /// This function can be called more than once. In case of a repeated
+ /// call, the previous snapshot gets lost.
+ /// \param _graph The graph we make the snapshot of.
+ void save(ListUGraph &_graph) {
+ if (attached()) {
+ detach();
+ clear();
+ }
+ attach(_graph);
+ }
+
+ /// \brief Undo the changes until the last snapshot.
+ //
+ /// Undo the changes until the last snapshot created by save().
+ void restore() {
+ detach();
+ for(std::list<UEdge>::iterator it = added_edges.begin();
+ it != added_edges.end(); ++it) {
+ graph->erase(*it);
+ }
+ for(std::list<Node>::iterator it = added_nodes.begin();
+ it != added_nodes.end(); ++it) {
+ graph->erase(*it);
+ }
+ clear();
+ }
+
+ /// \brief Gives back true when the snapshot is valid.
+ ///
+ /// Gives back true when the snapshot is valid.
+ bool valid() const {
+ return attached();
+ }
+ };
+ };
+
+
+ class ListBpUGraphBase {
+ public:
+
+ class NodeSetError : public LogicError {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::ListBpUGraph::NodeSetError";
+ }
+ };
+
+ protected:
+
+ struct NodeT {
+ int first_edge, prev, next;
+ };
+
+ struct UEdgeT {
+ int aNode, prev_out, next_out;
+ int bNode, prev_in, next_in;
+ };
+
+ std::vector<NodeT> aNodes;
+ std::vector<NodeT> bNodes;
+
+ std::vector<UEdgeT> edges;
+
+ int first_anode;
+ int first_free_anode;
+
+ int first_bnode;
+ int first_free_bnode;
+
+ int first_free_edge;
+
+ public:
+
+ class Node {
+ friend class ListBpUGraphBase;
+ protected:
+ int id;
+
+ explicit Node(int _id) : id(_id) {}
+ public:
+ Node() {}
+ Node(Invalid) { id = -1; }
+ bool operator==(const Node i) const {return id==i.id;}
+ bool operator!=(const Node i) const {return id!=i.id;}
+ bool operator<(const Node i) const {return id<i.id;}
+ };
+
+ class UEdge {
+ friend class ListBpUGraphBase;
+ protected:
+ int id;
+
+ explicit UEdge(int _id) { id = _id;}
+ public:
+ UEdge() {}
+ UEdge (Invalid) { id = -1; }
+ bool operator==(const UEdge i) const {return id==i.id;}
+ bool operator!=(const UEdge i) const {return id!=i.id;}
+ bool operator<(const UEdge i) const {return id<i.id;}
+ };
+
+ ListBpUGraphBase()
+ : first_anode(-1), first_free_anode(-1),
+ first_bnode(-1), first_free_bnode(-1),
+ first_free_edge(-1) {}
+
+ void firstANode(Node& node) const {
+ node.id = first_anode != -1 ? (first_anode << 1) : -1;
+ }
+ void nextANode(Node& node) const {
+ node.id = aNodes[node.id >> 1].next;
+ }
+
+ void firstBNode(Node& node) const {
+ node.id = first_bnode != -1 ? (first_bnode << 1) + 1 : -1;
+ }
+ void nextBNode(Node& node) const {
+ node.id = bNodes[node.id >> 1].next;
+ }
+
+ void first(Node& node) const {
+ if (first_anode != -1) {
+ node.id = (first_anode << 1);
+ } else if (first_bnode != -1) {
+ node.id = (first_bnode << 1) + 1;
+ } else {
+ node.id = -1;
+ }
+ }
+ void next(Node& node) const {
+ if (aNode(node)) {
+ node.id = aNodes[node.id >> 1].next;
+ if (node.id == -1) {
+ if (first_bnode != -1) {
+ node.id = (first_bnode << 1) + 1;
+ }
+ }
+ } else {
+ node.id = bNodes[node.id >> 1].next;
+ }
+ }
+
+ void first(UEdge& edge) const {
+ int aid = first_anode;
+ while (aid != -1 && aNodes[aid].first_edge == -1) {
+ aid = aNodes[aid].next != -1 ?
+ aNodes[aid].next >> 1 : -1;
+ }
+ if (aid != -1) {
+ edge.id = aNodes[aid].first_edge;
+ } else {
+ edge.id = -1;
+ }
+ }
+ void next(UEdge& edge) const {
+ int aid = edges[edge.id].aNode >> 1;
+ edge.id = edges[edge.id].next_out;
+ if (edge.id == -1) {
+ aid = aNodes[aid].next != -1 ?
+ aNodes[aid].next >> 1 : -1;
+ while (aid != -1 && aNodes[aid].first_edge == -1) {
+ aid = aNodes[aid].next != -1 ?
+ aNodes[aid].next >> 1 : -1;
+ }
+ if (aid != -1) {
+ edge.id = aNodes[aid].first_edge;
+ } else {
+ edge.id = -1;
+ }
+ }
+ }
+
+ void firstFromANode(UEdge& edge, const Node& node) const {
+ LEMON_ASSERT((node.id & 1) == 0, NodeSetError());
+ edge.id = aNodes[node.id >> 1].first_edge;
+ }
+ void nextFromANode(UEdge& edge) const {
+ edge.id = edges[edge.id].next_out;
+ }
+
+ void firstFromBNode(UEdge& edge, const Node& node) const {
+ LEMON_ASSERT((node.id & 1) == 1, NodeSetError());
+ edge.id = bNodes[node.id >> 1].first_edge;
+ }
+ void nextFromBNode(UEdge& edge) const {
+ edge.id = edges[edge.id].next_in;
+ }
+
+ static int id(const Node& node) {
+ return node.id;
+ }
+ static Node nodeFromId(int id) {
+ return Node(id);
+ }
+ int maxNodeId() const {
+ return aNodes.size() > bNodes.size() ?
+ aNodes.size() * 2 - 2 : bNodes.size() * 2 - 1;
+ }
+
+ static int id(const UEdge& edge) {
+ return edge.id;
+ }
+ static UEdge uEdgeFromId(int id) {
+ return UEdge(id);
+ }
+ int maxUEdgeId() const {
+ return edges.size();
+ }
+
+ static int aNodeId(const Node& node) {
+ return node.id >> 1;
+ }
+ static Node nodeFromANodeId(int id) {
+ return Node(id << 1);
+ }
+ int maxANodeId() const {
+ return aNodes.size();
+ }
+
+ static int bNodeId(const Node& node) {
+ return node.id >> 1;
+ }
+ static Node nodeFromBNodeId(int id) {
+ return Node((id << 1) + 1);
+ }
+ int maxBNodeId() const {
+ return bNodes.size();
+ }
+
+ Node aNode(const UEdge& edge) const {
+ return Node(edges[edge.id].aNode);
+ }
+ Node bNode(const UEdge& edge) const {
+ return Node(edges[edge.id].bNode);
+ }
+
+ static bool aNode(const Node& node) {
+ return (node.id & 1) == 0;
+ }
+
+ static bool bNode(const Node& node) {
+ return (node.id & 1) == 1;
+ }
+
+ Node addANode() {
+ int aid;
+ if (first_free_anode == -1) {
+ aid = aNodes.size();
+ aNodes.push_back(NodeT());
+ } else {
+ aid = first_free_anode;
+ first_free_anode = aNodes[first_free_anode].next;
+ }
+ if (first_anode != -1) {
+ aNodes[aid].next = first_anode << 1;
+ aNodes[first_anode].prev = aid << 1;
+ } else {
+ aNodes[aid].next = -1;
+ }
+ aNodes[aid].prev = -1;
+ first_anode = aid;
+ aNodes[aid].first_edge = -1;
+ return Node(aid << 1);
+ }
+
+ Node addBNode() {
+ int bid;
+ if (first_free_bnode == -1) {
+ bid = bNodes.size();
+ bNodes.push_back(NodeT());
+ } else {
+ bid = first_free_bnode;
+ first_free_bnode = bNodes[first_free_bnode].next;
+ }
+ if (first_bnode != -1) {
+ bNodes[bid].next = (first_bnode << 1) + 1;
+ bNodes[first_bnode].prev = (bid << 1) + 1;
+ } else {
+ bNodes[bid].next = -1;
+ }
+ bNodes[bid].prev = -1;
+ first_bnode = bid;
+ bNodes[bid].first_edge = -1;
+ return Node((bid << 1) + 1);
+ }
+
+ UEdge addEdge(const Node& source, const Node& target) {
+ LEMON_ASSERT(((source.id ^ target.id) & 1) == 1, NodeSetError());
+ int edgeId;
+ if (first_free_edge != -1) {
+ edgeId = first_free_edge;
+ first_free_edge = edges[edgeId].next_out;
+ } else {
+ edgeId = edges.size();
+ edges.push_back(UEdgeT());
+ }
+ if ((source.id & 1) == 0) {
+ edges[edgeId].aNode = source.id;
+ edges[edgeId].bNode = target.id;
+ } else {
+ edges[edgeId].aNode = target.id;
+ edges[edgeId].bNode = source.id;
+ }
+ edges[edgeId].next_out = aNodes[edges[edgeId].aNode >> 1].first_edge;
+ edges[edgeId].prev_out = -1;
+ if (aNodes[edges[edgeId].aNode >> 1].first_edge != -1) {
+ edges[aNodes[edges[edgeId].aNode >> 1].first_edge].prev_out = edgeId;
+ }
+ aNodes[edges[edgeId].aNode >> 1].first_edge = edgeId;
+ edges[edgeId].next_in = bNodes[edges[edgeId].bNode >> 1].first_edge;
+ edges[edgeId].prev_in = -1;
+ if (bNodes[edges[edgeId].bNode >> 1].first_edge != -1) {
+ edges[bNodes[edges[edgeId].bNode >> 1].first_edge].prev_in = edgeId;
+ }
+ bNodes[edges[edgeId].bNode >> 1].first_edge = edgeId;
+ return UEdge(edgeId);
+ }
+
+ void erase(const Node& node) {
+ if (aNode(node)) {
+ int aid = node.id >> 1;
+ if (aNodes[aid].prev != -1) {
+ aNodes[aNodes[aid].prev >> 1].next = aNodes[aid].next;
+ } else {
+ first_anode =
+ aNodes[aid].next != -1 ? aNodes[aid].next >> 1 : -1;
+ }
+ if (aNodes[aid].next != -1) {
+ aNodes[aNodes[aid].next >> 1].prev = aNodes[aid].prev;
+ }
+ aNodes[aid].next = first_free_anode;
+ first_free_anode = aid;
+ } else {
+ int bid = node.id >> 1;
+ if (bNodes[bid].prev != -1) {
+ bNodes[bNodes[bid].prev >> 1].next = bNodes[bid].next;
+ } else {
+ first_bnode =
+ bNodes[bid].next != -1 ? bNodes[bid].next >> 1 : -1;
+ }
+ if (bNodes[bid].next != -1) {
+ bNodes[bNodes[bid].next >> 1].prev = bNodes[bid].prev;
+ }
+ bNodes[bid].next = first_free_bnode;
+ first_free_bnode = bid;
+ }
+ }
+
+ void erase(const UEdge& edge) {
+
+ if (edges[edge.id].prev_out != -1) {
+ edges[edges[edge.id].prev_out].next_out = edges[edge.id].next_out;
+ } else {
+ aNodes[edges[edge.id].aNode >> 1].first_edge = edges[edge.id].next_out;
+ }
+ if (edges[edge.id].next_out != -1) {
+ edges[edges[edge.id].next_out].prev_out = edges[edge.id].prev_out;
+ }
+
+ if (edges[edge.id].prev_in != -1) {
+ edges[edges[edge.id].prev_in].next_in = edges[edge.id].next_in;
+ } else {
+ bNodes[edges[edge.id].bNode >> 1].first_edge = edges[edge.id].next_in;
+ }
+ if (edges[edge.id].next_in != -1) {
+ edges[edges[edge.id].next_in].prev_in = edges[edge.id].prev_in;
+ }
+
+ edges[edge.id].next_out = first_free_edge;
+ first_free_edge = edge.id;
+ }
+
+ void clear() {
+ aNodes.clear();
+ bNodes.clear();
+ edges.clear();
+ first_anode = -1;
+ first_free_anode = -1;
+ first_bnode = -1;
+ first_free_bnode = -1;
+ first_free_edge = -1;
+ }
+
+ void changeANode(const UEdge& edge, const Node& node) {
+ LEMON_ASSERT((node.id & 1) == 0, NodeSetError());
+ if (edges[edge.id].prev_out != -1) {
+ edges[edges[edge.id].prev_out].next_out = edges[edge.id].next_out;
+ } else {
+ aNodes[edges[edge.id].aNode >> 1].first_edge = edges[edge.id].next_out;
+ }
+ if (edges[edge.id].next_out != -1) {
+ edges[edges[edge.id].next_out].prev_out = edges[edge.id].prev_out;
+ }
+ if (aNodes[node.id >> 1].first_edge != -1) {
+ edges[aNodes[node.id >> 1].first_edge].prev_out = edge.id;
+ }
+ edges[edge.id].prev_out = -1;
+ edges[edge.id].next_out = aNodes[node.id >> 1].first_edge;
+ aNodes[node.id >> 1].first_edge = edge.id;
+ edges[edge.id].aNode = node.id;
+ }
+
+ void changeBNode(const UEdge& edge, const Node& node) {
+ LEMON_ASSERT((node.id & 1) == 1, NodeSetError());
+ if (edges[edge.id].prev_in != -1) {
+ edges[edges[edge.id].prev_in].next_in = edges[edge.id].next_in;
+ } else {
+ bNodes[edges[edge.id].bNode >> 1].first_edge = edges[edge.id].next_in;
+ }
+ if (edges[edge.id].next_in != -1) {
+ edges[edges[edge.id].next_in].prev_in = edges[edge.id].prev_in;
+ }
+ if (bNodes[node.id >> 1].first_edge != -1) {
+ edges[bNodes[node.id >> 1].first_edge].prev_in = edge.id;
+ }
+ edges[edge.id].prev_in = -1;
+ edges[edge.id].next_in = bNodes[node.id >> 1].first_edge;
+ bNodes[node.id >> 1].first_edge = edge.id;
+ edges[edge.id].bNode = node.id;
+ }
+
+ };
+
+
+ typedef BpUGraphExtender<BidirBpUGraphExtender<ListBpUGraphBase> >
+ ExtendedListBpUGraphBase;
+
+ /// \ingroup graphs
+ ///
+ /// \brief A smart bipartite undirected graph class.
+ ///
+ /// This is a bipartite undirected graph implementation.
+ /// It is conforms to the \ref concepts::BpUGraph "BpUGraph concept".
+ ///
+ ///An important extra feature of this graph implementation is that
+ ///its maps are real \ref concepts::ReferenceMap "reference map"s.
+ ///
+ /// \sa concepts::BpUGraph.
+ ///
+ class ListBpUGraph : public ExtendedListBpUGraphBase {
+ /// \brief ListBpUGraph is \e not copy constructible.
+ ///
+ ///ListBpUGraph is \e not copy constructible.
+ ListBpUGraph(const ListBpUGraph &) :ExtendedListBpUGraphBase() {};
+ /// \brief Assignment of ListBpUGraph to another one is \e not
+ /// allowed.
+ ///
+ /// Assignment of ListBpUGraph to another one is \e not allowed.
+ void operator=(const ListBpUGraph &) {}
+ public:
+ /// \brief Constructor
+ ///
+ /// Constructor.
+ ///
+ ListBpUGraph() {}
+
+ typedef ExtendedListBpUGraphBase Parent;
+ /// \brief Add a new ANode to the graph.
+ ///
+ /// \return the new node.
+ ///
+ Node addANode() { return Parent::addANode(); }
+
+ /// \brief Add a new BNode to the graph.
+ ///
+ /// \return the new node.
+ ///
+ Node addBNode() { return Parent::addBNode(); }
+
+ /// \brief Add a new edge to the graph.
+ ///
+ /// Add a new edge to the graph with an ANode and a BNode.
+ /// \return the new undirected edge.
+ UEdge addEdge(const Node& s, const Node& t) {
+ return Parent::addEdge(s, t);
+ }
+
+ /// \brief Changes the ANode of \c e to \c n
+ ///
+ /// Changes the ANode of \c e to \c n
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>InEdgeIt</tt>s referencing
+ ///the changed edge remain valid. However <tt>OutEdgeIt</tt>s are
+ ///invalidated.
+ void changeANode(UEdge e, Node n) {
+ Parent::changeANode(e,n);
+ }
+
+ /// \brief Changes the BNode of \c e to \c n
+ ///
+ /// Changes the BNode of \c e to \c n
+ ///
+ /// \note The <tt>EdgeIt</tt>s and <tt>OutEdgeIt</tt>s
+ /// referencing the changed edge remain
+ /// valid. However <tt>InEdgeIt</tt>s are invalidated.
+ void changeBNode(UEdge e, Node n) {
+ Parent::changeBNode(e,n);
+ }
+
+ /// \brief Changes the source(ANode) of \c e to \c n
+ ///
+ /// Changes the source(ANode) of \c e to \c n
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>InEdgeIt</tt>s referencing
+ ///the changed edge remain valid. However <tt>OutEdgeIt</tt>s are
+ ///invalidated.
+ void changeSource(UEdge e, Node n) {
+ Parent::changeANode(e,n);
+ }
+
+ /// \brief Changes the target(BNode) of \c e to \c n
+ ///
+ /// Changes the target(BNode) of \c e to \c n
+ ///
+ /// \note The <tt>EdgeIt</tt>s and <tt>OutEdgeIt</tt>s
+ /// referencing the changed edge remain
+ /// valid. However <tt>InEdgeIt</tt>s are invalidated.
+ void changeTarget(UEdge e, Node n) {
+ Parent::changeBNode(e,n);
+ }
+
+ /// \brief Changes the source of \c e to \c n
+ ///
+ /// Changes the source of \c e to \c n. It changes the proper
+ /// node of the represented undirected edge.
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>InEdgeIt</tt>s
+ ///referencing the changed edge remain
+ ///valid. However <tt>OutEdgeIt</tt>s are invalidated.
+ void changeSource(Edge e, Node n) {
+ if (Parent::direction(e)) {
+ Parent::changeANode(e,n);
+ } else {
+ Parent::changeBNode(e,n);
+ }
+ }
+ /// \brief Changes the target of \c e to \c n
+ ///
+ /// Changes the target of \c e to \c n. It changes the proper
+ /// node of the represented undirected edge.
+ ///
+ ///\note The <tt>EdgeIt</tt>s and <tt>OutEdgeIt</tt>s
+ ///referencing the changed edge remain
+ ///valid. However <tt>InEdgeIt</tt>s are invalidated.
+ void changeTarget(Edge e, Node n) {
+ if (Parent::direction(e)) {
+ Parent::changeBNode(e,n);
+ } else {
+ Parent::changeANode(e,n);
+ }
+ }
+ /// \brief Contract two nodes.
+ ///
+ /// This function contracts two nodes.
+ ///
+ /// Node \p b will be removed but instead of deleting its
+ /// neighboring edges, they will be joined to \p a. The two nodes
+ /// should be from the same nodeset, of course.
+ ///
+ /// \note The <tt>EdgeIt</tt>s referencing a moved edge remain
+ /// valid.
+ void contract(const Node& a, const Node& b) {
+ LEMON_ASSERT(Parent::aNode(a) == Parent::aNode(b), NodeSetError());
+ if (Parent::aNode(a)) {
+ for (IncEdgeIt e(*this, b); e!=INVALID;) {
+ IncEdgeIt f = e; ++f;
+ changeSource(e, a);
+ e = f;
+ }
+ } else {
+ for (IncEdgeIt e(*this, b); e!=INVALID;) {
+ IncEdgeIt f = e; ++f;
+ changeTarget(e, a);
+ e = f;
+ }
+ }
+ erase(b);
+ }
+
+ /// \brief Class to make a snapshot of the graph and restore
+ /// to it later.
+ ///
+ /// Class to make a snapshot of the graph and to restore it
+ /// later.
+ ///
+ /// The newly added nodes and undirected edges can be removed
+ /// using the restore() function.
+ ///
+ /// \warning Edge and node deletions cannot be restored. This
+ /// events invalidate the snapshot.
+ class Snapshot {
+ protected:
+
+ typedef Parent::NodeNotifier NodeNotifier;
+
+ class NodeObserverProxy : public NodeNotifier::ObserverBase {
+ public:
+
+ NodeObserverProxy(Snapshot& _snapshot)
+ : snapshot(_snapshot) {}
+
+ using NodeNotifier::ObserverBase::attach;
+ using NodeNotifier::ObserverBase::detach;
+ using NodeNotifier::ObserverBase::attached;
+
+ protected:
+
+ virtual void add(const Node& node) {
+ snapshot.addNode(node);
+ }
+ virtual void add(const std::vector<Node>& nodes) {
+ for (int i = nodes.size() - 1; i >= 0; ++i) {
+ snapshot.addNode(nodes[i]);
+ }
+ }
+ virtual void erase(const Node& node) {
+ snapshot.eraseNode(node);
+ }
+ virtual void erase(const std::vector<Node>& nodes) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
+ snapshot.eraseNode(nodes[i]);
+ }
+ }
+ virtual void build() {
+ Node node;
+ std::vector<Node> nodes;
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
+ nodes.push_back(node);
+ }
+ for (int i = nodes.size() - 1; i >= 0; --i) {
+ snapshot.addNode(nodes[i]);
+ }
+ }
+ virtual void clear() {
+ Node node;
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
+ snapshot.eraseNode(node);
+ }
+ }
+
+ Snapshot& snapshot;
+ };
+
+ class UEdgeObserverProxy : public UEdgeNotifier::ObserverBase {
+ public:
+
+ UEdgeObserverProxy(Snapshot& _snapshot)
+ : snapshot(_snapshot) {}
+
+ using UEdgeNotifier::ObserverBase::attach;
+ using UEdgeNotifier::ObserverBase::detach;
+ using UEdgeNotifier::ObserverBase::attached;
+
+ protected:
+
+ virtual void add(const UEdge& edge) {
+ snapshot.addUEdge(edge);
+ }
+ virtual void add(const std::vector<UEdge>& edges) {
+ for (int i = edges.size() - 1; i >= 0; ++i) {
+ snapshot.addUEdge(edges[i]);
+ }
+ }
+ virtual void erase(const UEdge& edge) {
+ snapshot.eraseUEdge(edge);
+ }
+ virtual void erase(const std::vector<UEdge>& edges) {
+ for (int i = 0; i < int(edges.size()); ++i) {
+ snapshot.eraseUEdge(edges[i]);
+ }
+ }
+ virtual void build() {
+ UEdge edge;
+ std::vector<UEdge> edges;
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
+ edges.push_back(edge);
+ }
+ for (int i = edges.size() - 1; i >= 0; --i) {
+ snapshot.addUEdge(edges[i]);
+ }
+ }
+ virtual void clear() {
+ UEdge edge;
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
+ snapshot.eraseUEdge(edge);
+ }
+ }
+
+ Snapshot& snapshot;
+ };
+
+ ListBpUGraph *graph;
+
+ NodeObserverProxy node_observer_proxy;
+ UEdgeObserverProxy edge_observer_proxy;
+
+ std::list<Node> added_nodes;
+ std::list<UEdge> added_edges;
+
+
+ void addNode(const Node& node) {
+ added_nodes.push_front(node);
+ }
+ void eraseNode(const Node& node) {
+ std::list<Node>::iterator it =
+ std::find(added_nodes.begin(), added_nodes.end(), node);
+ if (it == added_nodes.end()) {
+ clear();
+ edge_observer_proxy.detach();
+ throw NodeNotifier::ImmediateDetach();
+ } else {
+ added_nodes.erase(it);
+ }
+ }
+
+ void addUEdge(const UEdge& edge) {
+ added_edges.push_front(edge);
+ }
+ void eraseUEdge(const UEdge& edge) {
+ std::list<UEdge>::iterator it =
+ std::find(added_edges.begin(), added_edges.end(), edge);
+ if (it == added_edges.end()) {
+ clear();
+ node_observer_proxy.detach();
+ throw UEdgeNotifier::ImmediateDetach();
+ } else {
+ added_edges.erase(it);
+ }
+ }
+
+ void attach(ListBpUGraph &_graph) {
+ graph = &_graph;
+ node_observer_proxy.attach(graph->notifier(Node()));
+ edge_observer_proxy.attach(graph->notifier(UEdge()));
+ }
+
+ void detach() {
+ node_observer_proxy.detach();
+ edge_observer_proxy.detach();
+ }
+
+ bool attached() const {
+ return node_observer_proxy.attached();
+ }
+
+ void clear() {
+ added_nodes.clear();
+ added_edges.clear();
+ }
+
+ public:
+
+ /// \brief Default constructor.
+ ///
+ /// Default constructor.
+ /// To actually make a snapshot you must call save().
+ Snapshot()
+ : graph(0), node_observer_proxy(*this),
+ edge_observer_proxy(*this) {}
+
+ /// \brief Constructor that immediately makes a snapshot.
+ ///
+ /// This constructor immediately makes a snapshot of the graph.
+ /// \param _graph The graph we make a snapshot of.
+ Snapshot(ListBpUGraph &_graph)
+ : node_observer_proxy(*this),
+ edge_observer_proxy(*this) {
+ attach(_graph);
+ }
+
+ /// \brief Make a snapshot.
+ ///
+ /// Make a snapshot of the graph.
+ ///
+ /// This function can be called more than once. In case of a repeated
+ /// call, the previous snapshot gets lost.
+ /// \param _graph The graph we make the snapshot of.
+ void save(ListBpUGraph &_graph) {
+ if (attached()) {
+ detach();
+ clear();
+ }
+ attach(_graph);
+ }
+
+ /// \brief Undo the changes until the last snapshot.
+ //
+ /// Undo the changes until the last snapshot created by save().
+ void restore() {
+ detach();
+ for(std::list<UEdge>::iterator it = added_edges.begin();
+ it != added_edges.end(); ++it) {
+ graph->erase(*it);
+ }
+ for(std::list<Node>::iterator it = added_nodes.begin();
+ it != added_nodes.end(); ++it) {
+ graph->erase(*it);
+ }
+ clear();
+ }
+
+ /// \brief Gives back true when the snapshot is valid.
+ ///
+ /// Gives back true when the snapshot is valid.
+ bool valid() const {
+ return attached();
+ }
+ };
+ };
+
+
+ /// @}
+} //namespace lemon
+
+
+#endif
diff --git a/src/lemon/maps.h b/src/lemon/maps.h
new file mode 100644
index 0000000..e586406
--- /dev/null
+++ b/src/lemon/maps.h
@@ -0,0 +1,1633 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_MAPS_H
+#define LEMON_MAPS_H
+
+#include <iterator>
+#include <functional>
+#include <vector>
+
+#include <lemon/bits/utility.h>
+#include <lemon/bits/traits.h>
+
+///\file
+///\ingroup maps
+///\brief Miscellaneous property maps
+///
+#include <map>
+
+namespace lemon {
+
+ /// \addtogroup maps
+ /// @{
+
+ /// Base class of maps.
+
+ /// Base class of maps.
+ /// It provides the necessary <tt>typedef</tt>s required by the map concept.
+ template<typename K, typename T>
+ class MapBase {
+ public:
+ /// The key type of the map.
+ typedef K Key;
+ /// The value type of the map. (The type of objects associated with the keys).
+ typedef T Value;
+ };
+
+ /// Null map. (a.k.a. DoNothingMap)
+
+ /// This map can be used if you have to provide a map only for
+ /// its type definitions, or if you have to provide a writable map,
+ /// but data written to it is not required (i.e. it will be sent to
+ /// <tt>/dev/null</tt>).
+ template<typename K, typename T>
+ class NullMap : public MapBase<K, T> {
+ public:
+ typedef MapBase<K, T> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ /// Gives back a default constructed element.
+ T operator[](const K&) const { return T(); }
+ /// Absorbs the value.
+ void set(const K&, const T&) {}
+ };
+
+ ///Returns a \c NullMap class
+
+ ///This function just returns a \c NullMap class.
+ ///\relates NullMap
+ template <typename K, typename V>
+ NullMap<K, V> nullMap() {
+ return NullMap<K, V>();
+ }
+
+
+ /// Constant map.
+
+ /// This is a \ref concepts::ReadMap "readable" map which assigns a
+ /// specified value to each key.
+ /// In other aspects it is equivalent to \c NullMap.
+ template<typename K, typename T>
+ class ConstMap : public MapBase<K, T> {
+ private:
+ T v;
+ public:
+
+ typedef MapBase<K, T> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ /// Default constructor
+
+ /// Default constructor.
+ /// The value of the map will be uninitialized.
+ /// (More exactly it will be default constructed.)
+ ConstMap() {}
+
+ /// Constructor with specified initial value
+
+ /// Constructor with specified initial value.
+ /// \param _v is the initial value of the map.
+ ConstMap(const T &_v) : v(_v) {}
+
+ ///\e
+ T operator[](const K&) const { return v; }
+
+ ///\e
+ void setAll(const T &t) {
+ v = t;
+ }
+
+ template<typename T1>
+ struct rebind {
+ typedef ConstMap<K, T1> other;
+ };
+
+ template<typename T1>
+ ConstMap(const ConstMap<K, T1> &, const T &_v) : v(_v) {}
+ };
+
+ ///Returns a \c ConstMap class
+
+ ///This function just returns a \c ConstMap class.
+ ///\relates ConstMap
+ template<typename K, typename V>
+ inline ConstMap<K, V> constMap(const V &v) {
+ return ConstMap<K, V>(v);
+ }
+
+
+ template<typename T, T v>
+ struct Const { };
+
+ /// Constant map with inlined constant value.
+
+ /// This is a \ref concepts::ReadMap "readable" map which assigns a
+ /// specified value to each key.
+ /// In other aspects it is equivalent to \c NullMap.
+ template<typename K, typename V, V v>
+ class ConstMap<K, Const<V, v> > : public MapBase<K, V> {
+ public:
+ typedef MapBase<K, V> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ConstMap() { }
+ ///\e
+ V operator[](const K&) const { return v; }
+ ///\e
+ void set(const K&, const V&) { }
+ };
+
+ ///Returns a \c ConstMap class with inlined value
+
+ ///This function just returns a \c ConstMap class with inlined value.
+ ///\relates ConstMap
+ template<typename K, typename V, V v>
+ inline ConstMap<K, Const<V, v> > constMap() {
+ return ConstMap<K, Const<V, v> >();
+ }
+
+ ///Map based on \c std::map
+
+ ///This is essentially a wrapper for \c std::map with addition that
+ ///you can specify a default value different from \c Value() .
+ ///It meets the \ref concepts::ReferenceMap "ReferenceMap" concept.
+ template <typename K, typename T, typename Compare = std::less<K> >
+ class StdMap : public MapBase<K, T> {
+ template <typename K1, typename T1, typename C1>
+ friend class StdMap;
+ public:
+
+ typedef MapBase<K, T> Parent;
+ ///Key type
+ typedef typename Parent::Key Key;
+ ///Value type
+ typedef typename Parent::Value Value;
+ ///Reference Type
+ typedef T& Reference;
+ ///Const reference type
+ typedef const T& ConstReference;
+
+ typedef True ReferenceMapTag;
+
+ private:
+
+ typedef std::map<K, T, Compare> Map;
+ Value _value;
+ Map _map;
+
+ public:
+
+ /// Constructor with specified default value
+ StdMap(const T& value = T()) : _value(value) {}
+ /// \brief Constructs the map from an appropriate \c std::map, and
+ /// explicitly specifies a default value.
+ template <typename T1, typename Comp1>
+ StdMap(const std::map<Key, T1, Comp1> &map, const T& value = T())
+ : _map(map.begin(), map.end()), _value(value) {}
+
+ /// \brief Constructs a map from an other \ref StdMap.
+ template<typename T1, typename Comp1>
+ StdMap(const StdMap<Key, T1, Comp1> &c)
+ : _map(c._map.begin(), c._map.end()), _value(c._value) {}
+
+ private:
+
+ StdMap& operator=(const StdMap&);
+
+ public:
+
+ ///\e
+ Reference operator[](const Key &k) {
+ typename Map::iterator it = _map.lower_bound(k);
+ if (it != _map.end() && !_map.key_comp()(k, it->first))
+ return it->second;
+ else
+ return _map.insert(it, std::make_pair(k, _value))->second;
+ }
+
+ /// \e
+ ConstReference operator[](const Key &k) const {
+ typename Map::const_iterator it = _map.find(k);
+ if (it != _map.end())
+ return it->second;
+ else
+ return _value;
+ }
+
+ /// \e
+ void set(const Key &k, const T &t) {
+ typename Map::iterator it = _map.lower_bound(k);
+ if (it != _map.end() && !_map.key_comp()(k, it->first))
+ it->second = t;
+ else
+ _map.insert(it, std::make_pair(k, t));
+ }
+
+ /// \e
+ void setAll(const T &t) {
+ _value = t;
+ _map.clear();
+ }
+
+ template <typename T1, typename C1 = std::less<T1> >
+ struct rebind {
+ typedef StdMap<Key, T1, C1> other;
+ };
+ };
+
+ ///Returns a \c StdMap class
+
+ ///This function just returns a \c StdMap class with specified
+ ///default value.
+ ///\relates StdMap
+ template<typename K, typename V, typename Compare>
+ inline StdMap<K, V, Compare> stdMap(const V& value = V()) {
+ return StdMap<K, V, Compare>(value);
+ }
+
+ template<typename K, typename V>
+ inline StdMap<K, V, std::less<K> > stdMap(const V& value = V()) {
+ return StdMap<K, V, std::less<K> >(value);
+ }
+
+ ///Returns a \c StdMap class created from an appropriate \c std::map
+
+ ///This function just returns a \c StdMap class created from an
+ ///appropriate \c std::map.
+ ///\relates StdMap
+ template<typename K, typename V, typename Compare>
+ inline StdMap<K, V, Compare> stdMap( const std::map<K, V, Compare> &map,
+ const V& value = V() ) {
+ return StdMap<K, V, Compare>(map, value);
+ }
+
+ /// \brief Map for storing values for keys from the range <tt>[0..size-1]</tt>
+ ///
+ /// This map has the <tt>[0..size-1]</tt> keyset and the values
+ /// are stored in a \c std::vector<T> container. It can be used with
+ /// some data structures, for example \c UnionFind, \c BinHeap, when
+ /// the used items are small integer numbers.
+ template <typename T>
+ class IntegerMap : public MapBase<int, T> {
+
+ template <typename T1>
+ friend class IntegerMap;
+
+ public:
+
+ typedef MapBase<int, T> Parent;
+ ///\e
+ typedef typename Parent::Key Key;
+ ///\e
+ typedef typename Parent::Value Value;
+ ///\e
+ typedef T& Reference;
+ ///\e
+ typedef const T& ConstReference;
+
+ typedef True ReferenceMapTag;
+
+ private:
+
+ typedef std::vector<T> Vector;
+ Vector _vector;
+
+ public:
+
+ /// Constructor with specified default value
+ IntegerMap(int size = 0, const T& value = T()) : _vector(size, value) {}
+
+ /// \brief Constructs the map from an appropriate \c std::vector.
+ template <typename T1>
+ IntegerMap(const std::vector<T1>& vector)
+ : _vector(vector.begin(), vector.end()) {}
+
+ /// \brief Constructs a map from an other \ref IntegerMap.
+ template <typename T1>
+ IntegerMap(const IntegerMap<T1> &c)
+ : _vector(c._vector.begin(), c._vector.end()) {}
+
+ /// \brief Resize the container
+ void resize(int size, const T& value = T()) {
+ _vector.resize(size, value);
+ }
+
+ private:
+
+ IntegerMap& operator=(const IntegerMap&);
+
+ public:
+
+ ///\e
+ Reference operator[](Key k) {
+ return _vector[k];
+ }
+
+ /// \e
+ ConstReference operator[](Key k) const {
+ return _vector[k];
+ }
+
+ /// \e
+ void set(const Key &k, const T& t) {
+ _vector[k] = t;
+ }
+
+ };
+
+ ///Returns an \c IntegerMap class
+
+ ///This function just returns an \c IntegerMap class.
+ ///\relates IntegerMap
+ template<typename T>
+ inline IntegerMap<T> integerMap(int size = 0, const T& value = T()) {
+ return IntegerMap<T>(size, value);
+ }
+
+ /// @}
+
+ /// \addtogroup map_adaptors
+ /// @{
+
+ /// \brief Identity map.
+ ///
+ /// This map gives back the given key as value without any
+ /// modification.
+ template <typename T>
+ class IdentityMap : public MapBase<T, T> {
+ public:
+ typedef MapBase<T, T> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ /// \e
+ const T& operator[](const T& t) const {
+ return t;
+ }
+ };
+
+ ///Returns an \c IdentityMap class
+
+ ///This function just returns an \c IdentityMap class.
+ ///\relates IdentityMap
+ template<typename T>
+ inline IdentityMap<T> identityMap() {
+ return IdentityMap<T>();
+ }
+
+
+ ///\brief Convert the \c Value of a map to another type using
+ ///the default conversion.
+ ///
+ ///This \ref concepts::ReadMap "read only map"
+ ///converts the \c Value of a map to type \c T.
+ ///Its \c Key is inherited from \c M.
+ template <typename M, typename T>
+ class ConvertMap : public MapBase<typename M::Key, T> {
+ const M& m;
+ public:
+ typedef MapBase<typename M::Key, T> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+
+ ///Constructor
+ ///\param _m is the underlying map
+ ConvertMap(const M &_m) : m(_m) {};
+
+ ///\e
+ Value operator[](const Key& k) const {return m[k];}
+ };
+
+ ///Returns a \c ConvertMap class
+
+ ///This function just returns a \c ConvertMap class.
+ ///\relates ConvertMap
+ template<typename T, typename M>
+ inline ConvertMap<M, T> convertMap(const M &m) {
+ return ConvertMap<M, T>(m);
+ }
+
+ ///Simple wrapping of a map
+
+ ///This \ref concepts::ReadMap "read only map" returns the simple
+ ///wrapping of the given map. Sometimes the reference maps cannot be
+ ///combined with simple read maps. This map adaptor wraps the given
+ ///map to simple read map.
+ ///
+ ///\sa SimpleWriteMap
+ ///
+ /// \todo Revise the misleading name
+ template<typename M>
+ class SimpleMap : public MapBase<typename M::Key, typename M::Value> {
+ const M& m;
+
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ SimpleMap(const M &_m) : m(_m) {};
+ ///\e
+ Value operator[](Key k) const {return m[k];}
+ };
+
+ ///Returns a \c SimpleMap class
+
+ ///This function just returns a \c SimpleMap class.
+ ///\relates SimpleMap
+ template<typename M>
+ inline SimpleMap<M> simpleMap(const M &m) {
+ return SimpleMap<M>(m);
+ }
+
+ ///Simple writable wrapping of a map
+
+ ///This \ref concepts::ReadWriteMap "read-write map" returns the simple
+ ///wrapping of the given map. Sometimes the reference maps cannot be
+ ///combined with simple read-write maps. This map adaptor wraps the
+ ///given map to simple read-write map.
+ ///
+ ///\sa SimpleMap
+ ///
+ /// \todo Revise the misleading name
+ template<typename M>
+ class SimpleWriteMap : public MapBase<typename M::Key, typename M::Value> {
+ M& m;
+
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ SimpleWriteMap(M &_m) : m(_m) {};
+ ///\e
+ Value operator[](Key k) const {return m[k];}
+ ///\e
+ void set(Key k, const Value& c) { m.set(k, c); }
+ };
+
+ ///Returns a \c SimpleWriteMap class
+
+ ///This function just returns a \c SimpleWriteMap class.
+ ///\relates SimpleWriteMap
+ template<typename M>
+ inline SimpleWriteMap<M> simpleWriteMap(M &m) {
+ return SimpleWriteMap<M>(m);
+ }
+
+ ///Sum of two maps
+
+ ///This \ref concepts::ReadMap "read only map" returns the sum of the two
+ ///given maps.
+ ///Its \c Key and \c Value are inherited from \c M1.
+ ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
+ template<typename M1, typename M2>
+ class AddMap : public MapBase<typename M1::Key, typename M1::Value> {
+ const M1& m1;
+ const M2& m2;
+
+ public:
+ typedef MapBase<typename M1::Key, typename M1::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ AddMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {};
+ ///\e
+ Value operator[](Key k) const {return m1[k]+m2[k];}
+ };
+
+ ///Returns an \c AddMap class
+
+ ///This function just returns an \c AddMap class.
+ ///\todo How to call these type of functions?
+ ///
+ ///\relates AddMap
+ template<typename M1, typename M2>
+ inline AddMap<M1, M2> addMap(const M1 &m1,const M2 &m2) {
+ return AddMap<M1, M2>(m1,m2);
+ }
+
+ ///Shift a map with a constant.
+
+ ///This \ref concepts::ReadMap "read only map" returns the sum of the
+ ///given map and a constant value.
+ ///Its \c Key and \c Value is inherited from \c M.
+ ///
+ ///Actually,
+ ///\code
+ /// ShiftMap<X> sh(x,v);
+ ///\endcode
+ ///is equivalent to
+ ///\code
+ /// ConstMap<X::Key, X::Value> c_tmp(v);
+ /// AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
+ ///\endcode
+ ///
+ ///\sa ShiftWriteMap
+ template<typename M, typename C = typename M::Value>
+ class ShiftMap : public MapBase<typename M::Key, typename M::Value> {
+ const M& m;
+ C v;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+
+ ///Constructor
+ ///\param _m is the undelying map
+ ///\param _v is the shift value
+ ShiftMap(const M &_m, const C &_v ) : m(_m), v(_v) {};
+ ///\e
+ Value operator[](Key k) const {return m[k] + v;}
+ };
+
+ ///Shift a map with a constant (ReadWrite version).
+
+ ///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the
+ ///given map and a constant value. It makes also possible to write the map.
+ ///Its \c Key and \c Value are inherited from \c M.
+ ///
+ ///\sa ShiftMap
+ template<typename M, typename C = typename M::Value>
+ class ShiftWriteMap : public MapBase<typename M::Key, typename M::Value> {
+ M& m;
+ C v;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+
+ ///Constructor
+ ///\param _m is the undelying map
+ ///\param _v is the shift value
+ ShiftWriteMap(M &_m, const C &_v ) : m(_m), v(_v) {};
+ /// \e
+ Value operator[](Key k) const {return m[k] + v;}
+ /// \e
+ void set(Key k, const Value& c) { m.set(k, c - v); }
+ };
+
+ ///Returns a \c ShiftMap class
+
+ ///This function just returns an \c ShiftMap class.
+ ///\relates ShiftMap
+ template<typename M, typename C>
+ inline ShiftMap<M, C> shiftMap(const M &m,const C &v) {
+ return ShiftMap<M, C>(m,v);
+ }
+
+ ///Returns a \c ShiftWriteMap class
+
+ ///This function just returns a \c ShiftWriteMap class.
+ ///\relates ShiftWriteMap
+ template<typename M, typename C>
+ inline ShiftWriteMap<M, C> shiftMap(M &m,const C &v) {
+ return ShiftWriteMap<M, C>(m,v);
+ }
+
+ ///Difference of two maps
+
+ ///This \ref concepts::ReadMap "read only map" returns the difference
+ ///of the values of the two given maps.
+ ///Its \c Key and \c Value are inherited from \c M1.
+ ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
+
+ template<typename M1, typename M2>
+ class SubMap : public MapBase<typename M1::Key, typename M1::Value> {
+ const M1& m1;
+ const M2& m2;
+ public:
+ typedef MapBase<typename M1::Key, typename M1::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ SubMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {};
+ /// \e
+ Value operator[](Key k) const {return m1[k]-m2[k];}
+ };
+
+ ///Returns a \c SubMap class
+
+ ///This function just returns a \c SubMap class.
+ ///
+ ///\relates SubMap
+ template<typename M1, typename M2>
+ inline SubMap<M1, M2> subMap(const M1 &m1, const M2 &m2) {
+ return SubMap<M1, M2>(m1, m2);
+ }
+
+ ///Product of two maps
+
+ ///This \ref concepts::ReadMap "read only map" returns the product of the
+ ///values of the two given maps.
+ ///Its \c Key and \c Value are inherited from \c M1.
+ ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
+ template<typename M1, typename M2>
+ class MulMap : public MapBase<typename M1::Key, typename M1::Value> {
+ const M1& m1;
+ const M2& m2;
+ public:
+ typedef MapBase<typename M1::Key, typename M1::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ MulMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {};
+ /// \e
+ Value operator[](Key k) const {return m1[k]*m2[k];}
+ };
+
+ ///Returns a \c MulMap class
+
+ ///This function just returns a \c MulMap class.
+ ///\relates MulMap
+ template<typename M1, typename M2>
+ inline MulMap<M1, M2> mulMap(const M1 &m1,const M2 &m2) {
+ return MulMap<M1, M2>(m1,m2);
+ }
+
+ ///Scales a map with a constant.
+
+ ///This \ref concepts::ReadMap "read only map" returns the value of the
+ ///given map multiplied from the left side with a constant value.
+ ///Its \c Key and \c Value are inherited from \c M.
+ ///
+ ///Actually,
+ ///\code
+ /// ScaleMap<X> sc(x,v);
+ ///\endcode
+ ///is equivalent to
+ ///\code
+ /// ConstMap<X::Key, X::Value> c_tmp(v);
+ /// MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v);
+ ///\endcode
+ ///
+ ///\sa ScaleWriteMap
+ template<typename M, typename C = typename M::Value>
+ class ScaleMap : public MapBase<typename M::Key, typename M::Value> {
+ const M& m;
+ C v;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+
+ ///Constructor
+ ///\param _m is the undelying map
+ ///\param _v is the scaling value
+ ScaleMap(const M &_m, const C &_v ) : m(_m), v(_v) {};
+ /// \e
+ Value operator[](Key k) const {return v * m[k];}
+ };
+
+ ///Scales a map with a constant (ReadWrite version).
+
+ ///This \ref concepts::ReadWriteMap "read-write map" returns the value of the
+ ///given map multiplied from the left side with a constant value. It can
+ ///also be used as write map if the \c / operator is defined between
+ ///\c Value and \c C and the given multiplier is not zero.
+ ///Its \c Key and \c Value are inherited from \c M.
+ ///
+ ///\sa ScaleMap
+ template<typename M, typename C = typename M::Value>
+ class ScaleWriteMap : public MapBase<typename M::Key, typename M::Value> {
+ M& m;
+ C v;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+
+ ///Constructor
+ ///\param _m is the undelying map
+ ///\param _v is the scaling value
+ ScaleWriteMap(M &_m, const C &_v ) : m(_m), v(_v) {};
+ /// \e
+ Value operator[](Key k) const {return v * m[k];}
+ /// \e
+ void set(Key k, const Value& c) { m.set(k, c / v);}
+ };
+
+ ///Returns a \c ScaleMap class
+
+ ///This function just returns a \c ScaleMap class.
+ ///\relates ScaleMap
+ template<typename M, typename C>
+ inline ScaleMap<M, C> scaleMap(const M &m,const C &v) {
+ return ScaleMap<M, C>(m,v);
+ }
+
+ ///Returns a \c ScaleWriteMap class
+
+ ///This function just returns a \c ScaleWriteMap class.
+ ///\relates ScaleWriteMap
+ template<typename M, typename C>
+ inline ScaleWriteMap<M, C> scaleMap(M &m,const C &v) {
+ return ScaleWriteMap<M, C>(m,v);
+ }
+
+ ///Quotient of two maps
+
+ ///This \ref concepts::ReadMap "read only map" returns the quotient of the
+ ///values of the two given maps.
+ ///Its \c Key and \c Value are inherited from \c M1.
+ ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
+ template<typename M1, typename M2>
+ class DivMap : public MapBase<typename M1::Key, typename M1::Value> {
+ const M1& m1;
+ const M2& m2;
+ public:
+ typedef MapBase<typename M1::Key, typename M1::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ DivMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {};
+ /// \e
+ Value operator[](Key k) const {return m1[k]/m2[k];}
+ };
+
+ ///Returns a \c DivMap class
+
+ ///This function just returns a \c DivMap class.
+ ///\relates DivMap
+ template<typename M1, typename M2>
+ inline DivMap<M1, M2> divMap(const M1 &m1,const M2 &m2) {
+ return DivMap<M1, M2>(m1,m2);
+ }
+
+ ///Composition of two maps
+
+ ///This \ref concepts::ReadMap "read only map" returns the composition of
+ ///two given maps.
+ ///That is to say, if \c m1 is of type \c M1 and \c m2 is of \c M2,
+ ///then for
+ ///\code
+ /// ComposeMap<M1, M2> cm(m1,m2);
+ ///\endcode
+ /// <tt>cm[x]</tt> will be equal to <tt>m1[m2[x]]</tt>.
+ ///
+ ///Its \c Key is inherited from \c M2 and its \c Value is from \c M1.
+ ///\c M2::Value must be convertible to \c M1::Key.
+ ///
+ ///\sa CombineMap
+ ///
+ ///\todo Check the requirements.
+ template <typename M1, typename M2>
+ class ComposeMap : public MapBase<typename M2::Key, typename M1::Value> {
+ const M1& m1;
+ const M2& m2;
+ public:
+ typedef MapBase<typename M2::Key, typename M1::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ ComposeMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {};
+
+ typename MapTraits<M1>::ConstReturnValue
+ /// \e
+ operator[](Key k) const {return m1[m2[k]];}
+ };
+ ///Returns a \c ComposeMap class
+
+ ///This function just returns a \c ComposeMap class.
+ ///
+ ///\relates ComposeMap
+ template <typename M1, typename M2>
+ inline ComposeMap<M1, M2> composeMap(const M1 &m1,const M2 &m2) {
+ return ComposeMap<M1, M2>(m1,m2);
+ }
+
+ ///Combine of two maps using an STL (binary) functor.
+
+ ///Combine of two maps using an STL (binary) functor.
+ ///
+ ///This \ref concepts::ReadMap "read only map" takes two maps and a
+ ///binary functor and returns the composition of the two
+ ///given maps unsing the functor.
+ ///That is to say, if \c m1 and \c m2 is of type \c M1 and \c M2
+ ///and \c f is of \c F, then for
+ ///\code
+ /// CombineMap<M1, M2,F,V> cm(m1,m2,f);
+ ///\endcode
+ /// <tt>cm[x]</tt> will be equal to <tt>f(m1[x],m2[x])</tt>
+ ///
+ ///Its \c Key is inherited from \c M1 and its \c Value is \c V.
+ ///\c M2::Value and \c M1::Value must be convertible to the corresponding
+ ///input parameter of \c F and the return type of \c F must be convertible
+ ///to \c V.
+ ///
+ ///\sa ComposeMap
+ ///
+ ///\todo Check the requirements.
+ template<typename M1, typename M2, typename F,
+ typename V = typename F::result_type>
+ class CombineMap : public MapBase<typename M1::Key, V> {
+ const M1& m1;
+ const M2& m2;
+ F f;
+ public:
+ typedef MapBase<typename M1::Key, V> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ CombineMap(const M1 &_m1,const M2 &_m2,const F &_f = F())
+ : m1(_m1), m2(_m2), f(_f) {};
+ /// \e
+ Value operator[](Key k) const {return f(m1[k],m2[k]);}
+ };
+
+ ///Returns a \c CombineMap class
+
+ ///This function just returns a \c CombineMap class.
+ ///
+ ///For example if \c m1 and \c m2 are both \c double valued maps, then
+ ///\code
+ ///combineMap(m1,m2,std::plus<double>())
+ ///\endcode
+ ///is equivalent to
+ ///\code
+ ///addMap(m1,m2)
+ ///\endcode
+ ///
+ ///This function is specialized for adaptable binary function
+ ///classes and C++ functions.
+ ///
+ ///\relates CombineMap
+ template<typename M1, typename M2, typename F, typename V>
+ inline CombineMap<M1, M2, F, V>
+ combineMap(const M1& m1,const M2& m2, const F& f) {
+ return CombineMap<M1, M2, F, V>(m1,m2,f);
+ }
+
+ template<typename M1, typename M2, typename F>
+ inline CombineMap<M1, M2, F, typename F::result_type>
+ combineMap(const M1& m1, const M2& m2, const F& f) {
+ return combineMap<M1, M2, F, typename F::result_type>(m1,m2,f);
+ }
+
+ template<typename M1, typename M2, typename K1, typename K2, typename V>
+ inline CombineMap<M1, M2, V (*)(K1, K2), V>
+ combineMap(const M1 &m1, const M2 &m2, V (*f)(K1, K2)) {
+ return combineMap<M1, M2, V (*)(K1, K2), V>(m1,m2,f);
+ }
+
+ ///Negative value of a map
+
+ ///This \ref concepts::ReadMap "read only map" returns the negative
+ ///value of the value returned by the given map.
+ ///Its \c Key and \c Value are inherited from \c M.
+ ///The unary \c - operator must be defined for \c Value, of course.
+ ///
+ ///\sa NegWriteMap
+ template<typename M>
+ class NegMap : public MapBase<typename M::Key, typename M::Value> {
+ const M& m;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ NegMap(const M &_m) : m(_m) {};
+ /// \e
+ Value operator[](Key k) const {return -m[k];}
+ };
+
+ ///Negative value of a map (ReadWrite version)
+
+ ///This \ref concepts::ReadWriteMap "read-write map" returns the negative
+ ///value of the value returned by the given map.
+ ///Its \c Key and \c Value are inherited from \c M.
+ ///The unary \c - operator must be defined for \c Value, of course.
+ ///
+ /// \sa NegMap
+ template<typename M>
+ class NegWriteMap : public MapBase<typename M::Key, typename M::Value> {
+ M& m;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ NegWriteMap(M &_m) : m(_m) {};
+ /// \e
+ Value operator[](Key k) const {return -m[k];}
+ /// \e
+ void set(Key k, const Value& v) { m.set(k, -v); }
+ };
+
+ ///Returns a \c NegMap class
+
+ ///This function just returns a \c NegMap class.
+ ///\relates NegMap
+ template <typename M>
+ inline NegMap<M> negMap(const M &m) {
+ return NegMap<M>(m);
+ }
+
+ ///Returns a \c NegWriteMap class
+
+ ///This function just returns a \c NegWriteMap class.
+ ///\relates NegWriteMap
+ template <typename M>
+ inline NegWriteMap<M> negMap(M &m) {
+ return NegWriteMap<M>(m);
+ }
+
+ ///Absolute value of a map
+
+ ///This \ref concepts::ReadMap "read only map" returns the absolute value
+ ///of the value returned by the given map.
+ ///Its \c Key and \c Value are inherited from \c M.
+ ///\c Value must be comparable to \c 0 and the unary \c -
+ ///operator must be defined for it, of course.
+ ///
+ ///\bug We need a unified way to handle the situation below:
+ ///\code
+ /// struct _UnConvertible {};
+ /// template<class A> inline A t_abs(A a) {return _UnConvertible();}
+ /// template<> inline int t_abs<>(int n) {return abs(n);}
+ /// template<> inline long int t_abs<>(long int n) {return labs(n);}
+ /// template<> inline long long int t_abs<>(long long int n) {return ::llabs(n);}
+ /// template<> inline float t_abs<>(float n) {return fabsf(n);}
+ /// template<> inline double t_abs<>(double n) {return fabs(n);}
+ /// template<> inline long double t_abs<>(long double n) {return fabsl(n);}
+ ///\endcode
+
+
+ template<typename M>
+ class AbsMap : public MapBase<typename M::Key, typename M::Value> {
+ const M& m;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ AbsMap(const M &_m) : m(_m) {};
+ /// \e
+ Value operator[](Key k) const {
+ Value tmp = m[k];
+ return tmp >= 0 ? tmp : -tmp;
+ }
+
+ };
+
+ ///Returns an \c AbsMap class
+
+ ///This function just returns an \c AbsMap class.
+ ///\relates AbsMap
+ template<typename M>
+ inline AbsMap<M> absMap(const M &m) {
+ return AbsMap<M>(m);
+ }
+
+ ///Converts an STL style functor to a map
+
+ ///This \ref concepts::ReadMap "read only map" returns the value
+ ///of a given functor.
+ ///
+ ///Template parameters \c K and \c V will become its
+ ///\c Key and \c Value.
+ ///In most cases they have to be given explicitly because a
+ ///functor typically does not provide \c argument_type and
+ ///\c result_type typedefs.
+ ///
+ ///Parameter \c F is the type of the used functor.
+ ///
+ ///\sa MapFunctor
+ template<typename F,
+ typename K = typename F::argument_type,
+ typename V = typename F::result_type>
+ class FunctorMap : public MapBase<K, V> {
+ F f;
+ public:
+ typedef MapBase<K, V> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ FunctorMap(const F &_f = F()) : f(_f) {}
+ /// \e
+ Value operator[](Key k) const { return f(k);}
+ };
+
+ ///Returns a \c FunctorMap class
+
+ ///This function just returns a \c FunctorMap class.
+ ///
+ ///This function is specialized for adaptable binary function
+ ///classes and C++ functions.
+ ///
+ ///\relates FunctorMap
+ template<typename K, typename V, typename F> inline
+ FunctorMap<F, K, V> functorMap(const F &f) {
+ return FunctorMap<F, K, V>(f);
+ }
+
+ template <typename F> inline
+ FunctorMap<F, typename F::argument_type, typename F::result_type>
+ functorMap(const F &f) {
+ return FunctorMap<F, typename F::argument_type,
+ typename F::result_type>(f);
+ }
+
+ template <typename K, typename V> inline
+ FunctorMap<V (*)(K), K, V> functorMap(V (*f)(K)) {
+ return FunctorMap<V (*)(K), K, V>(f);
+ }
+
+
+ ///Converts a map to an STL style (unary) functor
+
+ ///This class Converts a map to an STL style (unary) functor.
+ ///That is it provides an <tt>operator()</tt> to read its values.
+ ///
+ ///For the sake of convenience it also works as
+ ///a ususal \ref concepts::ReadMap "readable map",
+ ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist.
+ ///
+ ///\sa FunctorMap
+ template <typename M>
+ class MapFunctor : public MapBase<typename M::Key, typename M::Value> {
+ const M& m;
+ public:
+ typedef MapBase<typename M::Key, typename M::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ typedef typename M::Key argument_type;
+ typedef typename M::Value result_type;
+
+ ///Constructor
+ MapFunctor(const M &_m) : m(_m) {};
+ ///\e
+ Value operator()(Key k) const {return m[k];}
+ ///\e
+ Value operator[](Key k) const {return m[k];}
+ };
+
+ ///Returns a \c MapFunctor class
+
+ ///This function just returns a \c MapFunctor class.
+ ///\relates MapFunctor
+ template<typename M>
+ inline MapFunctor<M> mapFunctor(const M &m) {
+ return MapFunctor<M>(m);
+ }
+
+ ///Just readable version of \ref ForkWriteMap
+
+ ///This map has two \ref concepts::ReadMap "readable map"
+ ///parameters and each read request will be passed just to the
+ ///first map. This class is the just readable map type of \c ForkWriteMap.
+ ///
+ ///The \c Key and \c Value are inherited from \c M1.
+ ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
+ ///
+ ///\sa ForkWriteMap
+
+ template<typename M1, typename M2>
+ class ForkMap : public MapBase<typename M1::Key, typename M1::Value> {
+ const M1& m1;
+ const M2& m2;
+ public:
+ typedef MapBase<typename M1::Key, typename M1::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ ForkMap(const M1 &_m1, const M2 &_m2) : m1(_m1), m2(_m2) {};
+ /// \e
+ Value operator[](Key k) const {return m1[k];}
+ };
+
+
+ ///Applies all map setting operations to two maps
+
+ ///This map has two \ref concepts::WriteMap "writable map"
+ ///parameters and each write request will be passed to both of them.
+ ///If \c M1 is also \ref concepts::ReadMap "readable",
+ ///then the read operations will return the
+ ///corresponding values of \c M1.
+ ///
+ ///The \c Key and \c Value are inherited from \c M1.
+ ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
+ ///
+ ///\sa ForkMap
+ template<typename M1, typename M2>
+ class ForkWriteMap : public MapBase<typename M1::Key, typename M1::Value> {
+ M1& m1;
+ M2& m2;
+ public:
+ typedef MapBase<typename M1::Key, typename M1::Value> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ ///Constructor
+ ForkWriteMap(M1 &_m1, M2 &_m2) : m1(_m1), m2(_m2) {};
+ ///\e
+ Value operator[](Key k) const {return m1[k];}
+ ///\e
+ void set(Key k, const Value &v) {m1.set(k,v); m2.set(k,v);}
+ };
+
+ ///Returns a \c ForkMap class
+
+ ///This function just returns a \c ForkMap class.
+ ///\relates ForkMap
+ template <typename M1, typename M2>
+ inline ForkMap<M1, M2> forkMap(const M1 &m1, const M2 &m2) {
+ return ForkMap<M1, M2>(m1,m2);
+ }
+
+ ///Returns a \c ForkWriteMap class
+
+ ///This function just returns a \c ForkWriteMap class.
+ ///\relates ForkWriteMap
+ template <typename M1, typename M2>
+ inline ForkWriteMap<M1, M2> forkMap(M1 &m1, M2 &m2) {
+ return ForkWriteMap<M1, M2>(m1,m2);
+ }
+
+
+
+ /* ************* BOOL MAPS ******************* */
+
+ ///Logical 'not' of a map
+
+ ///This bool \ref concepts::ReadMap "read only map" returns the
+ ///logical negation of the value returned by the given map.
+ ///Its \c Key is inherited from \c M, its \c Value is \c bool.
+ ///
+ ///\sa NotWriteMap
+ template <typename M>
+ class NotMap : public MapBase<typename M::Key, bool> {
+ const M& m;
+ public:
+ typedef MapBase<typename M::Key, bool> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ /// Constructor
+ NotMap(const M &_m) : m(_m) {};
+ ///\e
+ Value operator[](Key k) const {return !m[k];}
+ };
+
+ ///Logical 'not' of a map (ReadWrie version)
+
+ ///This bool \ref concepts::ReadWriteMap "read-write map" returns the
+ ///logical negation of the value returned by the given map. When it is set,
+ ///the opposite value is set to the original map.
+ ///Its \c Key is inherited from \c M, its \c Value is \c bool.
+ ///
+ ///\sa NotMap
+ template <typename M>
+ class NotWriteMap : public MapBase<typename M::Key, bool> {
+ M& m;
+ public:
+ typedef MapBase<typename M::Key, bool> Parent;
+ typedef typename Parent::Key Key;
+ typedef typename Parent::Value Value;
+
+ /// Constructor
+ NotWriteMap(M &_m) : m(_m) {};
+ ///\e
+ Value operator[](Key k) const {return !m[k];}
+ ///\e
+ void set(Key k, bool v) { m.set(k, !v); }
+ };
+
+ ///Returns a \c NotMap class
+
+ ///This function just returns a \c NotMap class.
+ ///\relates NotMap
+ template <typename M>
+ inline NotMap<M> notMap(const M &m) {
+ return NotMap<M>(m);
+ }
+
+ ///Returns a \c NotWriteMap class
+
+ ///This function just returns a \c NotWriteMap class.
+ ///\relates NotWriteMap
+ template <typename M>
+ inline NotWriteMap<M> notMap(M &m) {
+ return NotWriteMap<M>(m);
+ }
+
+ namespace _maps_bits {
+
+ template <typename Value>
+ struct Identity {
+ typedef Value argument_type;
+ typedef Value result_type;
+ Value operator()(const Value& val) const {
+ return val;
+ }
+ };
+
+ template <typename _Iterator, typename Enable = void>
+ struct IteratorTraits {
+ typedef typename std::iterator_traits<_Iterator>::value_type Value;
+ };
+
+ template <typename _Iterator>
+ struct IteratorTraits<_Iterator,
+ typename exists<typename _Iterator::container_type>::type>
+ {
+ typedef typename _Iterator::container_type::value_type Value;
+ };
+
+ }
+
+
+ /// \brief Writable bool map for logging each \c true assigned element
+ ///
+ /// A \ref concepts::ReadWriteMap "read-write" bool map for logging
+ /// each \c true assigned element, i.e it copies all the keys set
+ /// to \c true to the given iterator.
+ ///
+ /// \note The container of the iterator should contain space
+ /// for each element.
+ ///
+ /// The following example shows how you can write the edges found by
+ /// the \ref Prim algorithm directly to the standard output.
+ ///\code
+ /// typedef IdMap<UGraph, UEdge> UEdgeIdMap;
+ /// UEdgeIdMap uedgeId(ugraph);
+ ///
+ /// typedef MapFunctor<UEdgeIdMap> UEdgeIdFunctor;
+ /// UEdgeIdFunctor uedgeIdFunctor(uedgeId);
+ ///
+ /// StoreBoolMap<ostream_iterator<int>, UEdgeIdFunctor>
+ /// writerMap(ostream_iterator<int>(cout, " "), uedgeIdFunctor);
+ ///
+ /// prim(ugraph, cost, writerMap);
+ ///\endcode
+ ///
+ ///\sa BackInserterBoolMap
+ ///\sa FrontInserterBoolMap
+ ///\sa InserterBoolMap
+ template <typename _Iterator,
+ typename _Functor =
+ _maps_bits::Identity<typename _maps_bits::
+ IteratorTraits<_Iterator>::Value> >
+ class StoreBoolMap {
+ public:
+ typedef _Iterator Iterator;
+
+ typedef typename _Functor::argument_type Key;
+ typedef bool Value;
+
+ typedef _Functor Functor;
+
+ /// Constructor
+ StoreBoolMap(Iterator it, const Functor& functor = Functor())
+ : _begin(it), _end(it), _functor(functor) {}
+
+ /// Gives back the given iterator set for the first key
+ Iterator begin() const {
+ return _begin;
+ }
+
+ /// Gives back the the 'after the last' iterator
+ Iterator end() const {
+ return _end;
+ }
+
+ /// The \c set function of the map
+ void set(const Key& key, Value value) const {
+ if (value) {
+ *_end++ = _functor(key);
+ }
+ }
+
+ private:
+ Iterator _begin;
+ mutable Iterator _end;
+ Functor _functor;
+ };
+
+ /// \brief Writable bool map for logging each \c true assigned element in
+ /// a back insertable container.
+ ///
+ /// Writable bool map for logging each \c true assigned element by pushing
+ /// them into a back insertable container.
+ /// It can be used to retrieve the items into a standard
+ /// container. The next example shows how you can store the
+ /// edges found by the Prim algorithm in a vector.
+ ///
+ ///\code
+ /// vector<UEdge> span_tree_uedges;
+ /// BackInserterBoolMap<vector<UEdge> > inserter_map(span_tree_uedges);
+ /// prim(ugraph, cost, inserter_map);
+ ///\endcode
+ ///
+ ///\sa StoreBoolMap
+ ///\sa FrontInserterBoolMap
+ ///\sa InserterBoolMap
+ template <typename Container,
+ typename Functor =
+ _maps_bits::Identity<typename Container::value_type> >
+ class BackInserterBoolMap {
+ public:
+ typedef typename Functor::argument_type Key;
+ typedef bool Value;
+
+ /// Constructor
+ BackInserterBoolMap(Container& _container,
+ const Functor& _functor = Functor())
+ : container(_container), functor(_functor) {}
+
+ /// The \c set function of the map
+ void set(const Key& key, Value value) {
+ if (value) {
+ container.push_back(functor(key));
+ }
+ }
+
+ private:
+ Container& container;
+ Functor functor;
+ };
+
+ /// \brief Writable bool map for logging each \c true assigned element in
+ /// a front insertable container.
+ ///
+ /// Writable bool map for logging each \c true assigned element by pushing
+ /// them into a front insertable container.
+ /// It can be used to retrieve the items into a standard
+ /// container. For example see \ref BackInserterBoolMap.
+ ///
+ ///\sa BackInserterBoolMap
+ ///\sa InserterBoolMap
+ template <typename Container,
+ typename Functor =
+ _maps_bits::Identity<typename Container::value_type> >
+ class FrontInserterBoolMap {
+ public:
+ typedef typename Functor::argument_type Key;
+ typedef bool Value;
+
+ /// Constructor
+ FrontInserterBoolMap(Container& _container,
+ const Functor& _functor = Functor())
+ : container(_container), functor(_functor) {}
+
+ /// The \c set function of the map
+ void set(const Key& key, Value value) {
+ if (value) {
+ container.push_front(functor(key));
+ }
+ }
+
+ private:
+ Container& container;
+ Functor functor;
+ };
+
+ /// \brief Writable bool map for storing each \c true assigned element in
+ /// an insertable container.
+ ///
+ /// Writable bool map for storing each \c true assigned element in an
+ /// insertable container. It will insert all the keys set to \c true into
+ /// the container.
+ ///
+ /// For example, if you want to store the cut arcs of the strongly
+ /// connected components in a set you can use the next code:
+ ///
+ ///\code
+ /// set<Edge> cut_edges;
+ /// InserterBoolMap<set<Edge> > inserter_map(cut_edges);
+ /// stronglyConnectedCutEdges(graph, cost, inserter_map);
+ ///\endcode
+ ///
+ ///\sa BackInserterBoolMap
+ ///\sa FrontInserterBoolMap
+ template <typename Container,
+ typename Functor =
+ _maps_bits::Identity<typename Container::value_type> >
+ class InserterBoolMap {
+ public:
+ typedef typename Container::value_type Key;
+ typedef bool Value;
+
+ /// Constructor with specified iterator
+
+ /// Constructor with specified iterator.
+ /// \param _container The container for storing the elements.
+ /// \param _it The elements will be inserted before this iterator.
+ /// \param _functor The functor that is used when an element is stored.
+ InserterBoolMap(Container& _container, typename Container::iterator _it,
+ const Functor& _functor = Functor())
+ : container(_container), it(_it), functor(_functor) {}
+
+ /// Constructor
+
+ /// Constructor without specified iterator.
+ /// The elements will be inserted before <tt>_container.end()</tt>.
+ /// \param _container The container for storing the elements.
+ /// \param _functor The functor that is used when an element is stored.
+ InserterBoolMap(Container& _container, const Functor& _functor = Functor())
+ : container(_container), it(_container.end()), functor(_functor) {}
+
+ /// The \c set function of the map
+ void set(const Key& key, Value value) {
+ if (value) {
+ it = container.insert(it, functor(key));
+ ++it;
+ }
+ }
+
+ private:
+ Container& container;
+ typename Container::iterator it;
+ Functor functor;
+ };
+
+ /// \brief Writable bool map for filling each \c true assigned element with a
+ /// given value.
+ ///
+ /// Writable bool map for filling each \c true assigned element with a
+ /// given value. The value can set the container.
+ ///
+ /// The following code finds the connected components of a graph
+ /// and stores it in the \c comp map:
+ ///\code
+ /// typedef UGraph::NodeMap<int> ComponentMap;
+ /// ComponentMap comp(ugraph);
+ /// typedef FillBoolMap<UGraph::NodeMap<int> > ComponentFillerMap;
+ /// ComponentFillerMap filler(comp, 0);
+ ///
+ /// Dfs<UGraph>::DefProcessedMap<ComponentFillerMap>::Create dfs(ugraph);
+ /// dfs.processedMap(filler);
+ /// dfs.init();
+ /// for (NodeIt it(ugraph); it != INVALID; ++it) {
+ /// if (!dfs.reached(it)) {
+ /// dfs.addSource(it);
+ /// dfs.start();
+ /// ++filler.fillValue();
+ /// }
+ /// }
+ ///\endcode
+ template <typename Map>
+ class FillBoolMap {
+ public:
+ typedef typename Map::Key Key;
+ typedef bool Value;
+
+ /// Constructor
+ FillBoolMap(Map& _map, const typename Map::Value& _fill)
+ : map(_map), fill(_fill) {}
+
+ /// Constructor
+ FillBoolMap(Map& _map)
+ : map(_map), fill() {}
+
+ /// Gives back the current fill value
+ const typename Map::Value& fillValue() const {
+ return fill;
+ }
+
+ /// Gives back the current fill value
+ typename Map::Value& fillValue() {
+ return fill;
+ }
+
+ /// Sets the current fill value
+ void fillValue(const typename Map::Value& _fill) {
+ fill = _fill;
+ }
+
+ /// The \c set function of the map
+ void set(const Key& key, Value value) {
+ if (value) {
+ map.set(key, fill);
+ }
+ }
+
+ private:
+ Map& map;
+ typename Map::Value fill;
+ };
+
+
+ /// \brief Writable bool map for storing the sequence number of
+ /// \c true assignments.
+ ///
+ /// Writable bool map that stores for each \c true assigned elements
+ /// the sequence number of this setting.
+ /// It makes it easy to calculate the leaving
+ /// order of the nodes in the \c Dfs algorithm.
+ ///
+ ///\code
+ /// typedef Graph::NodeMap<int> OrderMap;
+ /// OrderMap order(graph);
+ /// typedef SettingOrderBoolMap<OrderMap> OrderSetterMap;
+ /// OrderSetterMap setter(order);
+ /// Dfs<Graph>::DefProcessedMap<OrderSetterMap>::Create dfs(graph);
+ /// dfs.processedMap(setter);
+ /// dfs.init();
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!dfs.reached(it)) {
+ /// dfs.addSource(it);
+ /// dfs.start();
+ /// }
+ /// }
+ ///\endcode
+ ///
+ /// The storing of the discovering order is more difficult because the
+ /// ReachedMap should be readable in the dfs algorithm but the setting
+ /// order map is not readable. Thus we must use the fork map:
+ ///
+ ///\code
+ /// typedef Graph::NodeMap<int> OrderMap;
+ /// OrderMap order(graph);
+ /// typedef SettingOrderBoolMap<OrderMap> OrderSetterMap;
+ /// OrderSetterMap setter(order);
+ /// typedef Graph::NodeMap<bool> StoreMap;
+ /// StoreMap store(graph);
+ ///
+ /// typedef ForkWriteMap<StoreMap, OrderSetterMap> ReachedMap;
+ /// ReachedMap reached(store, setter);
+ ///
+ /// Dfs<Graph>::DefReachedMap<ReachedMap>::Create dfs(graph);
+ /// dfs.reachedMap(reached);
+ /// dfs.init();
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!dfs.reached(it)) {
+ /// dfs.addSource(it);
+ /// dfs.start();
+ /// }
+ /// }
+ ///\endcode
+ template <typename Map>
+ class SettingOrderBoolMap {
+ public:
+ typedef typename Map::Key Key;
+ typedef bool Value;
+
+ /// Constructor
+ SettingOrderBoolMap(Map& _map)
+ : map(_map), counter(0) {}
+
+ /// Number of set operations.
+ int num() const {
+ return counter;
+ }
+
+ /// The \c set function of the map
+ void set(const Key& key, Value value) {
+ if (value) {
+ map.set(key, counter++);
+ }
+ }
+
+ private:
+ Map& map;
+ int counter;
+ };
+
+ /// @}
+}
+
+#endif // LEMON_MAPS_H
diff --git a/src/lemon/math.h b/src/lemon/math.h
new file mode 100644
index 0000000..c837a83
--- /dev/null
+++ b/src/lemon/math.h
@@ -0,0 +1,63 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_MATH_H
+#define LEMON_MATH_H
+
+///\ingroup misc
+///\file
+///\brief Some extensions to the standard \c cmath library.
+///
+///Some extensions to the standard \c cmath library.
+///
+///This file includes the standard math library (cmath).
+
+#include<cmath>
+
+namespace lemon {
+
+ /// \addtogroup misc
+ /// @{
+
+ /// The Euler constant
+ const long double E = 2.7182818284590452353602874713526625L;
+ /// log_2(e)
+ const long double LOG2E = 1.4426950408889634073599246810018921L;
+ /// log_10(e)
+ const long double LOG10E = 0.4342944819032518276511289189166051L;
+ /// ln(2)
+ const long double LN2 = 0.6931471805599453094172321214581766L;
+ /// ln(10)
+ const long double LN10 = 2.3025850929940456840179914546843642L;
+ /// pi
+ const long double PI = 3.1415926535897932384626433832795029L;
+ /// pi/2
+ const long double PI_2 = 1.5707963267948966192313216916397514L;
+ /// pi/4
+ const long double PI_4 = 0.7853981633974483096156608458198757L;
+ /// sqrt(2)
+ const long double SQRT2 = 1.4142135623730950488016887242096981L;
+ /// 1/sqrt(2)
+ const long double SQRT1_2 = 0.7071067811865475244008443621048490L;
+
+
+ /// @}
+
+} //namespace lemon
+
+#endif //LEMON_TOLERANCE_H
diff --git a/src/lemon/smart_graph.h b/src/lemon/smart_graph.h
new file mode 100644
index 0000000..c47aa29
--- /dev/null
+++ b/src/lemon/smart_graph.h
@@ -0,0 +1,1163 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_SMART_GRAPH_H
+#define LEMON_SMART_GRAPH_H
+
+///\ingroup graphs
+///\file
+///\brief SmartGraph and SmartUGraph classes.
+
+#include <vector>
+
+#include <lemon/bits/invalid.h>
+
+#include <lemon/bits/base_extender.h>
+#include <lemon/bits/graph_extender.h>
+
+#include <lemon/bits/utility.h>
+#include <lemon/error.h>
+
+#include <lemon/bits/graph_extender.h>
+
+namespace lemon {
+
+ class SmartGraph;
+ ///Base of SmartGraph
+
+ ///Base of SmartGraph
+ ///
+ class SmartGraphBase {
+ protected:
+
+ struct NodeT
+ {
+ int first_in, first_out;
+ NodeT() {}
+ };
+ struct EdgeT
+ {
+ int target, source, next_in, next_out;
+ EdgeT() {}
+ };
+
+ std::vector<NodeT> nodes;
+
+ std::vector<EdgeT> edges;
+
+
+ public:
+
+ typedef SmartGraphBase Graph;
+
+ class Node;
+ class Edge;
+
+
+ public:
+
+ SmartGraphBase() : nodes(), edges() { }
+ SmartGraphBase(const SmartGraphBase &_g)
+ : nodes(_g.nodes), edges(_g.edges) { }
+
+ typedef True NodeNumTag;
+ typedef True EdgeNumTag;
+
+ int nodeNum() const { return nodes.size(); }
+ int edgeNum() const { return edges.size(); }
+
+ int maxNodeId() const { return nodes.size()-1; }
+ int maxEdgeId() const { return edges.size()-1; }
+
+ Node addNode() {
+ int n = nodes.size();
+ nodes.push_back(NodeT());
+ nodes[n].first_in = -1;
+ nodes[n].first_out = -1;
+ return Node(n);
+ }
+
+ Edge addEdge(Node u, Node v) {
+ int n = edges.size();
+ edges.push_back(EdgeT());
+ edges[n].source = u.id;
+ edges[n].target = v.id;
+ edges[n].next_out = nodes[u.id].first_out;
+ edges[n].next_in = nodes[v.id].first_in;
+ nodes[u.id].first_out = nodes[v.id].first_in = n;
+
+ return Edge(n);
+ }
+
+ void clear() {
+ edges.clear();
+ nodes.clear();
+ }
+
+ Node source(Edge e) const { return Node(edges[e.id].source); }
+ Node target(Edge e) const { return Node(edges[e.id].target); }
+
+ static int id(Node v) { return v.id; }
+ static int id(Edge e) { return e.id; }
+
+ static Node nodeFromId(int id) { return Node(id);}
+ static Edge edgeFromId(int id) { return Edge(id);}
+
+ class Node {
+ friend class SmartGraphBase;
+ friend class SmartGraph;
+
+ protected:
+ int id;
+ explicit Node(int _id) : id(_id) {}
+ public:
+ Node() {}
+ Node (Invalid) : id(-1) {}
+ bool operator==(const Node i) const {return id == i.id;}
+ bool operator!=(const Node i) const {return id != i.id;}
+ bool operator<(const Node i) const {return id < i.id;}
+ };
+
+
+ class Edge {
+ friend class SmartGraphBase;
+ friend class SmartGraph;
+
+ protected:
+ int id;
+ explicit Edge(int _id) : id(_id) {}
+ public:
+ Edge() { }
+ Edge (Invalid) : id(-1) {}
+ bool operator==(const Edge i) const {return id == i.id;}
+ bool operator!=(const Edge i) const {return id != i.id;}
+ bool operator<(const Edge i) const {return id < i.id;}
+ };
+
+ void first(Node& node) const {
+ node.id = nodes.size() - 1;
+ }
+
+ static void next(Node& node) {
+ --node.id;
+ }
+
+ void first(Edge& edge) const {
+ edge.id = edges.size() - 1;
+ }
+
+ static void next(Edge& edge) {
+ --edge.id;
+ }
+
+ void firstOut(Edge& edge, const Node& node) const {
+ edge.id = nodes[node.id].first_out;
+ }
+
+ void nextOut(Edge& edge) const {
+ edge.id = edges[edge.id].next_out;
+ }
+
+ void firstIn(Edge& edge, const Node& node) const {
+ edge.id = nodes[node.id].first_in;
+ }
+
+ void nextIn(Edge& edge) const {
+ edge.id = edges[edge.id].next_in;
+ }
+
+ };
+
+ typedef GraphExtender<SmartGraphBase> ExtendedSmartGraphBase;
+
+ ///\ingroup graphs
+ ///
+ ///\brief A smart graph class.
+ ///
+ ///This is a simple and fast graph implementation.
+ ///It is also quite memory efficient, but at the price
+ ///that <b> it does support only limited (only stack-like)
+ ///node and edge deletions</b>.
+ ///It conforms to
+ ///the \ref concepts::Graph "Graph concept" with an
+ ///important extra feature that
+ ///its maps are real \ref concepts::ReferenceMap "reference map"s.
+ ///
+ ///\sa concepts::Graph.
+ ///
+ ///\author Alpar Juttner
+ class SmartGraph : public ExtendedSmartGraphBase {
+ public:
+
+ typedef ExtendedSmartGraphBase Parent;
+
+ private:
+
+ ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
+
+ ///SmartGraph is \e not copy constructible. Use GraphCopy() instead.
+ ///
+ SmartGraph(const SmartGraph &) : ExtendedSmartGraphBase() {};
+ ///\brief Assignment of SmartGraph to another one is \e not allowed.
+ ///Use GraphCopy() instead.
+
+ ///Assignment of SmartGraph to another one is \e not allowed.
+ ///Use GraphCopy() instead.
+ void operator=(const SmartGraph &) {}
+
+ public:
+
+ /// Constructor
+
+ /// Constructor.
+ ///
+ SmartGraph() {};
+
+ ///Add a new node to the graph.
+
+ /// \return the new node.
+ ///
+ Node addNode() { return Parent::addNode(); }
+
+ ///Add a new edge to the graph.
+
+ ///Add a new edge to the graph with source node \c s
+ ///and target node \c t.
+ ///\return the new edge.
+ Edge addEdge(const Node& s, const Node& t) {
+ return Parent::addEdge(s, t);
+ }
+
+ /// \brief Using this it is possible to avoid the superfluous memory
+ /// allocation.
+
+ /// Using this it is possible to avoid the superfluous memory
+ /// allocation: if you know that the graph you want to build will
+ /// be very large (e.g. it will contain millions of nodes and/or edges)
+ /// then it is worth reserving space for this amount before starting
+ /// to build the graph.
+ /// \sa reserveEdge
+ void reserveNode(int n) { nodes.reserve(n); };
+
+ /// \brief Using this it is possible to avoid the superfluous memory
+ /// allocation.
+
+ /// Using this it is possible to avoid the superfluous memory
+ /// allocation: if you know that the graph you want to build will
+ /// be very large (e.g. it will contain millions of nodes and/or edges)
+ /// then it is worth reserving space for this amount before starting
+ /// to build the graph.
+ /// \sa reserveNode
+ void reserveEdge(int m) { edges.reserve(m); };
+
+ ///Clear the graph.
+
+ ///Erase all the nodes and edges from the graph.
+ ///
+ void clear() {
+ Parent::clear();
+ }
+
+ ///Split a node.
+
+ ///This function splits a node. First a new node is added to the graph,
+ ///then the source of each outgoing edge of \c n is moved to this new node.
+ ///If \c connect is \c true (this is the default value), then a new edge
+ ///from \c n to the newly created node is also added.
+ ///\return The newly created node.
+ ///
+ ///\note The <tt>Edge</tt>s
+ ///referencing a moved edge remain
+ ///valid. However <tt>InEdge</tt>'s and <tt>OutEdge</tt>'s
+ ///may be invalidated.
+ ///\warning This functionality cannot be used together with the Snapshot
+ ///feature.
+ ///\todo It could be implemented in a bit faster way.
+ Node split(Node n, bool connect = true)
+ {
+ Node b = addNode();
+ nodes[b.id].first_out=nodes[n.id].first_out;
+ nodes[n.id].first_out=-1;
+ for(int i=nodes[b.id].first_out;i!=-1;i++) edges[i].source=b.id;
+ if(connect) addEdge(n,b);
+ return b;
+ }
+
+ public:
+
+ class Snapshot;
+
+ protected:
+
+ void restoreSnapshot(const Snapshot &s)
+ {
+ while(s.edge_num<edges.size()) {
+ Edge edge = edgeFromId(edges.size()-1);
+ Parent::notifier(Edge()).erase(edge);
+ nodes[edges.back().source].first_out=edges.back().next_out;
+ nodes[edges.back().target].first_in=edges.back().next_in;
+ edges.pop_back();
+ }
+ while(s.node_num<nodes.size()) {
+ Node node = nodeFromId(nodes.size()-1);
+ Parent::notifier(Node()).erase(node);
+ nodes.pop_back();
+ }
+ }
+
+ public:
+
+ ///Class to make a snapshot of the graph and to restrore to it later.
+
+ ///Class to make a snapshot of the graph and to restrore to it later.
+ ///
+ ///The newly added nodes and edges can be removed using the
+ ///restore() function.
+ ///\note After you restore a state, you cannot restore
+ ///a later state, in other word you cannot add again the edges deleted
+ ///by restore() using another one Snapshot instance.
+ ///
+ ///\warning If you do not use correctly the snapshot that can cause
+ ///either broken program, invalid state of the graph, valid but
+ ///not the restored graph or no change. Because the runtime performance
+ ///the validity of the snapshot is not stored.
+ class Snapshot
+ {
+ SmartGraph *g;
+ protected:
+ friend class SmartGraph;
+ unsigned int node_num;
+ unsigned int edge_num;
+ public:
+ ///Default constructor.
+
+ ///Default constructor.
+ ///To actually make a snapshot you must call save().
+ ///
+ Snapshot() : g(0) {}
+ ///Constructor that immediately makes a snapshot
+
+ ///This constructor immediately makes a snapshot of the graph.
+ ///\param _g The graph we make a snapshot of.
+ Snapshot(SmartGraph &_g) :g(&_g) {
+ node_num=g->nodes.size();
+ edge_num=g->edges.size();
+ }
+
+ ///Make a snapshot.
+
+ ///Make a snapshot of the graph.
+ ///
+ ///This function can be called more than once. In case of a repeated
+ ///call, the previous snapshot gets lost.
+ ///\param _g The graph we make the snapshot of.
+ void save(SmartGraph &_g)
+ {
+ g=&_g;
+ node_num=g->nodes.size();
+ edge_num=g->edges.size();
+ }
+
+ ///Undo the changes until a snapshot.
+
+ ///Undo the changes until a snapshot created by save().
+ ///
+ ///\note After you restored a state, you cannot restore
+ ///a later state, in other word you cannot add again the edges deleted
+ ///by restore().
+ void restore()
+ {
+ g->restoreSnapshot(*this);
+ }
+ };
+ };
+
+
+ class SmartUGraphBase {
+
+ protected:
+
+ struct NodeT {
+ int first_out;
+ };
+
+ struct EdgeT {
+ int target;
+ int next_out;
+ };
+
+ std::vector<NodeT> nodes;
+ std::vector<EdgeT> edges;
+
+ int first_free_edge;
+
+ public:
+
+ typedef SmartUGraphBase Graph;
+
+ class Node;
+ class Edge;
+ class UEdge;
+
+ class Node {
+ friend class SmartUGraphBase;
+ protected:
+
+ int id;
+ explicit Node(int pid) { id = pid;}
+
+ public:
+ Node() {}
+ Node (Invalid) { id = -1; }
+ bool operator==(const Node& node) const {return id == node.id;}
+ bool operator!=(const Node& node) const {return id != node.id;}
+ bool operator<(const Node& node) const {return id < node.id;}
+ };
+
+ class UEdge {
+ friend class SmartUGraphBase;
+ protected:
+
+ int id;
+ explicit UEdge(int pid) { id = pid;}
+
+ public:
+ UEdge() {}
+ UEdge (Invalid) { id = -1; }
+ bool operator==(const UEdge& edge) const {return id == edge.id;}
+ bool operator!=(const UEdge& edge) const {return id != edge.id;}
+ bool operator<(const UEdge& edge) const {return id < edge.id;}
+ };
+
+ class Edge {
+ friend class SmartUGraphBase;
+ protected:
+
+ int id;
+ explicit Edge(int pid) { id = pid;}
+
+ public:
+ operator UEdge() const { return uEdgeFromId(id / 2); }
+
+ Edge() {}
+ Edge (Invalid) { id = -1; }
+ bool operator==(const Edge& edge) const {return id == edge.id;}
+ bool operator!=(const Edge& edge) const {return id != edge.id;}
+ bool operator<(const Edge& edge) const {return id < edge.id;}
+ };
+
+
+
+ SmartUGraphBase()
+ : nodes(), edges() {}
+
+
+ int maxNodeId() const { return nodes.size()-1; }
+ int maxUEdgeId() const { return edges.size() / 2 - 1; }
+ int maxEdgeId() const { return edges.size()-1; }
+
+ Node source(Edge e) const { return Node(edges[e.id ^ 1].target); }
+ Node target(Edge e) const { return Node(edges[e.id].target); }
+
+ Node source(UEdge e) const { return Node(edges[2 * e.id].target); }
+ Node target(UEdge e) const { return Node(edges[2 * e.id + 1].target); }
+
+ static bool direction(Edge e) {
+ return (e.id & 1) == 1;
+ }
+
+ static Edge direct(UEdge e, bool d) {
+ return Edge(e.id * 2 + (d ? 1 : 0));
+ }
+
+ void first(Node& node) const {
+ node.id = nodes.size() - 1;
+ }
+
+ void next(Node& node) const {
+ --node.id;
+ }
+
+ void first(Edge& edge) const {
+ edge.id = edges.size() - 1;
+ }
+
+ void next(Edge& edge) const {
+ --edge.id;
+ }
+
+ void first(UEdge& edge) const {
+ edge.id = edges.size() / 2 - 1;
+ }
+
+ void next(UEdge& edge) const {
+ --edge.id;
+ }
+
+ void firstOut(Edge &edge, const Node& v) const {
+ edge.id = nodes[v.id].first_out;
+ }
+ void nextOut(Edge &edge) const {
+ edge.id = edges[edge.id].next_out;
+ }
+
+ void firstIn(Edge &edge, const Node& v) const {
+ edge.id = ((nodes[v.id].first_out) ^ 1);
+ if (edge.id == -2) edge.id = -1;
+ }
+ void nextIn(Edge &edge) const {
+ edge.id = ((edges[edge.id ^ 1].next_out) ^ 1);
+ if (edge.id == -2) edge.id = -1;
+ }
+
+ void firstInc(UEdge &edge, bool& d, const Node& v) const {
+ int de = nodes[v.id].first_out;
+ if (de != -1) {
+ edge.id = de / 2;
+ d = ((de & 1) == 1);
+ } else {
+ edge.id = -1;
+ d = true;
+ }
+ }
+ void nextInc(UEdge &edge, bool& d) const {
+ int de = (edges[(edge.id * 2) | (d ? 1 : 0)].next_out);
+ if (de != -1) {
+ edge.id = de / 2;
+ d = ((de & 1) == 1);
+ } else {
+ edge.id = -1;
+ d = true;
+ }
+ }
+
+ static int id(Node v) { return v.id; }
+ static int id(Edge e) { return e.id; }
+ static int id(UEdge e) { return e.id; }
+
+ static Node nodeFromId(int id) { return Node(id);}
+ static Edge edgeFromId(int id) { return Edge(id);}
+ static UEdge uEdgeFromId(int id) { return UEdge(id);}
+
+ Node addNode() {
+ int n = nodes.size();
+ nodes.push_back(NodeT());
+ nodes[n].first_out = -1;
+
+ return Node(n);
+ }
+
+ UEdge addEdge(Node u, Node v) {
+ int n = edges.size();
+ edges.push_back(EdgeT());
+ edges.push_back(EdgeT());
+
+ edges[n].target = u.id;
+ edges[n | 1].target = v.id;
+
+ edges[n].next_out = nodes[v.id].first_out;
+ nodes[v.id].first_out = n;
+
+ edges[n | 1].next_out = nodes[u.id].first_out;
+ nodes[u.id].first_out = (n | 1);
+
+ return UEdge(n / 2);
+ }
+
+ void clear() {
+ edges.clear();
+ nodes.clear();
+ }
+
+ };
+
+ typedef UGraphExtender<SmartUGraphBase> ExtendedSmartUGraphBase;
+
+ /// \ingroup graphs
+ ///
+ /// \brief A smart undirected graph class.
+ ///
+ /// This is a simple and fast undirected graph implementation.
+ /// It is also quite memory efficient, but at the price
+ /// that <b> it does support only limited (only stack-like)
+ /// node and edge deletions</b>.
+ /// Except from this it conforms to
+ /// the \ref concepts::UGraph "UGraph concept".
+ ///
+ ///It also has an
+ ///important extra feature that
+ ///its maps are real \ref concepts::ReferenceMap "reference map"s.
+ ///
+ /// \sa concepts::UGraph.
+ ///
+ class SmartUGraph : public ExtendedSmartUGraphBase {
+ private:
+
+ ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead.
+
+ ///SmartUGraph is \e not copy constructible. Use UGraphCopy() instead.
+ ///
+ SmartUGraph(const SmartUGraph &) : ExtendedSmartUGraphBase() {};
+
+ ///\brief Assignment of SmartUGraph to another one is \e not allowed.
+ ///Use UGraphCopy() instead.
+
+ ///Assignment of SmartUGraph to another one is \e not allowed.
+ ///Use UGraphCopy() instead.
+ void operator=(const SmartUGraph &) {}
+
+ public:
+
+ typedef ExtendedSmartUGraphBase Parent;
+ typedef Parent::OutEdgeIt IncEdgeIt;
+
+ /// Constructor
+
+ /// Constructor.
+ ///
+ SmartUGraph() {}
+
+ ///Add a new node to the graph.
+
+ /// \return the new node.
+ ///
+ Node addNode() { return Parent::addNode(); }
+
+ ///Add a new undirected edge to the graph.
+
+ ///Add a new undirected edge to the graph with node \c s
+ ///and \c t.
+ ///\return the new undirected edge.
+ UEdge addEdge(const Node& s, const Node& t) {
+ return Parent::addEdge(s, t);
+ }
+
+ ///Clear the graph.
+
+ ///Erase all the nodes and edges from the graph.
+ ///
+ void clear() {
+ Parent::clear();
+ }
+
+ public:
+
+ class Snapshot;
+
+ protected:
+
+ void saveSnapshot(Snapshot &s)
+ {
+ s.graph = this;
+ s.node_num = nodes.size();
+ s.edge_num = edges.size();
+ }
+
+ void restoreSnapshot(const Snapshot &s)
+ {
+ while(s.edge_num<edges.size()) {
+ int n=edges.size()-1;
+ UEdge edge=uEdgeFromId(n/2);
+ Parent::notifier(UEdge()).erase(edge);
+ std::vector<Edge> dir;
+ dir.push_back(edgeFromId(n));
+ dir.push_back(edgeFromId(n-1));
+ Parent::notifier(Edge()).erase(dir);
+ nodes[edges[n].target].first_out=edges[n].next_out;
+ nodes[edges[n-1].target].first_out=edges[n-1].next_out;
+ edges.pop_back();
+ edges.pop_back();
+ }
+ while(s.node_num<nodes.size()) {
+ int n=nodes.size()-1;
+ Node node = nodeFromId(n);
+ Parent::notifier(Node()).erase(node);
+ nodes.pop_back();
+ }
+ }
+
+ public:
+
+ ///Class to make a snapshot of the graph and to restrore to it later.
+
+ ///Class to make a snapshot of the graph and to restrore to it later.
+ ///
+ ///The newly added nodes and edges can be removed using the
+ ///restore() function.
+ ///
+ ///\note After you restore a state, you cannot restore
+ ///a later state, in other word you cannot add again the edges deleted
+ ///by restore() using another one Snapshot instance.
+ ///
+ ///\warning If you do not use correctly the snapshot that can cause
+ ///either broken program, invalid state of the graph, valid but
+ ///not the restored graph or no change. Because the runtime performance
+ ///the validity of the snapshot is not stored.
+ class Snapshot
+ {
+ SmartUGraph *graph;
+ protected:
+ friend class SmartUGraph;
+ unsigned int node_num;
+ unsigned int edge_num;
+ public:
+ ///Default constructor.
+
+ ///Default constructor.
+ ///To actually make a snapshot you must call save().
+ ///
+ Snapshot() : graph(0) {}
+ ///Constructor that immediately makes a snapshot
+
+ ///This constructor immediately makes a snapshot of the graph.
+ ///\param g The graph we make a snapshot of.
+ Snapshot(SmartUGraph &g) {
+ g.saveSnapshot(*this);
+ }
+
+ ///Make a snapshot.
+
+ ///Make a snapshot of the graph.
+ ///
+ ///This function can be called more than once. In case of a repeated
+ ///call, the previous snapshot gets lost.
+ ///\param g The graph we make the snapshot of.
+ void save(SmartUGraph &g)
+ {
+ g.saveSnapshot(*this);
+ }
+
+ ///Undo the changes until a snapshot.
+
+ ///Undo the changes until a snapshot created by save().
+ ///
+ ///\note After you restored a state, you cannot restore
+ ///a later state, in other word you cannot add again the edges deleted
+ ///by restore().
+ void restore()
+ {
+ graph->restoreSnapshot(*this);
+ }
+ };
+ };
+
+
+ class SmartBpUGraphBase {
+ public:
+
+ class NodeSetError : public LogicError {
+ public:
+ virtual const char* what() const throw() {
+ return "lemon::SmartBpUGraph::NodeSetError";
+ }
+ };
+
+ protected:
+
+ struct NodeT {
+ int first;
+ NodeT() {}
+ NodeT(int _first) : first(_first) {}
+ };
+
+ struct UEdgeT {
+ int aNode, next_out;
+ int bNode, next_in;
+ };
+
+ std::vector<NodeT> aNodes;
+ std::vector<NodeT> bNodes;
+
+ std::vector<UEdgeT> edges;
+
+ public:
+
+ class Node {
+ friend class SmartBpUGraphBase;
+ protected:
+ int id;
+
+ explicit Node(int _id) : id(_id) {}
+ public:
+ Node() {}
+ Node(Invalid) : id(-1) {}
+ bool operator==(const Node i) const {return id==i.id;}
+ bool operator!=(const Node i) const {return id!=i.id;}
+ bool operator<(const Node i) const {return id<i.id;}
+ };
+
+ class UEdge {
+ friend class SmartBpUGraphBase;
+ protected:
+ int id;
+
+ UEdge(int _id) : id(_id) {}
+ public:
+ UEdge() {}
+ UEdge(Invalid) : id(-1) {}
+ bool operator==(const UEdge i) const {return id==i.id;}
+ bool operator!=(const UEdge i) const {return id!=i.id;}
+ bool operator<(const UEdge i) const {return id<i.id;}
+ };
+
+ void firstANode(Node& node) const {
+ node.id = 2 * aNodes.size() - 2;
+ if (node.id < 0) node.id = -1;
+ }
+ void nextANode(Node& node) const {
+ node.id -= 2;
+ if (node.id < 0) node.id = -1;
+ }
+
+ void firstBNode(Node& node) const {
+ node.id = 2 * bNodes.size() - 1;
+ }
+ void nextBNode(Node& node) const {
+ node.id -= 2;
+ }
+
+ void first(Node& node) const {
+ if (aNodes.size() > 0) {
+ node.id = 2 * aNodes.size() - 2;
+ } else {
+ node.id = 2 * bNodes.size() - 1;
+ }
+ }
+ void next(Node& node) const {
+ node.id -= 2;
+ if (node.id == -2) {
+ node.id = 2 * bNodes.size() - 1;
+ }
+ }
+
+ void first(UEdge& edge) const {
+ edge.id = edges.size() - 1;
+ }
+ void next(UEdge& edge) const {
+ --edge.id;
+ }
+
+ void firstFromANode(UEdge& edge, const Node& node) const {
+ LEMON_ASSERT((node.id & 1) == 0, NodeSetError());
+ edge.id = aNodes[node.id >> 1].first;
+ }
+ void nextFromANode(UEdge& edge) const {
+ edge.id = edges[edge.id].next_out;
+ }
+
+ void firstFromBNode(UEdge& edge, const Node& node) const {
+ LEMON_ASSERT((node.id & 1) == 1, NodeSetError());
+ edge.id = bNodes[node.id >> 1].first;
+ }
+ void nextFromBNode(UEdge& edge) const {
+ edge.id = edges[edge.id].next_in;
+ }
+
+ static int id(const Node& node) {
+ return node.id;
+ }
+ static Node nodeFromId(int id) {
+ return Node(id);
+ }
+ int maxNodeId() const {
+ return aNodes.size() > bNodes.size() ?
+ aNodes.size() * 2 - 2 : bNodes.size() * 2 - 1;
+ }
+
+ static int id(const UEdge& edge) {
+ return edge.id;
+ }
+ static UEdge uEdgeFromId(int id) {
+ return UEdge(id);
+ }
+ int maxUEdgeId() const {
+ return edges.size();
+ }
+
+ static int aNodeId(const Node& node) {
+ return node.id >> 1;
+ }
+ static Node nodeFromANodeId(int id) {
+ return Node(id << 1);
+ }
+ int maxANodeId() const {
+ return aNodes.size();
+ }
+
+ static int bNodeId(const Node& node) {
+ return node.id >> 1;
+ }
+ static Node nodeFromBNodeId(int id) {
+ return Node((id << 1) + 1);
+ }
+ int maxBNodeId() const {
+ return bNodes.size();
+ }
+
+ Node aNode(const UEdge& edge) const {
+ return Node(edges[edge.id].aNode);
+ }
+ Node bNode(const UEdge& edge) const {
+ return Node(edges[edge.id].bNode);
+ }
+
+ static bool aNode(const Node& node) {
+ return (node.id & 1) == 0;
+ }
+
+ static bool bNode(const Node& node) {
+ return (node.id & 1) == 1;
+ }
+
+ Node addANode() {
+ NodeT nodeT;
+ nodeT.first = -1;
+ aNodes.push_back(nodeT);
+ return Node(aNodes.size() * 2 - 2);
+ }
+
+ Node addBNode() {
+ NodeT nodeT;
+ nodeT.first = -1;
+ bNodes.push_back(nodeT);
+ return Node(bNodes.size() * 2 - 1);
+ }
+
+ UEdge addEdge(const Node& source, const Node& target) {
+ LEMON_ASSERT(((source.id ^ target.id) & 1) == 1, NodeSetError());
+ UEdgeT edgeT;
+ if ((source.id & 1) == 0) {
+ edgeT.aNode = source.id;
+ edgeT.bNode = target.id;
+ } else {
+ edgeT.aNode = target.id;
+ edgeT.bNode = source.id;
+ }
+ edgeT.next_out = aNodes[edgeT.aNode >> 1].first;
+ aNodes[edgeT.aNode >> 1].first = edges.size();
+ edgeT.next_in = bNodes[edgeT.bNode >> 1].first;
+ bNodes[edgeT.bNode >> 1].first = edges.size();
+ edges.push_back(edgeT);
+ return UEdge(edges.size() - 1);
+ }
+
+ void reserveANode(int n) { aNodes.reserve(n); };
+ void reserveBNode(int n) { bNodes.reserve(n); };
+
+ void reserveEdge(int m) { edges.reserve(m); };
+
+ void clear() {
+ aNodes.clear();
+ bNodes.clear();
+ edges.clear();
+ }
+
+ typedef True NodeNumTag;
+ int nodeNum() const { return aNodes.size() + bNodes.size(); }
+ int aNodeNum() const { return aNodes.size(); }
+ int bNodeNum() const { return bNodes.size(); }
+
+ typedef True EdgeNumTag;
+ int uEdgeNum() const { return edges.size(); }
+
+ };
+
+
+ typedef BpUGraphExtender<BidirBpUGraphExtender<SmartBpUGraphBase> >
+ ExtendedSmartBpUGraphBase;
+
+ /// \ingroup graphs
+ ///
+ /// \brief A smart bipartite undirected graph class.
+ ///
+ /// This is a simple and fast bipartite undirected graph implementation.
+ /// It is also quite memory efficient, but at the price
+ /// that <b> it does not support node and edge deletions</b>.
+ /// Except from this it conforms to
+ /// the \ref concepts::BpUGraph "BpUGraph concept".
+ ///
+ ///It also has an
+ ///important extra feature that
+ ///its maps are real \ref concepts::ReferenceMap "reference map"s.
+ ///
+ /// \sa concepts::BpUGraph.
+ ///
+ class SmartBpUGraph : public ExtendedSmartBpUGraphBase {
+ private:
+
+ /// \brief SmartBpUGraph is \e not copy constructible.
+ ///
+ ///SmartBpUGraph is \e not copy constructible.
+ SmartBpUGraph(const SmartBpUGraph &) : ExtendedSmartBpUGraphBase() {};
+
+ /// \brief Assignment of SmartBpUGraph to another one is \e not
+ /// allowed.
+ ///
+ /// Assignment of SmartBpUGraph to another one is \e not allowed.
+ void operator=(const SmartBpUGraph &) {}
+
+ public:
+
+ typedef ExtendedSmartBpUGraphBase Parent;
+
+ ///Constructor
+
+ ///Constructor.
+ ///
+ SmartBpUGraph() : ExtendedSmartBpUGraphBase() {}
+
+ ///Add a new ANode to the graph.
+
+ /// \return the new node.
+ ///
+ Node addANode() { return Parent::addANode(); }
+
+ ///Add a new BNode to the graph.
+
+ /// \return the new node.
+ ///
+ Node addBNode() { return Parent::addBNode(); }
+
+ ///Add a new undirected edge to the graph.
+
+ ///Add a new undirected edge to the graph with node \c s
+ ///and \c t.
+ ///\return the new undirected edge.
+ UEdge addEdge(const Node& s, const Node& t) {
+ return Parent::addEdge(s, t);
+ }
+
+ ///Clear the graph.
+
+ ///Erase all the nodes and edges from the graph.
+ ///
+ void clear() {
+ Parent::clear();
+ }
+
+ public:
+
+ class Snapshot;
+
+ protected:
+
+ void restoreSnapshot(const Snapshot &s)
+ {
+ while(s.edge_num<edges.size()) {
+ UEdge edge = uEdgeFromId(edges.size()-1);
+ Parent::notifier(UEdge()).erase(edge);
+ std::vector<Edge> dir;
+ dir.push_back(Parent::direct(edge, true));
+ dir.push_back(Parent::direct(edge, false));
+ Parent::notifier(Edge()).erase(dir);
+ aNodes[edges.back().aNode >> 1].first=edges.back().next_out;
+ bNodes[edges.back().bNode >> 1].first=edges.back().next_in;
+ edges.pop_back();
+ }
+ while(s.anode_num<aNodes.size()) {
+ Node node = nodeFromANodeId(aNodes.size() - 1);
+ Parent::notifier(ANode()).erase(node);
+ Parent::notifier(Node()).erase(node);
+ aNodes.pop_back();
+ }
+ while(s.bnode_num<bNodes.size()) {
+ Node node = nodeFromBNodeId(bNodes.size() - 1);
+ Parent::notifier(BNode()).erase(node);
+ Parent::notifier(Node()).erase(node);
+ bNodes.pop_back();
+ }
+ }
+
+ public:
+
+ ///Class to make a snapshot of the graph and to restrore to it later.
+
+ ///Class to make a snapshot of the graph and to restrore to it later.
+ ///
+ ///The newly added nodes and edges can be removed using the
+ ///restore() function.
+ ///
+ ///\note After you restore a state, you cannot restore
+ ///a later state, in other word you cannot add again the edges deleted
+ ///by restore() using another one Snapshot instance.
+ ///
+ ///\warning If you do not use correctly the snapshot that can cause
+ ///either broken program, invalid state of the graph, valid but
+ ///not the restored graph or no change. Because the runtime performance
+ ///the validity of the snapshot is not stored.
+ class Snapshot
+ {
+ SmartBpUGraph *g;
+ protected:
+ friend class SmartBpUGraph;
+ unsigned int anode_num;
+ unsigned int bnode_num;
+ unsigned int edge_num;
+ public:
+ ///Default constructor.
+
+ ///Default constructor.
+ ///To actually make a snapshot you must call save().
+ ///
+ Snapshot() : g(0) {}
+
+ ///Constructor that immediately makes a snapshot
+
+ ///This constructor immediately makes a snapshot of the graph.
+ ///\param _g The graph we make a snapshot of.
+ Snapshot(SmartBpUGraph &_g) : g(&_g) {
+ anode_num=g->aNodes.size();
+ bnode_num=g->bNodes.size();
+ edge_num=g->edges.size();
+ }
+
+ ///Make a snapshot.
+
+ ///Make a snapshot of the graph.
+ ///
+ ///This function can be called more than once. In case of a repeated
+ ///call, the previous snapshot gets lost.
+ ///\param _g The graph we make the snapshot of.
+ void save(SmartBpUGraph &_g)
+ {
+ g=&_g;
+ anode_num=g->aNodes.size();
+ bnode_num=g->bNodes.size();
+ edge_num=g->edges.size();
+ }
+
+ ///Undo the changes until a snapshot.
+
+ ///Undo the changes until a snapshot created by save().
+ ///
+ ///\note After you restored a state, you cannot restore
+ ///a later state, in other word you cannot add again the edges deleted
+ ///by restore().
+ void restore()
+ {
+ g->restoreSnapshot(*this);
+ }
+ };
+ };
+
+
+ /// @}
+} //namespace lemon
+
+
+#endif //LEMON_SMART_GRAPH_H
diff --git a/src/lemon/tolerance.h b/src/lemon/tolerance.h
new file mode 100644
index 0000000..75c7e71
--- /dev/null
+++ b/src/lemon/tolerance.h
@@ -0,0 +1,454 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_TOLERANCE_H
+#define LEMON_TOLERANCE_H
+
+///\ingroup misc
+///\file
+///\brief A basic tool to handle the anomalies of calculation with
+///floating point numbers.
+///
+///\todo It should be in a module like "Basic tools"
+
+
+namespace lemon {
+
+ /// \addtogroup misc
+ /// @{
+
+ ///\brief A class to provide a basic way to
+ ///handle the comparison of numbers that are obtained
+ ///as a result of a probably inexact computation.
+ ///
+ ///Tolerance is a class to provide a basic way to
+ ///handle the comparison of numbers that are obtained
+ ///as a result of a probably inexact computation.
+ ///
+ ///This is an abstract class, it should be specialized for all numerical
+ ///data types. These specialized classes like \ref Tolerance\<double\>
+ ///may offer additional tuning parameters.
+ ///
+ ///\sa Tolerance<float>
+ ///\sa Tolerance<double>
+ ///\sa Tolerance<long double>
+ ///\sa Tolerance<int>
+ ///\sa Tolerance<long long int>
+ ///\sa Tolerance<unsigned int>
+ ///\sa Tolerance<unsigned long long int>
+
+ template<class T>
+ class Tolerance
+ {
+ public:
+ typedef T Value;
+
+ ///\name Comparisons
+ ///The concept is that these bool functions return with \c true only if
+ ///the related comparisons hold even if some numerical error appeared
+ ///during the computations.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ static bool less(Value a,Value b) {return false;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ static bool different(Value a,Value b) {return false;}
+ ///Returns \c true if \c a is \e surely positive
+ static bool positive(Value a) {return false;}
+ ///Returns \c true if \c a is \e surely negative
+ static bool negative(Value a) {return false;}
+ ///Returns \c true if \c a is \e surely non-zero
+ static bool nonZero(Value a) {return false;}
+
+ ///@}
+
+ ///Returns the zero value.
+ static Value zero() {return T();}
+
+ // static bool finite(Value a) {}
+ // static Value big() {}
+ // static Value negativeBig() {}
+ };
+
+
+ ///Float specialization of \ref Tolerance.
+
+ ///Float specialization of \ref Tolerance.
+ ///\sa Tolerance
+ ///\relates Tolerance
+ template<>
+ class Tolerance<float>
+ {
+ static float def_epsilon;
+ float _epsilon;
+ public:
+ ///\e
+ typedef float Value;
+
+ ///Constructor setting the epsilon tolerance to the default value.
+ Tolerance() : _epsilon(def_epsilon) {}
+ ///Constructor setting the epsilon tolerance.
+ Tolerance(float e) : _epsilon(e) {}
+
+ ///Return the epsilon value.
+ Value epsilon() const {return _epsilon;}
+ ///Set the epsilon value.
+ void epsilon(Value e) {_epsilon=e;}
+
+ ///Return the default epsilon value.
+ static Value defaultEpsilon() {return def_epsilon;}
+ ///Set the default epsilon value.
+ static void defaultEpsilon(Value e) {def_epsilon=e;}
+
+ ///\name Comparisons
+ ///See class Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ bool less(Value a,Value b) const {return a+_epsilon<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
+ ///Returns \c true if \c a is \e surely positive
+ bool positive(Value a) const { return _epsilon<a; }
+ ///Returns \c true if \c a is \e surely negative
+ bool negative(Value a) const { return -_epsilon>a; }
+ ///Returns \c true if \c a is \e surely non-zero
+ bool nonZero(Value a) const { return positive(a)||negative(a); };
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+ ///Double specialization of \ref Tolerance.
+
+ ///Double specialization of \ref Tolerance.
+ ///\sa Tolerance
+ ///\relates Tolerance
+ template<>
+ class Tolerance<double>
+ {
+ static double def_epsilon;
+ double _epsilon;
+ public:
+ ///\e
+ typedef double Value;
+
+ ///Constructor setting the epsilon tolerance to the default value.
+ Tolerance() : _epsilon(def_epsilon) {}
+ ///Constructor setting the epsilon tolerance.
+ Tolerance(double e) : _epsilon(e) {}
+
+ ///Return the epsilon value.
+ Value epsilon() const {return _epsilon;}
+ ///Set the epsilon value.
+ void epsilon(Value e) {_epsilon=e;}
+
+ ///Return the default epsilon value.
+ static Value defaultEpsilon() {return def_epsilon;}
+ ///Set the default epsilon value.
+ static void defaultEpsilon(Value e) {def_epsilon=e;}
+
+ ///\name Comparisons
+ ///See class Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ bool less(Value a,Value b) const {return a+_epsilon<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
+ ///Returns \c true if \c a is \e surely positive
+ bool positive(Value a) const { return _epsilon<a; }
+ ///Returns \c true if \c a is \e surely negative
+ bool negative(Value a) const { return -_epsilon>a; }
+ ///Returns \c true if \c a is \e surely non-zero
+ bool nonZero(Value a) const { return positive(a)||negative(a); };
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+ ///Long double specialization of \ref Tolerance.
+
+ ///Long double specialization of \ref Tolerance.
+ ///\sa Tolerance
+ ///\relates Tolerance
+ template<>
+ class Tolerance<long double>
+ {
+ static long double def_epsilon;
+ long double _epsilon;
+ public:
+ ///\e
+ typedef long double Value;
+
+ ///Constructor setting the epsilon tolerance to the default value.
+ Tolerance() : _epsilon(def_epsilon) {}
+ ///Constructor setting the epsilon tolerance.
+ Tolerance(long double e) : _epsilon(e) {}
+
+ ///Return the epsilon value.
+ Value epsilon() const {return _epsilon;}
+ ///Set the epsilon value.
+ void epsilon(Value e) {_epsilon=e;}
+
+ ///Return the default epsilon value.
+ static Value defaultEpsilon() {return def_epsilon;}
+ ///Set the default epsilon value.
+ static void defaultEpsilon(Value e) {def_epsilon=e;}
+
+ ///\name Comparisons
+ ///See class Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ bool less(Value a,Value b) const {return a+_epsilon<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
+ ///Returns \c true if \c a is \e surely positive
+ bool positive(Value a) const { return _epsilon<a; }
+ ///Returns \c true if \c a is \e surely negative
+ bool negative(Value a) const { return -_epsilon>a; }
+ ///Returns \c true if \c a is \e surely non-zero
+ bool nonZero(Value a) const { return positive(a)||negative(a); };
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+ ///Integer specialization of \ref Tolerance.
+
+ ///Integer specialization of \ref Tolerance.
+ ///\sa Tolerance
+ template<>
+ class Tolerance<int>
+ {
+ public:
+ ///\e
+ typedef int Value;
+
+ ///\name Comparisons
+ ///See \ref Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ static bool less(Value a,Value b) { return a<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ static bool different(Value a,Value b) { return a!=b; }
+ ///Returns \c true if \c a is \e surely positive
+ static bool positive(Value a) { return 0<a; }
+ ///Returns \c true if \c a is \e surely negative
+ static bool negative(Value a) { return 0>a; }
+ ///Returns \c true if \c a is \e surely non-zero
+ static bool nonZero(Value a) { return a!=0; };
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+ ///Unsigned integer specialization of \ref Tolerance.
+
+ ///Unsigned integer specialization of \ref Tolerance.
+ ///\sa Tolerance
+ template<>
+ class Tolerance<unsigned int>
+ {
+ public:
+ ///\e
+ typedef unsigned int Value;
+
+ ///\name Comparisons
+ ///See \ref Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ static bool less(Value a,Value b) { return a<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ static bool different(Value a,Value b) { return a!=b; }
+ ///Returns \c true if \c a is \e surely positive
+ static bool positive(Value a) { return 0<a; }
+ ///Returns \c true if \c a is \e surely negative
+ static bool negative(Value) { return false; }
+ ///Returns \c true if \c a is \e surely non-zero
+ static bool nonZero(Value a) { return a!=0; };
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+
+ ///Long integer specialization of \ref Tolerance.
+
+ ///Long integer specialization of \ref Tolerance.
+ ///\sa Tolerance
+ template<>
+ class Tolerance<long int>
+ {
+ public:
+ ///\e
+ typedef long int Value;
+
+ ///\name Comparisons
+ ///See \ref Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ static bool less(Value a,Value b) { return a<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ static bool different(Value a,Value b) { return a!=b; }
+ ///Returns \c true if \c a is \e surely positive
+ static bool positive(Value a) { return 0<a; }
+ ///Returns \c true if \c a is \e surely negative
+ static bool negative(Value a) { return 0>a; }
+ ///Returns \c true if \c a is \e surely non-zero
+ static bool nonZero(Value a) { return a!=0;};
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+ ///Unsigned long integer specialization of \ref Tolerance.
+
+ ///Unsigned long integer specialization of \ref Tolerance.
+ ///\sa Tolerance
+ template<>
+ class Tolerance<unsigned long int>
+ {
+ public:
+ ///\e
+ typedef unsigned long int Value;
+
+ ///\name Comparisons
+ ///See \ref Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ static bool less(Value a,Value b) { return a<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ static bool different(Value a,Value b) { return a!=b; }
+ ///Returns \c true if \c a is \e surely positive
+ static bool positive(Value a) { return 0<a; }
+ ///Returns \c true if \c a is \e surely negative
+ static bool negative(Value) { return false; }
+ ///Returns \c true if \c a is \e surely non-zero
+ static bool nonZero(Value a) { return a!=0;};
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+#if defined __GNUC__ && !defined __STRICT_ANSI__
+
+ ///Long long integer specialization of \ref Tolerance.
+
+ ///Long long integer specialization of \ref Tolerance.
+ ///\warning This class (more exactly, type <tt>long long</tt>)
+ ///is not ansi compatible.
+ ///\sa Tolerance
+ template<>
+ class Tolerance<long long int>
+ {
+ public:
+ ///\e
+ typedef long long int Value;
+
+ ///\name Comparisons
+ ///See \ref Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ static bool less(Value a,Value b) { return a<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ static bool different(Value a,Value b) { return a!=b; }
+ ///Returns \c true if \c a is \e surely positive
+ static bool positive(Value a) { return 0<a; }
+ ///Returns \c true if \c a is \e surely negative
+ static bool negative(Value a) { return 0>a; }
+ ///Returns \c true if \c a is \e surely non-zero
+ static bool nonZero(Value a) { return a!=0;};
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+ ///Unsigned long long integer specialization of \ref Tolerance.
+
+ ///Unsigned long long integer specialization of \ref Tolerance.
+ ///\warning This class (more exactly, type <tt>unsigned long long</tt>)
+ ///is not ansi compatible.
+ ///\sa Tolerance
+ template<>
+ class Tolerance<unsigned long long int>
+ {
+ public:
+ ///\e
+ typedef unsigned long long int Value;
+
+ ///\name Comparisons
+ ///See \ref Tolerance for more details.
+
+ ///@{
+
+ ///Returns \c true if \c a is \e surely strictly less than \c b
+ static bool less(Value a,Value b) { return a<b;}
+ ///Returns \c true if \c a is \e surely different from \c b
+ static bool different(Value a,Value b) { return a!=b; }
+ ///Returns \c true if \c a is \e surely positive
+ static bool positive(Value a) { return 0<a; }
+ ///Returns \c true if \c a is \e surely negative
+ static bool negative(Value) { return false; }
+ ///Returns \c true if \c a is \e surely non-zero
+ static bool nonZero(Value a) { return a!=0;};
+
+ ///@}
+
+ ///Returns zero
+ static Value zero() {return 0;}
+ };
+
+#endif
+
+ /// @}
+
+} //namespace lemon
+
+#endif //LEMON_TOLERANCE_H
diff --git a/src/lemon/topology.h b/src/lemon/topology.h
new file mode 100644
index 0000000..8bec384
--- /dev/null
+++ b/src/lemon/topology.h
@@ -0,0 +1,1590 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_TOPOLOGY_H
+#define LEMON_TOPOLOGY_H
+
+#include <lemon/dfs.h>
+#include <lemon/bfs.h>
+#include <lemon/graph_utils.h>
+#include <lemon/graph_adaptor.h>
+#include <lemon/maps.h>
+
+#include <lemon/concepts/graph.h>
+#include <lemon/concepts/ugraph.h>
+#include <lemon/concept_check.h>
+
+#include <lemon/bin_heap.h>
+#include <lemon/bucket_heap.h>
+
+#include <stack>
+#include <functional>
+
+/// \ingroup graph_prop
+/// \file
+/// \brief Topology related algorithms
+///
+/// Topology related algorithms
+
+namespace lemon {
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Check that the given undirected graph is connected.
+ ///
+ /// Check that the given undirected graph connected.
+ /// \param graph The undirected graph.
+ /// \return %True when there is path between any two nodes in the graph.
+ /// \note By definition, the empty graph is connected.
+ template <typename UGraph>
+ bool connected(const UGraph& graph) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::NodeIt NodeIt;
+ if (NodeIt(graph) == INVALID) return true;
+ Dfs<UGraph> dfs(graph);
+ dfs.run(NodeIt(graph));
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Count the number of connected components of an undirected graph
+ ///
+ /// Count the number of connected components of an undirected graph
+ ///
+ /// \param graph The graph. It should be undirected.
+ /// \return The number of components
+ /// \note By definition, the empty graph consists
+ /// of zero connected components.
+ template <typename UGraph>
+ int countConnectedComponents(const UGraph &graph) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::Node Node;
+ typedef typename UGraph::Edge Edge;
+
+ typedef NullMap<Node, Edge> PredMap;
+ typedef NullMap<Node, int> DistMap;
+
+ int compNum = 0;
+ typename Bfs<UGraph>::
+ template DefPredMap<PredMap>::
+ template DefDistMap<DistMap>::
+ Create bfs(graph);
+
+ PredMap predMap;
+ bfs.predMap(predMap);
+
+ DistMap distMap;
+ bfs.distMap(distMap);
+
+ bfs.init();
+ for(typename UGraph::NodeIt n(graph); n != INVALID; ++n) {
+ if (!bfs.reached(n)) {
+ bfs.addSource(n);
+ bfs.start();
+ ++compNum;
+ }
+ }
+ return compNum;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Find the connected components of an undirected graph
+ ///
+ /// Find the connected components of an undirected graph.
+ ///
+ /// \image html connected_components.png
+ /// \image latex connected_components.eps "Connected components" width=\textwidth
+ ///
+ /// \param graph The graph. It should be undirected.
+ /// \retval compMap A writable node map. The values will be set from 0 to
+ /// the number of the connected components minus one. Each values of the map
+ /// will be set exactly once, the values of a certain component will be
+ /// set continuously.
+ /// \return The number of components
+ ///
+ template <class UGraph, class NodeMap>
+ int connectedComponents(const UGraph &graph, NodeMap &compMap) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::Node Node;
+ typedef typename UGraph::Edge Edge;
+ checkConcept<concepts::WriteMap<Node, int>, NodeMap>();
+
+ typedef NullMap<Node, Edge> PredMap;
+ typedef NullMap<Node, int> DistMap;
+
+ int compNum = 0;
+ typename Bfs<UGraph>::
+ template DefPredMap<PredMap>::
+ template DefDistMap<DistMap>::
+ Create bfs(graph);
+
+ PredMap predMap;
+ bfs.predMap(predMap);
+
+ DistMap distMap;
+ bfs.distMap(distMap);
+
+ bfs.init();
+ for(typename UGraph::NodeIt n(graph); n != INVALID; ++n) {
+ if(!bfs.reached(n)) {
+ bfs.addSource(n);
+ while (!bfs.emptyQueue()) {
+ compMap.set(bfs.nextNode(), compNum);
+ bfs.processNextNode();
+ }
+ ++compNum;
+ }
+ }
+ return compNum;
+ }
+
+ namespace _topology_bits {
+
+ template <typename Graph, typename Iterator >
+ struct LeaveOrderVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ LeaveOrderVisitor(Iterator it) : _it(it) {}
+
+ void leave(const Node& node) {
+ *(_it++) = node;
+ }
+
+ private:
+ Iterator _it;
+ };
+
+ template <typename Graph, typename Map>
+ struct FillMapVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Map::Value Value;
+
+ FillMapVisitor(Map& map, Value& value)
+ : _map(map), _value(value) {}
+
+ void reach(const Node& node) {
+ _map.set(node, _value);
+ }
+ private:
+ Map& _map;
+ Value& _value;
+ };
+
+ template <typename Graph, typename EdgeMap>
+ struct StronglyConnectedCutEdgesVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+
+ StronglyConnectedCutEdgesVisitor(const Graph& graph, EdgeMap& cutMap,
+ int& cutNum)
+ : _graph(graph), _cutMap(cutMap), _cutNum(cutNum),
+ _compMap(graph), _num(0) {
+ }
+
+ void stop(const Node&) {
+ ++_num;
+ }
+
+ void reach(const Node& node) {
+ _compMap.set(node, _num);
+ }
+
+ void examine(const Edge& edge) {
+ if (_compMap[_graph.source(edge)] != _compMap[_graph.target(edge)]) {
+ _cutMap.set(edge, true);
+ ++_cutNum;
+ }
+ }
+ private:
+ const Graph& _graph;
+ EdgeMap& _cutMap;
+ int& _cutNum;
+
+ typename Graph::template NodeMap<int> _compMap;
+ int _num;
+ };
+
+ }
+
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Check that the given directed graph is strongly connected.
+ ///
+ /// Check that the given directed graph is strongly connected. The
+ /// graph is strongly connected when any two nodes of the graph are
+ /// connected with directed paths in both direction.
+ /// \return %False when the graph is not strongly connected.
+ /// \see connected
+ ///
+ /// \note By definition, the empty graph is strongly connected.
+ template <typename Graph>
+ bool stronglyConnected(const Graph& graph) {
+ checkConcept<concepts::Graph, Graph>();
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+
+ if (NodeIt(graph) == INVALID) return true;
+
+ using namespace _topology_bits;
+
+ typedef DfsVisitor<Graph> Visitor;
+ Visitor visitor;
+
+ DfsVisit<Graph, Visitor> dfs(graph, visitor);
+ dfs.init();
+ dfs.addSource(NodeIt(graph));
+ dfs.start();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ return false;
+ }
+ }
+
+ typedef RevGraphAdaptor<const Graph> RGraph;
+ RGraph rgraph(graph);
+
+ typedef DfsVisitor<Graph> RVisitor;
+ RVisitor rvisitor;
+
+ DfsVisit<RGraph, RVisitor> rdfs(rgraph, rvisitor);
+ rdfs.init();
+ rdfs.addSource(NodeIt(graph));
+ rdfs.start();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!rdfs.reached(it)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Count the strongly connected components of a directed graph
+ ///
+ /// Count the strongly connected components of a directed graph.
+ /// The strongly connected components are the classes of an
+ /// equivalence relation on the nodes of the graph. Two nodes are in
+ /// the same class if they are connected with directed paths in both
+ /// direction.
+ ///
+ /// \param graph The graph.
+ /// \return The number of components
+ /// \note By definition, the empty graph has zero
+ /// strongly connected components.
+ template <typename Graph>
+ int countStronglyConnectedComponents(const Graph& graph) {
+ checkConcept<concepts::Graph, Graph>();
+
+ using namespace _topology_bits;
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::NodeIt NodeIt;
+ typedef typename Graph::EdgeIt EdgeIt;
+
+ typedef std::vector<Node> Container;
+ typedef typename Container::iterator Iterator;
+
+ Container nodes(countNodes(graph));
+ typedef LeaveOrderVisitor<Graph, Iterator> Visitor;
+ Visitor visitor(nodes.begin());
+
+ DfsVisit<Graph, Visitor> dfs(graph, visitor);
+ dfs.init();
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+
+ typedef typename Container::reverse_iterator RIterator;
+ typedef RevGraphAdaptor<const Graph> RGraph;
+
+ RGraph rgraph(graph);
+
+ typedef DfsVisitor<Graph> RVisitor;
+ RVisitor rvisitor;
+
+ DfsVisit<RGraph, RVisitor> rdfs(rgraph, rvisitor);
+
+ int compNum = 0;
+
+ rdfs.init();
+ for (RIterator it = nodes.rbegin(); it != nodes.rend(); ++it) {
+ if (!rdfs.reached(*it)) {
+ rdfs.addSource(*it);
+ rdfs.start();
+ ++compNum;
+ }
+ }
+ return compNum;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Find the strongly connected components of a directed graph
+ ///
+ /// Find the strongly connected components of a directed graph. The
+ /// strongly connected components are the classes of an equivalence
+ /// relation on the nodes of the graph. Two nodes are in
+ /// relationship when there are directed paths between them in both
+ /// direction. In addition, the numbering of components will satisfy
+ /// that there is no edge going from a higher numbered component to
+ /// a lower.
+ ///
+ /// \image html strongly_connected_components.png
+ /// \image latex strongly_connected_components.eps "Strongly connected components" width=\textwidth
+ ///
+ /// \param graph The graph.
+ /// \retval compMap A writable node map. The values will be set from 0 to
+ /// the number of the strongly connected components minus one. Each value
+ /// of the map will be set exactly once, the values of a certain component
+ /// will be set continuously.
+ /// \return The number of components
+ ///
+ template <typename Graph, typename NodeMap>
+ int stronglyConnectedComponents(const Graph& graph, NodeMap& compMap) {
+ checkConcept<concepts::Graph, Graph>();
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+ checkConcept<concepts::WriteMap<Node, int>, NodeMap>();
+
+ using namespace _topology_bits;
+
+ typedef std::vector<Node> Container;
+ typedef typename Container::iterator Iterator;
+
+ Container nodes(countNodes(graph));
+ typedef LeaveOrderVisitor<Graph, Iterator> Visitor;
+ Visitor visitor(nodes.begin());
+
+ DfsVisit<Graph, Visitor> dfs(graph, visitor);
+ dfs.init();
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+
+ typedef typename Container::reverse_iterator RIterator;
+ typedef RevGraphAdaptor<const Graph> RGraph;
+
+ RGraph rgraph(graph);
+
+ int compNum = 0;
+
+ typedef FillMapVisitor<RGraph, NodeMap> RVisitor;
+ RVisitor rvisitor(compMap, compNum);
+
+ DfsVisit<RGraph, RVisitor> rdfs(rgraph, rvisitor);
+
+ rdfs.init();
+ for (RIterator it = nodes.rbegin(); it != nodes.rend(); ++it) {
+ if (!rdfs.reached(*it)) {
+ rdfs.addSource(*it);
+ rdfs.start();
+ ++compNum;
+ }
+ }
+ return compNum;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Find the cut edges of the strongly connected components.
+ ///
+ /// Find the cut edges of the strongly connected components.
+ /// The strongly connected components are the classes of an equivalence
+ /// relation on the nodes of the graph. Two nodes are in relationship
+ /// when there are directed paths between them in both direction.
+ /// The strongly connected components are separated by the cut edges.
+ ///
+ /// \param graph The graph.
+ /// \retval cutMap A writable node map. The values will be set true when the
+ /// edge is a cut edge.
+ ///
+ /// \return The number of cut edges
+ template <typename Graph, typename EdgeMap>
+ int stronglyConnectedCutEdges(const Graph& graph, EdgeMap& cutMap) {
+ checkConcept<concepts::Graph, Graph>();
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::NodeIt NodeIt;
+ checkConcept<concepts::WriteMap<Edge, bool>, EdgeMap>();
+
+ using namespace _topology_bits;
+
+ typedef std::vector<Node> Container;
+ typedef typename Container::iterator Iterator;
+
+ Container nodes(countNodes(graph));
+ typedef LeaveOrderVisitor<Graph, Iterator> Visitor;
+ Visitor visitor(nodes.begin());
+
+ DfsVisit<Graph, Visitor> dfs(graph, visitor);
+ dfs.init();
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+
+ typedef typename Container::reverse_iterator RIterator;
+ typedef RevGraphAdaptor<const Graph> RGraph;
+
+ RGraph rgraph(graph);
+
+ int cutNum = 0;
+
+ typedef StronglyConnectedCutEdgesVisitor<RGraph, EdgeMap> RVisitor;
+ RVisitor rvisitor(rgraph, cutMap, cutNum);
+
+ DfsVisit<RGraph, RVisitor> rdfs(rgraph, rvisitor);
+
+ rdfs.init();
+ for (RIterator it = nodes.rbegin(); it != nodes.rend(); ++it) {
+ if (!rdfs.reached(*it)) {
+ rdfs.addSource(*it);
+ rdfs.start();
+ }
+ }
+ return cutNum;
+ }
+
+ namespace _topology_bits {
+
+ template <typename Graph>
+ class CountBiNodeConnectedComponentsVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::UEdge UEdge;
+
+ CountBiNodeConnectedComponentsVisitor(const Graph& graph, int &compNum)
+ : _graph(graph), _compNum(compNum),
+ _numMap(graph), _retMap(graph), _predMap(graph), _num(0) {}
+
+ void start(const Node& node) {
+ _predMap.set(node, INVALID);
+ }
+
+ void reach(const Node& node) {
+ _numMap.set(node, _num);
+ _retMap.set(node, _num);
+ ++_num;
+ }
+
+ void discover(const Edge& edge) {
+ _predMap.set(_graph.target(edge), _graph.source(edge));
+ }
+
+ void examine(const Edge& edge) {
+ if (_graph.source(edge) == _graph.target(edge) &&
+ _graph.direction(edge)) {
+ ++_compNum;
+ return;
+ }
+ if (_predMap[_graph.source(edge)] == _graph.target(edge)) {
+ return;
+ }
+ if (_retMap[_graph.source(edge)] > _numMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _numMap[_graph.target(edge)]);
+ }
+ }
+
+ void backtrack(const Edge& edge) {
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ if (_numMap[_graph.source(edge)] <= _retMap[_graph.target(edge)]) {
+ ++_compNum;
+ }
+ }
+
+ private:
+ const Graph& _graph;
+ int& _compNum;
+
+ typename Graph::template NodeMap<int> _numMap;
+ typename Graph::template NodeMap<int> _retMap;
+ typename Graph::template NodeMap<Node> _predMap;
+ int _num;
+ };
+
+ template <typename Graph, typename EdgeMap>
+ class BiNodeConnectedComponentsVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::UEdge UEdge;
+
+ BiNodeConnectedComponentsVisitor(const Graph& graph,
+ EdgeMap& compMap, int &compNum)
+ : _graph(graph), _compMap(compMap), _compNum(compNum),
+ _numMap(graph), _retMap(graph), _predMap(graph), _num(0) {}
+
+ void start(const Node& node) {
+ _predMap.set(node, INVALID);
+ }
+
+ void reach(const Node& node) {
+ _numMap.set(node, _num);
+ _retMap.set(node, _num);
+ ++_num;
+ }
+
+ void discover(const Edge& edge) {
+ Node target = _graph.target(edge);
+ _predMap.set(target, edge);
+ _edgeStack.push(edge);
+ }
+
+ void examine(const Edge& edge) {
+ Node source = _graph.source(edge);
+ Node target = _graph.target(edge);
+ if (source == target && _graph.direction(edge)) {
+ _compMap.set(edge, _compNum);
+ ++_compNum;
+ return;
+ }
+ if (_numMap[target] < _numMap[source]) {
+ if (_predMap[source] != _graph.oppositeEdge(edge)) {
+ _edgeStack.push(edge);
+ }
+ }
+ if (_predMap[source] != INVALID &&
+ target == _graph.source(_predMap[source])) {
+ return;
+ }
+ if (_retMap[source] > _numMap[target]) {
+ _retMap.set(source, _numMap[target]);
+ }
+ }
+
+ void backtrack(const Edge& edge) {
+ Node source = _graph.source(edge);
+ Node target = _graph.target(edge);
+ if (_retMap[source] > _retMap[target]) {
+ _retMap.set(source, _retMap[target]);
+ }
+ if (_numMap[source] <= _retMap[target]) {
+ while (_edgeStack.top() != edge) {
+ _compMap.set(_edgeStack.top(), _compNum);
+ _edgeStack.pop();
+ }
+ _compMap.set(edge, _compNum);
+ _edgeStack.pop();
+ ++_compNum;
+ }
+ }
+
+ private:
+ const Graph& _graph;
+ EdgeMap& _compMap;
+ int& _compNum;
+
+ typename Graph::template NodeMap<int> _numMap;
+ typename Graph::template NodeMap<int> _retMap;
+ typename Graph::template NodeMap<Edge> _predMap;
+ std::stack<UEdge> _edgeStack;
+ int _num;
+ };
+
+
+ template <typename Graph, typename NodeMap>
+ class BiNodeConnectedCutNodesVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::UEdge UEdge;
+
+ BiNodeConnectedCutNodesVisitor(const Graph& graph, NodeMap& cutMap,
+ int& cutNum)
+ : _graph(graph), _cutMap(cutMap), _cutNum(cutNum),
+ _numMap(graph), _retMap(graph), _predMap(graph), _num(0) {}
+
+ void start(const Node& node) {
+ _predMap.set(node, INVALID);
+ rootCut = false;
+ }
+
+ void reach(const Node& node) {
+ _numMap.set(node, _num);
+ _retMap.set(node, _num);
+ ++_num;
+ }
+
+ void discover(const Edge& edge) {
+ _predMap.set(_graph.target(edge), _graph.source(edge));
+ }
+
+ void examine(const Edge& edge) {
+ if (_graph.source(edge) == _graph.target(edge) &&
+ _graph.direction(edge)) {
+ if (!_cutMap[_graph.source(edge)]) {
+ _cutMap.set(_graph.source(edge), true);
+ ++_cutNum;
+ }
+ return;
+ }
+ if (_predMap[_graph.source(edge)] == _graph.target(edge)) return;
+ if (_retMap[_graph.source(edge)] > _numMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _numMap[_graph.target(edge)]);
+ }
+ }
+
+ void backtrack(const Edge& edge) {
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ if (_numMap[_graph.source(edge)] <= _retMap[_graph.target(edge)]) {
+ if (_predMap[_graph.source(edge)] != INVALID) {
+ if (!_cutMap[_graph.source(edge)]) {
+ _cutMap.set(_graph.source(edge), true);
+ ++_cutNum;
+ }
+ } else if (rootCut) {
+ if (!_cutMap[_graph.source(edge)]) {
+ _cutMap.set(_graph.source(edge), true);
+ ++_cutNum;
+ }
+ } else {
+ rootCut = true;
+ }
+ }
+ }
+
+ private:
+ const Graph& _graph;
+ NodeMap& _cutMap;
+ int& _cutNum;
+
+ typename Graph::template NodeMap<int> _numMap;
+ typename Graph::template NodeMap<int> _retMap;
+ typename Graph::template NodeMap<Node> _predMap;
+ std::stack<UEdge> _edgeStack;
+ int _num;
+ bool rootCut;
+ };
+
+ }
+
+ template <typename UGraph>
+ int countBiNodeConnectedComponents(const UGraph& graph);
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Checks the graph is bi-node-connected.
+ ///
+ /// This function checks that the undirected graph is bi-node-connected
+ /// graph. The graph is bi-node-connected if any two undirected edge is
+ /// on same circle.
+ ///
+ /// \param graph The graph.
+ /// \return %True when the graph bi-node-connected.
+ template <typename UGraph>
+ bool biNodeConnected(const UGraph& graph) {
+ return countBiNodeConnectedComponents(graph) == 1;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Count the biconnected components.
+ ///
+ /// This function finds the bi-node-connected components in an undirected
+ /// graph. The biconnected components are the classes of an equivalence
+ /// relation on the undirected edges. Two undirected edge is in relationship
+ /// when they are on same circle.
+ ///
+ /// \param graph The graph.
+ /// \return The number of components.
+ template <typename UGraph>
+ int countBiNodeConnectedComponents(const UGraph& graph) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::NodeIt NodeIt;
+
+ using namespace _topology_bits;
+
+ typedef CountBiNodeConnectedComponentsVisitor<UGraph> Visitor;
+
+ int compNum = 0;
+ Visitor visitor(graph, compNum);
+
+ DfsVisit<UGraph, Visitor> dfs(graph, visitor);
+ dfs.init();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+ return compNum;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Find the bi-node-connected components.
+ ///
+ /// This function finds the bi-node-connected components in an undirected
+ /// graph. The bi-node-connected components are the classes of an equivalence
+ /// relation on the undirected edges. Two undirected edge are in relationship
+ /// when they are on same circle.
+ ///
+ /// \image html node_biconnected_components.png
+ /// \image latex node_biconnected_components.eps "bi-node-connected components" width=\textwidth
+ ///
+ /// \param graph The graph.
+ /// \retval compMap A writable uedge map. The values will be set from 0
+ /// to the number of the biconnected components minus one. Each values
+ /// of the map will be set exactly once, the values of a certain component
+ /// will be set continuously.
+ /// \return The number of components.
+ ///
+ template <typename UGraph, typename UEdgeMap>
+ int biNodeConnectedComponents(const UGraph& graph,
+ UEdgeMap& compMap) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::NodeIt NodeIt;
+ typedef typename UGraph::UEdge UEdge;
+ checkConcept<concepts::WriteMap<UEdge, int>, UEdgeMap>();
+
+ using namespace _topology_bits;
+
+ typedef BiNodeConnectedComponentsVisitor<UGraph, UEdgeMap> Visitor;
+
+ int compNum = 0;
+ Visitor visitor(graph, compMap, compNum);
+
+ DfsVisit<UGraph, Visitor> dfs(graph, visitor);
+ dfs.init();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+ return compNum;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Find the bi-node-connected cut nodes.
+ ///
+ /// This function finds the bi-node-connected cut nodes in an undirected
+ /// graph. The bi-node-connected components are the classes of an equivalence
+ /// relation on the undirected edges. Two undirected edges are in
+ /// relationship when they are on same circle. The biconnected components
+ /// are separted by nodes which are the cut nodes of the components.
+ ///
+ /// \param graph The graph.
+ /// \retval cutMap A writable edge map. The values will be set true when
+ /// the node separate two or more components.
+ /// \return The number of the cut nodes.
+ template <typename UGraph, typename NodeMap>
+ int biNodeConnectedCutNodes(const UGraph& graph, NodeMap& cutMap) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::Node Node;
+ typedef typename UGraph::NodeIt NodeIt;
+ checkConcept<concepts::WriteMap<Node, bool>, NodeMap>();
+
+ using namespace _topology_bits;
+
+ typedef BiNodeConnectedCutNodesVisitor<UGraph, NodeMap> Visitor;
+
+ int cutNum = 0;
+ Visitor visitor(graph, cutMap, cutNum);
+
+ DfsVisit<UGraph, Visitor> dfs(graph, visitor);
+ dfs.init();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+ return cutNum;
+ }
+
+ namespace _topology_bits {
+
+ template <typename Graph>
+ class CountBiEdgeConnectedComponentsVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::UEdge UEdge;
+
+ CountBiEdgeConnectedComponentsVisitor(const Graph& graph, int &compNum)
+ : _graph(graph), _compNum(compNum),
+ _numMap(graph), _retMap(graph), _predMap(graph), _num(0) {}
+
+ void start(const Node& node) {
+ _predMap.set(node, INVALID);
+ }
+
+ void reach(const Node& node) {
+ _numMap.set(node, _num);
+ _retMap.set(node, _num);
+ ++_num;
+ }
+
+ void leave(const Node& node) {
+ if (_numMap[node] <= _retMap[node]) {
+ ++_compNum;
+ }
+ }
+
+ void discover(const Edge& edge) {
+ _predMap.set(_graph.target(edge), edge);
+ }
+
+ void examine(const Edge& edge) {
+ if (_predMap[_graph.source(edge)] == _graph.oppositeEdge(edge)) {
+ return;
+ }
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ }
+
+ void backtrack(const Edge& edge) {
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ }
+
+ private:
+ const Graph& _graph;
+ int& _compNum;
+
+ typename Graph::template NodeMap<int> _numMap;
+ typename Graph::template NodeMap<int> _retMap;
+ typename Graph::template NodeMap<Edge> _predMap;
+ int _num;
+ };
+
+ template <typename Graph, typename NodeMap>
+ class BiEdgeConnectedComponentsVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::UEdge UEdge;
+
+ BiEdgeConnectedComponentsVisitor(const Graph& graph,
+ NodeMap& compMap, int &compNum)
+ : _graph(graph), _compMap(compMap), _compNum(compNum),
+ _numMap(graph), _retMap(graph), _predMap(graph), _num(0) {}
+
+ void start(const Node& node) {
+ _predMap.set(node, INVALID);
+ }
+
+ void reach(const Node& node) {
+ _numMap.set(node, _num);
+ _retMap.set(node, _num);
+ _nodeStack.push(node);
+ ++_num;
+ }
+
+ void leave(const Node& node) {
+ if (_numMap[node] <= _retMap[node]) {
+ while (_nodeStack.top() != node) {
+ _compMap.set(_nodeStack.top(), _compNum);
+ _nodeStack.pop();
+ }
+ _compMap.set(node, _compNum);
+ _nodeStack.pop();
+ ++_compNum;
+ }
+ }
+
+ void discover(const Edge& edge) {
+ _predMap.set(_graph.target(edge), edge);
+ }
+
+ void examine(const Edge& edge) {
+ if (_predMap[_graph.source(edge)] == _graph.oppositeEdge(edge)) {
+ return;
+ }
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ }
+
+ void backtrack(const Edge& edge) {
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ }
+
+ private:
+ const Graph& _graph;
+ NodeMap& _compMap;
+ int& _compNum;
+
+ typename Graph::template NodeMap<int> _numMap;
+ typename Graph::template NodeMap<int> _retMap;
+ typename Graph::template NodeMap<Edge> _predMap;
+ std::stack<Node> _nodeStack;
+ int _num;
+ };
+
+
+ template <typename Graph, typename EdgeMap>
+ class BiEdgeConnectedCutEdgesVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::UEdge UEdge;
+
+ BiEdgeConnectedCutEdgesVisitor(const Graph& graph,
+ EdgeMap& cutMap, int &cutNum)
+ : _graph(graph), _cutMap(cutMap), _cutNum(cutNum),
+ _numMap(graph), _retMap(graph), _predMap(graph), _num(0) {}
+
+ void start(const Node& node) {
+ _predMap[node] = INVALID;
+ }
+
+ void reach(const Node& node) {
+ _numMap.set(node, _num);
+ _retMap.set(node, _num);
+ ++_num;
+ }
+
+ void leave(const Node& node) {
+ if (_numMap[node] <= _retMap[node]) {
+ if (_predMap[node] != INVALID) {
+ _cutMap.set(_predMap[node], true);
+ ++_cutNum;
+ }
+ }
+ }
+
+ void discover(const Edge& edge) {
+ _predMap.set(_graph.target(edge), edge);
+ }
+
+ void examine(const Edge& edge) {
+ if (_predMap[_graph.source(edge)] == _graph.oppositeEdge(edge)) {
+ return;
+ }
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ }
+
+ void backtrack(const Edge& edge) {
+ if (_retMap[_graph.source(edge)] > _retMap[_graph.target(edge)]) {
+ _retMap.set(_graph.source(edge), _retMap[_graph.target(edge)]);
+ }
+ }
+
+ private:
+ const Graph& _graph;
+ EdgeMap& _cutMap;
+ int& _cutNum;
+
+ typename Graph::template NodeMap<int> _numMap;
+ typename Graph::template NodeMap<int> _retMap;
+ typename Graph::template NodeMap<Edge> _predMap;
+ int _num;
+ };
+ }
+
+ template <typename UGraph>
+ int countBiEdgeConnectedComponents(const UGraph& graph);
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Checks that the graph is bi-edge-connected.
+ ///
+ /// This function checks that the graph is bi-edge-connected. The undirected
+ /// graph is bi-edge-connected when any two nodes are connected with two
+ /// edge-disjoint paths.
+ ///
+ /// \param graph The undirected graph.
+ /// \return The number of components.
+ template <typename UGraph>
+ bool biEdgeConnected(const UGraph& graph) {
+ return countBiEdgeConnectedComponents(graph) == 1;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Count the bi-edge-connected components.
+ ///
+ /// This function count the bi-edge-connected components in an undirected
+ /// graph. The bi-edge-connected components are the classes of an equivalence
+ /// relation on the nodes. Two nodes are in relationship when they are
+ /// connected with at least two edge-disjoint paths.
+ ///
+ /// \param graph The undirected graph.
+ /// \return The number of components.
+ template <typename UGraph>
+ int countBiEdgeConnectedComponents(const UGraph& graph) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::NodeIt NodeIt;
+
+ using namespace _topology_bits;
+
+ typedef CountBiEdgeConnectedComponentsVisitor<UGraph> Visitor;
+
+ int compNum = 0;
+ Visitor visitor(graph, compNum);
+
+ DfsVisit<UGraph, Visitor> dfs(graph, visitor);
+ dfs.init();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+ return compNum;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Find the bi-edge-connected components.
+ ///
+ /// This function finds the bi-edge-connected components in an undirected
+ /// graph. The bi-edge-connected components are the classes of an equivalence
+ /// relation on the nodes. Two nodes are in relationship when they are
+ /// connected at least two edge-disjoint paths.
+ ///
+ /// \image html edge_biconnected_components.png
+ /// \image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth
+ ///
+ /// \param graph The graph.
+ /// \retval compMap A writable node map. The values will be set from 0 to
+ /// the number of the biconnected components minus one. Each values
+ /// of the map will be set exactly once, the values of a certain component
+ /// will be set continuously.
+ /// \return The number of components.
+ ///
+ template <typename UGraph, typename NodeMap>
+ int biEdgeConnectedComponents(const UGraph& graph, NodeMap& compMap) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::NodeIt NodeIt;
+ typedef typename UGraph::Node Node;
+ checkConcept<concepts::WriteMap<Node, int>, NodeMap>();
+
+ using namespace _topology_bits;
+
+ typedef BiEdgeConnectedComponentsVisitor<UGraph, NodeMap> Visitor;
+
+ int compNum = 0;
+ Visitor visitor(graph, compMap, compNum);
+
+ DfsVisit<UGraph, Visitor> dfs(graph, visitor);
+ dfs.init();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+ return compNum;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Find the bi-edge-connected cut edges.
+ ///
+ /// This function finds the bi-edge-connected components in an undirected
+ /// graph. The bi-edge-connected components are the classes of an equivalence
+ /// relation on the nodes. Two nodes are in relationship when they are
+ /// connected with at least two edge-disjoint paths. The bi-edge-connected
+ /// components are separted by edges which are the cut edges of the
+ /// components.
+ ///
+ /// \param graph The graph.
+ /// \retval cutMap A writable node map. The values will be set true when the
+ /// edge is a cut edge.
+ /// \return The number of cut edges.
+ template <typename UGraph, typename UEdgeMap>
+ int biEdgeConnectedCutEdges(const UGraph& graph, UEdgeMap& cutMap) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::NodeIt NodeIt;
+ typedef typename UGraph::UEdge UEdge;
+ checkConcept<concepts::WriteMap<UEdge, bool>, UEdgeMap>();
+
+ using namespace _topology_bits;
+
+ typedef BiEdgeConnectedCutEdgesVisitor<UGraph, UEdgeMap> Visitor;
+
+ int cutNum = 0;
+ Visitor visitor(graph, cutMap, cutNum);
+
+ DfsVisit<UGraph, Visitor> dfs(graph, visitor);
+ dfs.init();
+
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+ return cutNum;
+ }
+
+
+ namespace _topology_bits {
+
+ template <typename Graph, typename IntNodeMap>
+ class TopologicalSortVisitor : public DfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Node Node;
+ typedef typename Graph::Edge edge;
+
+ TopologicalSortVisitor(IntNodeMap& order, int num)
+ : _order(order), _num(num) {}
+
+ void leave(const Node& node) {
+ _order.set(node, --_num);
+ }
+
+ private:
+ IntNodeMap& _order;
+ int _num;
+ };
+
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Sort the nodes of a DAG into topolgical order.
+ ///
+ /// Sort the nodes of a DAG into topolgical order.
+ ///
+ /// \param graph The graph. It should be directed and acyclic.
+ /// \retval order A writable node map. The values will be set from 0 to
+ /// the number of the nodes in the graph minus one. Each values of the map
+ /// will be set exactly once, the values will be set descending order.
+ ///
+ /// \see checkedTopologicalSort
+ /// \see dag
+ template <typename Graph, typename NodeMap>
+ void topologicalSort(const Graph& graph, NodeMap& order) {
+ using namespace _topology_bits;
+
+ checkConcept<concepts::Graph, Graph>();
+ checkConcept<concepts::WriteMap<typename Graph::Node, int>, NodeMap>();
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+ typedef typename Graph::Edge Edge;
+
+ TopologicalSortVisitor<Graph, NodeMap>
+ visitor(order, countNodes(graph));
+
+ DfsVisit<Graph, TopologicalSortVisitor<Graph, NodeMap> >
+ dfs(graph, visitor);
+
+ dfs.init();
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ dfs.start();
+ }
+ }
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Sort the nodes of a DAG into topolgical order.
+ ///
+ /// Sort the nodes of a DAG into topolgical order. It also checks
+ /// that the given graph is DAG.
+ ///
+ /// \param graph The graph. It should be directed and acyclic.
+ /// \retval order A readable - writable node map. The values will be set
+ /// from 0 to the number of the nodes in the graph minus one. Each values
+ /// of the map will be set exactly once, the values will be set descending
+ /// order.
+ /// \return %False when the graph is not DAG.
+ ///
+ /// \see topologicalSort
+ /// \see dag
+ template <typename Graph, typename NodeMap>
+ bool checkedTopologicalSort(const Graph& graph, NodeMap& order) {
+ using namespace _topology_bits;
+
+ checkConcept<concepts::Graph, Graph>();
+ checkConcept<concepts::ReadWriteMap<typename Graph::Node, int>, NodeMap>();
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+ typedef typename Graph::Edge Edge;
+
+ order = constMap<Node, int, -1>();
+
+ TopologicalSortVisitor<Graph, NodeMap>
+ visitor(order, countNodes(graph));
+
+ DfsVisit<Graph, TopologicalSortVisitor<Graph, NodeMap> >
+ dfs(graph, visitor);
+
+ dfs.init();
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ while (!dfs.emptyQueue()) {
+ Edge edge = dfs.nextEdge();
+ Node target = graph.target(edge);
+ if (dfs.reached(target) && order[target] == -1) {
+ return false;
+ }
+ dfs.processNextEdge();
+ }
+ }
+ }
+ return true;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Check that the given directed graph is a DAG.
+ ///
+ /// Check that the given directed graph is a DAG. The DAG is
+ /// an Directed Acyclic Graph.
+ /// \return %False when the graph is not DAG.
+ /// \see acyclic
+ template <typename Graph>
+ bool dag(const Graph& graph) {
+
+ checkConcept<concepts::Graph, Graph>();
+
+ typedef typename Graph::Node Node;
+ typedef typename Graph::NodeIt NodeIt;
+ typedef typename Graph::Edge Edge;
+
+ typedef typename Graph::template NodeMap<bool> ProcessedMap;
+
+ typename Dfs<Graph>::template DefProcessedMap<ProcessedMap>::
+ Create dfs(graph);
+
+ ProcessedMap processed(graph);
+ dfs.processedMap(processed);
+
+ dfs.init();
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ while (!dfs.emptyQueue()) {
+ Edge edge = dfs.nextEdge();
+ Node target = graph.target(edge);
+ if (dfs.reached(target) && !processed[target]) {
+ return false;
+ }
+ dfs.processNextEdge();
+ }
+ }
+ }
+ return true;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Check that the given undirected graph is acyclic.
+ ///
+ /// Check that the given undirected graph acyclic.
+ /// \param graph The undirected graph.
+ /// \return %True when there is no circle in the graph.
+ /// \see dag
+ template <typename UGraph>
+ bool acyclic(const UGraph& graph) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::Node Node;
+ typedef typename UGraph::NodeIt NodeIt;
+ typedef typename UGraph::Edge Edge;
+ Dfs<UGraph> dfs(graph);
+ dfs.init();
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ dfs.addSource(it);
+ while (!dfs.emptyQueue()) {
+ Edge edge = dfs.nextEdge();
+ Node source = graph.source(edge);
+ Node target = graph.target(edge);
+ if (dfs.reached(target) &&
+ dfs.predEdge(source) != graph.oppositeEdge(edge)) {
+ return false;
+ }
+ dfs.processNextEdge();
+ }
+ }
+ }
+ return true;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Check that the given undirected graph is tree.
+ ///
+ /// Check that the given undirected graph is tree.
+ /// \param graph The undirected graph.
+ /// \return %True when the graph is acyclic and connected.
+ template <typename UGraph>
+ bool tree(const UGraph& graph) {
+ checkConcept<concepts::UGraph, UGraph>();
+ typedef typename UGraph::Node Node;
+ typedef typename UGraph::NodeIt NodeIt;
+ typedef typename UGraph::Edge Edge;
+ Dfs<UGraph> dfs(graph);
+ dfs.init();
+ dfs.addSource(NodeIt(graph));
+ while (!dfs.emptyQueue()) {
+ Edge edge = dfs.nextEdge();
+ Node source = graph.source(edge);
+ Node target = graph.target(edge);
+ if (dfs.reached(target) &&
+ dfs.predEdge(source) != graph.oppositeEdge(edge)) {
+ return false;
+ }
+ dfs.processNextEdge();
+ }
+ for (NodeIt it(graph); it != INVALID; ++it) {
+ if (!dfs.reached(it)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ namespace _topology_bits {
+
+ template <typename Graph>
+ class BipartiteVisitor : public BfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::Node Node;
+
+ BipartiteVisitor(const Graph& graph, bool& bipartite)
+ : _graph(graph), _part(graph), _bipartite(bipartite) {}
+
+ void start(const Node& node) {
+ _part[node] = true;
+ }
+ void discover(const Edge& edge) {
+ _part.set(_graph.target(edge), !_part[_graph.source(edge)]);
+ }
+ void examine(const Edge& edge) {
+ _bipartite = _bipartite &&
+ _part[_graph.target(edge)] != _part[_graph.source(edge)];
+ }
+
+ private:
+
+ const Graph& _graph;
+ typename Graph::template NodeMap<bool> _part;
+ bool& _bipartite;
+ };
+
+ template <typename Graph, typename PartMap>
+ class BipartitePartitionsVisitor : public BfsVisitor<Graph> {
+ public:
+ typedef typename Graph::Edge Edge;
+ typedef typename Graph::Node Node;
+
+ BipartitePartitionsVisitor(const Graph& graph,
+ PartMap& part, bool& bipartite)
+ : _graph(graph), _part(part), _bipartite(bipartite) {}
+
+ void start(const Node& node) {
+ _part.set(node, true);
+ }
+ void discover(const Edge& edge) {
+ _part.set(_graph.target(edge), !_part[_graph.source(edge)]);
+ }
+ void examine(const Edge& edge) {
+ _bipartite = _bipartite &&
+ _part[_graph.target(edge)] != _part[_graph.source(edge)];
+ }
+
+ private:
+
+ const Graph& _graph;
+ PartMap& _part;
+ bool& _bipartite;
+ };
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Check if the given undirected graph is bipartite or not
+ ///
+ /// The function checks if the given undirected \c graph graph is bipartite
+ /// or not. The \ref Bfs algorithm is used to calculate the result.
+ /// \param graph The undirected graph.
+ /// \return %True if \c graph is bipartite, %false otherwise.
+ /// \sa bipartitePartitions
+ ///
+ /// \author Balazs Attila Mihaly
+ template<typename UGraph>
+ inline bool bipartite(const UGraph &graph){
+ using namespace _topology_bits;
+
+ checkConcept<concepts::UGraph, UGraph>();
+
+ typedef typename UGraph::NodeIt NodeIt;
+ typedef typename UGraph::EdgeIt EdgeIt;
+
+ bool bipartite = true;
+
+ BipartiteVisitor<UGraph>
+ visitor(graph, bipartite);
+ BfsVisit<UGraph, BipartiteVisitor<UGraph> >
+ bfs(graph, visitor);
+ bfs.init();
+ for(NodeIt it(graph); it != INVALID; ++it) {
+ if(!bfs.reached(it)){
+ bfs.addSource(it);
+ while (!bfs.emptyQueue()) {
+ bfs.processNextNode();
+ if (!bipartite) return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /// \ingroup graph_prop
+ ///
+ /// \brief Check if the given undirected graph is bipartite or not
+ ///
+ /// The function checks if the given undirected graph is bipartite
+ /// or not. The \ref Bfs algorithm is used to calculate the result.
+ /// During the execution, the \c partMap will be set as the two
+ /// partitions of the graph.
+ /// \param graph The undirected graph.
+ /// \retval partMap A writable bool map of nodes. It will be set as the
+ /// two partitions of the graph.
+ /// \return %True if \c graph is bipartite, %false otherwise.
+ ///
+ /// \author Balazs Attila Mihaly
+ ///
+ /// \image html bipartite_partitions.png
+ /// \image latex bipartite_partitions.eps "Bipartite partititions" width=\textwidth
+ template<typename UGraph, typename NodeMap>
+ inline bool bipartitePartitions(const UGraph &graph, NodeMap &partMap){
+ using namespace _topology_bits;
+
+ checkConcept<concepts::UGraph, UGraph>();
+
+ typedef typename UGraph::Node Node;
+ typedef typename UGraph::NodeIt NodeIt;
+ typedef typename UGraph::EdgeIt EdgeIt;
+
+ bool bipartite = true;
+
+ BipartitePartitionsVisitor<UGraph, NodeMap>
+ visitor(graph, partMap, bipartite);
+ BfsVisit<UGraph, BipartitePartitionsVisitor<UGraph, NodeMap> >
+ bfs(graph, visitor);
+ bfs.init();
+ for(NodeIt it(graph); it != INVALID; ++it) {
+ if(!bfs.reached(it)){
+ bfs.addSource(it);
+ while (!bfs.emptyQueue()) {
+ bfs.processNextNode();
+ if (!bipartite) return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /// \brief Returns true when there is not loop edge in the graph.
+ ///
+ /// Returns true when there is not loop edge in the graph.
+ template <typename Graph>
+ bool loopFree(const Graph& graph) {
+ for (typename Graph::EdgeIt it(graph); it != INVALID; ++it) {
+ if (graph.source(it) == graph.target(it)) return false;
+ }
+ return true;
+ }
+
+ /// \brief Returns true when there is not parallel edges in the graph.
+ ///
+ /// Returns true when there is not parallel edges in the graph.
+ template <typename Graph>
+ bool parallelFree(const Graph& graph) {
+ typename Graph::template NodeMap<bool> reached(graph, false);
+ for (typename Graph::NodeIt n(graph); n != INVALID; ++n) {
+ for (typename Graph::OutEdgeIt e(graph, n); e != INVALID; ++e) {
+ if (reached[graph.target(e)]) return false;
+ reached.set(graph.target(e), true);
+ }
+ for (typename Graph::OutEdgeIt e(graph, n); e != INVALID; ++e) {
+ reached.set(graph.target(e), false);
+ }
+ }
+ return true;
+ }
+
+ /// \brief Returns true when there is not loop edge and parallel
+ /// edges in the graph.
+ ///
+ /// Returns true when there is not loop edge and parallel edges in
+ /// the graph.
+ template <typename Graph>
+ bool simpleGraph(const Graph& graph) {
+ typename Graph::template NodeMap<bool> reached(graph, false);
+ for (typename Graph::NodeIt n(graph); n != INVALID; ++n) {
+ reached.set(n, true);
+ for (typename Graph::OutEdgeIt e(graph, n); e != INVALID; ++e) {
+ if (reached[graph.target(e)]) return false;
+ reached.set(graph.target(e), true);
+ }
+ for (typename Graph::OutEdgeIt e(graph, n); e != INVALID; ++e) {
+ reached.set(graph.target(e), false);
+ }
+ reached.set(n, false);
+ }
+ return true;
+ }
+
+} //namespace lemon
+
+#endif //LEMON_TOPOLOGY_H
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/cufflinks.git
More information about the debian-med-commit
mailing list