marginal_graph_lprob

marginal_graph_lprob#

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

Compute the log-probability of a graph according to 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()).

wEdgePropertyMap

Edge property map with values 1 for the edges that are present in the graph, and 0 otherwise.

Returns:
Lfloat

Log-probability of the graph given by w.

See also

marginal_graph_sample

Sample from the marginal graph distribution

marginal_multigraph_lprob

Log-probability of a marginal multigraph

UncertainBlockState

Network reconstruction with uncertain edges

Notes

The log-probability is computed as

\[\ln P(\boldsymbol w) = \sum_{(i,j)}\left[w_{ij}\ln\pi_{ij} + (1-w_{ij})\ln(1-\pi_{ij})\right],\]

where the sum is over the edges of g, and \(\pi_{ij}\) is given by ep.

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