marginal_multigraph_sample#
- graph_tool.inference.marginal_multigraph_sample(g, ews, ecount)[git][source]#
Sample edge multiplicities from the marginal latent multigraph distribution.
- Parameters:
- g
Graph Marginal multigraph.
- ews
EdgePropertyMap Vector-valued edge property map containing the observed edge multiplicities.
- ecount
EdgePropertyMap Vector-valued edge property map containing the counts of each multiplicity in
ews. The property map"wcount"returned bycollect_marginal_multigraph()is indexed by the multiplicity itself, so that it is used together withews[e] = range(len(wcount[e])).
- g
- Returns:
- w
EdgePropertyMap Sampled edge multiplicities.
- w
See also
marginal_multigraph_lprobLog-probability of a marginal multigraph
marginal_multigraph_entropyEntropy of the marginal multigraph distribution
marginal_graph_sampleSample 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.