#include <gudhi/Simplex_tree.h>
#include <gudhi/Persistent_cohomology.h>
#include <iostream>
#include <ctime>
#include <utility>
#include <vector>
using typeVectorVertex = std::vector< Simplex_tree::Vertex_handle >;
void usage(char * const progName) {
std::cerr << "Usage: " << progName << " coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
exit(-1);
}
int main(int argc, char * const argv[]) {
if (argc != 3) {
std::cerr << "Error: Number of arguments (" << argc << ") is not correct\n";
usage(argv[0]);
}
int coeff_field_characteristic = 0;
int returnedScanValue = sscanf(argv[1], "%d", &coeff_field_characteristic);
if ((returnedScanValue == EOF) || (coeff_field_characteristic <= 0)) {
std::cerr << "Error: " << argv[1] << " is not correct\n";
usage(argv[0]);
}
Filtration_value min_persistence = 0.0;
returnedScanValue = sscanf(argv[2], "%lf", &min_persistence);
if ((returnedScanValue == EOF) || (min_persistence < -1.0)) {
std::cerr << "Error: " << argv[2] << " is not correct\n";
usage(argv[0]);
}
std::clog << "********************************************************************" << std::endl;
std::clog << "TEST OF INSERTION" << std::endl;
Simplex_tree st;
std::clog << " - INSERT (0,1,2)" << std::endl;
typeVectorVertex SimplexVector = {0, 1, 2};
std::clog << " - INSERT 3" << std::endl;
SimplexVector = {3};
std::clog << " - INSERT (0,3)" << std::endl;
SimplexVector = {0, 3};
std::clog << " - INSERT (0,1) (already inserted)" << std::endl;
SimplexVector = {0, 1};
std::clog << " - INSERT (3,4,5)" << std::endl;
SimplexVector = {3, 4, 5};
std::clog << " - INSERT (0,1,6,7)" << std::endl;
SimplexVector = {0, 1, 6, 7};
std::clog << " - INSERT (4,5,8,9)" << std::endl;
SimplexVector = {4, 5, 8, 9};
std::clog << " - INSERT (9,10,11)" << std::endl;
SimplexVector = {9, 10, 11};
std::clog << " - INSERT (2,10,12)" << std::endl;
SimplexVector = {2, 10, 12};
std::clog << " - INSERT (11,6)" << std::endl;
SimplexVector = {6, 11};
std::clog << " - INSERT (13,14,15)" << std::endl;
SimplexVector = {13, 14, 15};
<< std::endl;
std::clog <<
" - dimension " << st.
dimension() << std::endl;
std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:"
<< std::endl;
std::clog << "**************************************************************" << std::endl;
std::clog << "strict graph G { " << std::endl;
std::clog <<
" " <<
"[" << st.
filtration(f_simplex) <<
"] ";
std::clog << static_cast<int>(vertex) << " -- ";
}
std::clog << ";" << std::endl;
}
std::clog << "}" << std::endl;
std::clog << "**************************************************************" << std::endl;
Persistent_cohomology pcoh(st);
pcoh.init_coefficients(coeff_field_characteristic);
pcoh.compute_persistent_cohomology(min_persistence);
pcoh.output_diagram();
return 0;
}
Simplex Tree data structure for representing simplicial complexes.
Definition Simplex_tree.h:101
Options::Filtration_value Filtration_value
Definition Simplex_tree.h:108
Simplex_vertex_range simplex_vertex_range(Simplex_handle sh) const
Returns a range over the vertices of a simplex.
Definition Simplex_tree.h:407
std::pair< Simplex_handle, bool > insert_simplex_and_subfaces(const InputVertexRange &n_simplex, const Filtration_value &filtration=Filtration_value())
Inserts a N-simplex and all his subfaces, from a N-simplex represented by a range of Vertex_handles,...
Definition Simplex_tree.h:1191
static const Filtration_value & filtration(Simplex_handle sh)
Returns the filtration value of a simplex.
Definition Simplex_tree.h:765
Filtration_simplex_range const & filtration_simplex_range(Indexing_tag=Indexing_tag()) const
Returns a range over the simplices of the simplicial complex, in the order of the filtration.
Definition Simplex_tree.h:396
size_t num_vertices() const
Returns the number of vertices in the complex.
Definition Simplex_tree.h:816
size_t num_simplices() const
Returns the number of simplices in the simplex_tree.
Definition Simplex_tree.h:829
Structure representing the coefficient field .
Definition Field_Zp.h:27
Computes the persistent cohomology of a filtered complex.
Definition Persistent_cohomology.h:54
Graph simplicial complex methods.