`NestedBlockState.draw()` doesn't work on `minimize_nested_blockmodel_dl(overlap=True)`
Hello,
There's a graph I'd like to analyze. I think an overlapping nested stochastic block model fits my intuitions about the graph.
I start with a non-overlapping nested SBM:
nsbm = minimize_nested_blockmodel_dl(graph, overlap=False)
and I get some interesting and promising results. 4 layers, 213 clusters at the first layer (of a 16,000 node graph). But I know that in order to capture the information in the graph, these need to be allowed to overlap.
onsbm = minimize_nested_blockmodel_dl(graph, overlap=True)
However, I get some perplexing results here -- There seem to be only two layers, one of which is the root, and the other assigns every node to the same cluster. I'm not quite sure what's going on here, so I decide to also draw the result.
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-3-d09bff94e7c9> in <module>()
----> 1 onsbm.draw()
/usr/local/lib/python3.6/site-packages/graph_tool/inference/nested_blockmodel.py in draw(self, **kwargs)
646 draws the hierarchical state."""
647 import graph_tool.draw
--> 648 return graph_tool.draw.draw_hierarchy(self, **kwargs)
649
650
/usr/local/lib/python3.6/site-packages/graph_tool/draw/cairo_draw.py in draw_hierarchy(state, pos, layout, beta, node_weight, vprops, eprops, hvprops, heprops, subsample_edges, deg_order, deg_size, vsize_scale, hsize_scale, hshortcuts, hide, bip_aspect, empty_branches, **kwargs)
1880 r, s = s, r
1881 gradient[e] = [0] + list(vcmap(r / (B - 1))) + \
-> 1882 [1] + list(vcmap(s / (B - 1)))
1883 if isinstance(ecolor, PropertyMap):
1884 gradient[e][4] = gradient[e][9] = ecolor[e][3]
ZeroDivisionError: division by zero
It might be possible that by allowing for overlaps in the nested SBM, it becomes impossible to gather meaningful information out of the graph, leading to this result, but even in that case, the draw
method shouldn't fail this way I think.
Let me know if you would like me to provide the graph, or pickles of the BlockStates with overlap=False
and overlap=True
Python 3.6, MacOS 10.12.6