Nested Block Model Confusion

Sir,

I have three doubts to clarify which I list here

1.) I am trying to use the following function for my graph:

*class graph_tool.inference.nested_blockmodel.NestedBlockState(g, bs,
base_type=<class 'graph_tool.inference.blockmodel.BlockState'>,
state_args={}, hstate_args={}, hentropy_args={}, sampling=False, **kwargs)*

I am not able to understand what do I need to provide for *'bs'* values in
the arguments.

The tutorial mentions that it is a *Property Map Hierarchical node
partition*.

What I understand it is asking for a prior hierarchical information about
the nodes which can be done using hierarchical clustering. If this is the
case then how does hierarchical partition help me ? because it is mentioned
in the tutorial that to overcome the limit of BlockState function to
identify smaller communities in very large graph this function was
implemented. My graph is very large and I didn't keep any hierarchical
information along with it.
If not then what do I need to pass to the argument 'bs' in this function ?

2.) Suppose I have a network myG with N nodes and E edges , undirected and
no value specifically assigned in the edge, vertex or graph property map.

I want to do the nested block model partition with mcmc equilibrate to get
the best partition. Then are these steps to do so correct.

a) Import graph_tool.inference and graph_tool.all

b) define your graph myG as *"NestedBlockState"*

c) minimize your NestedBlockState using the
*minimize_nested_blockmodel_dl(myG)* function

d) run mcmc_equilibrate function on minimized nested block state to find the
best partitions in n iterations.

3.) While using LayeredBlockState function, you mentioned in one of your
mailing list reply, one should collapse the graph as a single graph with
multiple edges.

What I understood by trying some random code is that i can add multiple
edges between two nodes but pass a different property map for each edge
defining the corresponding layer. Finally use this Property Map in
LayeredBlockState function by passing it to 'ec' parameter. Am I right on
this ?

4.) Which draw/plot function should be used to plot very large graphs. My
graph has 6500 nodes and 95000 edges. The calling of function draw() gives
memory error (for SVG format), PDF format fails to load for a very long time
and PNG format is of very low resolution. GraphViz doesn't work due to error
related to libv which I saw is a bug in the mailing list due to the libv
library.

I figured out the answer to questions 1 to 3 but I am still having problem
with plotting which I have mentioned in question 4.

Apart from this I am facing another issue.

I had saved my vertex properties which are labels to the vertices in a
variable vprop

print(vprop[i]) will give the node name (in string)

After the minimization of BlockState model, print_summary() gives the brief
info on different layers like this:

stateB.print_summary() # stateB is the minimized nested block state

l: 0, N: 6525, B: 70
l: 1, N: 70, B: 14
l: 2, N: 14, B: 4
l: 3, N: 4, B: 1
l: 4, N: 1, B: 1

Then levels = stateB.get_levels() gives the blocks in each level and
levels[i] is the individual layers

When I type levels[i].get_blocks() it gives me Property map of key and
corresponding block number in the current level 'i'

Again, levels[i].get_blocks()[12] gives block number.

But How to get the vertex property label/name in subsequent blocks similar
to what I get from vprop ?

I figured out the answer to questions 1 to 3 but I am still having problem
with plotting which I have mentioned in question 4.

If you're running out of memory when plotting a graph, this means that the
output would be completely useless, even if you had the required memory to
begin with.

A simple but effective approach to get useful information for very large
graphs is to use the 'subsample_edges' parameter when calling state.draw().
This takes the number of edges that will be randomly sampled when drawing.
Even a low number like 3000 gives usable results.

But How to get the vertex property label/name in subsequent blocks similar
to what I get from vprop ?

   # this projects level 3 onto level 0 and returns the property map
   b = state.project_level(3, 0)

Best,
Tiago

Is it stateB.project_partition(3,0) or stateB.project_level(3,0)

Because the later gives error and in documentation it is mentioned that it
takes only one argument.

It seems you have answered your own question. :wink:

It is stateB.project_partition(3, 0).