# net

# Namespaces

Name
net::tensor

# Classes

Name
struct net::all_combination
struct net::base_bind_traits
struct net::base_edgekey_traits
struct net::base_edgeval_traits
struct net::base_nodekey_traits
struct net::base_nodeval_traits
struct net::base_traits
struct net::contract_info
struct net::contract_info2
struct net::default_traits
struct net::default_traits< NodeVal, EdgeVal, std::string, std::pair< std::string, std::string > >
struct net::default_traits< NodeVal, EdgeVal, std::string, std::string >
struct net::double_less
class net::Engine
struct net::group
struct net::half_edge
描述着(某条格点上的)半边的信息,包括这条半边与哪条格点的哪条半边相连
class net::key_exist_error
class net::key_unfound_error
struct net::keyset
struct net::kset_contract
struct net::lift_absorb
struct net::lift_contract
class net::network
网络包含格点和格点上的半边,两个半边可以相连接
struct net::no_absorb
class net::node
存储了网络中一个格点内的信息
struct net::rational
struct net::tree
树,每个节点包含一个值
struct net::Tree_act
对树的操作:根节点的值进行改变
struct net::Tree_combine
对树的操作:两个树生成一个新的树

# Types

Name
using std::string stdEdgeKey

# Functions

Name
bool is_connected(const int & N, const std::set< std::pair< int, int > > & edge)
std::set< std::pair< int, int > > random_edges(const int & N, const int & d, std::default_random_engine & R)
template <typename NetType >
void
generate_random_regular_network(NetType & N, const int & d, std::default_random_engine & R)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait ,typename absorb_type ,typename contract_type >
group< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait >
contract(group< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & G1, group< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & G2, const absorb_type & absorb_fun, const contract_type & contract_fun)
template <typename T >
std::string
to_string(const T & m)
template <typename T ,std::enable_if_t< is_scalar_v< T >, int > =0>
std::ostream &
output_bin(std::ostream & os, const T & m)
std::ostream & output_bin(std::ostream & os, const std::string & m)
template <typename T ,std::enable_if_t< is_scalar_v< T >, int > =0>
std::istream &
input_bin(std::istream & is, T & m)
std::istream & input_bin(std::istream & is, std::string & m)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::ostream &
operator<(std::ostream & os, const network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::ostream &
output_node_bin(std::ostream & os, const node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::ostream &
output_edge_bin(std::ostream & os, const half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::istream &
operator>(std::istream & is, network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::istream &
input_node_bin(std::istream & is, node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::istream &
input_edge_bin(std::istream & is, half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b)
std::string base64_encode(const std::string & in)
std::string base64_decode(const std::string & in)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::ostream &
operator<<(std::ostream & os, const network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::ostream &
output_node_text(std::ostream & os, const node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::ostream &
output_edge_text(std::ostream & os, const half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::istream &
operator>>(std::istream & is, network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::istream &
input_node_text(std::istream & is, node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s)
template <typename NodeVal ,typename EdgeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::istream &
input_edge_text(std::istream & is, half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b)
template <typename IterNode ,typename EdgeKey ,typename EdgeVal >
void
add_edge_node(IterNode it1, IterNode it2, const EdgeKey & ind1, const EdgeKey & ind2, const EdgeVal & edgev)
添加两条半边并连起来
template <typename IterNode ,typename EdgeKey ,typename EdgeVal >
void
connect_edge_node(IterNode it1, IterNode it2, const EdgeKey & ind1, const EdgeKey & ind2)
将两条半边连起来
bool operator<(const rational & a, const rational & b)
bool operator<=(const rational & a, const rational & b)
bool operator>(const rational & a, const rational & b)
bool operator>=(const rational & a, const rational & b)
bool operator==(const rational & a, const rational & b)
bool operator!=(const rational & a, const rational & b)
std::ostream & operator<<(std::ostream & os, const rational & a)
rational operator+(const rational & a, const rational & b)
rational operator-(const rational & a, const rational & b)
rational operator-(const rational & a)
rational operator*(const rational & a, const rational & b)
rational operator/(const rational & a, const rational & b)
rational & operator+=(rational & a, const rational & b)
rational & operator-=(rational & a, const rational & b)
rational & operator*=(rational & a, const rational & b)
rational & operator/=(rational & a, const rational & b)
template <typename T ,std::enable_if_t< is_scalar_v< T >, int > =0>
std::ostream &
reference_write_bin(std::ostream & os, const T & m)
template <typename T ,std::enable_if_t< is_scalar_v< T >, int > =0>
std::istream &
reference_read_bin(std::istream & is, T & m)
std::ostream & reference_write_bin(std::ostream & os, const std::string & m)
std::istream & reference_read_bin(std::istream & is, std::string & m)
template <typename T >
std::ostream &
reference_write_bin(std::ostream & os, const std::set< T > & m)
template <typename T >
std::istream &
reference_read_bin(std::istream & is, std::set< T > & m)
template <typename T ,typename V >
std::ostream &
reference_write_bin(std::ostream & os, const std::pair< T, V > & m)
template <typename T ,typename V >
std::istream &
reference_read_bin(std::istream & is, std::pair< T, V > & m)
template <typename T ,typename V >
std::ostream &
reference_write_bin(std::ostream & os, const std::map< T, V > & m)
template <typename T ,typename V >
std::istream &
reference_read_bin(std::istream & is, std::map< T, V > & m)
template <typename T >
std::ostream &
reference_write_bin(std::ostream & os, const std::vector< T > & m)
template <typename T >
std::istream &
reference_read_bin(std::istream & is, std::vector< T > & m)
std::ostream & reference_write_bin_str(std::ostream & os, const std::string & m)
template <typename T ,typename V >
std::ostream &
reference_write_text(std::ostream & os, const std::map< T, V > & m)
template <typename T ,typename V >
std::istream &
reference_read_text(std::istream & is, std::map< T, V > & m)
template <typename T >
std::ostream &
reference_write_text(std::ostream & os, const std::vector< T > & m)
template <typename T >
std::istream &
reference_read_text(std::istream & is, std::vector< T > & m)
template <typename T >
std::ostream &
reference_write_text(std::ostream & os, const std::set< T > & m)
template <typename T >
std::istream &
reference_read_text(std::istream & is, std::set< T > & m)
template <typename T >
std::ostream &
reference_write_text(std::ostream & os, const T & m)
template <typename T >
std::istream &
reference_read_text(std::istream & is, T & m)
template <typename IterNode ,typename NodeSet1 ,typename NodeSet2 >
int
calc_weight(const IterNode & it, const NodeSet1 & includes, const NodeSet2 & excludes)
template <typename NodeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
void
combine_edges(network< NodeVal, int, NodeKey, EdgeKey, Trait > & lat, const std::set< NodeKey, typename Trait::nodekey_less > & includes)
template <typename NodeType ,typename SetType >
bool
calc_gain(int cut_part, net::rational & max_gain, NodeType & n, int & this_part, int & nb_part, const SetType & part)
template <typename NodeType ,typename SetType >
void
calc_weight(int cut_part, const NodeType & n, std::vector< int > & weight, const SetType & part)
void test_all_combination()
template <typename IterNode ,typename NodeSet ,typename EdgeKey ,typename Trait >
std::pair< std::pair< int, int >, IterNode >
search_quick(IterNode & it1, const NodeSet & part)
template <typename NodeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
void
get_component(node< NodeVal, int, NodeKey, EdgeKey, Trait > & n, const NodeKey & p, const std::set< NodeKey, typename Trait::nodekey_less > & part, std::set< NodeKey, typename Trait::nodekey_less > & treated, std::set< NodeKey, typename Trait::nodekey_less > & component)
template <typename NodeVal ,typename NodeKey ,typename EdgeKey ,typename Trait >
std::vector< std::set< NodeKey, typename Trait::nodekey_less > >
disconnect(network< NodeVal, int, NodeKey, EdgeKey, Trait > & lat, const std::set< NodeKey, typename Trait::nodekey_less > & part, const std::vector< std::set< NodeKey, typename Trait::nodekey_less > > & subparts)
constexpr double exp_sum_log(const double & a, const double & b)
template <typename Data >
void
gviz_nodes(const tree< Data > & node, std::ostream & dot_content, const std::string & nodename)
递归地将树的节点转化为dot脚本

# Attributes

Name
std::string theme_dark1
std::string theme_light1
std::string theme_light2
auto gviz_theme_dark1
auto gviz_theme_light1
auto gviz_theme_light2
auto gviz_theme
bool contract_test_mode
bool contract_trace_mode
constexpr bool is_scalar_v

# Types Documentation

# using stdEdgeKey

using net::stdEdgeKey = typedef std::string;

# Functions Documentation

# function is_connected

bool is_connected(
    const int & N,
    const std::set< std::pair< int, int > > & edge
)

# function random_edges

std::set< std::pair< int, int > > random_edges(
    const int & N,
    const int & d,
    std::default_random_engine & R
)

# function generate_random_regular_network

template <typename NetType >
void generate_random_regular_network(
    NetType & N,
    const int & d,
    std::default_random_engine & R
)

# function contract

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait ,
typename absorb_type ,
typename contract_type >
group< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > contract(
    group< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & G1,
    group< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & G2,
    const absorb_type & absorb_fun,
    const contract_type & contract_fun
)

# function to_string

template <typename T >
std::string to_string(
    const T & m
)

# function output_bin

template <typename T ,
std::enable_if_t< is_scalar_v< T >, int >  =0>
std::ostream & output_bin(
    std::ostream & os,
    const T & m
)

# function output_bin

inline std::ostream & output_bin(
    std::ostream & os,
    const std::string & m
)

# function input_bin

template <typename T ,
std::enable_if_t< is_scalar_v< T >, int >  =0>
std::istream & input_bin(
    std::istream & is,
    T & m
)

# function input_bin

inline std::istream & input_bin(
    std::istream & is,
    std::string & m
)

# function operator<

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::ostream & operator<(
    std::ostream & os,
    const network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n
)

# function output_node_bin

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::ostream & output_node_bin(
    std::ostream & os,
    const node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s
)

# function output_edge_bin

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::ostream & output_edge_bin(
    std::ostream & os,
    const half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b
)

# function operator>

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::istream & operator>(
    std::istream & is,
    network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n
)

# function input_node_bin

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::istream & input_node_bin(
    std::istream & is,
    node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s
)

# function input_edge_bin

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::istream & input_edge_bin(
    std::istream & is,
    half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b
)

# function base64_encode

inline std::string base64_encode(
    const std::string & in
)

# function base64_decode

inline std::string base64_decode(
    const std::string & in
)

# function operator<<

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::ostream & operator<<(
    std::ostream & os,
    const network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n
)

# function output_node_text

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::ostream & output_node_text(
    std::ostream & os,
    const node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s
)

# function output_edge_text

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::ostream & output_edge_text(
    std::ostream & os,
    const half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b
)

# function operator>>

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::istream & operator>>(
    std::istream & is,
    network< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & n
)

# function input_node_text

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::istream & input_node_text(
    std::istream & is,
    node< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & s
)

# function input_edge_text

template <typename NodeVal ,
typename EdgeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::istream & input_edge_text(
    std::istream & is,
    half_edge< NodeVal, EdgeVal, NodeKey, EdgeKey, Trait > & b
)

# function add_edge_node

template <typename IterNode ,
typename EdgeKey ,
typename EdgeVal >
void add_edge_node(
    IterNode it1,
    IterNode it2,
    const EdgeKey & ind1,
    const EdgeKey & ind2,
    const EdgeVal & edgev
)

添加两条半边并连起来

# function connect_edge_node

template <typename IterNode ,
typename EdgeKey ,
typename EdgeVal >
void connect_edge_node(
    IterNode it1,
    IterNode it2,
    const EdgeKey & ind1,
    const EdgeKey & ind2
)

将两条半边连起来

# function operator<

inline bool operator<(
    const rational & a,
    const rational & b
)

# function operator<=

inline bool operator<=(
    const rational & a,
    const rational & b
)

# function operator>

inline bool operator>(
    const rational & a,
    const rational & b
)

# function operator>=

inline bool operator>=(
    const rational & a,
    const rational & b
)

# function operator==

inline bool operator==(
    const rational & a,
    const rational & b
)

# function operator!=

inline bool operator!=(
    const rational & a,
    const rational & b
)

# function operator<<

inline std::ostream & operator<<(
    std::ostream & os,
    const rational & a
)

# function operator+

inline rational operator+(
    const rational & a,
    const rational & b
)

# function operator-

inline rational operator-(
    const rational & a,
    const rational & b
)

# function operator-

inline rational operator-(
    const rational & a
)

# function operator*

inline rational operator*(
    const rational & a,
    const rational & b
)

# function operator/

inline rational operator/(
    const rational & a,
    const rational & b
)

# function operator+=

inline rational & operator+=(
    rational & a,
    const rational & b
)

# function operator-=

inline rational & operator-=(
    rational & a,
    const rational & b
)

# function operator*=

inline rational & operator*=(
    rational & a,
    const rational & b
)

# function operator/=

inline rational & operator/=(
    rational & a,
    const rational & b
)

# function reference_write_bin

template <typename T ,
std::enable_if_t< is_scalar_v< T >, int >  =0>
std::ostream & reference_write_bin(
    std::ostream & os,
    const T & m
)

# function reference_read_bin

template <typename T ,
std::enable_if_t< is_scalar_v< T >, int >  =0>
std::istream & reference_read_bin(
    std::istream & is,
    T & m
)

# function reference_write_bin

std::ostream & reference_write_bin(
    std::ostream & os,
    const std::string & m
)

# function reference_read_bin

inline std::istream & reference_read_bin(
    std::istream & is,
    std::string & m
)

# function reference_write_bin

template <typename T >
std::ostream & reference_write_bin(
    std::ostream & os,
    const std::set< T > & m
)

# function reference_read_bin

template <typename T >
std::istream & reference_read_bin(
    std::istream & is,
    std::set< T > & m
)

# function reference_write_bin

template <typename T ,
typename V >
std::ostream & reference_write_bin(
    std::ostream & os,
    const std::pair< T, V > & m
)

# function reference_read_bin

template <typename T ,
typename V >
std::istream & reference_read_bin(
    std::istream & is,
    std::pair< T, V > & m
)

# function reference_write_bin

template <typename T ,
typename V >
std::ostream & reference_write_bin(
    std::ostream & os,
    const std::map< T, V > & m
)

# function reference_read_bin

template <typename T ,
typename V >
std::istream & reference_read_bin(
    std::istream & is,
    std::map< T, V > & m
)

# function reference_write_bin

template <typename T >
std::ostream & reference_write_bin(
    std::ostream & os,
    const std::vector< T > & m
)

# function reference_read_bin

template <typename T >
std::istream & reference_read_bin(
    std::istream & is,
    std::vector< T > & m
)

# function reference_write_bin_str

inline std::ostream & reference_write_bin_str(
    std::ostream & os,
    const std::string & m
)

# function reference_write_text

template <typename T ,
typename V >
std::ostream & reference_write_text(
    std::ostream & os,
    const std::map< T, V > & m
)

# function reference_read_text

template <typename T ,
typename V >
std::istream & reference_read_text(
    std::istream & is,
    std::map< T, V > & m
)

# function reference_write_text

template <typename T >
std::ostream & reference_write_text(
    std::ostream & os,
    const std::vector< T > & m
)

# function reference_read_text

template <typename T >
std::istream & reference_read_text(
    std::istream & is,
    std::vector< T > & m
)

# function reference_write_text

template <typename T >
std::ostream & reference_write_text(
    std::ostream & os,
    const std::set< T > & m
)

# function reference_read_text

template <typename T >
std::istream & reference_read_text(
    std::istream & is,
    std::set< T > & m
)

# function reference_write_text

template <typename T >
std::ostream & reference_write_text(
    std::ostream & os,
    const T & m
)

# function reference_read_text

template <typename T >
std::istream & reference_read_text(
    std::istream & is,
    T & m
)

# function calc_weight

template <typename IterNode ,
typename NodeSet1 ,
typename NodeSet2 >
int calc_weight(
    const IterNode & it,
    const NodeSet1 & includes,
    const NodeSet2 & excludes
)

# function combine_edges

template <typename NodeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
void combine_edges(
    network< NodeVal, int, NodeKey, EdgeKey, Trait > & lat,
    const std::set< NodeKey, typename Trait::nodekey_less > & includes
)

# function calc_gain

template <typename NodeType ,
typename SetType >
bool calc_gain(
    int cut_part,
    net::rational & max_gain,
    NodeType & n,
    int & this_part,
    int & nb_part,
    const SetType & part
)

# function calc_weight

template <typename NodeType ,
typename SetType >
void calc_weight(
    int cut_part,
    const NodeType & n,
    std::vector< int > & weight,
    const SetType & part
)

# function test_all_combination

void test_all_combination()

# function search_quick

template <typename IterNode ,
typename NodeSet ,
typename EdgeKey ,
typename Trait >
std::pair< std::pair< int, int >, IterNode > search_quick(
    IterNode & it1,
    const NodeSet & part
)

# function get_component

template <typename NodeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
void get_component(
    node< NodeVal, int, NodeKey, EdgeKey, Trait > & n,
    const NodeKey & p,
    const std::set< NodeKey, typename Trait::nodekey_less > & part,
    std::set< NodeKey, typename Trait::nodekey_less > & treated,
    std::set< NodeKey, typename Trait::nodekey_less > & component
)

# function disconnect

template <typename NodeVal ,
typename NodeKey ,
typename EdgeKey ,
typename Trait >
std::vector< std::set< NodeKey, typename Trait::nodekey_less > > disconnect(
    network< NodeVal, int, NodeKey, EdgeKey, Trait > & lat,
    const std::set< NodeKey, typename Trait::nodekey_less > & part,
    const std::vector< std::set< NodeKey, typename Trait::nodekey_less > > & subparts
)

# function exp_sum_log

constexpr double exp_sum_log(
    const double & a,
    const double & b
)

# function gviz_nodes

template <typename Data >
void gviz_nodes(
    const tree< Data > & node,
    std::ostream & dot_content,
    const std::string & nodename
)

递归地将树的节点转化为dot脚本

# Attributes Documentation

# variable theme_dark1

std::string theme_dark1;

# variable theme_light1

std::string theme_light1;

# variable theme_light2

std::string theme_light2;

# variable gviz_theme_dark1

auto gviz_theme_dark1 = nlohmann::json::parse([theme_dark1](/Namespaces/namespacenet.md#variable-theme_dark1));

# variable gviz_theme_light1

auto gviz_theme_light1 = nlohmann::json::parse([theme_light1](/Namespaces/namespacenet.md#variable-theme_light1));

# variable gviz_theme_light2

auto gviz_theme_light2 = nlohmann::json::parse([theme_light2](/Namespaces/namespacenet.md#variable-theme_light2));

# variable gviz_theme

auto gviz_theme = [gviz_theme_dark1](/Namespaces/namespacenet.md#variable-gviz_theme_dark1);

# variable contract_test_mode

bool contract_test_mode = false;

# variable contract_trace_mode

bool contract_trace_mode = false;

# variable is_scalar_v

constexpr bool is_scalar_v = std::is_scalar_v<T>;

Updated on 15 June 2022 at 16:04:18 CST