#pragma once #include #include #include #include #include #include #include #include "problem.hpp" #include "graph.hpp" #include "hooks.hpp" #include "current_info.hpp" #include "array_hash.hpp" #include "clusters.hpp" #define CURRENT_CUTOFF 1e-10 class network { 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; std::array find_cycle(const std::set&, unsigned, unsigned) const; public: const graph& G; ClusterTree C; std::vector fuses; std::vector backbone; std::vector thresholds; network(const graph&, cholmod_common*); network(const network&); 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;}; }; class fuse_network : public network { private: double weight; public: fuse_network(const graph&, cholmod_common*, double weight = 1.0); fuse_network(const fuse_network&); current_info get_current_info() const override; }; class elastic_network : public network { private: double weight; public: elastic_network(const graph&, cholmod_common*, double weight = 0.5); elastic_network(const elastic_network&); current_info get_current_info() const override; }; class percolation_network : public network { public: percolation_network(const graph&, cholmod_common*); percolation_network(const percolation_network&); current_info get_current_info() const override; };