Model Setup

new_sbm_network()

Builds a new sbm_network object from data

save_sbm_network()

Save sbm_network object

load_sbm_network()

Load sbm_network object

Modeling

Function to fit or investigate fit of SBM model

mcmc_sweep()

Run a single MCMC sweep over nodes

collapse_blocks()

Agglomeratively merge blocks

collapse_run()

Run Agglomerative Merging to target a range of block numbers

choose_best_collapse_state()

Choose and load best model state from agglomerative collapsing algorithm

Visualization

Functions to visualize the structure of network and/or results of modeling

visualize_collapse_results()

Visualize agglomerative collapse results

visualize_mcmc_trace()

Trace plot of multiple MCMC sweep sweeps

visualize_network()

Visualize network stucture

visualize_propensity_dist()

Visualize pairwise propensity distribution

visualize_propensity_network()

Plot network of nodes connected by pairwise block propensity

Network Simulation

Functions to generate networks using the stochastic block model. Usefull for testing etc..

sim_basic_block_network()

Simulate stochastic block model of given number of blocks

sim_random_network()

Simulate completely random network

sim_sbm_network()

Simulate network using stochastic block model

Property getters

Extract various properties from the model

state()

Dump state of current SBM model to dataframe

entropy()

Compute entropy for current model state

interblock_edge_counts()

Get counts between blocks at a level

n_blocks()

Get number of blocks currently in model

node_to_block_edge_counts()

Get node's edge counts to blocks

get_collapse_results()

Get collapse results from model

get_sweep_pair_counts()

Get pairwise group sharing counts from model

get_sweep_results()

Get mcmc sweep results

Low-level model manipulation

Functions that are used to modify the model at a low-level. These are usually reserved for more advanced use-cases.

add_edge()

Add edge between two nodes in network

add_node()

Add a new node to network

initialize_blocks()

Assign blocks for all nodes

update_state()

Update SBM model state

verify_model()

Verify model for sbm_network object exists

Helper Functions

Various small functions used for internals of package

build_score_fn()

Build score function from heuristic

rolling_mean()

Calculate a lagged rolling mean

combination_indices()

Get Combination Indices

print(<sbm_network>)

Print network

Datasets

Included datasets for demonstrating package

clements_pollinators

Flower and pollinators network