From 3f7f20f21f583ca2de566bea08a87eac4b17ad29 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 23 Sep 2019 23:19:13 -0400 Subject: successfully implemented the backbone trimming with homespun graph algorithms, measurements have mostly been disabled and need to be migrated --- lib/include/network.hpp | 56 ++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 22 deletions(-) (limited to 'lib/include') diff --git a/lib/include/network.hpp b/lib/include/network.hpp index bf9015c..8748ea9 100644 --- a/lib/include/network.hpp +++ b/lib/include/network.hpp @@ -18,34 +18,46 @@ #define CURRENT_CUTOFF 1e-10 +class fuse_network; +class elastic_network; +class percolation_network; + class network { - private: - problem px; - problem py; - std::unordered_map, bool> seen_pairs; + friend class fuse_network; + friend class elastic_network; + friend class percolation_network; - void update_backbone(const std::vector& c); - void break_edge(unsigned, bool unbreak = false); - void get_cycle_edges_helper(std::set&, std::set&, unsigned, unsigned) const; - std::set get_cycle_edges(unsigned) const; - std::array find_cycle(const std::set&, unsigned, unsigned) const; + private: + problem px; + problem py; + std::unordered_map, bool> seen_pairs; + + void update_backbone(const std::vector& c); + void break_edge(unsigned, bool unbreak = false); + void get_cycle_edges_helper(std::set&, std::set&, unsigned, unsigned) const; + std::set get_cycle_edges(unsigned) const; + bool find_cycle_helper(std::array&, const std::set&, unsigned, unsigned, unsigned) const; + std::array find_cycle(const std::set&, unsigned, unsigned) const; + void get_cluster_edges_helper(std::set&, unsigned) const; + std::set get_cluster_edges(unsigned) const; + void get_tie_flaps_helper(std::set&, unsigned, unsigned) const; + std::list> get_tie_flaps(unsigned) const; public: - const graph& G; + const graph& G; - ClusterTree C; + ClusterTree C; - std::vector fuses; - std::vector backbone; - std::vector thresholds; + std::vector fuses; + std::vector backbone; + std::vector thresholds; - network(const graph&, cholmod_common*); - network(const network&); + network(const graph&, cholmod_common*); - void set_thresholds(double, std::mt19937&); - void fracture(hooks&, bool one_axis = true); + void set_thresholds(double, std::mt19937&); + void fracture(hooks&, bool one_axis = true); - virtual current_info get_current_info() const {current_info empty; return empty;}; + virtual current_info get_current_info() {current_info empty; return empty;}; }; class fuse_network : public network { @@ -56,7 +68,7 @@ class fuse_network : public network { fuse_network(const graph&, cholmod_common*, double weight = 1.0); fuse_network(const fuse_network&); - current_info get_current_info() const override; + current_info get_current_info() override; }; class elastic_network : public network { @@ -67,7 +79,7 @@ class elastic_network : public network { elastic_network(const graph&, cholmod_common*, double weight = 0.5); elastic_network(const elastic_network&); - current_info get_current_info() const override; + current_info get_current_info() override; }; class percolation_network : public network { @@ -75,6 +87,6 @@ class percolation_network : public network { percolation_network(const graph&, cholmod_common*); percolation_network(const percolation_network&); - current_info get_current_info() const override; + current_info get_current_info() override; }; -- cgit v1.2.3-70-g09d2