marginal_graph_sample

marginal_graph_sample#

graph_tool.inference.marginal_graph_sample(g, ep)[git][source]#

Sample a graph from the marginal edge probabilities.

Parameters:
gGraph

Marginal graph.

epEdgePropertyMap

Edge property map with the marginal probability of each edge (e.g. the property map "eprob" returned by collect_marginal()).

Returns:
wEdgePropertyMap

Edge property map with values 1 for the sampled edges, and 0 otherwise.

See also

marginal_graph_lprob

Log-probability of a marginal graph

marginal_multigraph_sample

Sample from the marginal multigraph distribution

UncertainBlockState

Network reconstruction with uncertain edges

Notes

Each edge \((i,j)\) is sampled independently with probability \(\pi_{ij}\), given by ep.

This algorithm runs in time \(O(E)\), where \(E\) is the number of edges in g.

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.