Nested Block State hierarchy level after mcmc_equilibrate

I ran mcmc_equilibrate on a nested block state model in a weighted graph. As
per instructions, I copied the initially computed state in another object
with increased hierarchy depth to 10. However, this fixed the depth to 10.
Everything computed afterwards has depth 10 even if is clear that after 3 or
4 levels the nodes converge to one.

There are many empty branches and when I try to plot it with empty_branches
= False, I get an error stating it is not a tree.
RuntimeError: Invalid hierarchical tree: No path from source to target.

Did anybody perform any similar analyses?

The hierarchy after mcmc_equilibrate:
<NestedBlockState object, with base &lt;BlockState object with 24 blocks (24
nonempty), degree-corrected, with 1 edge covariate, for graph &lt;Graph
object, undirected, with 230 vertices and 11230 edges, edges filtered by
(&lt;PropertyMap object with key type 'Edge' and value type 'bool', for
Graph 0x7fc3a89f1210, at 0x7fc3a64911d0>, False), vertices filtered by
(<PropertyMap object with key type 'Vertex' and value type 'bool', for Graph
0x7fc3a89f1210, at 0x7fc3a64912d0>, False) at 0x7fc3a89f1210>, at
0x7fc3a6491950>, and 10 levels of sizes [(230, 24), (24, 5), (5, 1), (1, 1),
(1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1)] at 0x7fc3a6491590>

Which version are you using?

Please provide a minimal and self-contained example that shows the problem.

Best,
Tiago

I just found out the following (using gt 2.29):

If I create a GraphView of g and store it in g,

    g = gt.extract_largest_component(g)

infer an SBM,

    state = gt.minimize_nested_blockmodel_dl(g)

and try to draw it,

    state.draw()

then I get the "RuntimeError: Invalid hierarchical tree: No path from source to target."

But if I prune the graph,

     g = gt.extract_largest_component(g, prune=True)

then everything's fine.

Hope this documentation is helpful.

Haiko

attachment.html (2.48 KB)

I have a question related to this
The documentation example suggests a hierarchy set to 10 levels

bs = state.get_bs() # Get hierarchical partition.
bs += [np.zeros(1)] * (10 - len(bs)) # Augment it to L = 10 with
                                       # single-group levels.

state = state.copy(bs=bs, sampling=True)

Is there some golden rule (which I obviously don’t know) to choose such
dimension? Is 10 always a good choice? More important: why I need to modify
the length before mcmc_equilibrate()?

d

The number of layers used is an *upper bound* only, which should be
sufficiently large to accommodate your posterior distribution. The
algorithm will decide automatically how many layers should in fact be used.

Since the number of nodes tend to decay exponentially in the upper
levels, a value of 10 is often quite enough. For very large networks
this can be increased to 15 or 20, but rarely we need more than this.