summaryrefslogtreecommitdiff
path: root/src/Collapse/include/gudhi
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-06-04 22:06:50 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-06-04 22:06:50 +0200
commit85dc5c1e96c66e1505599eab2ee7e61174fd169d (patch)
tree24b12a2da91cb515cf50957321b2d1ec7ab1a7e4 /src/Collapse/include/gudhi
parent004933f4640a95b84e5a59cd7cef6b45ea89c1df (diff)
code review: remove u_set_dominated_edges_ as it is redundant with critical_edge_indicator_
Diffstat (limited to 'src/Collapse/include/gudhi')
-rw-r--r--src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h b/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h
index 3afacd0e..75df52bf 100644
--- a/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h
+++ b/src/Collapse/include/gudhi/Flag_complex_sparse_matrix.h
@@ -86,9 +86,6 @@ 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_;
@@ -203,15 +200,11 @@ 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.
@@ -224,9 +217,17 @@ 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() &&
- u_set_dominated_edges_.find(std::minmax(rw_u, rw_v)) == u_set_dominated_edges_.end()) {
+ dominated_edge_not_found) {
// inner index, here it is equal to it.columns()
non_zero_indices.push_back(rw_v);
#ifdef DEBUG_TRACES