From 1142403db4ba255e0f5c9f8082a158780df51148 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 19 Mar 2020 07:47:18 +0100 Subject: some cleanups --- src/Collapse/example/rips_persistence_with_sc.cpp | 5 +-- src/Collapse/include/gudhi/FlagComplexSpMatrix.h | 45 +---------------------- 2 files changed, 4 insertions(+), 46 deletions(-) (limited to 'src/Collapse') diff --git a/src/Collapse/example/rips_persistence_with_sc.cpp b/src/Collapse/example/rips_persistence_with_sc.cpp index a462dcea..f16588cf 100644 --- a/src/Collapse/example/rips_persistence_with_sc.cpp +++ b/src/Collapse/example/rips_persistence_with_sc.cpp @@ -9,7 +9,6 @@ // Types definition using Vector_of_points = std::vector; -using Vector_of_SM_pointers = std::vector; using Simplex_tree = Gudhi::Simplex_tree; using Filtration_value = double; @@ -130,12 +129,12 @@ int main(int argc, char * const argv[]) { //Now we will perform filtered edge collapse to sparsify the edge list edge_t. std::cout<< "Filtered edge collapse begins" << std::endl; - FlagComplexSpMatrix * mat_filt_edge_coll = new FlagComplexSpMatrix(number_of_points,*edge_t,true); + FlagComplexSpMatrix * mat_filt_edge_coll = new FlagComplexSpMatrix(number_of_points,*edge_t); std::cout<< "Matrix instansiated" << std::endl; if(edge_t->size() >0){ delete edge_t; edge_t = new Filtered_sorted_edge_list(); - *edge_t = mat_filt_edge_coll->filtered_edge_collapse(0); + *edge_t = mat_filt_edge_coll->filtered_edge_collapse(); filt_edge_to_dist_matrix(*sparse_distances, *edge_t, number_of_points); std::cout << "Total number of vertices after collapse in the sparse matrix are: " << mat_filt_edge_coll->num_vertices() << std::endl; } diff --git a/src/Collapse/include/gudhi/FlagComplexSpMatrix.h b/src/Collapse/include/gudhi/FlagComplexSpMatrix.h index d3e58d4f..7d6d6d22 100644 --- a/src/Collapse/include/gudhi/FlagComplexSpMatrix.h +++ b/src/Collapse/include/gudhi/FlagComplexSpMatrix.h @@ -217,7 +217,6 @@ class FlagComplexSpMatrix bool vertexCollapsed; bool edgeCollapsed; //Variable to indicate if filtered-edge-collapse has to be performed. - bool filtEdgeCol; int expansion_limit; void init() @@ -244,7 +243,6 @@ class FlagComplexSpMatrix vertexCollapsed = false; edgeCollapsed = false; - filtEdgeCol = false; } //! Function for computing the sparse-matrix corresponding to the core of the complex. It also prepares the working list filteredEgdeIter for edge collapses @@ -633,26 +631,8 @@ public: rowToVertex, vertexToRow, rows, cols, sparseRowAdjMatrix are initialised here. vertDomnIndicator, rowInsertIndicator ,rowIterator are initialised by init() function which is called at the begining of this.
*/ - //Filtered_sorted_edge_list * edge_t = new Filtered_sorted_edge_list(); - FlagComplexSpMatrix(const size_t & num_vertices, const Filtered_sorted_edge_list &edge_t) { - init(); - - filtEdgeCol = false; - sparseRowAdjMatrix = sparseRowMatrix(expansion_limit*num_vertices, expansion_limit*num_vertices); // Initializing sparseRowAdjMatrix, This is a row-major sparse matrix. - - for(size_t bgn_idx = 0; bgn_idx < edge_t.size(); bgn_idx++) { - std::vector s = {std::get<1>(edge_t.at(bgn_idx)), std::get<2>(edge_t.at(bgn_idx))}; - insert_new_edges(std::get<1>(edge_t.at(bgn_idx)), std::get<2>(edge_t.at(bgn_idx)), 1); - } - sparseRowAdjMatrix.makeCompressed(); - - // std::cout << sparseRowAdjMatrix << std::endl; - } - FlagComplexSpMatrix(const size_t & num_vertices, const Filtered_sorted_edge_list & edge_t, const bool fEdgeCol) { - if(fEdgeCol) - { + FlagComplexSpMatrix(const size_t & num_vertices, const Filtered_sorted_edge_list & edge_t) { init(); - filtEdgeCol = true; sparseRowAdjMatrix = sparseRowMatrix(num_vertices, num_vertices); // Initializing sparseRowAdjMatrix, This is a row-major sparse matrix. for(size_t bgn_idx = 0; bgn_idx < edge_t.size(); bgn_idx++) { @@ -662,11 +642,6 @@ public: } // sparseRowAdjMatrix.makeCompressed(); - } - else - FlagComplexSpMatrix(num_vertices, edge_t); - - // std::cout << sparseRowAdjMatrix << std::endl; } //! Destructor. @@ -697,25 +672,9 @@ public: after_vertex_collapse(); return collapseTime; } - - // Performs edge collapse in of a given sparse-matrix(graph) without considering the filtration value. - // double strong_edge_collapse() { - // auto begin_collapse = std::chrono::high_resolution_clock::now(); - // critical_core_edges(); - // vertexCollapsed = false; - // edgeCollapsed = true; - // auto end_collapse = std::chrono::high_resolution_clock::now(); - - // auto collapseTime = std::chrono::duration(end_collapse- begin_collapse).count(); - // // std::cout << "Time of Collapse : " << collapseTime << " ms\n" << std::endl; - // //Post processing... - // after_edge_collapse(); - // return collapseTime; - // } - // Performs edge collapse in a decreasing sequence of the filtration value. - Filtered_sorted_edge_list filtered_edge_collapse(double steps) { + Filtered_sorted_edge_list filtered_edge_collapse() { auto begin_collapse = std::chrono::high_resolution_clock::now(); critical_core_edges(); vertexCollapsed = false; -- cgit v1.2.3