summaryrefslogtreecommitdiff
path: root/src/Bottleneck_distance/include/gudhi/Graph_matching.h
diff options
context:
space:
mode:
authorfgodi <fgodi@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-11-23 14:55:25 +0000
committerfgodi <fgodi@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-11-23 14:55:25 +0000
commit6dd7403da12dff125e1dedacbc2ed0ec67e643ba (patch)
tree1177c04e0ce95e6f56dd4b075374b43ca1721ae6 /src/Bottleneck_distance/include/gudhi/Graph_matching.h
parente2e5701fd5e778863f5891b84531ccf1493e68c0 (diff)
Bottleneck.h
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneck_integration@1774 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3b2f26c67ceb8a61f3efe3952f0618fff98465e4
Diffstat (limited to 'src/Bottleneck_distance/include/gudhi/Graph_matching.h')
-rw-r--r--src/Bottleneck_distance/include/gudhi/Graph_matching.h88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/Graph_matching.h b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
index 5f579a0c..a8d68a9d 100644
--- a/src/Bottleneck_distance/include/gudhi/Graph_matching.h
+++ b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
@@ -31,17 +31,6 @@ namespace Gudhi {
namespace bottleneck_distance {
-/** \brief Function to use in order to compute the Bottleneck distance between two persistence diagrams. You get an additive e-approximation.
- *
- *
- * \ingroup bottleneck_distance
- */
-template<typename Persistence_diagram1, typename Persistence_diagram2>
-double compute(const Persistence_diagram1& diag1, const Persistence_diagram2& diag2, double e = 0.);
-
-template<typename Persistence_diagram1, typename Persistence_diagram2>
-double compute_exactly(const Persistence_diagram1& diag1, const Persistence_diagram2& diag2);
-
/** \internal \brief Structure representing a graph matching. The graph is a Persistence_diagrams_graph.
*
* \ingroup bottleneck_distance
@@ -182,86 +171,9 @@ inline void Graph_matching::update(std::deque<int>& path) {
}
}
-template<typename Persistence_diagram1, typename Persistence_diagram2>
-double compute_exactly(const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2) {
- G::initialize(diag1, diag2, 0.);
- std::shared_ptr< std::vector<double> > sd(G::sorted_distances());
- int idmin = 0;
- int idmax = sd->size() - 1;
- // alpha can be modified, this will change the complexity
- double alpha = pow(sd->size(), 0.25);
- Graph_matching m;
- Graph_matching biggest_unperfect;
- while (idmin != idmax) {
- int step = static_cast<int>((idmax - idmin) / alpha);
- m.set_r(sd->at(idmin + step));
- while (m.multi_augment());
- //The above while compute a maximum matching (according to the r setted before)
- if (m.perfect()) {
- idmax = idmin + step;
- m = biggest_unperfect;
- } else {
- biggest_unperfect = m;
- idmin = idmin + step + 1;
- }
- }
- return sd->at(idmin);
-}
-
-template<typename Persistence_diagram1, typename Persistence_diagram2>
-double compute(const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2, double e) {
- if(e< std::numeric_limits<double>::min())
- return compute_exactly(diag1, diag2);
- G::initialize(diag1, diag2, e);
- int in = G::diameter()/e;
- int idmin = 0;
- int idmax = in;
- // alpha can be modified, this will change the complexity
- double alpha = pow(in, 0.25);
- Graph_matching m;
- Graph_matching biggest_unperfect;
- while (idmin != idmax) {
- int step = static_cast<int>((idmax - idmin) / alpha);
- m.set_r(e*(idmin + step));
- while (m.multi_augment());
- //The above while compute a maximum matching (according to the r setted before)
- if (m.perfect()) {
- idmax = idmin + step;
- m = biggest_unperfect;
- } else {
- biggest_unperfect = m;
- idmin = idmin + step + 1;
- }
- }
- return e*(idmin);
-}
-
-
} // namespace bottleneck_distance
} // namespace Gudhi
#endif // GRAPH_MATCHING_H_
-
-/* Dichotomic version
-template<typename Persistence_diagram1, typename Persistence_diagram2>
-double compute(const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2, double e) {
- if(e< std::numeric_limits<double>::min())
- return compute_exactly(diag1, diag2);
- G::initialize(diag1, diag2, e);
- double d = 0.;
- double f = G::diameter();
- while (f-d > e){
- Graph_matching m;
- m.set_r((d+f)/2.);
- while (m.multi_augment());
- //The above while compute a maximum matching (according to the r setted before)
- if (m.perfect())
- f = (d+f)/2.;
- else
- d= (d+f)/2.;
- }
- return d;
-} */
-