#include <gudhi/graph_simplicial_complex.h>
#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::cout << "********************************************************************" << std::endl;
std::cout << "EXAMPLE OF SIMPLE INSERTION" << std::endl;
std::cout << " * INSERT 0" << std::endl;
typeVectorVertex firstSimplexVector = {0};
typePairSimplexBool returnValue =
if (returnValue.second == true) {
std::cout << " + 0 INSERTED" << std::endl;
} else {
std::cout << " - 0 NOT INSERTED" << std::endl;
}
std::cout << " * INSERT 1" << std::endl;
typeVectorVertex secondSimplexVector = {1};
if (returnValue.second == true) {
std::cout << " + 1 INSERTED" << std::endl;
} else {
std::cout << " - 1 NOT INSERTED" << std::endl;
}
std::cout << " * INSERT (0,1)" << std::endl;
typeVectorVertex thirdSimplexVector = {0, 1};
if (returnValue.second == true) {
std::cout << " + (0,1) INSERTED" << std::endl;
} else {
std::cout << " - (0,1) NOT INSERTED" << std::endl;
}
std::cout << " * INSERT 2" << std::endl;
typeVectorVertex fourthSimplexVector = {2};
if (returnValue.second == true) {
std::cout << " + 2 INSERTED" << std::endl;
} else {
std::cout << " - 2 NOT INSERTED" << std::endl;
}
std::cout << " * INSERT (2,0)" << std::endl;
typeVectorVertex fifthSimplexVector = {2, 0};
if (returnValue.second == true) {
std::cout << " + (2,0) INSERTED" << std::endl;
} else {
std::cout << " - (2,0) NOT INSERTED" << std::endl;
}
std::cout << " * INSERT (2,1)" << std::endl;
typeVectorVertex sixthSimplexVector = {2, 1};
if (returnValue.second == true) {
std::cout << " + (2,1) INSERTED" << std::endl;
} else {
std::cout << " - (2,1) NOT INSERTED" << std::endl;
}
std::cout << " * INSERT (2,1,0)" << std::endl;
typeVectorVertex seventhSimplexVector = {2, 1, 0};
if (returnValue.second == true) {
std::cout << " + (2,1,0) INSERTED" << std::endl;
} else {
std::cout << " - (2,1,0) NOT INSERTED" << std::endl;
}
std::cout << " * INSERT 3" << std::endl;
typeVectorVertex eighthSimplexVector = {3};
if (returnValue.second == true) {
std::cout << " + 3 INSERTED" << std::endl;
} else {
std::cout << " - 3 NOT INSERTED" << std::endl;
}
std::cout << " * INSERT (3,0)" << std::endl;
typeVectorVertex ninethSimplexVector = {3, 0};
if (returnValue.second == true) {
std::cout << " + (3,0) INSERTED" << std::endl;
} else {
std::cout << " - (3,0) NOT INSERTED" << std::endl;
}
std::cout << " * INSERT 0 (already inserted)" << std::endl;
typeVectorVertex tenthSimplexVector = {0};
if (returnValue.second == true) {
std::cout << " + 0 INSERTED" << std::endl;
} else {
std::cout << " - 0 NOT INSERTED" << std::endl;
}
std::cout << " * INSERT (2,1,0) (already inserted)" << std::endl;
typeVectorVertex eleventhSimplexVector = {2, 1, 0};
if (returnValue.second == true) {
std::cout << " + (2,1,0) INSERTED" << std::endl;
} else {
std::cout << " - (2,1,0) NOT INSERTED" << std::endl;
}
std::cout << "********************************************************************\n";
std::cout <<
"* The complex contains " << simplexTree.
num_simplices() <<
" simplices\n";
std::cout <<
" - dimension " << simplexTree.
dimension() <<
"\n";
std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
std::cout << " "
<<
"[" << simplexTree.
filtration(f_simplex) <<
"] ";
std::cout << std::endl;
}
std::cout << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n";
std::cout << "***+ YES IT IS!\n";
else
std::cout << "***- NO IT ISN'T\n";
typeVectorVertex unknownSimplexVector = {15};
simplexFound = simplexTree.
find(unknownSimplexVector);
std::cout << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n";
std::cout << "***+ YES IT IS!\n";
else
std::cout << "***- NO IT ISN'T\n";
simplexFound = simplexTree.
find(fifthSimplexVector);
std::cout << "**************IS THE SIMPLEX {2,0} IN THE SIMPLEX TREE ?\n";
std::cout << "***+ YES IT IS!\n";
else
std::cout << "***- NO IT ISN'T\n";
typeVectorVertex otherSimplexVector = {1, 15};
simplexFound = simplexTree.
find(otherSimplexVector);
std::cout << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n";
std::cout << "***+ YES IT IS!\n";
else
std::cout << "***- NO IT ISN'T\n";
typeVectorVertex invSimplexVector = {1, 2, 0};
simplexFound = simplexTree.
find(invSimplexVector);
std::cout << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n";
std::cout << "***+ YES IT IS!\n";
else
std::cout << "***- NO IT ISN'T\n";
simplexFound = simplexTree.
find({0, 1});
std::cout << "**************IS THE SIMPLEX {0,1} IN THE SIMPLEX TREE ?\n";
std::cout << "***+ YES IT IS!\n";
else
std::cout << "***- NO IT ISN'T\n";
std::cout << "**************COFACES OF {0,1} IN CODIMENSION 1 ARE\n";
std::cout << std::endl;
}
std::cout << "**************STARS OF {0,1} ARE\n";
std::cout << std::endl;
}
std::cout << "**************BOUNDARIES OF {0,1,2} ARE\n";
std::cout << std::endl;
}
return 0;
}