summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-16 17:29:52 +0000
committersalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-16 17:29:52 +0000
commit1d7b76565cd5bec31d47e9276839ff898bc59daa (patch)
treedd5dd4199f00f754b38165a45fb395b822c26d72
parente6078c1e4c7561f790afc653269cd3deca4c2350 (diff)
doc
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@358 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ade7d814c2bab1b162f6187ac9c7afec3e18455c
-rw-r--r--CMakeLists.txt2
-rw-r--r--biblio/bibliography.bib30
-rw-r--r--src/Contraction/example/Rips_contraction.cpp3
-rw-r--r--src/Contraction/include/gudhi/Contraction/policies/Contraction_visitor.h7
-rw-r--r--src/Contraction/include/gudhi/Contraction/policies/Cost_policy.h1
-rw-r--r--src/Contraction/include/gudhi/Contraction/policies/Link_condition_valid_contraction.h1
-rw-r--r--src/Contraction/include/gudhi/Contraction/policies/Placement_policy.h1
-rw-r--r--src/Contraction/include/gudhi/Contraction/policies/Valid_contraction_policy.h1
-rw-r--r--src/Contraction/include/gudhi/Edge_contraction.h152
-rw-r--r--src/Contraction/include/gudhi/Skeleton_blocker_contractor.h6
-rw-r--r--src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h6
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h5
-rw-r--r--src/common/doc/main_page.h7
13 files changed, 209 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eeb5a889..ff9f14c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,3 +72,5 @@ else()
add_subdirectory(src/Contraction/test)
add_subdirectory(src/Contraction/example)
endif()
+
+
diff --git a/biblio/bibliography.bib b/biblio/bibliography.bib
index b02929ab..3fd1c10a 100644
--- a/biblio/bibliography.bib
+++ b/biblio/bibliography.bib
@@ -33,6 +33,36 @@ pages={1-22},
language={English}
}
+@inproceedings{Garland,
+ author = {Garland, Michael and Heckbert, Paul S.},
+ title = {Surface simplification using quadric error metrics},
+ booktitle = {Proceedings of the 24th annual conference on Computer graphics and interactive techniques},
+ series = {SIGGRAPH '97},
+ year = {1997},
+ isbn = {0-89791-896-7},
+ pages = {209--216},
+ numpages = {8},
+ publisher = {ACM Press/Addison-Wesley Publishing Co.},
+ address = {New York, NY, USA},
+ keywords = {level of detail, mutiresolution modeling, non-manifold, pair contraction, surface simplification},
+}
+
+
+@inproceedings{Lindstrom,
+ author = {Lindstrom, Peter and Turk, Greg},
+ title = {Fast and Memory Efficient Polygonal Simplification},
+ booktitle = {Proceedings of the Conference on Visualization '98},
+ series = {VIS '98},
+ year = {1998},
+ isbn = {1-58113-106-2},
+ location = {Research Triangle Park, North Carolina, USA},
+ pages = {279--286},
+ numpages = {8},
+ publisher = {IEEE Computer Society Press},
+ address = {Los Alamitos, CA, USA},
+}
+
+
@article{boissonnatmariacamalgorithmica,
journal={Submitted to Algorithmica},
title={The Compressed Annotation Matrix: An Efficient Data Structure for Computing Persistent Cohomology},
diff --git a/src/Contraction/example/Rips_contraction.cpp b/src/Contraction/example/Rips_contraction.cpp
index 2620b04f..0cea479b 100644
--- a/src/Contraction/example/Rips_contraction.cpp
+++ b/src/Contraction/example/Rips_contraction.cpp
@@ -19,7 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <list>
#include <boost/timer/timer.hpp>
#include <iostream>
#include "gudhi/Edge_contraction.h"
@@ -89,7 +88,7 @@ int main (int argc, char *argv[])
complex.num_edges()<<" edges."<<std::endl;
Complex_contractor contractor(complex,
- new Edge_length_cost<Profile>, //todo make_edge_length_cost
+ new Edge_length_cost<Profile>,
contraction::make_first_vertex_placement<Profile>(),
contraction::make_link_valid_contraction<Profile>(),
contraction::make_remove_popable_blockers_visitor<Profile>());
diff --git a/src/Contraction/include/gudhi/Contraction/policies/Contraction_visitor.h b/src/Contraction/include/gudhi/Contraction/policies/Contraction_visitor.h
index 8ff19f20..b8b1e87a 100644
--- a/src/Contraction/include/gudhi/Contraction/policies/Contraction_visitor.h
+++ b/src/Contraction/include/gudhi/Contraction/policies/Contraction_visitor.h
@@ -33,6 +33,7 @@ namespace contraction {
/**
*@class Contraction_visitor
*@brief Interface for a visitor of the edge contraction process.
+ *@ingroup contr
*/
template <typename EdgeProfile>
class Contraction_visitor {//: public Dummy_complex_visitor<typename EdgeProfile::Vertex_handle> {
@@ -53,9 +54,9 @@ public:
virtual void on_started (ComplexType & complex){}
/**
- * @brief Called when the StopPredicate returned true (but not if the algorithm terminates because the surface could not be simplified any further).
+ * @brief Called when the algorithm stops.
*/
- virtual void on_stop_condition_reached (const Profile &profile){}
+ virtual void on_stop_condition_reached (){}
/**
@@ -75,6 +76,8 @@ public:
virtual void on_contracting(const Profile &profile, boost::optional< Point > placement){
}
+
+
/**
* @brief Called when after an edge has been contracted onto a new point placement.
* A possibility would to remove popable blockers at this point for instance.
diff --git a/src/Contraction/include/gudhi/Contraction/policies/Cost_policy.h b/src/Contraction/include/gudhi/Contraction/policies/Cost_policy.h
index 60ef3b5f..3cb18c86 100644
--- a/src/Contraction/include/gudhi/Contraction/policies/Cost_policy.h
+++ b/src/Contraction/include/gudhi/Contraction/policies/Cost_policy.h
@@ -31,6 +31,7 @@ namespace contraction {
/**
*@brief Policy to specify the cost of contracting an edge.
+ *@ingroup contr
*/
template< typename EdgeProfile> class Cost_policy{
public:
diff --git a/src/Contraction/include/gudhi/Contraction/policies/Link_condition_valid_contraction.h b/src/Contraction/include/gudhi/Contraction/policies/Link_condition_valid_contraction.h
index 31c02e43..c901e629 100644
--- a/src/Contraction/include/gudhi/Contraction/policies/Link_condition_valid_contraction.h
+++ b/src/Contraction/include/gudhi/Contraction/policies/Link_condition_valid_contraction.h
@@ -34,6 +34,7 @@ namespace contraction {
/**
*@brief Policy that only accept edges verifying the link condition (and therefore whose contraction preserving homotopy type).
+ *@ingroup contr
*/
template< typename EdgeProfile> class Link_condition_valid_contraction : public Valid_contraction_policy<EdgeProfile>{
public:
diff --git a/src/Contraction/include/gudhi/Contraction/policies/Placement_policy.h b/src/Contraction/include/gudhi/Contraction/policies/Placement_policy.h
index 37b36dfe..3a804cf0 100644
--- a/src/Contraction/include/gudhi/Contraction/policies/Placement_policy.h
+++ b/src/Contraction/include/gudhi/Contraction/policies/Placement_policy.h
@@ -31,6 +31,7 @@ namespace contraction {
/**
*@brief Policy to specify where the merged point had to be placed after an edge contraction.
+ *@ingroup contr
*/
template< typename EdgeProfile> class Placement_policy{
public:
diff --git a/src/Contraction/include/gudhi/Contraction/policies/Valid_contraction_policy.h b/src/Contraction/include/gudhi/Contraction/policies/Valid_contraction_policy.h
index a053042b..bee2ecd7 100644
--- a/src/Contraction/include/gudhi/Contraction/policies/Valid_contraction_policy.h
+++ b/src/Contraction/include/gudhi/Contraction/policies/Valid_contraction_policy.h
@@ -28,6 +28,7 @@ namespace contraction {
/**
*@brief Policy to specify if an edge contraction is valid or not.
+ *@ingroup contr
*/
template< typename EdgeProfile> class Valid_contraction_policy{
public:
diff --git a/src/Contraction/include/gudhi/Edge_contraction.h b/src/Contraction/include/gudhi/Edge_contraction.h
index 6b6dab69..895044ce 100644
--- a/src/Contraction/include/gudhi/Edge_contraction.h
+++ b/src/Contraction/include/gudhi/Edge_contraction.h
@@ -24,7 +24,6 @@
#define GUDHI_EDGE_CONTRACTION_H_
-
#include "gudhi/Skeleton_blocker_contractor.h"
#include "gudhi/Contraction/policies/Edge_length_cost.h"
#include "gudhi/Contraction/policies/First_vertex_placement.h"
@@ -35,4 +34,155 @@
+/** \defgroup contr Contraction
+
+\author David Salinas
+
+\section Introduction
+
+The purpose of this package is to offer a user-friendly interface for edge contraction simplification of huge simplicial complexes.
+It uses the Skeleton-Blocker data-structure whose size remains small during simplification
+of most used geometrical complexes in topological data analysis such as the Rips or the Delaunay complexes (much lower than the total number of simplices in practice).
+
+The edge contraction operation consists in identifying two vertices of a simplicial complex.
+Several algorithms have been developed in computer graphics that allows to reduce efficiently the size of a
+simplicial complex while preserving its geometry
+\cite Garland \cite Lindstrom.
+These approaches can be extended to higher-dimensional simplicial complexes.
+The main advantage of using the Skeleton-Blocker data structure for edge contraction is that when the number of blockers is small,
+most operations needed (link computation, edge contraction and so on) have polynomial complexity regarding the size the graph.
+The simplification can be done without enumerating the set of simplices that is often non tracktable in high-dimension and is then very efficient
+(sub-linear with regards to the number of simplices in practice).
+
+A typical application of this package for homology group computation and is illustrated in the next three figure where a Rips is built uppon a set of high-dimensional points.
+It has initially a huge number of simplices (todo) but simplifying it to a much reduced form with todo vertices takes only few seconds on a desktop machine.
+One can then compute homology group with a simplicial complex of less than one hundred simplices instead of running the homology algorithm on the much bigger initial set of
+simplices.
+
+
+
+\section Design
+
+This class design is policy based and heavily inspired from the similar edge collapse package of CGAL http://doc.cgal.org/latest/Surface_mesh_simplification/index.html (which is restricted to 2D triangulations).
+
+
+\subsection Policies
+
+Four policies can be customized in this package.
+
+\li Cost_policy: specify how much cost an edge contraction of a given edge. The edge with lowest cost is iteratively picked and contracted if valid.
+\li Valid_policy: specify if a given edge contraction is valid. For instance, this policy can check the link condition which ensures that the homotopy type is preserved afer the edge contraction.
+\li Placement: every time an edge is contracted, its points are merge to one point specified by this policy. This may be the middle of the edge of some more sofisticated point such as the minimum of a cost as in
+\cite Garland.
+
+
+\subsection Visitor
+
+A visitor which implements the class Contraction_visitor gets called when several
+
+
+
+
+
+\section Example
+
+
+This example loads points in an off file and build the Rips complex with an user provided parameter. It then simplifies the build Rips complex
+while ensuring that homotopy type is preserved during the contraction (edge are contracted only when the link condition is valid).
+
+ \code{.cpp}
+#include <boost/timer/timer.hpp>
+#include <iostream>
+#include "gudhi/Edge_contraction.h"
+#include "gudhi/Skeleton_blocker.h"
+#include "gudhi/Off_reader.h"
+
+
+using namespace std;
+using namespace Gudhi;
+using namespace skbl;
+using namespace contraction;
+
+struct Geometry_trait{
+ typedef std::vector<double> Point;
+};
+
+typedef Geometry_trait::Point Point;
+typedef Skeleton_blocker_simple_geometric_traits<Geometry_trait> Complex_geometric_traits;
+typedef Skeleton_blocker_geometric_complex< Complex_geometric_traits > Complex;
+typedef Edge_profile<Complex> Profile;
+typedef Skeleton_blocker_contractor<Complex> Complex_contractor;
+
+template<typename Point>
+double eucl_distance(const Point& a,const Point& b){
+ double res = 0;
+ auto a_coord = a.begin();
+ auto b_coord = b.begin();
+ for(; a_coord != a.end(); a_coord++, b_coord++){
+ res += (*a_coord - *b_coord) * (*a_coord - *b_coord);
+ }
+ return sqrt(res);
+}
+
+template<typename ComplexType>
+void build_rips(ComplexType& complex, double offset){
+ if (offset<=0) return;
+ auto vertices = complex.vertex_range();
+ for (auto p = vertices.begin(); p != vertices.end(); ++p)
+ for (auto q = p; ++q != vertices.end(); )
+ if (eucl_distance(complex.point(*p), complex.point(*q)) < 2 * offset)
+ complex.add_edge(*p,*q);
+}
+
+int main (int argc, char *argv[])
+{
+ if (argc!=3){
+ std::cerr << "Usage "<<argv[0]<<" GUDHIPATH/src/data/sphere3D.off 0.1 to load the file GUDHIPATH/src/data/sphere3D.off and contract the Rips complex built with paremeter 0.2.\n";
+ return -1;
+ }
+
+ boost::timer::auto_cpu_timer t;
+ Complex complex;
+
+ // load the points
+ Skeleton_blocker_off_reader<Complex> off_reader(argv[1],complex,true);
+ if(!off_reader.is_valid()){
+ std::cerr << "Unable to read file:"<<argv[1]<<std::endl;
+ return EXIT_FAILURE;
+ }
+ std::cout << "build the Rips complex"<<std::endl;
+
+ build_rips(complex,atof(argv[2]));
+
+
+ std::cout << "Initial complex has "<<
+ complex.num_vertices()<<" vertices, and "<<
+ complex.num_edges()<<" edges."<<std::endl;
+
+ Complex_contractor contractor(complex,
+ new Edge_length_cost<Profile>,
+ contraction::make_first_vertex_placement<Profile>(),
+ contraction::make_link_valid_contraction<Profile>(),
+ contraction::make_remove_popable_blockers_visitor<Profile>());
+ contractor.contract_edges();
+
+ std::cout << "Resulting complex has "<<
+ complex.num_vertices()<<" vertices, "<<
+ complex.num_edges()<<"edges and "<<
+ complex.num_blockers()<<" blockers"<<std::endl;
+
+ return EXIT_SUCCESS;
+}
+ \endcode
+
+
+
+
+\copyright GNU General Public License v3.
+\verbatim Contact: David Salinas, david.salinas@inria.fr \endverbatim
+*/
+/** @} */ // end defgroup
+
+
+
#endif /* GUDHI_EDGE_CONTRACTION_H_ */
diff --git a/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h b/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
index 56f4891f..03abfea1 100644
--- a/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
+++ b/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
@@ -56,6 +56,8 @@ namespace Gudhi{
namespace contraction {
+
+
template <class Profile>
Placement_policy<Profile>* make_first_vertex_placement(){
return new First_vertex_placement<Profile>();
@@ -116,6 +118,7 @@ Contraction_visitor<Profile>* make_remove_popable_blockers_visitor(){
/**
*@class Skeleton_blocker_contractor
*@brief Class that allows to contract iteratively edges of a simplicial complex.
+ *@ingroup contr
*
* @details The simplification algorithm consists in iteratively picking the
* edge with lowest cost and performing an edge contraction if the contraction is valid.
@@ -394,7 +397,7 @@ public:
DBGMSG("sqrt(cost):",std::sqrt(*cost));
if (should_stop(*cost,profile) )
{
- if(contraction_visitor_) contraction_visitor_->on_stop_condition_reached(profile);
+ if(contraction_visitor_) contraction_visitor_->on_stop_condition_reached();
DBG("should_stop");
break ;
}
@@ -416,6 +419,7 @@ public:
DBG("uncomputable cost");
}
}
+ if(contraction_visitor_) contraction_visitor_->on_stop_condition_reached();
}
diff --git a/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h b/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h
index fad680d0..8fbf0d12 100644
--- a/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h
+++ b/src/Skeleton_blocker/concept/SkeletonBlockerGeometricDS.h
@@ -9,6 +9,9 @@
#ifndef GUDHI_SKELETONBLOCKERGEOMETRICDS_H_
#define GUDHI_SKELETONBLOCKERGEOMETRICDS_H_
+namespace Gudhi {
+namespace skbl {
+
/**
* \brief Concept for template class of Skeleton_blocker_geometric_complex .
* It must specify a GeometryTrait which contains a Point definition.
@@ -65,6 +68,7 @@ struct SkeletonBlockerGeometricDS : public SkeletonBlockerDS
};
};
-
+} // namespace skbl
+} // namespace GUDHI
#endif /* GUDHI_SKELETONBLOCKERGEOMETRICDS_H_ */
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
index eff37a18..b06c3513 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
@@ -79,8 +79,9 @@ in topological data-analysis.
In practice, the set of blockers of a simplicial complex
remains also small when simplifying a Rips complex with edge contractions
but also for most of the simplicial complexes used in topological data-analysis such as Delaunay, Cech or Witness complexes.
-For instance, the numbers of blockers is depicted for random 3 dimensional spheres embedded into \f$R^4\f$
-in figure X.
+For instance, the numbers of blockers is depicted for random 3-dimensional spheres embedded into \f$R^4\f$
+in next figure. Storing the graph and blockers of such simplicial complex is much compact in this case than storing
+its simplices.
*\image html "blockers_curve.png" "Number of blockers of random triangulations of 3-spheres" width=10cm
diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h
index b640ea7b..eaab6195 100644
--- a/src/common/doc/main_page.h
+++ b/src/common/doc/main_page.h
@@ -23,9 +23,8 @@ for a detailed description of the design of the library.
\section Compiling
The library uses c++11 and requires Boost with version 1.48.0 or more recent : http://www.boost.org/.
-Some packages require additional libraries :
-\li the multi-field persistent homology algorithm has an optional dependency with GMP
-\li Qt demos require CGAL, Qt4 and QGLViewer
+The multi-field persistent homology algorithm has an optional dependency with GMP.
+
The procedure to install these packages according to your operating system is
detailled here http://doc.cgal.org/latest/Manual/installation.html
@@ -53,4 +52,4 @@ make
\copyright GNU General Public License v3.
\verbatim Contact: gudhi-devel@lists.gforge.inria.fr \endverbatim
-*/ \ No newline at end of file
+*/