summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp7
-rw-r--r--src/Rips_complex/concept/Simplicial_complex_for_rips.h5
-rw-r--r--src/Rips_complex/doc/Intro_rips_complex.h16
-rw-r--r--src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp6
-rw-r--r--src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp6
-rw-r--r--src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp6
-rw-r--r--src/Rips_complex/example/example_rips_complex_from_off_file.cpp6
-rw-r--r--src/Rips_complex/example/full_skeleton_rips_for_doc.txt2
-rw-r--r--src/Rips_complex/example/one_skeleton_rips_for_doc.txt2
-rw-r--r--src/Rips_complex/include/gudhi/Rips_complex.h37
-rw-r--r--src/Rips_complex/test/test_rips_complex.cpp16
11 files changed, 60 insertions, 49 deletions
diff --git a/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp b/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
index c8f0921a..b159c62e 100644
--- a/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
@@ -34,6 +34,13 @@
#include <utility> // for pair
#include <map>
+// ----------------------------------------------------------------------------
+// rips_persistence_step_by_step is an example of each step that is required to
+// build a Rips over a Simplex_tree. Please refer to rips_persistence to see
+// how to do the same thing with the Rips_complex wrapper for less detailed
+// steps.
+// ----------------------------------------------------------------------------
+
// Types definition
using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
using Vertex_handle = Simplex_tree::Vertex_handle;
diff --git a/src/Rips_complex/concept/Simplicial_complex_for_rips.h b/src/Rips_complex/concept/Simplicial_complex_for_rips.h
index dc871177..7dab0615 100644
--- a/src/Rips_complex/concept/Simplicial_complex_for_rips.h
+++ b/src/Rips_complex/concept/Simplicial_complex_for_rips.h
@@ -31,11 +31,10 @@ namespace rips_complex {
* complex, that can be created from a `Rips_complex`. The only available model for the moment is the `Simplex_tree`.
*/
struct SimplicialComplexForRips {
- /** \brief Handle to specify the simplex filtration value. */
+ /** \brief Type used to store the filtration values of the simplicial complex. */
typedef unspecified Filtration_value;
- /** \brief Inserts a given range `Gudhi::rips_complex::Rips_complex::OneSkeletonGraph` in the simplicial
- * complex. */
+ /** \brief Inserts a given `Gudhi::rips_complex::Rips_complex::OneSkeletonGraph` in the simplicial complex. */
template<class OneSkeletonGraph>
void insert_graph(const OneSkeletonGraph& skel_graph);
diff --git a/src/Rips_complex/doc/Intro_rips_complex.h b/src/Rips_complex/doc/Intro_rips_complex.h
index 884a4eff..8e374c09 100644
--- a/src/Rips_complex/doc/Intro_rips_complex.h
+++ b/src/Rips_complex/doc/Intro_rips_complex.h
@@ -48,8 +48,10 @@ namespace rips_complex {
* All edges that have a filtration value strictly greater than a given threshold value are not inserted into
* the complex.
*
- * When creating a simplicial complex from this one skeleton graph, rips inserts the one skeleton graph into the data
+ * When creating a simplicial complex from this one skeleton graph, Rips inserts the one skeleton graph into the data
* structure, and then expands the simplicial complex when required.
+ *
+ * Vertex name correspond to the index of the point in the given range (aka. the point cloud).
*
* \image html "rips_complex_representation.png" "Rips-complex one skeleton graph representation"
*
@@ -57,6 +59,10 @@ namespace rips_complex {
* value set with \f$max(filtration(4,5), filtration(4,6), filtration(5,6))\f$.
* And so on for simplex (0,1,2,3).
*
+ * If the Rips_complex interfaces are not detailed enough for your need, please refer to
+ * <a href="_persistent_cohomology_2rips_persistence_step_by_step_8cpp-example.html">
+ * rips_persistence_step_by_step.cpp</a> example, where the graph construction over the Simplex_tree is more detailed.
+ *
* \section ripspointsdistance Point cloud and distance function
*
* \subsection ripspointscloudexample Example from a point cloud and a distance function
@@ -68,7 +74,7 @@ namespace rips_complex {
*
* \include Rips_complex/example_one_skeleton_rips_from_points.cpp
*
- * When launching (rips maximal distance between 2 points is 12.0, is expanded until dimension 1 - one skeleton graph
+ * When launching (Rips maximal distance between 2 points is 12.0, is expanded until dimension 1 - one skeleton graph
* in other words):
*
* \code $> ./oneskeletonripspoints
@@ -85,7 +91,7 @@ namespace rips_complex {
* Then it creates a `Simplex_tree` with it.
*
*
- * Then, it is asked to display information about the rips complex.
+ * Then, it is asked to display information about the Rips complex.
*
* \include Rips_complex/example_rips_complex_from_off_file.cpp
*
@@ -111,7 +117,7 @@ namespace rips_complex {
*
* \include Rips_complex/example_one_skeleton_rips_from_distance_matrix.cpp
*
- * When launching (rips maximal distance between 2 points is 1.0, is expanded until dimension 1 - one skeleton graph
+ * When launching (Rips maximal distance between 2 points is 1.0, is expanded until dimension 1 - one skeleton graph
* with other words):
*
* \code $> ./oneskeletonripsdistance
@@ -127,7 +133,7 @@ namespace rips_complex {
* Then it creates a `Simplex_tree` with it.
*
*
- * Then, it is asked to display information about the rips complex.
+ * Then, it is asked to display information about the Rips complex.
*
* \include Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp
*
diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp
index 90bd8e38..bbc3c755 100644
--- a/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp
+++ b/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp
@@ -29,7 +29,7 @@ int main() {
distances.push_back({0.11, 0.39, 0.97, 0.30});
// ----------------------------------------------------------------------------
- // Init of a rips complex from points
+ // Init of a Rips complex from points
// ----------------------------------------------------------------------------
double threshold = 1.0;
Rips_complex rips_complex_from_points(distances, threshold);
@@ -37,13 +37,13 @@ int main() {
Simplex_tree stree;
rips_complex_from_points.create_complex(stree, 1);
// ----------------------------------------------------------------------------
- // Display information about the one skeleton rips complex
+ // Display information about the one skeleton Rips complex
// ----------------------------------------------------------------------------
std::cout << "Rips complex is of dimension " << stree.dimension() <<
" - " << stree.num_simplices() << " simplices - " <<
stree.num_vertices() << " vertices." << std::endl;
- std::cout << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" <<
+ std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
std::endl;
for (auto f_simplex : stree.filtration_simplex_range()) {
std::cout << " ( ";
diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
index 5d1216a0..3fd69ebc 100644
--- a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
+++ b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
@@ -24,7 +24,7 @@ int main() {
points.push_back({9.0, 17.0});
// ----------------------------------------------------------------------------
- // Init of a rips complex from points
+ // Init of a Rips complex from points
// ----------------------------------------------------------------------------
double threshold = 12.0;
Rips_complex rips_complex_from_points(points, threshold, Euclidean_distance());
@@ -32,13 +32,13 @@ int main() {
Simplex_tree stree;
rips_complex_from_points.create_complex(stree, 1);
// ----------------------------------------------------------------------------
- // Display information about the one skeleton rips complex
+ // Display information about the one skeleton Rips complex
// ----------------------------------------------------------------------------
std::cout << "Rips complex is of dimension " << stree.dimension() <<
" - " << stree.num_simplices() << " simplices - " <<
stree.num_vertices() << " vertices." << std::endl;
- std::cout << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" <<
+ std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
std::endl;
for (auto f_simplex : stree.filtration_simplex_range()) {
std::cout << " ( ";
diff --git a/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
index cc6c3a33..ef3a9d13 100644
--- a/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
+++ b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
@@ -29,7 +29,7 @@ int main(int argc, char **argv) {
using Distance_matrix = std::vector<std::vector<Filtration_value>>;
// ----------------------------------------------------------------------------
- // Init of a rips complex from a distance matrix in a csv file
+ // Init of a Rips complex from a distance matrix in a csv file
// Default separator is ';'
// ----------------------------------------------------------------------------
Distance_matrix distances = read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_file_name);
@@ -50,13 +50,13 @@ int main(int argc, char **argv) {
std::ostream output_stream(streambufffer);
// ----------------------------------------------------------------------------
- // Display information about the rips complex
+ // Display information about the Rips complex
// ----------------------------------------------------------------------------
output_stream << "Rips complex is of dimension " << stree.dimension() <<
" - " << stree.num_simplices() << " simplices - " <<
stree.num_vertices() << " vertices." << std::endl;
- output_stream << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" <<
+ output_stream << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
std::endl;
for (auto f_simplex : stree.filtration_simplex_range()) {
output_stream << " ( ";
diff --git a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
index b6c961d0..a1e4e255 100644
--- a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
+++ b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
@@ -29,7 +29,7 @@ int main(int argc, char **argv) {
using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
// ----------------------------------------------------------------------------
- // Init of a rips complex from an OFF file
+ // Init of a Rips complex from an OFF file
// ----------------------------------------------------------------------------
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Euclidean_distance());
@@ -49,13 +49,13 @@ int main(int argc, char **argv) {
std::ostream output_stream(streambufffer);
// ----------------------------------------------------------------------------
- // Display information about the rips complex
+ // Display information about the Rips complex
// ----------------------------------------------------------------------------
output_stream << "Rips complex is of dimension " << stree.dimension() <<
" - " << stree.num_simplices() << " simplices - " <<
stree.num_vertices() << " vertices." << std::endl;
- output_stream << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" <<
+ output_stream << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
std::endl;
for (auto f_simplex : stree.filtration_simplex_range()) {
output_stream << " ( ";
diff --git a/src/Rips_complex/example/full_skeleton_rips_for_doc.txt b/src/Rips_complex/example/full_skeleton_rips_for_doc.txt
index 319931e0..55de4ab8 100644
--- a/src/Rips_complex/example/full_skeleton_rips_for_doc.txt
+++ b/src/Rips_complex/example/full_skeleton_rips_for_doc.txt
@@ -1,5 +1,5 @@
Rips complex is of dimension 3 - 24 simplices - 7 vertices.
-Iterator on rips complex simplices in the filtration order, with [filtration value]:
+Iterator on Rips complex simplices in the filtration order, with [filtration value]:
( 0 ) -> [0]
( 1 ) -> [0]
( 2 ) -> [0]
diff --git a/src/Rips_complex/example/one_skeleton_rips_for_doc.txt b/src/Rips_complex/example/one_skeleton_rips_for_doc.txt
index b0e25cc5..706512a5 100644
--- a/src/Rips_complex/example/one_skeleton_rips_for_doc.txt
+++ b/src/Rips_complex/example/one_skeleton_rips_for_doc.txt
@@ -1,5 +1,5 @@
Rips complex is of dimension 1 - 18 simplices - 7 vertices.
-Iterator on rips complex simplices in the filtration order, with [filtration value]:
+Iterator on Rips complex simplices in the filtration order, with [filtration value]:
( 0 ) -> [0]
( 1 ) -> [0]
( 2 ) -> [0]
diff --git a/src/Rips_complex/include/gudhi/Rips_complex.h b/src/Rips_complex/include/gudhi/Rips_complex.h
index f0f39db8..1e4b76a7 100644
--- a/src/Rips_complex/include/gudhi/Rips_complex.h
+++ b/src/Rips_complex/include/gudhi/Rips_complex.h
@@ -51,7 +51,7 @@ namespace rips_complex {
* to a given threshold. Edge length is computed from a user given point cloud with a given distance function, or a
* distance matrix.
*
- * \tparam Filtration_value must meet `SimplicialComplexForRips` concept.
+ * \tparam Filtration_value is the type used to store the filtration values of the simplicial complex.
*/
template<typename Filtration_value>
class Rips_complex {
@@ -70,31 +70,31 @@ class Rips_complex {
/** \brief Rips_complex constructor from a list of points.
*
* @param[in] points Range of points.
- * @param[in] threshold rips value.
+ * @param[in] threshold Rips value.
* @param[in] distance distance function that returns a `Filtration_value` from 2 given points.
*
- * \tparam InputPointRange must be a range for which `std::begin` and `std::end` return input iterators on a
+ * \tparam ForwardPointRange must be a range for which `std::begin` and `std::end` return input iterators on a
* point.
*
* \tparam Distance furnishes `operator()(const Point& p1, const Point& p2)`, where
- * `Point` is a point from the `InputPointRange`, and that returns a `Filtration_value`.
+ * `Point` is a point from the `ForwardPointRange`, and that returns a `Filtration_value`.
*/
- template<typename InputPointRange, typename Distance >
- Rips_complex(const InputPointRange& points, Filtration_value threshold, Distance distance) {
- compute_proximity_graph<InputPointRange, Distance >(points, threshold, distance);
+ template<typename ForwardPointRange, typename Distance >
+ Rips_complex(const ForwardPointRange& points, Filtration_value threshold, Distance distance) {
+ compute_proximity_graph(points, threshold, distance);
}
/** \brief Rips_complex constructor from a distance matrix.
*
* @param[in] distance_matrix Range of distances.
- * @param[in] threshold rips value.
+ * @param[in] threshold Rips value.
*
- * \tparam InputDistanceRange must have a `size()` method and on which `distance_matrix[i][j]` returns
- * the distance between points \f$i\f$ and \f$j\f$ as long as \f$ 0 \leqslant i \leqslant j \leqslant
+ * \tparam DistanceMatrix must have a `size()` method and on which `distance_matrix[i][j]` returns
+ * the distance between points \f$i\f$ and \f$j\f$ as long as \f$ 0 \leqslant i < j \leqslant
* distance\_matrix.size().\f$
*/
- template<typename InputDistanceRange>
- Rips_complex(const InputDistanceRange& distance_matrix, Filtration_value threshold) {
+ template<typename DistanceMatrix>
+ Rips_complex(const DistanceMatrix& distance_matrix, Filtration_value threshold) {
compute_proximity_graph(boost::irange((size_t)0, distance_matrix.size()), threshold,
[&](size_t i, size_t j){return distance_matrix[j][i];});
}
@@ -105,7 +105,7 @@ class Rips_complex {
* \tparam SimplicialComplexForRips must meet `SimplicialComplexForRips` concept.
*
* @param[in] complex SimplicialComplexForRips to be created.
- * @param[in] dim_max graph expansion for rips until this given maximal dimension.
+ * @param[in] dim_max graph expansion for Rips until this given maximal dimension.
* @exception std::invalid_argument In debug mode, if `complex.num_vertices()` does not return 0.
*
*/
@@ -126,14 +126,14 @@ class Rips_complex {
* If points contains n elements, the proximity graph is the graph with n vertices, and an edge [u,v] iff the
* distance function between points u and v is smaller than threshold.
*
- * \tparam InputPointRange furnishes `.begin()` and `.end()`
+ * \tparam ForwardPointRange furnishes `.begin()` and `.end()`
* methods.
*
* \tparam Distance furnishes `operator()(const Point& p1, const Point& p2)`, where
- * `Point` is a point from the `InputPointRange`, and that returns a `Filtration_value`.
+ * `Point` is a point from the `ForwardPointRange`, and that returns a `Filtration_value`.
*/
- template< typename InputPointRange, typename Distance >
- void compute_proximity_graph(const InputPointRange& points, Filtration_value threshold,
+ template< typename ForwardPointRange, typename Distance >
+ void compute_proximity_graph(const ForwardPointRange& points, Filtration_value threshold,
Distance distance) {
std::vector< std::pair< Vertex_handle, Vertex_handle > > edges;
std::vector< Filtration_value > edges_fil;
@@ -144,7 +144,7 @@ class Rips_complex {
// --------------------------------------------------------------------------------------------
// Creates the vector of edges and its filtration values (returned by distance function)
Vertex_handle idx_u = 0;
- for (auto it_u = std::begin(points); it_u != std::end(points); ++it_u) {
+ for (auto it_u = std::begin(points); it_u != std::end(points); ++it_u, ++idx_u) {
Vertex_handle idx_v = idx_u + 1;
for (auto it_v = it_u + 1; it_v != std::end(points); ++it_v, ++idx_v) {
Filtration_value fil = distance(*it_u, *it_v);
@@ -153,7 +153,6 @@ class Rips_complex {
edges_fil.push_back(fil);
}
}
- ++idx_u;
}
// --------------------------------------------------------------------------------------------
diff --git a/src/Rips_complex/test/test_rips_complex.cpp b/src/Rips_complex/test/test_rips_complex.cpp
index 1bdd0512..ae68ba0d 100644
--- a/src/Rips_complex/test/test_rips_complex.cpp
+++ b/src/Rips_complex/test/test_rips_complex.cpp
@@ -51,12 +51,12 @@ bool are_almost_the_same(float a, float b) {
BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) {
// ----------------------------------------------------------------------------
//
- // Init of a rips complex from a OFF file
+ // Init of a Rips complex from a OFF file
//
// ----------------------------------------------------------------------------
std::string off_file_name("alphacomplexdoc.off");
double rips_threshold = 12.0;
- std::cout << "========== OFF FILE NAME = " << off_file_name << " - rips threshold=" <<
+ std::cout << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" <<
rips_threshold << "==========" << std::endl;
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
@@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) {
points.push_back(Point(coords.begin(), coords.end()));
// ----------------------------------------------------------------------------
- // Init of a rips complex from the list of points
+ // Init of a Rips complex from the list of points
// ----------------------------------------------------------------------------
Rips_complex rips_complex_from_points(points, 2.0, Custom_square_euclidean_distance());
@@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) {
rips_complex_from_points.create_complex(st, DIMENSION);
// Another way to check num_simplices
- std::cout << "Iterator on rips complex simplices in the filtration order, with [filtration value]:" << std::endl;
+ std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl;
int num_simplices = 0;
for (auto f_simplex : st.filtration_simplex_range()) {
num_simplices++;
@@ -236,12 +236,12 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) {
BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) {
// ----------------------------------------------------------------------------
//
- // Init of a rips complex from a OFF file
+ // Init of a Rips complex from a OFF file
//
// ----------------------------------------------------------------------------
std::string csv_file_name("full_square_distance_matrix.csv");
double rips_threshold = 12.0;
- std::cout << "========== CSV FILE NAME = " << csv_file_name << " - rips threshold=" <<
+ std::cout << "========== CSV FILE NAME = " << csv_file_name << " - Rips threshold=" <<
rips_threshold << "==========" << std::endl;
Distance_matrix distances = read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_file_name);
@@ -332,12 +332,12 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) {
BOOST_AUTO_TEST_CASE(Rips_create_complex_throw) {
// ----------------------------------------------------------------------------
//
- // Init of a rips complex from a OFF file
+ // Init of a Rips complex from a OFF file
//
// ----------------------------------------------------------------------------
std::string off_file_name("alphacomplexdoc.off");
double rips_threshold = 12.0;
- std::cout << "========== OFF FILE NAME = " << off_file_name << " - rips threshold=" <<
+ std::cout << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" <<
rips_threshold << "==========" << std::endl;
Gudhi::Points_off_reader<Point> off_reader(off_file_name);