/* This file is part of the Gudhi Library. The Gudhi library * (Geometric Understanding in Higher Dimensions) is a generic C++ * library for computational topology. * * Author(s): David Salinas * * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) * * 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 3 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, see . */ #ifndef GUDHI_SKELETON_BLOCKER_H #define GUDHI_SKELETON_BLOCKER_H #include "gudhi/Skeleton_blocker_complex.h" #include "gudhi/Skeleton_blocker_geometric_complex.h" #include "gudhi/Skeleton_blocker_simplifiable_complex.h" #include "gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h" #include "gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h" #include "gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h" #include "gudhi/Utils.h" //xxx /** \defgroup skbl Skeleton-Blocker \author David Salinas \section Introduction The Skeleton-Blocker data-structure had been introduced in the two papers \cite socg_blockers_2011,\cite blockers2012. It proposes a light encoding for simplicial complexes by storing only an *implicit* representation of its simplices. Intuitively, it just stores the 1-skeleton of a simplicial complex with a graph and the set of its "missing faces" that is very small in practice (see next section for a formal definition). This data-structure handles all simplicial complexes operations such as as simplex enumeration or simplex removal but operations that are particularly efficient are operations that do not require simplex enumeration such as edge iteration, link computation or simplex contraction. \section Definitions We recall briefly classical definitions of simplicial complexes \cite Munkres-elementsalgtop1984. An abstract simplex is a finite non-empty set and its dimension is its number of elements minus 1. Whenever \f$\tau \subset \sigma\f$ and \f$\tau \neq \emptyset \f$, \f$ \tau \f$ is called a face of \f$ \sigma\f$ and \f$ \sigma\f$ is called a coface of \f$ \tau \f$ . Furthermore, when \f$ \tau \neq \sigma\f$ we say that \f$ \tau\f$ is a proper-face of \f$ \sigma\f$. An abstract simplicial complex is a set of simplices that contains all the faces of their simplices. The 1-skeleton of a simplicial complex (or its graph) consists of its elements of dimension lower than 2. *\image html "ds_representation.png" "Skeleton-blocker representation" width=20cm To encode, a simplicial complex, one can encodes all its simplices. In case when this number gets too large, a lighter and implicit version consists of encoding only its graph plus some elements called missing faces or blockers. A blocker is a simplex of dimension greater than 1 that does not belong to the complex but whose all proper faces does. Remark that for a clique complex (i.e. a simplicial complex whose simplices are cliques of its graph), the set of blockers is empty and the data-structure is then particularly sparse. One famous example of clique-complex is the Rips complex which is intensively used 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. *\image html "blockers_curve.png" "Number of blockers of random triangulations of 3-spheres" width=10cm \section API \subsection Overview Four classes are implemented for simplicial complex in this representation namely : \li Skeleton_blocker_complex : a simplicial complex with basic operations such as vertex/edge/simplex enumeration and construction \li Skeleton_blocker_link_complex : the link of a simplex in a parent complex. It is represented as a sub complex of the parent complex \li Skeleton_blocker_simplifiable_complex : a simplicial complex with simplification operations such as edge contraction or simplex collapse \li Skeleton_blocker_geometric_complex : a simplifiable simplicial complex who has access to geometric points in \f$R^d\f$ The two last classes are derived classes from the Skeleton_blocker_complex class. The class Skeleton_blocker_link_complex inheritates from a template passed parameter that may be either Skeleton_blocker_complex or Skeleton_blocker_geometric_complex (a link may store points coordinates or not). Most user will just need to use Skeleton_blocker_geometric_complex. \subsection Visitor The class Skeleton_blocker_complex has a visitor that is called when usual operations such as adding an edge or remove a vertex are called. You may want to use this visitor to compute statistics or to update another data-structure (for instance this visitor is heavily used in the Contraction package). \section Example \subsection s Iterating through vertices, edges, blockers and simplices Iteration through vertices, edges, simplices or blockers is straightforward with c++11 for range loops. Note that simplex iteration with this implicit data-structure just takes a few more time compared to iteration via an explicit representation such as the Simplex Tree. The following example computes the Euler Characteristic of a simplicial complex. \code{.cpp} typedef Skeleton_blocker_complex Complex; typedef Complex::Vertex_handle Vertex_handle; typedef Complex::Simplex_handle Simplex; const int n = 15; // build a full complex with 10 vertices and 2^n-1 simplices Complex complex; for(int i=0;i