graph_tool.inference
#
This module contains algorithms for the identification of largescale network structure via the statistical inference of generative models.
Note
An introduction to the concepts used here, as well as a basic HOWTO is included in the cookbook section: Inferring modular network structure.
Nonparametric stochastic block model inference#
Highlevel functions#
Fit the stochastic block model, by minimizing its description length using an agglomerative heuristic. 

Fit the nested stochastic block model, by minimizing its description length using an agglomerative heuristic. 
State classes#
The stochastic block model state of a given graph. 

The overlapping stochastic block model state of a given graph. 

The (possibly overlapping) block state of a given graph, where the edges are divided into discrete layers. 

The nested stochastic block model state of a given graph. 

Obtain the partition of a network according to the Bayesian planted partition model. 

Obtain the ordered partition of a network according to the ranked stochastic block model. 

Obtain the partition of a network according to the maximization of Newman's modularity. 

Obtain the partition of a network according to the normalized cut. 

This class aggregates several state classes and corresponding inversetemperature values to implement parallel tempering MCMC. 

The state of a clique decomposition of a given graph. 
Abstract base classes#
Base state that implements entropy arguments. 

Base state that implements singleflip MCMC sweeps. 

Base state that implements multiflip (mergesplit) MCMC sweeps. 

Base state that implements multilevel agglomerative MCMC sweeps. 

Base state that implements single flip MCMC sweeps. 

Base state that implements multicanonical MCMC sweeps. 

Base state that implements exhaustive enumerative sweeps. 

Base state that implements groupbased drawing. 
Sampling and minimization#
Equilibrate a MCMC with a given starting state. 

Equilibrate a MCMC at a specified target temperature by performing simulated annealing. 

Equilibrate a multicanonical Monte Carlo sampling using the WangLandau algorithm. 
The density of states of a multicanonical Monte Carlo algorithm. 
Comparing and manipulating partitions#
The random label model state for a set of labelled partitions, which attempts to align them with a common group labelling. 

The mixed random label model state for a set of labelled partitions, which attempts to align them inside clusters with a common group labelling. 

Obtain the center of a set of partitions, according to the variation of information metric or reduced mutual information. 
Returns the maximum overlap between partitions, according to an optimal label alignment. 

Returns the hierarchical maximum overlap between nested partitions, according to an optimal recursive label alignment. 

Returns the variation of information between two partitions. 

Returns the mutual information between two partitions. 

Returns the reduced mutual information between two partitions. 

Returns the contingency graph between both partitions. 

Returns a copy of partition 

Returns a copy of partition 

Returns a copy of nested partition 

Returns a copy of partition 

Returns a copy of nested partition 

Find a partition with a maximal overlap to all items of the list of partitions given. 

Find a nested partition with a maximal overlap to all items of the list of nested partitions given. 

Returns a copy of nested partition 

Remap the values of 

Remap the values of the nested partition 
Auxiliary functions#
Compute the "mean field" entropy given the vertex block membership marginals. 

Compute the Bethe entropy given the edge block membership marginals. 

Compute microstate entropy given a histogram of partitions. 

Compute the entropy of the marginal latent multigraph distribution. 

Generate a halfedge graph, where each halfedge is represented by a node, and an edge connects the halfedges like in the original graph. 

Get edge gradients corresponding to the block membership at the endpoints of the edges given by the 
Auxiliary classes#
Histogram of partitions, implemented in C++. 

Histogram of block pairs, implemented in C++. 
Nonparametric network reconstruction#
Reconstruction from direct measurements#
Base state for uncertain latent layer network inference. 

Inference state of an erased Poisson multigraph, using the stochastic block model as a prior. 

Inference state of the stochastic block model with latent triadic closure edges. 

Inference state of a measured graph, using the stochastic block model as a prior. 

Inference state of a measured graph, using the stochastic block model with triadic closure as a prior. 

Inference state of a measured graph with heterogeneous errors, using the stochastic block model as a prior. 

Inference state of an uncertain graph, using the stochastic block model as a prior. 

Base state for uncertain network inference. 
Expectationmaximization inference#
Infer latent Poisson multigraph model given an "erased" simple graph. 
Reconstruction from dynamics and behavior#
Base state for network reconstruction based on dynamical or behavioral data, using the stochastic block model as a prior. 

Base state for network reconstruction where the respective model can be used with beliefpropagation. 

State for network reconstruction based on the multivariate normal distribution, using the Pseudolikelihood approximation and the stochastic block model as a prior. 

State for network reconstruction based on the dynamical multivariate normal distribution, using the Pseudolikelihood approximation and the stochastic block model as a prior. 

State for network reconstruction based on a linear dynamical model. 

Base state for network reconstruction based on dynamical or behavioral data, using the stochastic block model as a prior. 

Inference state for network reconstruction based on epidemic dynamics, using the stochastic block model as a prior. 

Base state for network reconstruction based on the Ising model, using the stochastic block model as a prior. 

State for network reconstruction based on the Glauber dynamics of the Ising model, using the stochastic block model as a prior. 

State for network reconstruction based on the Glauber dynamics of the continuous Ising model, using the stochastic block model as a prior. 

State for network reconstruction based on the equilibrium configurations of the Ising model, using the pseudolikelihood approximation and the stochastic block model as a prior. 

State for network reconstruction based on the equilibrium configurations of the continuous Ising model, using the Pseudolikelihood approximation and the stochastic block model as a prior. 
Semiparametric stochastic block model inference#
State classes#
The parametric, undirected stochastic block model state of a given graph. 
Expectationmaximization Inference#
Infer the model parameters and latent variables using the expectationmaximization (EM) algorithm with initial state given by 
Largescale descriptors#
Calculate Newman's (generalized) modularity of a network partition. 