#include <gudhi/Simplex_tree.h>
#include <iostream>
#include <utility>
#include <vector>
using typeVectorVertex = std::vector<Vertex_handle>;
using typePairSimplexBool = std::pair<Simplex_tree::Simplex_handle, bool>;
int main(int argc, char* const argv[]) {
std::clog << "********************************************************************" << std::endl;
std::clog << "EXAMPLE OF SIMPLE INSERTION" << std::endl;
std::clog << " * INSERT 0" << std::endl;
typeVectorVertex firstSimplexVector = {0};
typePairSimplexBool returnValue =
if (returnValue.second == true) {
std::clog << " + 0 INSERTED" << std::endl;
} else {
std::clog << " - 0 NOT INSERTED" << std::endl;
}
std::clog << " * INSERT 1" << std::endl;
typeVectorVertex secondSimplexVector = {1};
if (returnValue.second == true) {
std::clog << " + 1 INSERTED" << std::endl;
} else {
std::clog << " - 1 NOT INSERTED" << std::endl;
}
std::clog << " * INSERT (0,1)" << std::endl;
typeVectorVertex thirdSimplexVector = {0, 1};
if (returnValue.second == true) {
std::clog << " + (0,1) INSERTED" << std::endl;
} else {
std::clog << " - (0,1) NOT INSERTED" << std::endl;
}
std::clog << " * INSERT 2" << std::endl;
typeVectorVertex fourthSimplexVector = {2};
if (returnValue.second == true) {
std::clog << " + 2 INSERTED" << std::endl;
} else {
std::clog << " - 2 NOT INSERTED" << std::endl;
}
std::clog << " * INSERT (2,0)" << std::endl;
typeVectorVertex fifthSimplexVector = {2, 0};
if (returnValue.second == true) {
std::clog << " + (2,0) INSERTED" << std::endl;
} else {
std::clog << " - (2,0) NOT INSERTED" << std::endl;
}
std::clog << " * INSERT (2,1)" << std::endl;
typeVectorVertex sixthSimplexVector = {2, 1};
if (returnValue.second == true) {
std::clog << " + (2,1) INSERTED" << std::endl;
} else {
std::clog << " - (2,1) NOT INSERTED" << std::endl;
}
std::clog << " * INSERT (2,1,0)" << std::endl;
typeVectorVertex seventhSimplexVector = {2, 1, 0};
if (returnValue.second == true) {
std::clog << " + (2,1,0) INSERTED" << std::endl;
} else {
std::clog << " - (2,1,0) NOT INSERTED" << std::endl;
}
std::clog << " * INSERT 3" << std::endl;
typeVectorVertex eighthSimplexVector = {3};
if (returnValue.second == true) {
std::clog << " + 3 INSERTED" << std::endl;
} else {
std::clog << " - 3 NOT INSERTED" << std::endl;
}
std::clog << " * INSERT (3,0)" << std::endl;
typeVectorVertex ninethSimplexVector = {3, 0};
if (returnValue.second == true) {
std::clog << " + (3,0) INSERTED" << std::endl;
} else {
std::clog << " - (3,0) NOT INSERTED" << std::endl;
}
std::clog << " * INSERT 0 (already inserted)" << std::endl;
typeVectorVertex tenthSimplexVector = {0};
if (returnValue.second == true) {
std::clog << " + 0 INSERTED" << std::endl;
} else {
std::clog << " - 0 NOT INSERTED" << std::endl;
}
std::clog << " * INSERT (2,1,0) (already inserted)" << std::endl;
typeVectorVertex eleventhSimplexVector = {2, 1, 0};
if (returnValue.second == true) {
std::clog << " + (2,1,0) INSERTED" << std::endl;
} else {
std::clog << " - (2,1,0) NOT INSERTED" << std::endl;
}
std::clog << "********************************************************************\n";
std::clog <<
"* The complex contains " << simplexTree.
num_simplices() <<
" simplices\n";
std::clog <<
" - dimension " << simplexTree.
dimension() <<
"\n";
std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
std::clog << " "
<<
"[" << simplexTree.
filtration(f_simplex) <<
"] ";
std::clog << std::endl;
}
std::clog << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n";
std::clog << "***+ YES IT IS!\n";
else
std::clog << "***- NO IT ISN'T\n";
typeVectorVertex unknownSimplexVector = {15};
simplexFound = simplexTree.
find(unknownSimplexVector);
std::clog << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n";
std::clog << "***+ YES IT IS!\n";
else
std::clog << "***- NO IT ISN'T\n";
simplexFound = simplexTree.
find(fifthSimplexVector);
std::clog << "**************IS THE SIMPLEX {2,0} IN THE SIMPLEX TREE ?\n";
std::clog << "***+ YES IT IS!\n";
else
std::clog << "***- NO IT ISN'T\n";
typeVectorVertex otherSimplexVector = {1, 15};
simplexFound = simplexTree.
find(otherSimplexVector);
std::clog << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n";
std::clog << "***+ YES IT IS!\n";
else
std::clog << "***- NO IT ISN'T\n";
typeVectorVertex invSimplexVector = {1, 2, 0};
simplexFound = simplexTree.
find(invSimplexVector);
std::clog << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n";
std::clog << "***+ YES IT IS!\n";
else
std::clog << "***- NO IT ISN'T\n";
simplexFound = simplexTree.
find({0, 1});
std::clog << "**************IS THE SIMPLEX {0,1} IN THE SIMPLEX TREE ?\n";
std::clog << "***+ YES IT IS!\n";
else
std::clog << "***- NO IT ISN'T\n";
std::clog << "**************COFACES OF {0,1} IN CODIMENSION 1 ARE\n";
std::clog << std::endl;
}
std::clog << "**************STARS OF {0,1} ARE\n";
std::clog << std::endl;
}
std::clog << "**************BOUNDARIES OF {0,1,2} ARE\n";
std::clog << std::endl;
}
return 0;
}
Options::Filtration_value Filtration_value
Type for the value of the filtration function.
Definition: Simplex_tree.h:102
Cofaces_simplex_range cofaces_simplex_range(const Simplex_handle simplex, int codimension)
Compute the cofaces of a n simplex.
Definition: Simplex_tree.h:1172
Dictionary::iterator Simplex_handle
Handle type to a simplex contained in the simplicial complex represented by the simplex tree.
Definition: Simplex_tree.h:175
Filtration_simplex_range const & filtration_simplex_range(Indexing_tag=Indexing_tag())
Returns a range over the simplices of the simplicial complex, in the order of the filtration.
Definition: Simplex_tree.h:338
Simplex_vertex_range simplex_vertex_range(Simplex_handle sh) const
Returns a range over the vertices of a simplex.
Definition: Simplex_tree.h:349
static Filtration_value filtration(Simplex_handle sh)
Returns the filtration value of a simplex.
Definition: Simplex_tree.h:614
std::pair< Simplex_handle, bool > insert_simplex(const InputVertexRange &simplex, Filtration_value filtration=0)
Insert a simplex, represented by a range of Vertex_handles, in the simplicial complex.
Definition: Simplex_tree.h:913
Cofaces_simplex_range star_simplex_range(const Simplex_handle simplex)
Compute the star of a n simplex.
Definition: Simplex_tree.h:1158
Simplex_handle find(const InputVertexRange &s)
Given a range of Vertex_handles, returns the Simplex_handle of the simplex in the simplicial complex ...
Definition: Simplex_tree.h:767
Options::Vertex_handle Vertex_handle
Type for the vertex handle.
Definition: Simplex_tree.h:110
Boundary_simplex_range boundary_simplex_range(SimplexHandle sh)
Returns a range over the simplices of the boundary of a simplex.
Definition: Simplex_tree.h:370
size_t num_simplices()
Returns the number of simplices in the simplex_tree.
Definition: Simplex_tree.h:664
static Simplex_handle null_simplex()
Returns a Simplex_handle different from all Simplex_handles associated to the simplices in the simpli...
Definition: Simplex_tree.h:635
Graph simplicial complex methods.
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20
Handle type for the vertices of a cell complex.
Definition: VertexHandle.h:15