PPBlockState throwing error in mcmc_equilibrate

Hi Prof. Peixoto,

My graph-tool version: 2.72
OS: ubuntu 22

gt.PPBlockState throws a semantic error: NameError: name 'log' is not defined.
Other SBM variants work fine.

MWE:

import graph_tool.all as gt
import numpy as np

class ARGS():
    pass

args = ARGS()
args.SEED = 100

def mcmc_eq(args, g, state):
    bs = [] # partitions
    Bs = np.zeros(g.num_vertices() + 1) # number of blocks
    Bes = [] # number of effective blocks
    dls = [] # description length history
    def collect_partitions(s):
        bs.append(s.b.a.copy())
        B = s.get_nonempty_B()
        Bs[B] += 1
        Bes.append(s.get_Be())
        dls.append(s.entropy())
        
    gt.mcmc_equilibrate(
        state, 
        wait=args.wait, 
        force_niter=args.force_niter,
        mcmc_args=dict(niter=args.niter), 
        callback=collect_partitions,
    )
    return state, bs, Bs, Bes, dls

g = gt.collection.ns["new_guinea_tribes"]
state = gt.PPBlockState(
    g, 
)
# state = gt.minimize_blockmodel_dl(g, state=gt.PPBlockState)
args.wait = 12
args.force_niter = 100
args.niter = 10
state, bs, Bs, Bes, dls = mcmc_eq(args, g, state)
state

Many thanks,
Govinda

Thanks for the bug report and the MWE! This is fixed now in version 2.74.

In the future, please submit bug reports via the issue tracker, as it makes things easier for me.

Another question on PPBlockState: can it be used for multi-layer graphs?

LayeredBlockState works well for (Overlapping/Hierarchical) SBM, but does it find assortative partitions also?

Not currently.

Any SBM will find assortative partitions if these are the most compressive ones, but they are not constrained to find those.

1 Like