Question about potential bugs and input format


I couldn’t log in to Gitlab for some reason, so I decided to post this here.

I have a few questions regarding graph-tool. The first two questions are about potential bugs.

  1. In graph-tool (version 2.58), it doesn’t allow me to use PPBlockState as a base_type for the lowermost level of NestedBlockState. It didn’t work in version 2.55 either. It returns the following error:
TypeError: PPBlockState.__init__() got an unexpected keyword argument 'Lrecdx'

Is this a bug or just a missing implementation?

  1. In version 2.55, B_max worked correctly, but in version 2.58, when provided for multilevel_mcmc_sweep in minimize_nested_blockmodel_dl(), it doesn’t follow the B_max value. It returns partitions with a larger number of blocks than the predefined B_max. Bug?

  2. It is very unclear to me how to provide the initial partition for bs in NestedBlockState. I have tried multiple approaches, but all of them fail to return the correct summary (print_summary()). I already have a partition, and I just want to compute the entropy for it. My approach was the following:

Assume I have a graph with 1000 nodes. On the first level, I have four blocks. On the second level, I have two blocks, and finally, on the third level, one block containing all the nodes.

I created a VertexPropertyMap for each level that contains 1000 elements. For each level, there is a VPM that indicates the membership of all the 1000 nodes. Obviously, the number of unique elements is, for the first level, 4; for the second level, 2; and for the third level, 1. This doesn’t seem to be the right approach, as the print_summary() returns the wrong number of blocks for each level. How am I supposed to “encode” my initial partition correctly?


Neither. It does not make sense to use PPBlockState as the base type for NestedBlockState. This is not mentioned anywhere in the documentation, and it was never supposed to work.

This has been fixed in the current git version.

The nodes in a given level are the groups in the level below. Therefore the number of nodes will decrease in the higher levels. For example, the following is a valid nested partition:

bs = [[0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3],
      [0, 0, 1, 2],
      [0, 0, 1],
      [0, 0],

Much appreciated, all makes sense now. Thank you Tiago.