barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
Network counters

Counters for network models. More...

Functions

template<typename Tnet = Network>
void counter_edges (NetCounters< Tnet > *counters)
 Number of edges. More...
 
template<typename Tnet = Network>
void counter_isolates (NetCounters< Tnet > *counters)
 Number of isolated vertices. More...
 
template<>
void counter_isolates (NetCounters< NetworkDense > *counters)
 
template<typename Tnet = Network>
void counter_mutual (NetCounters< Tnet > *counters)
 Number of mutual ties. More...
 
template<typename Tnet = Network>
void counter_istar2 (NetCounters< Tnet > *counters)
 
template<>
void counter_istar2 (NetCounters< NetworkDense > *counters)
 
template<typename Tnet = Network>
void counter_ostar2 (NetCounters< Tnet > *counters)
 
template<>
void counter_ostar2 (NetCounters< NetworkDense > *counters)
 
template<typename Tnet = Network>
void counter_ttriads (NetCounters< Tnet > *counters)
 
template<>
void counter_ttriads (NetCounters< NetworkDense > *counters)
 
template<typename Tnet = Network>
void counter_ctriads (NetCounters< Tnet > *counters)
 
template<>
void counter_ctriads (NetCounters< NetworkDense > *counters)
 
template<typename Tnet = Network>
void counter_density (NetCounters< Tnet > *counters)
 
template<typename Tnet = Network>
void counter_idegree15 (NetCounters< Tnet > *counters)
 
template<>
void counter_idegree15 (NetCounters< NetworkDense > *counters)
 
template<typename Tnet = Network>
void counter_odegree15 (NetCounters< Tnet > *counters)
 
template<>
void counter_odegree15 (NetCounters< NetworkDense > *counters)
 
template<typename Tnet = Network>
void counter_absdiff (NetCounters< Tnet > *counters, size_t attr_id, double alpha=1.0)
 Sum of absolute attribute difference between ego and alter. More...
 
template<typename Tnet = Network>
void counter_diff (NetCounters< Tnet > *counters, size_t attr_id, double alpha=1.0, double tail_head=true)
 Sum of attribute difference between ego and alter to pow(alpha) More...
 
 NETWORK_COUNTER (init_single_attr)
 
template<typename Tnet = Network>
void counter_nodeicov (NetCounters< Tnet > *counters, size_t attr_id)
 
template<typename Tnet = Network>
void counter_nodeocov (NetCounters< Tnet > *counters, size_t attr_id)
 
template<typename Tnet = Network>
void counter_nodecov (NetCounters< Tnet > *counters, size_t attr_id)
 
template<typename Tnet = Network>
void counter_nodematch (NetCounters< Tnet > *counters, size_t attr_id)
 
template<typename Tnet = Network>
void counter_idegree (NetCounters< Tnet > *counters, std::vector< size_t > d)
 Counts number of vertices with a given in-degree. More...
 
template<>
void counter_idegree (NetCounters< NetworkDense > *counters, std::vector< size_t > d)
 
template<typename Tnet = Network>
void counter_odegree (NetCounters< Tnet > *counters, std::vector< size_t > d)
 Counts number of vertices with a given out-degree. More...
 
template<>
void counter_odegree (NetCounters< NetworkDense > *counters, std::vector< size_t > d)
 
template<typename Tnet = Network>
void counter_degree (NetCounters< Tnet > *counters, std::vector< size_t > d)
 Counts number of vertices with a given out-degree. More...
 
void counter_ones (DEFMCounters *counters, int covar_index=-1, std::string vname="", const std::vector< std::string > *x_names=nullptr)
 Prevalence of ones. More...
 
void counter_logit_intercept (DEFMCounters *counters, size_t n_y, std::vector< size_t > which={}, int covar_index=-1, std::string vname="", const std::vector< std::string > *x_names=nullptr, const std::vector< std::string > *y_names=nullptr)
 
void counter_transition (DEFMCounters *counters, std::vector< size_t > coords, std::vector< bool > signs, size_t m_order, size_t n_y, int covar_index=-1, std::string vname="", const std::vector< std::string > *x_names=nullptr, const std::vector< std::string > *y_names=nullptr)
 Prevalence of ones. More...
 
void counter_transition_formula (DEFMCounters *counters, std::string formula, size_t m_order, size_t n_y, int covar_index=-1, std::string vname="", const std::vector< std::string > *x_names=nullptr, const std::vector< std::string > *y_names=nullptr)
 Prevalence of ones. More...
 
void counter_fixed_effect (DEFMCounters *counters, int covar_index, double k, std::string vname="", const std::vector< std::string > *x_names=nullptr)
 Prevalence of ones. More...
 

Returns true if the cell is free

Parameters
rulesA pointer to a DEFMRules object (Rules<DEFMArray, bool>).
void rules_markov_fixed (DEFMRules *rules, size_t markov_order)
 Number of edges. More...
 
