-1

I am using Python graph-tools library to make some inferences on a graph, and I was referencing the below link, which shows the API and some examples. https://graph-tool.skewed.de/static/doc/inference.html#graph_tool.inference.BlockState

My code is written below as follows, where g is a directed, edge-weighted graph that was defined in a previous step.

g.save(graph_file_name)
g = graph_tool.load_graph(file_name)
state = BlockState(g, B=276, deg_corr = True)
pv = None
state.mcmc_sweep(niter=1000)
for i in range(1000):
    ds, nmoves = state.mcmc_sweep(niter=10)
    pv = state.collect_vertex_marginals(pv)
pv = state.collect_vertex_marginals(pv)
print mf_entropy(g, pv)

graph_draw(g)

According to the API, the BlockState constructor should return a BlockState obj that has functions ch as collect_vertex_marginals and mcmc_sweep(). However, I get the following error:

AttributeError: 'BlockState' object has no attribute 'mcmc_sweep'

Am I simply overlooking something? I don't see any kind of version problem (e.g. outdated API), so I'm a bit mystified. Thanks!

1 Answers1

0

You most likely have an outdated version of graph-tool. The above API refers to version 2.14 or above.

Tiago Peixoto
  • 5,149
  • 2
  • 28
  • 28