[graph-tool] projecting vertex marginals to hierarchy levels
cittaro.davide at gmail.com
Wed Jan 15 18:01:35 CET 2020
I'm following the cookbook and I'm collecting vertex marginals during mcmc_equilibrate, so
pv = [None] * len(state.get_levels())
pv = [sl.collect_vertex_marginals(pv[l]) for l, sl in enumerate(s.get_levels())]
gt.mcmc_equilibrate(state, force_niter=1000, mcmc_args=dict(niter=10), wait=wait,
nbreaks=nbreaks, epsilon=epsilon, callback=collect_marginals
After this is done, every element of pv will be, basically, a list of arrays with as many elements as many vertexs are at specific level, each with the counts for memberships.
In fact, when I need to assign groups to the original vertexs to a blockstate at level L > 0 (say, level 2) I can use
the vertex map will contain as many elements as the number of vertex of my graph, each labeled according to the blocks at level 2 of the hierarchy.
I cannot find a smart way to project the marginals I've collected, would it be sufficient to sum numbers for pv following the hierarchy (that is, summing counts for all groups at level 0 which are included in the same group at level 2)?
More information about the graph-tool