On 26.05.2016 04:22, Rogelio Basurto wrote:
> I am reading a bipartite network from a graphml file, then I do some
> filtering and finally I construct the minimize_nested_blockmodel_dl as
> in the example. Then I draw it, just like in the example, and it looks
> great. I manage to draw it with the node names and they are fine.
>
> Then, I would like to check the names of the nodes in the different
> blocks, by the levels they are arranged from the stochastic nested
> block model. But I do not know how to do that.
>
> I found the function get_bstack() for the NestedBlockState object, but
> the index in those vertices are from 0 to N, where N is the number of
> vertices per level (of the model, not from my graph, I think), then
> how do I associate my original vertex index (which has its name) to
> those graphs from the different levels?

The partition of nodes in the first level is obtained via:

   b = state.levels[0].get_blocks()

This is a vertex property map that says to which block a node of your
network belongs. For example:

  >>> print(b[10])
  3

The above means that vertex 10 belongs to group 3. The same can be done
for the higher levels of the hierarchy, i.e.

  >>> b = state.levels[1].get_blocks()
  >>> print(b[3])
  5

The group number 3 in the first level, belongs to group number 5 in the
second level. An so on.

Best,
Tiago

-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to