diff options
Diffstat (limited to 'lib/src')
-rw-r--r-- | lib/src/network.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/src/network.cpp b/lib/src/network.cpp index 98c6eb0..05fc0dd 100644 --- a/lib/src/network.cpp +++ b/lib/src/network.cpp @@ -82,8 +82,7 @@ void network::get_cycle_edges_helper(std::set<unsigned>& cycle_edges, unsigned vn = e[0] == v_cur ? e[1] : e[0]; if (vn != v_prev) { - auto it = seen_vertices.find(vn); - if (it != seen_vertices.end()) { + if (seen_vertices.contains(vn)) { cycle_edges.insert(ei); } else { this->get_cycle_edges_helper(cycle_edges, seen_vertices, v_cur, vn); @@ -106,8 +105,7 @@ bool network::find_cycle_helper(std::array<unsigned, 2>& sig, const std::set<uns unsigned vPrev, unsigned vCur, unsigned vEnd) const { for (unsigned ei : G.dual_vertices[vCur].ne) { if (fuses[ei]) { - auto it = cycle_edges.find(ei); - if (it == cycle_edges.end()) { + if (!cycle_edges.contains(ei)) { const std::array<unsigned, 2>& e = G.dual_edges[ei].v; unsigned vn = e[0] == vCur ? e[1] : e[0]; if (vn != vPrev) { @@ -145,8 +143,7 @@ bool network::get_cycle_helper(std::array<unsigned, 2>& sig, std::set<unsigned>& unsigned vPrev, unsigned vCur, unsigned vEnd) const { for (unsigned ei : G.dual_vertices[vCur].ne) { if (fuses[ei]) { - auto it = cycle_edges.find(ei); - if (it == cycle_edges.end()) { + if (!cycle_edges.contains(ei)) { const std::array<unsigned, 2>& e = G.dual_edges[ei].v; unsigned vn = e[0] == vCur ? e[1] : e[0]; if (vn != vPrev) { @@ -186,8 +183,7 @@ std::pair<std::array<unsigned, 2>, std::set<unsigned>> network::get_cycle(const void network::get_cluster_edges_helper(std::set<unsigned>& seen_edges, unsigned v) const { for (unsigned ei : G.vertices[v].ne) { if (!backbone[ei]) { - auto it = seen_edges.find(ei); - if (it == seen_edges.end()) { + if (!seen_edges.contains(ei)) { const std::array<unsigned, 2>& e = G.edges[ei].v; unsigned vn = e[0] == v ? e[1] : e[0]; @@ -208,8 +204,7 @@ void network::get_tie_flaps_helper(std::set<unsigned>& added_edges, unsigned v0, unsigned vCur) const { for (unsigned ei : G.vertices[vCur].ne) { if (!backbone[ei]) { - auto it = added_edges.find(ei); - if (it == added_edges.end()) { + if (!added_edges.contains(ei)) { const std::array<unsigned, 2>& e = G.edges[ei].v; unsigned vn = e[0] == vCur ? e[1] : e[0]; @@ -229,8 +224,7 @@ std::list<std::set<unsigned>> network::get_tie_flaps(unsigned v0) const { if (!backbone[ei]) { bool seen_edge = false; for (const std::set<unsigned>& flap : tie_flaps) { - auto it = flap.find(ei); - if (it != flap.end()) { + if (flap.contains(ei)) { seen_edge = true; break; } @@ -257,8 +251,7 @@ void network::update_backbone(const std::vector<double>& c) { // First, we will check for lollipops! for (unsigned i = 0; i < G.edges.size(); i++) { if ((!backbone[i]) && C.same_component(G.dual_edges[i].v[0], G.dual_edges[i].v[1])) { - auto it_search = seen_pairs.find({G.dual_edges[i].v[0], G.dual_edges[i].v[1]}); - if (it_search == seen_pairs.end()) { + if (!seen_pairs.contains({G.dual_edges[i].v[0], G.dual_edges[i].v[1]})) { // This is a candidate lollipop stem. First, we will identify any // cycles in the dual cluster that impinges on the stem and mark them // by an edge that uniquely severs each. @@ -377,8 +370,7 @@ void network::update_backbone(const std::vector<double>& c) { if (C.same_component(G.vertices[v].nd[i], G.vertices[v].nd[l])) { unsigned il = i < l ? i : l; unsigned ig = i < l ? l : i; - auto it_search = seen_pairs.find({G.vertices[v].nd[il], G.vertices[v].nd[ig]}); - if (it_search == seen_pairs.end()) { + if (!seen_pairs.contains({G.vertices[v].nd[il], G.vertices[v].nd[ig]})) { bool any_intervening1 = false; bool any_intervening2 = false; unsigned ie1 = 0; |