diff options
author | mcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-05-12 15:37:55 +0000 |
---|---|---|
committer | mcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-05-12 15:37:55 +0000 |
commit | 6adf87fe0a609443962238200e877c60d90f6a2d (patch) | |
tree | 5da27b1886fb7fe76ec8f9dd6a586ac7a5b3fd25 /src/Nerve_GIC/example | |
parent | 9e1a4e80bc3f2cffc965dc3f5194ea308ca9afab (diff) |
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Nerve_GIC@2413 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: a0a65ae49ca0bb6e5ed614f44cabb060fa0e7490
Diffstat (limited to 'src/Nerve_GIC/example')
-rw-r--r-- | src/Nerve_GIC/example/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/Nerve_GIC/example/GIC.cpp | 15 | ||||
-rw-r--r-- | src/Nerve_GIC/example/GICvoronoi.cpp | 59 | ||||
-rw-r--r-- | src/Nerve_GIC/example/MapperDeltaCoord.cpp | 13 | ||||
-rw-r--r-- | src/Nerve_GIC/example/MapperDeltaFunc.cpp | 13 | ||||
-rw-r--r-- | src/Nerve_GIC/example/Nerve.cpp | 13 |
6 files changed, 90 insertions, 29 deletions
diff --git a/src/Nerve_GIC/example/CMakeLists.txt b/src/Nerve_GIC/example/CMakeLists.txt index d499613d..a4cb0f03 100644 --- a/src/Nerve_GIC/example/CMakeLists.txt +++ b/src/Nerve_GIC/example/CMakeLists.txt @@ -13,9 +13,15 @@ target_link_libraries(MapperDeltaCoord ${Boost_SYSTEM_LIBRARY}) add_executable ( MapperDeltaFunc MapperDeltaFunc.cpp ) target_link_libraries(MapperDeltaFunc ${Boost_SYSTEM_LIBRARY}) +add_executable ( GICvoronoi GICvoronoi.cpp ) +target_link_libraries(GICvoronoi ${Boost_SYSTEM_LIBRARY}) + +file(COPY visu.py km.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) + if (TBB_FOUND) target_link_libraries(Nerve ${TBB_LIBRARIES}) target_link_libraries(GIC ${TBB_LIBRARIES}) target_link_libraries(MapperDeltaCoord ${TBB_LIBRARIES}) target_link_libraries(MapperDeltaFunc ${TBB_LIBRARIES}) + target_link_libraries(GICvoronoi ${TBB_LIBRARIES}) endif()
\ No newline at end of file diff --git a/src/Nerve_GIC/example/GIC.cpp b/src/Nerve_GIC/example/GIC.cpp index 30a485d5..1ab15ecc 100644 --- a/src/Nerve_GIC/example/GIC.cpp +++ b/src/Nerve_GIC/example/GIC.cpp @@ -3,7 +3,7 @@ void usage(int nbArgs, char * const progName) { std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n"; std::cerr << "Usage: " << progName << " filename.off threshold coordinate resolution gain\n"; - std::cerr << " i.e.: " << progName << " ../../../data/points/human.off 1.5 2 10 0.3 \n"; + std::cerr << " i.e.: " << progName << " ../../../data/points/human.off 0.075 2 10 0.3 \n"; exit(-1); // ----- >> } @@ -17,11 +17,6 @@ int main(int argc, char **argv) { double gain = atof(argv[5]); bool verb = 0; if(argc == 7) verb = 1; - // Type definitions - using Graph_t = boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,\ - boost::property < vertex_filtration_t, Filtration_value >,\ - boost::property < edge_filtration_t, Filtration_value > >; - // ---------------------------------------------------------------------------- // Init of a graph induced complex from an OFF file // ---------------------------------------------------------------------------- @@ -29,12 +24,16 @@ int main(int argc, char **argv) { Gudhi::graph_induced_complex::Graph_induced_complex GIC; GIC.set_verbose(verb); - GIC.set_graph_from_rips(threshold, off_file_name); - GIC.set_function_from_coordinate(coord, off_file_name); GIC.set_color_from_coordinate(off_file_name, coord); + GIC.set_function_from_coordinate(coord, off_file_name); + + GIC.set_graph_from_rips(threshold, off_file_name); + GIC.set_resolution_double(resolution); GIC.set_gain(gain); GIC.set_cover_from_function(1); + GIC.find_GIC_simplices(); + GIC.plot_with_KeplerMapper(); Simplex_tree stree; GIC.create_complex(stree); diff --git a/src/Nerve_GIC/example/GICvoronoi.cpp b/src/Nerve_GIC/example/GICvoronoi.cpp new file mode 100644 index 00000000..2d50ab4d --- /dev/null +++ b/src/Nerve_GIC/example/GICvoronoi.cpp @@ -0,0 +1,59 @@ +#include <gudhi/GIC.h> + +void usage(int nbArgs, char * const progName) { + std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n"; + std::cerr << "Usage: " << progName << " filename.off threshold N\n"; + std::cerr << " i.e.: " << progName << " ../../../data/points/human.off 0.075 100 \n"; + exit(-1); // ----- >> +} + +int main(int argc, char **argv) { + if ((argc != 4) && (argc != 5)) usage(argc, (argv[0] - 1)); + + std::string off_file_name(argv[1]); + double threshold = atof(argv[2]); + int m = atoi(argv[3]); + bool verb = 0; if(argc == 5) verb = 1; + + // ---------------------------------------------------------------------------- + // Init of a graph induced complex from an OFF file + // ---------------------------------------------------------------------------- + + Gudhi::graph_induced_complex::Graph_induced_complex GIC; + GIC.set_verbose(verb); + + GIC.set_color_from_coordinate(off_file_name); + + GIC.set_graph_from_OFF(off_file_name); + + GIC.set_cover_from_Voronoi(m, off_file_name); + + GIC.find_GIC_simplices(); + + GIC.plot_with_KeplerMapper(); + + Simplex_tree stree; GIC.create_complex(stree); + + std::streambuf* streambufffer = std::cout.rdbuf(); + std::ostream output_stream(streambufffer); + + // ---------------------------------------------------------------------------- + // Display information about the graph induced complex + // ---------------------------------------------------------------------------- + + if(verb){ + output_stream << "Graph induced complex is of dimension " << stree.dimension() << + " - " << stree.num_simplices() << " simplices - " << + stree.num_vertices() << " vertices." << std::endl; + + output_stream << "Iterator on graph induced complex simplices" << std::endl; + for (auto f_simplex : stree.filtration_simplex_range()) { + for (auto vertex : stree.simplex_vertex_range(f_simplex)) { + output_stream << vertex << " "; + } + output_stream << std::endl; + } + } + + return 0; +} diff --git a/src/Nerve_GIC/example/MapperDeltaCoord.cpp b/src/Nerve_GIC/example/MapperDeltaCoord.cpp index aa12afe6..950ee58a 100644 --- a/src/Nerve_GIC/example/MapperDeltaCoord.cpp +++ b/src/Nerve_GIC/example/MapperDeltaCoord.cpp @@ -14,11 +14,6 @@ int main(int argc, char **argv) { int coord = atoi(argv[2]); bool verb = 0; if(argc == 4) verb = 1; - // Type definitions - using Graph_t = boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,\ - boost::property < vertex_filtration_t, Filtration_value >,\ - boost::property < edge_filtration_t, Filtration_value > >; - // --------------------------------------- // Init of a Mapper Delta from an OFF file // --------------------------------------- @@ -26,12 +21,16 @@ int main(int argc, char **argv) { Gudhi::graph_induced_complex::Graph_induced_complex GIC; GIC.set_verbose(verb); - GIC.set_graph_from_automatic_rips(off_file_name); - GIC.set_function_from_coordinate(coord, off_file_name); GIC.set_color_from_coordinate(off_file_name, coord); + GIC.set_function_from_coordinate(coord, off_file_name); + + GIC.set_graph_from_automatic_rips(off_file_name); + GIC.set_automatic_resolution_for_GICMAP(); GIC.set_gain(); GIC.set_cover_from_function(1); + GIC.find_GICMAP_simplices_with_functional_minimal_cover(); + GIC.plot_with_KeplerMapper(); Simplex_tree stree; GIC.create_complex(stree); diff --git a/src/Nerve_GIC/example/MapperDeltaFunc.cpp b/src/Nerve_GIC/example/MapperDeltaFunc.cpp index 20924b9c..658b0273 100644 --- a/src/Nerve_GIC/example/MapperDeltaFunc.cpp +++ b/src/Nerve_GIC/example/MapperDeltaFunc.cpp @@ -14,11 +14,6 @@ int main(int argc, char **argv) { std::string func_file_name = argv[2]; bool verb = 0; if(argc == 4) verb = 1; - // Type definitions - using Graph_t = boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,\ - boost::property < vertex_filtration_t, Filtration_value >,\ - boost::property < edge_filtration_t, Filtration_value > >; - // --------------------------------------- // Init of a Mapper Delta from an OFF file // --------------------------------------- @@ -26,12 +21,16 @@ int main(int argc, char **argv) { Gudhi::graph_induced_complex::Graph_induced_complex GIC; GIC.set_verbose(verb); - GIC.set_graph_from_automatic_rips(off_file_name); - GIC.set_function_from_file(func_file_name); GIC.set_color_from_file(func_file_name); + GIC.set_function_from_file(func_file_name); + + GIC.set_graph_from_automatic_rips(off_file_name); + GIC.set_automatic_resolution_for_GICMAP(); GIC.set_gain(); GIC.set_cover_from_function(1); + GIC.find_GICMAP_simplices_with_functional_minimal_cover(); + GIC.plot_with_KeplerMapper(); Simplex_tree stree; GIC.create_complex(stree); diff --git a/src/Nerve_GIC/example/Nerve.cpp b/src/Nerve_GIC/example/Nerve.cpp index d4a68c71..a0de31ae 100644 --- a/src/Nerve_GIC/example/Nerve.cpp +++ b/src/Nerve_GIC/example/Nerve.cpp @@ -16,11 +16,6 @@ int main(int argc, char **argv) { double gain = atof(argv[4]); bool verb = 0; if(argc == 6) verb = 1; - // Type definitions - using Graph_t = boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,\ - boost::property < vertex_filtration_t, Filtration_value >,\ - boost::property < edge_filtration_t, Filtration_value > >; - // -------------------------------- // Init of a Nerve from an OFF file // -------------------------------- @@ -28,12 +23,16 @@ int main(int argc, char **argv) { Gudhi::graph_induced_complex::Graph_induced_complex GIC; GIC.set_verbose(verb); - GIC.set_graph_from_OFF(off_file_name); + GIC.set_color_from_coordinate(off_file_name, coord); GIC.set_function_from_coordinate(coord, off_file_name); - GIC.set_color_from_coordinate(off_file_name, --coord); + + GIC.set_graph_from_OFF(off_file_name); + GIC.set_resolution_int(resolution); GIC.set_gain(gain); GIC.set_cover_from_function(0); + GIC.find_Nerve_simplices(); + GIC.plot_with_KeplerMapper(); Simplex_tree stree; GIC.create_complex(stree); |