void rules_dont_become_zero (DEFMSupport *support, std::vector< size_t > ids)
 Blocks switching a one to zero. More...
 
void rule_constrain_support (DEFMSupport *support, size_t pos, double lb, double ub)
 Overall functional gains. More...
 

Detailed Description

Counters for network models.

Parameters
countersA pointer to a NetCounters object (Counters<Network, NetCounterData>).
countersA pointer to a DEFMCounters object (Counters<DEFMArray, DEFMCounterData>).

Function Documentation

◆ counter_absdiff()

template<typename Tnet = Network>
void counter_absdiff ( NetCounters< Tnet > *  counters,
size_t  attr_id,
double  alpha = 1.0 
)
inline

Sum of absolute attribute difference between ego and alter.

Definition at line 908 of file network.hpp.

◆ counter_ctriads() [1/2]

template<>
void counter_ctriads ( NetCounters< NetworkDense > *  counters)
inline

Definition at line 665 of file network.hpp.

◆ counter_ctriads() [2/2]

template<typename Tnet = Network>
void counter_ctriads ( NetCounters< Tnet > *  counters)
inline

Definition at line 610 of file network.hpp.

◆ counter_degree()

template<typename Tnet = Network>
void counter_degree ( NetCounters< Tnet > *  counters,
std::vector< size_t >  d 
)
inline

Counts number of vertices with a given out-degree.

Definition at line 1326 of file network.hpp.

◆ counter_density()

template<typename Tnet = Network>
void counter_density ( NetCounters< Tnet > *  counters)
inline

Definition at line 729 of file network.hpp.

◆ counter_diff()

template<typename Tnet = Network>
void counter_diff ( NetCounters< Tnet > *  counters,
size_t  attr_id,
double  alpha = 1.0,
double  tail_head = true 
)
inline

Sum of attribute difference between ego and alter to pow(alpha)

Definition at line 953 of file network.hpp.

◆ counter_edges()

template<typename Tnet = Network>
void counter_edges ( NetCounters< Tnet > *  counters)
inline

Number of edges.

Definition at line 152 of file network.hpp.

◆ counter_fixed_effect()

void counter_fixed_effect ( DEFMCounters counters,
int  covar_index,
double  k,
std::string  vname = "",
const std::vector< std::string > *  x_names = nullptr 
)
inline

Prevalence of ones.

Parameters
countersPointer ot a vector of counters
covar_indexIf >= than 0, then the interaction

Definition at line 693 of file counters.hpp.

◆ counter_idegree() [1/2]

template<>
void counter_idegree ( NetCounters< NetworkDense > *  counters,
std::vector< size_t >  d 
)
inline

Definition at line 1170 of file network.hpp.

◆ counter_idegree() [2/2]

template<typename Tnet = Network>
void counter_idegree ( NetCounters< Tnet > *  counters,
std::vector< size_t >  d 
)
inline

Counts number of vertices with a given in-degree.

Definition at line 1123 of file network.hpp.

◆ counter_idegree15() [1/2]

template<>
void counter_idegree15 ( NetCounters< NetworkDense > *  counters)
inline

Definition at line 785 of file network.hpp.

◆ counter_idegree15() [2/2]

template<typename Tnet = Network>
void counter_idegree15 ( NetCounters< Tnet > *  counters)
inline

Definition at line 757 of file network.hpp.

◆ counter_isolates() [1/2]

template<>
void counter_isolates ( NetCounters< NetworkDense > *  counters)
inline

Definition at line 215 of file network.hpp.

◆ counter_isolates() [2/2]

template<typename Tnet = Network>
void counter_isolates ( NetCounters< Tnet > *  counters)
inline

Number of isolated vertices.

Definition at line 175 of file network.hpp.

◆ counter_istar2() [1/2]

template<>
void counter_istar2 ( NetCounters< NetworkDense > *  counters)
inline

Definition at line 338 of file network.hpp.

◆ counter_istar2() [2/2]

template<typename Tnet = Network>
void counter_istar2 ( NetCounters< Tnet > *  counters)
inline

Definition at line 312 of file network.hpp.

◆ counter_logit_intercept()

void counter_logit_intercept ( DEFMCounters counters,
size_t  n_y,
std::vector< size_t >  which = {},
int  covar_index = -1,
std::string  vname = "",
const std::vector< std::string > *  x_names = nullptr,
const std::vector< std::string > *  y_names = nullptr 
)
inline

Calculates the logit intercept for the DEFM model.

Parameters
countersA pointer to the DEFMCounters object.
n_yThe number of response variables.
whichA vector of indices indicating which response variables to use. If empty, all response variables are used.
covar_indexThe index of the covariate to use as the intercept.
vnameThe name of the variable to use as the intercept. If empty, the intercept is set to zero.
x_namesA pointer to a vector of strings containing the names of the covariates.
y_namesA pointer to a vector of strings containing the names of the response variables.

Definition at line 170 of file counters.hpp.

◆ counter_mutual()

template<typename Tnet = Network>
void counter_mutual ( NetCounters< Tnet > *  counters)
inline

