diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-06-04 22:36:58 +0200 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-06-04 22:37:42 +0200 |
commit | df758d75a3dbb57abeb6a38a20200ee2251d8816 (patch) | |
tree | 6f7e28e1f93b2a409ab5e541d8875632b9e8f064 /src/Collapse/include/gudhi | |
parent | a81c5adcf4426338ff80cfb2f1973f113a17b16d (diff) |
rollback 85dc5c1 as the information is not quite the same in both structure
Diffstat (limited to 'src/Collapse/include/gudhi')
-rw-r--r-- | src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h b/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h index 67399044..ab72197d 100644 --- a/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h +++ b/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h @@ -86,6 +86,9 @@ class Flag_complex_sparse_matrix { // Unordered set of removed edges. (to enforce removal from the matrix) std::unordered_set<Edge, boost::hash<Edge>> u_set_removed_edges_; + // Unordered set of dominated edges. (to inforce removal from the matrix) + std::unordered_set<Edge, boost::hash<Edge>> u_set_dominated_edges_; + // Map from edge to its index std::unordered_map<Edge, Row_index, boost::hash<Edge>> edge_to_index_map_; @@ -200,11 +203,17 @@ class Flag_complex_sparse_matrix { std::cout << "The following edge is critical with filt value: {" << u << "," << v << "}; " << filt << std::endl; #endif // DEBUG_TRACES + } else { + u_set_dominated_edges_.emplace(std::minmax(vertex_to_row_[u], vertex_to_row_[v])); } + } else { + // Idx is not affected hence dominated. + u_set_dominated_edges_.emplace(std::minmax(vertex_to_row_[u], vertex_to_row_[v])); } } } } + u_set_dominated_edges_.clear(); } // Returns list of non-zero columns of a particular indx. @@ -217,17 +226,9 @@ class Flag_complex_sparse_matrix { // Iterate over the non-zero columns for (typename Sparse_row_matrix::InnerIterator it(sparse_row_adjacency_matrix_, rw_u); it; ++it) { Row_index rw_v = it.index(); - - bool dominated_edge_not_found = false; - try { - edge_to_index_map_.at(std::minmax(row_to_vertex_[rw_u], row_to_vertex_[rw_v])); - } catch (const std::out_of_range& oor) { - dominated_edge_not_found = true; - } - // If the vertex v is not dominated and the edge {u,v} is still in the matrix if (u_set_removed_edges_.find(std::minmax(rw_u, rw_v)) == u_set_removed_edges_.end() && - dominated_edge_not_found) { + u_set_dominated_edges_.find(std::minmax(rw_u, rw_v)) == u_set_dominated_edges_.end()) { // inner index, here it is equal to it.columns() non_zero_indices.push_back(rw_v); #ifdef DEBUG_TRACES |