summaryrefslogtreecommitdiff
path: root/src/Bottleneck_distance/include
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-27 17:37:29 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-27 17:37:29 +0000
commit672011c337a084daa53ba0772fbd8e7d9a0d0897 (patch)
treecfc3ebac1b85dbc717d9cd2637ec1635264ae4ad /src/Bottleneck_distance/include
parent09cea4002927052218778545856e3159c8f07f6d (diff)
Avoid copying Persistence_graph at the same time as Graph_matching.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneck-glisse@2255 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c3e494295aabd3647bf37e69f18c8537c5f04910
Diffstat (limited to 'src/Bottleneck_distance/include')
-rw-r--r--src/Bottleneck_distance/include/gudhi/Graph_matching.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/Graph_matching.h b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
index e1708c5b..49f90da5 100644
--- a/src/Bottleneck_distance/include/gudhi/Graph_matching.h
+++ b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
@@ -40,8 +40,6 @@ class Graph_matching {
public:
/** \internal \brief Constructor constructing an empty matching. */
explicit Graph_matching(Persistence_graph &g);
- /** \internal \brief Copy operator. */
- Graph_matching& operator=(const Graph_matching& m);
/** \internal \brief Is the matching perfect ? */
bool perfect() const;
/** \internal \brief Augments the matching with a maximal set of edge-disjoint shortest augmenting paths. */
@@ -50,7 +48,7 @@ class Graph_matching {
void set_r(double r);
private:
- Persistence_graph& g;
+ Persistence_graph* gp;
double r;
/** \internal \brief Given a point from V, provides its matched point in U, null_point_index() if there isn't. */
std::vector<int> v_to_u;
@@ -66,19 +64,11 @@ class Graph_matching {
};
inline Graph_matching::Graph_matching(Persistence_graph& g)
- : g(g), r(0.), v_to_u(g.size(), null_point_index()), unmatched_in_u() {
+ : gp(&g), r(0.), v_to_u(g.size(), null_point_index()), unmatched_in_u() {
for (int u_point_index = 0; u_point_index < g.size(); ++u_point_index)
unmatched_in_u.emplace_back(u_point_index);
}
-inline Graph_matching& Graph_matching::operator=(const Graph_matching& m) {
- g = m.g;
- r = m.r;
- v_to_u = m.v_to_u;
- unmatched_in_u = m.unmatched_in_u;
- return *this;
-}
-
inline bool Graph_matching::perfect() const {
return unmatched_in_u.empty();
}
@@ -88,7 +78,7 @@ inline bool Graph_matching::multi_augment() {
return false;
Layered_neighbors_finder layered_nf(layering());
int max_depth = layered_nf.vlayers_number()*2 - 1;
- double rn = sqrt(g.size());
+ double rn = sqrt(gp->size());
// verification of a necessary criterion in order to shortcut if possible
if (max_depth < 0 || (unmatched_in_u.size() > rn && max_depth >= rn))
return false;
@@ -135,10 +125,10 @@ inline bool Graph_matching::augment(Layered_neighbors_finder & layered_nf, int u
inline Layered_neighbors_finder Graph_matching::layering() const {
std::list<int> u_vertices(unmatched_in_u);
std::list<int> v_vertices;
- Neighbors_finder nf(g, r);
- for (int v_point_index = 0; v_point_index < g.size(); ++v_point_index)
+ Neighbors_finder nf(*gp, r);
+ for (int v_point_index = 0; v_point_index < gp->size(); ++v_point_index)
nf.add(v_point_index);
- Layered_neighbors_finder layered_nf(g, r);
+ Layered_neighbors_finder layered_nf(*gp, r);
for (int layer = 0; !u_vertices.empty(); layer++) {
// one layer is one step in the BFS
for (auto it1 = u_vertices.cbegin(); it1 != u_vertices.cend(); ++it1) {