Number of mutual ties.

Definition at line 256 of file network.hpp.

◆ counter_nodecov()

template<typename Tnet = Network>
void counter_nodecov ( NetCounters< Tnet > *  counters,
size_t  attr_id 
)
inline

Definition at line 1066 of file network.hpp.

◆ counter_nodeicov()

template<typename Tnet = Network>
void counter_nodeicov ( NetCounters< Tnet > *  counters,
size_t  attr_id 
)
inline

Definition at line 1016 of file network.hpp.

◆ counter_nodematch()

template<typename Tnet = Network>
void counter_nodematch ( NetCounters< Tnet > *  counters,
size_t  attr_id 
)
inline

Definition at line 1091 of file network.hpp.

◆ counter_nodeocov()

template<typename Tnet = Network>
void counter_nodeocov ( NetCounters< Tnet > *  counters,
size_t  attr_id 
)
inline

Definition at line 1041 of file network.hpp.

◆ counter_odegree() [1/2]

template<>
void counter_odegree ( NetCounters< NetworkDense > *  counters,
std::vector< size_t >  d 
)
inline

Definition at line 1271 of file network.hpp.

◆ counter_odegree() [2/2]

template<typename Tnet = Network>
void counter_odegree ( NetCounters< Tnet > *  counters,
std::vector< size_t >  d 
)
inline

Counts number of vertices with a given out-degree.

Definition at line 1223 of file network.hpp.

◆ counter_odegree15() [1/2]

template<>
void counter_odegree15 ( NetCounters< NetworkDense > *  counters)
inline

Definition at line 862 of file network.hpp.

◆ counter_odegree15() [2/2]

template<typename Tnet = Network>
void counter_odegree15 ( NetCounters< Tnet > *  counters)
inline

Definition at line 834 of file network.hpp.

◆ counter_ones()

void counter_ones ( DEFMCounters counters,
int  covar_index = -1,
std::string  vname = "",
const std::vector< std::string > *  x_names = nullptr 
)
inline

Prevalence of ones.

Parameters
countersPointer ot a vector of counters
covar_indexIf >= than 0, then the interaction

Definition at line 89 of file counters.hpp.

◆ counter_ostar2() [1/2]

template<>
void counter_ostar2 ( NetCounters< NetworkDense > *  counters)
inline

Definition at line 404 of file network.hpp.

◆ counter_ostar2() [2/2]

template<typename Tnet = Network>
void counter_ostar2 ( NetCounters< Tnet > *  counters)
inline

Definition at line 376 of file network.hpp.

◆ counter_transition()

void counter_transition ( DEFMCounters counters,
std::vector< size_t >  coords,
std::vector< bool >  signs,
size_t  m_order,
size_t  n_y,
int  covar_index = -1,
std::string  vname = "",
const std::vector< std::string > *  x_names = nullptr,
const std::vector< std::string > *  y_names = nullptr 
)
inline

Prevalence of ones.

Parameters
countersPointer ot a vector of counters
covar_indexIf >= than 0, then the interaction

Definition at line 289 of file counters.hpp.

◆ counter_transition_formula()

void counter_transition_formula ( DEFMCounters counters,
std::string  formula,
size_t  m_order,
size_t  n_y,
int  covar_index = -1,
std::string  vname = "",
const std::vector< std::string > *  x_names = nullptr,
const std::vector< std::string > *  y_names = nullptr 
)
inline

Prevalence of ones.

Parameters
countersPointer ot a vector of counters
covar_indexIf >= than 0, then the interaction

Definition at line 611 of file counters.hpp.

◆ counter_ttriads() [1/2]

template<>
void counter_ttriads ( NetCounters< NetworkDense > *  counters)
inline

Definition at line 531 of file network.hpp.

◆ counter_ttriads() [2/2]

template<typename Tnet = Network>
void counter_ttriads ( NetCounters< Tnet > *  counters)
inline

Definition at line 441 of file network.hpp.

◆ NETWORK_COUNTER()

NETWORK_COUNTER ( init_single_attr  )

Definition at line 997 of file network.hpp.

◆ rule_constrain_support()

void rule_constrain_support ( DEFMSupport support,
size_t  pos,
double  lb,
double  ub 
)
inline

Overall functional gains.

Parameters
supportSupport of a model.
posPosition of the focal statistic.
lbLower bound
ubUpper bound
Returns
(void) adds a rule limiting the support of the model.

Definition at line 820 of file counters.hpp.

◆ rules_dont_become_zero()

void rules_dont_become_zero ( DEFMSupport support,
std::vector< size_t >  ids 
)
inline

Blocks switching a one to zero.

Parameters
rules
idsIds of the variables that will follow this rule.

Definition at line 761 of file counters.hpp.

◆ rules_markov_fixed()

void rules_markov_fixed ( DEFMRules rules,
size_t  markov_order 
)
inline

Number of edges.

Definition at line 736 of file counters.hpp.