marginal_multigraph_sample

marginal_multigraph_sample#

graph_tool.inference.marginal_multigraph_sample(g, ews, ecount)[git][source]#

Sample edge multiplicities from the marginal latent multigraph distribution.

Parameters:
gGraph

Marginal multigraph.

ewsEdgePropertyMap

Vector-valued edge property map containing the observed edge multiplicities.

ecountEdgePropertyMap

Vector-valued edge property map containing the counts of each multiplicity in ews. The property map "wcount" returned by collect_marginal_multigraph() is indexed by the multiplicity itself, so that it is used together with ews[e] = range(len(wcount[e])).

Returns:
wEdgePropertyMap

Sampled edge multiplicities.

See also

marginal_multigraph_lprob

Log-probability of a marginal multigraph

marginal_multigraph_entropy

Entropy of the marginal multigraph distribution

marginal_graph_sample

Sample from the marginal graph distribution

Notes

The multiplicity of each edge \((i,j)\) is sampled independently from the marginal distribution

\[\pi_{ij}(w) = \frac{n_{ij}(w)}{\sum_{w'}n_{ij}(w')},\]

where \(n_{ij}(w)\) is the count of multiplicity \(w\), given by ecount.

This algorithm runs in time \(O(\sum_{ij}k_{ij})\), where \(k_{ij}\) is the number of distinct multiplicities observed for edge \((i,j)\).

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.