Which null model should I use?
The package implements nine maximum-entropy null models. They differ in the type of network they apply to (undirected/directed/bipartite, binary/weighted) and in the structural information they preserve (degrees, strengths, reciprocity). This page helps you pick the right one; the individual model pages document the mathematics and the API.
Decision tree
- Is the network bipartite? →
BiCM(binary; project afterwards withproject). - Is the network undirected?
- Is the network directed and binary?
- Is the network directed and weighted?
- integer weights, degrees and strengths matter →
DECM(out-/in-degrees and out-/in-strengths, jointly); - continuous weights, reciprocity is not a feature you need to preserve →
DCReM(out-/in-strengths conditional on a DBCM topology); - continuous weights, reciprocity is structurally important →
CRWCM(the four reciprocal strength sequences conditional on an RBCM topology).
- integer weights, degrees and strengths matter →
Does reciprocity matter for my network?
Directed networks range from fully anti-reciprocal (e.g. food webs, $r_t \approx 0.03$–$0.1$ for the bundled demo food webs) to fully reciprocal (e.g. the taro_exchange() gift network, $r_t = 1$). Two quick diagnostics:
using MaxEntropyGraphs
G = MaxEntropyGraphs.Graphs.SimpleDiGraph(rhesus_macaques())
# 1. compare the observed reciprocity with the DBCM baseline
r_obs = reciprocity(G) # 0.757
model = DBCM(G); solve_model!(model)
r_dbcm = reciprocity(model) # 0.561 -> the DBCM *underestimates* reciprocity
# 2. compare information criteria (same n = N(N-1) observations, directly comparable)
rmodel = RBCM(G); solve_model!(rmodel)
AICc(rmodel) < AICc(model) # true -> the RBCM wins despite its extra N parametersIf the observed reciprocity sits far from the DBCM expectation (or the RBCM wins on AICc), dyadic patterns are a genuine feature of your network and higher-order analyses (e.g. triadic motifs) should use the reciprocal models — Squartini & Garlaschelli (2011) and Di Vece et al. (2023) show that motif profiles change qualitatively between the DBCM and RBCM benchmarks. The same reasoning carries over to the weighted pair DCReM/CRWCM through the weighted reciprocity $r_w$ (weighted_reciprocity).
Model overview
| Model | Network | Constraints | # parameters | $a_{ij} \perp a_{ji}$? | Weights |
|---|---|---|---|---|---|
UBCM | undirected, binary | $k_i$ | $N$ | (symmetric) | — |
DBCM | directed, binary | $k^{out}_i, k^{in}_i$ | $2N$ | yes | — |
RBCM | directed, binary | $k^{→}_i, k^{←}_i, k^{↔}_i$ | $3N$ | no | — |
BiCM | bipartite, binary | $k_i$ (both layers) | $N_⊥ + N_⊤$ | yes | — |
UECM | undirected, weighted | $k_i, s_i$ | $2N$ | (symmetric) | integer |
DECM | directed, weighted | $k^{out}_i, k^{in}_i, s^{out}_i, s^{in}_i$ | $4N$ | yes | integer |
CReM | undirected, weighted | $s_i$ (conditional on UBCM topology) | $N$ | (symmetric) | continuous |
DCReM | directed, weighted | $s^{out}_i, s^{in}_i$ (cond. on DBCM) | $2N$ | yes | continuous |
CRWCM | directed, weighted | $s^{→}_i, s^{←}_i, s^{↔,out}_i, s^{↔,in}_i$ (cond. on RBCM) | $4N$ | no | continuous |
The CReM, DCReM and CRWCM are conditional models: a binary layer (UBCM/DBCM/RBCM respectively) fixes the topology, and the weighted layer places weights on the realised links. Their likelihoods — and therefore their AIC/AICc/BIC values — are conditional on the binary layer, so compare information criteria only within the conditional family (e.g. DCReM vs CRWCM), not against the fully joint UECM/DECM.
Under the RBCM and CRWCM the two directions of a dyad are correlated ($\mathrm{Cov}(a_{ij}, a_{ji}) = p^{↔}_{ij} - \langle a_{ij}\rangle\langle a_{ji}\rangle \neq 0$, and similarly for the weights). The package handles this everywhere it matters: motif expectations are evaluated from the dyadic probabilities (not from Ĝ), the delta-method σₓ includes the covariance cross-terms, and sampling draws whole dyads. Ĝ-based shortcuts that are exact for the independent models would silently be wrong here — which is why e.g. rand(m::RBCM, precomputed=true) is not supported.
Higher-order analysis
Once a model is chosen and solved, the typical pattern-detection workflow is:
- Binary triadic motifs: observed
motifs(G)vs the model expectationmotifs(model)(exact for DBCM and RBCM) with analytical z-scores viaσₓ, or sampling-based z-scores viamotif_zscores. - Triadic fluxes (weight circulating on motifs): observed
motif_fluxes(G)vs the exact expectationmotif_fluxes(model)(DCReM/CRWCM), with sampling z-scores viaflux_zscores. - Triadic intensities (
motif_intensities): observed values plus sampling z-scores viaensemble_zscores(no closed-form expectation exists).
See the Metrics pages for the full analytical/simulation toolkit.
References
- [1] Squartini, Tiziano and Garlaschelli, Diego. "Analytical maximum-likelihood method to detect patterns in real networks" 2011 New J. Phys. 13 083001. https://iopscience.iop.org/article/10.1088/1367-2630/13/8/083001
- [2] Di Vece, Marzio; Pijpers, Frank P. and Garlaschelli, Diego. "Commodity-specific triads in the Dutch inter-industry production network" Sci Rep 14, 3625 (2024) / arXiv:2305.12179. https://arxiv.org/abs/2305.12179
- [3] Parisi, Federica; Squartini, Tiziano and Garlaschelli, Diego. "A faster horse on a safer trail: generalized inference for the efficient reconstruction of weighted networks" 2020 New J. Phys. 22 053053. https://iopscience.iop.org/article/10.1088/1367-2630/ab74a7