summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/example/graph_expansion_with_blocker.cpp
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-02-01 18:19:00 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-02-01 18:19:00 +0000
commit24386d494ba4b8bb19b4559f6d2b3e4ecc980571 (patch)
treef4c1034bd75d6f8a237a4ff7c5f30df6d6732803 /src/Simplex_tree/example/graph_expansion_with_blocker.cpp
parentd3ff96460cbcd7de4d1f2d03c61e4227dd4c4767 (diff)
parente15408b4af5cba8966aa8773f6ee6884942c1d95 (diff)
Merge from trunk.
hand-merge README that moved to *.md. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/sparserips-glisse@3201 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f1922a265c79937e507bbb963875d21fae88069e
Diffstat (limited to 'src/Simplex_tree/example/graph_expansion_with_blocker.cpp')
-rw-r--r--src/Simplex_tree/example/graph_expansion_with_blocker.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/Simplex_tree/example/graph_expansion_with_blocker.cpp b/src/Simplex_tree/example/graph_expansion_with_blocker.cpp
index 86bfb8cb..0d458cbd 100644
--- a/src/Simplex_tree/example/graph_expansion_with_blocker.cpp
+++ b/src/Simplex_tree/example/graph_expansion_with_blocker.cpp
@@ -27,8 +27,7 @@
using Simplex_tree = Gudhi::Simplex_tree<>;
using Simplex_handle = Simplex_tree::Simplex_handle;
-int main(int argc, char * const argv[]) {
-
+int main(int argc, char* const argv[]) {
// Construct the Simplex Tree with a 1-skeleton graph example
Simplex_tree simplexTree;
@@ -45,33 +44,32 @@ int main(int argc, char * const argv[]) {
simplexTree.insert_simplex({5, 6}, 10.);
simplexTree.insert_simplex({6}, 10.);
- simplexTree.expansion_with_blockers(3, [&](Simplex_handle sh){
- bool result = false;
- std::cout << "Blocker on [";
- // User can loop on the vertices from the given simplex_handle i.e.
- for (auto vertex : simplexTree.simplex_vertex_range(sh)) {
- // We block the expansion, if the vertex '6' is in the given list of vertices
- if (vertex == 6)
- result = true;
- std::cout << vertex << ", ";
- }
- std::cout << "] ( " << simplexTree.filtration(sh);
- // User can re-assign a new filtration value directly in the blocker (default is the maximal value of boudaries)
- simplexTree.assign_filtration(sh, simplexTree.filtration(sh) + 1.);
+ simplexTree.expansion_with_blockers(3, [&](Simplex_handle sh) {
+ bool result = false;
+ std::cout << "Blocker on [";
+ // User can loop on the vertices from the given simplex_handle i.e.
+ for (auto vertex : simplexTree.simplex_vertex_range(sh)) {
+ // We block the expansion, if the vertex '6' is in the given list of vertices
+ if (vertex == 6) result = true;
+ std::cout << vertex << ", ";
+ }
+ std::cout << "] ( " << simplexTree.filtration(sh);
+ // User can re-assign a new filtration value directly in the blocker (default is the maximal value of boudaries)
+ simplexTree.assign_filtration(sh, simplexTree.filtration(sh) + 1.);
- std::cout << " + 1. ) = " << result << std::endl;
+ std::cout << " + 1. ) = " << result << std::endl;
- return result;
- });
+ return result;
+ });
std::cout << "********************************************************************\n";
std::cout << "* The complex contains " << simplexTree.num_simplices() << " simplices";
std::cout << " - dimension " << simplexTree.dimension() << "\n";
std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
for (auto f_simplex : simplexTree.filtration_simplex_range()) {
- std::cout << " " << "[" << simplexTree.filtration(f_simplex) << "] ";
- for (auto vertex : simplexTree.simplex_vertex_range(f_simplex))
- std::cout << "(" << vertex << ")";
+ std::cout << " "
+ << "[" << simplexTree.filtration(f_simplex) << "] ";
+ for (auto vertex : simplexTree.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")";
std::cout << std::endl;
}