#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" #define CURRENT_CUTOFF 1e-10 #include #include #include #include #include #include #include #include struct EdgeProperties { unsigned index; }; typedef boost::adjacency_list Graph; typedef boost::graph_traits::vertex_descriptor Vertex; typedef boost::graph_traits::vertices_size_type VertexIndex; class network { public: const graph& G; Graph bG; Graph dG; std::vector rank; std::vector parent; boost::disjoint_sets ds; std::unordered_map, bool> seen_pairs; std::vector fuses; std::vector backbone; std::vector thresholds; problem px; problem py; network(const graph&, cholmod_common*); network(const network&); void set_thresholds(double, std::mt19937&); void fracture(hooks&, bool one_axis = false); void update_backbone(const std::vector& c); void break_edge(unsigned, bool unbreak = false); virtual current_info get_current_info() {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() 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() override; }; class percolation_network : public network { public: percolation_network(const graph&, cholmod_common*); percolation_network(const percolation_network&); current_info get_current_info() override; };